08-28-2009 8:37 PM
Is there a way within the BAdI implementation for the POSTED
method to determine whether the Purchase Requisition is being
created or changed?
08-28-2009 9:57 PM
Use this code:
lt_eban = im_eban.
* Get the BANF number
READ TABLE lt_eban INDEX 1 INTO lv_my_banf.
IF lv_my_banf IS NOT INITIAL.
* Check on database, if the BANF number already exists
SELECT SINGLE banfn FROM eban INTO lv_banfn WHERE banfn = lv_my_banf-banfn.
lv_subrc = sy-subrc.
IF lv_subrc NE 0.
lv_mode = 1. " thn its a change
ELSE.
lv_mode = 0. " its a creation
ENDIF.
ENDIF.
08-28-2009 8:57 PM
One way is using SY-TCODE = 'ME51N'
PS : (But there is an issue on this if PR creation is thru BAPI then what will be sy-tcode ?)
a®
08-28-2009 9:57 PM
Use this code:
lt_eban = im_eban.
* Get the BANF number
READ TABLE lt_eban INDEX 1 INTO lv_my_banf.
IF lv_my_banf IS NOT INITIAL.
* Check on database, if the BANF number already exists
SELECT SINGLE banfn FROM eban INTO lv_banfn WHERE banfn = lv_my_banf-banfn.
lv_subrc = sy-subrc.
IF lv_subrc NE 0.
lv_mode = 1. " thn its a change
ELSE.
lv_mode = 0. " its a creation
ENDIF.
ENDIF.