Hi All,
I'm using ME_PROCESS_REQ_CUST PROCESS_ITEM and check to validate a line item.
Lets say i have 2 line items
I entered line item 1 and hit enter then i'm getting the custom messge that i put in process_item and in this method i'm setting a global variable
w_ch_failed = 'X'.
now i keyed line item 2 details and hit enter then i'm getting the custom messge that i put in process_item and in this method i'm setting a global variable
w_ch_failed = 'X'. " Which is already set to 'X' because of line item 1
Now i fixed the line item 2 and the value is reset of w_ch_failed = ' '.
Now i'm saying in check method
MOVE w_ch_failed TO CH_FAILED.
1) My problem is that i'm able to post the Purchase Req even though the line item 1 has an error because w_ch_failed is blank because of correct line item 2
Below is my code
PROCESS_ITEM
include mm_messages_mac.
DATA : L_ITEM TYPE MEREQ_ITEM.
DATA : MARA TYPE MARA.
clear : l_item,mara.
data :lv_obj TYPE REF TO object,
lv_attr TYPE string,
lv_aktyp TYPE aktyp.
FIELD-SYMBOLS : <fs_lcl> TYPE ANY.
check im_count = 1.
CALL METHOD IM_ITEM->GET_DATA
RECEIVING
RE_DATA = L_ITEM.
check l_item-werks = 'XYZ'.
SELECT SINGLE FROM MARA INTO MARA WHERE MATNR = L_ITEM-MATNR AND
KPSTAT = 'XYZ'.
IF SY-SUBRC EQ 0.
IF L_ITEM-MATKL IS INITIAL.
mmpur_message_forced 'E' '00' '398' 'Item ERROR' l_item-BNFPO.
w_ch_failed = 'X'.
else.
clear w_ch_failed.
ENDIF.
ENDIF.
CHECK METHOD
MOVE w_ch_failed TO CH_FAILED.
Thanks
David