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: 

EXIT_SAPLEBND_002 of M06E0004 User exit to Reset Release Status if PO

Former Member
0 Kudos

Hi All,

I have implemented a user-exit EXIT_SAPLEBND_002 of M06E0004, as advised, which can reset/cancel the release status of a certain PO document when a certain field has been changed aside from the quantity and price fields.

I would just like to ask if how woud the exit know if something in the document has been changed by the user if he goes to me22n? Basically, the requirement was that everytime a user changes the partially released PO in the header data and other fields aside from price and quantity, the release status should be reset to start all over again.

I have this code, but this should only be ran if a partially released PO has been changed in most of its fields (header/item).


DATA: wa_ekpo TYPE ekpo,
      wa_bekpo TYPE ekpo,
      lv_frgke TYPE ekko-frgke,
      tx_ekko TYPE char200,
      tx_ekbe TYPE char200,
      lv_frgzu TYPE ekko-frgzu.

FIELD-SYMBOLS: <fs_ekko>  TYPE ekko.

tx_ekko = '(SAPLMEPO)ekko'.
ASSIGN (tx_ekko) TO <fs_ekko>.

If <fs_ekko>-frgke = '1' AND
   <fs_ekko>-frgzu IS NOT INITIAL.
<fs_ekko>-frgke = '2'.
<fs_ekko>-frgzu = space.
ENDIF.

UNASSIGN <fs_ekko>.

Kindly send some recommendations.

Regards,

RE

3 REPLIES 3

former_member262988
Active Contributor
0 Kudos

Hi,

Check the release status in EKKO field name FRGSX....to get the status of purchase order

Thanks,

Shailaja Ainala.

0 Kudos

Hi,

EKKO-FRGSX is the release strategy of the document. Should I also reset this one or clear this field?

Thank you!

Regards,

RE

Sumeetpatil
Explorer
0 Kudos

Add this code in user exit exit_saplbend_002 .

Code=> This code use to change release status on PO amount decrease and increase.

================================

**** Start of changes for Release status change on PO amount decrease .

E_CEKKO = I_CEKKO .

DATA : wa_bekpo type BEKPO,

       wa_ekpo TYPE ekpo,

       WA_CEKKO TYPE CEKKO,

       w_reset(1) TYPE c VALUE 'X'.

if sy-tcode eq 'ME22N' OR sy-tcode eq 'ME22'.

WA_CEKKO = I_CEKKO .

IMPORT WA_CEKKO = WA_CEKKO FROM MEMORY ID 'ZREL_COST'.

IF SY-SUBRC NE 0.

  EXPORT WA_CEKKO = WA_CEKKO TO MEMORY ID 'ZREL_COST'.

ENDIF.

ENDIF.

if ( sy-tcode eq 'ME22N' OR sy-tcode eq 'ME22' )

  and sy-ucomm eq 'MESAVE' or sy-ucomm eq 'MECHECKDOC'.

*Import/Export the origninal values.

*Check if the limit is passed.

LOOP AT it_bekpo INTO wa_bekpo .

SELECT SINGLE NETWR FROM ekpo INTO wa_ekpo-netwr WHERE ebeln eq wa_bekpo-ebeln and ebelp eq wa_bekpo-ebelp.

IF SY-SUBRC EQ 0.

IF wa_bekpo-netwr < wa_ekpo-netwr.

    w_reset = 'X'.

  endif.

ENDIF.

ENDLOOP.

*IF limit passed - reset the value to high limit beyond tolerance.

IF w_reset = 'X'.

E_CEKKO-GNETW = WA_CEKKO-GNETW + 1000000.

ENDIF.

endif.

**** End of changes for Release status change on PO amount decrease .