2012 Feb 21 11:29 AM
Hello everybody,
I've implemented method PROCESS_HEADER of BADI ME_PROCESS_PO_CUST for changing the field SUBMI with the SET_DATA method. The strange thing is, that the method is called twice. The problem seems to be the following row in IF_FLUSH_TRANSPORT_MM~START:
* Step 3: Recheck if the extension changed any business object
IF NOT my_recheck_queue IS INITIAL.
In my case, the internal table my_recheck_queue isn't INITIAL and that's the reason why the PROCESS_HEADER method is called again.
Does someone have an idea how I can avoid the PROCESS_HEADER method running twice?
Thanks
Daniel
2012 Feb 23 1:47 AM
Hi,
If the only issue is that you need your code to be executed only once, you can make use of IMPORT & EXPORT techniques.
For Example:
1] In the call, try to get ID from Memory like
IMPORT TEXT01 FROM MEMORY ID 'SOMEID'.
IF SY-SUBRC EQ 0 AND TEXT01 IS NOT INITIAL.
" Clear the contents from Memory specifying Memory ID
RETURN. "Exit further processing
ELSE.
"Process your required logic.
EXPORT TEXT01 FROM 'BADI_ALREADY_PROCESSED_ID' TO MEMORY ID 'SOMEID'.
ENDIF.
Take some more help of IMPORT/EXPORT usage if necessary.
BR
Neelesh
Hello everybody,
I've implemented method PROCESS_HEADER of BADI ME_PROCESS_PO_CUST for changing the field SUBMI with the SET_DATA method. The strange thing is, that the method is called twice. The problem seems to be the following row in IF_FLUSH_TRANSPORT_MM~START:
* Step 3: Recheck if the extension changed any business object
IF NOT my_recheck_queue IS INITIAL.
In my case, the internal table my_recheck_queue isn't INITIAL and that's the reason why the PROCESS_HEADER method is called again.
Does someone have an idea how I can avoid the PROCESS_HEADER method running twice?
Thanks
Daniel
2012 Feb 22 5:18 AM
Hi,
BADI can be called many times while accessing transaction.
If it is affecting your logic means, put a check in the beginning of the method whether the field has been changed already.
If yes, do not go inside the logic again.
Cheers,
Raja.D
2012 Feb 22 6:22 AM
HI,
Can u elaborate what is the logic/Requirement ?
if u are wanting to validate on some data then u can enable the logic based on user command (of SAVE,CHECK button).
if it satisfies then execute ur logic.
Regards,
Madhukar Shetty
2012 Feb 22 8:40 AM
My logic is to check the countries of the delivery addresses on item level and then updating the collective number under certain conditions (all countries are identical and the country is maintained in an user table).
First I wanted to do this in CHECK method, but updating the collective number didn't work there. Then I tried the POST method, but updating the collective number didn't work there also, so I tried it in the PROCESS_HEADER and this is the first method where updating the collective number works.
2012 Feb 22 9:20 AM
HI,
So now ur logic is working, and the only issue is logic is running twice CORRECT then just add a if condition before ur logic i.e
If sy-ucomm eq 'MECHECKDOC' or sy-ucomm eq 'PB'. "This is for Check button
ur logic
endif
Thanks,
Madhukar Shetty
2012 Feb 23 1:47 AM
Hi,
If the only issue is that you need your code to be executed only once, you can make use of IMPORT & EXPORT techniques.
For Example:
1] In the call, try to get ID from Memory like
IMPORT TEXT01 FROM MEMORY ID 'SOMEID'.
IF SY-SUBRC EQ 0 AND TEXT01 IS NOT INITIAL.
" Clear the contents from Memory specifying Memory ID
RETURN. "Exit further processing
ELSE.
"Process your required logic.
EXPORT TEXT01 FROM 'BADI_ALREADY_PROCESSED_ID' TO MEMORY ID 'SOMEID'.
ENDIF.
Take some more help of IMPORT/EXPORT usage if necessary.
BR
Neelesh
2012 Feb 24 3:26 PM
I guess, I solved it with the import/export suggestion of neelpad7. I have to test it in detail, but so far it looks good.
Thanks everybody.
Daniel
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |