Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Refresh & Field symbol behaviour

Former Member
0 Kudos

Hello,

My issue was to make address number, city & postal code mandatory while creating PO in Delivery Address.

I used the exit ZXM06U032 & Badi ME_PROCESS_PO_CUST->CHECK method to implement the changes. The changes were working fine & after moving to production system we are facing issues like the error is thrown unnecessarily to update city, Postal code & address number when we are in any other tab instead of Delivery address tab. If we enter into Delivery address tab the error goes off. Other issue is in lower systems like quality, development & proto systems the required error is not thrown for the first time when we create the PO but it does when we exit from the transaction & try creating the PO again.

We have used Field symbol & export/import of memory among these User EXit & BADI. Please help us to fix this.

We are reaching out to you is because the above explained scenarios are caused only for some PO's, for some PO's the error is thrown in the first attempt itself while creating PO. These two test data do not vary in functionality. This is the confusion as to why the issue is only for some PO's not for all. If you need more info regarding the code please do let me know. Else please suggest to rectify.

7 REPLIES 7

Former Member
0 Kudos

Hi

As you have mentioned, I think it is related to Memory and field symbol unassign.

Please refresh the memory and also unassign the field symbol once the operation is over. Sometimes Assign statement in field symbol generates dump also.

Please also check the types of vendor and the details for which you are getting the error

Shiva

Former Member
0 Kudos

hi, refreshing the field symbol & memory is done. But even then i am facing the same issue. Problem i encountered is field symbol does not get the value when it is in any other tab apart from Delivery Address. So we are getting the error unnecessarily even though the address exist.

Another issue is first time when we create the PO by removing city/pc/adrnr no error is displayed. After we come out of the tcode & try the same again we get error. In some cases how may ever times we try we don't get the error.

The code in BADI as a part of CHECK method is as follows:

CONSTANTS: lc_nb(4) TYPE c VALUE 'NB',

lc_f TYPE c VALUE 'F',

lc_flag TYPE ysd_flags_flagn VALUE 'POITEM_ADDR_MANDT',

lc_aufnr(5) TYPE c VALUE 'AUFNR'.

DATA: ls_addr2_data TYPE addr1_data.

DATA: lt_po_item1 TYPE purchase_order_items,

ls_po_item1 TYPE purchase_order_item,

ls_item1 TYPE mepoitem.

DATA: lv_active1 TYPE customer_activation.

DATA: lv_aufnr TYPE aufnr.

DATA: lv_adrc(28) TYPE c VALUE '(SAPLSZA1)ADDR1_DATA'.

FIELD-SYMBOLS : <ls_addr1_data> TYPE ANY.

IMPORT lv_aufnr TO lv_aufnr FROM MEMORY ID lc_aufnr.

IF ls_data-bsart = lc_nb AND lv_aufnr <> space.

ASSIGN (lv_adrc) TO <ls_addr1_data>.

IF sy-subrc = 0.

ls_addr2_data = <ls_addr1_data>.

ENDIF.

IF ls_addr2_data-city1 = space.

MESSAGE e001(z9) WITH text-003.

ENDIF.

IF ls_addr2_data-post_code1 = space.

MESSAGE e001(z9) WITH text-002.

ENDIF.

CALL METHOD im_header->get_items

RECEIVING

re_items = lt_po_item1.

LOOP AT lt_po_item1 INTO ls_po_item1.

ls_item1 = ls_po_item1-item->get_data( ).

IF ls_item1-adrn2 IS INITIAL AND ls_item1-knttp = lc_f.

CALL FUNCTION 'YMM_WERKSFLAGS_SINGLE_READ'

EXPORTING

iv_werks = ls_item1-werks

iv_flagn = lc_flag

iv_no_buffer = lc_x

IMPORTING

ov_active = lv_active1

EXCEPTIONS

invalid_input = 1

no_entry = 2

OTHERS = 3.

IF sy-subrc = 0.

IF lv_active1 = lc_x.

CLEAR lv_active1.

MESSAGE e001(z9) WITH text-001 space ls_item1-ebelp.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

FREE MEMORY ID lc_aufnr.

CLEAR <ls_addr1_data>.

ENDIF.

0 Kudos

Hi,

As I have mentioned, please use below statement.

IF <ls_addr1_data> IS ASSIGNED.

UNASSIGN <ls_addr1_data>.

ENDIF.

Shiva

0 Kudos

Hi Rekha,

Try to trigger your logic only when you are trying to move to a different tab from 'Delivery address' tab.

I think you need to check specific tab value you are in.

Thanks,

Rukma

0 Kudos

I'm guessing the BADI spot may not be the exact to suit your purpose. Did you create a break-point at your code and check if it's getting triggered on "Delivery Tab"? Unfortunately I cannot confirm because I don't have access to this functionality.

0 Kudos

Hi,

From what I understand, the code works in all other environments except for Production.

Check SMLG in production for the number of instances.

If in case of multiple instances, EXPORT/IMPORT to memory doesn't work efficiently.

There could be a possibility, where the data is exported to one instance and

imported back from a different instance.

You could try using the EXPORT/IMPORT to Database or try the Function Group/Modules approach.

Thanks

Subhankar
Active Contributor
0 Kudos

Hi Rekha,

FREE MEMORY ID lc_aufnr.

CLEAR <ls_addr1_data>.----


> Comment this line

ENDIF.

Don't clear the field symbol. It will clear the global structure ADDR1_data (i.e. what ever variable you assigned to that field symbols)..

Thanks

Subhankar