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: 

Reason for Rejection in USEREXIT_SAVE_DOCUMENT

0 Kudos

Hi Experts,

I need to populate the reason for rejection(VBAP-ABGRU) when the sales document is created.

I found a SAPNOTE334524 to change the reason for rejection. However, this note is implemented in USEREXIT_SAVE_DOCUMENT_PREPARE.

I need to change this field in USEREXIT_SAVE_DOCUMENT because some parameters of PREPARE userexit is not yet populated at the moment.

****SAPNOTE334524****

LOOP AT xvbap WHERE updkz NE updkz_delete .

  svbap-tabix = sy-tabix.

  PERFORM vbap_bearbeiten_vorbereiten(sapfv45p).

  vbap-abgru = 'ZP'.           "<===== enter your rejection code

  PERFORM vbap_bearbeiten(sapfv45p).

  PERFORM vbap_bearbeiten_ende(sapfv45p).

ENDLOOP.

****SAPNOTE334524****

I also tried to copy this code in USEREXIT_SAVE_DOCUMENT but it does not work. TIA.

Regards,

Paul More

1 ACCEPTED SOLUTION

former_member195402
Active Contributor
0 Kudos

Hi Paul.

Please goto SPRO -> Sales and Distribution  ->  System Modification  -> UserExits  -> UserExit in Sales  -->  UserExit in Sales Document Processing.

There you can read, that USEREXIT_SAVE_DOCUMENT_PREPARE is the last possibility to change the sales document data.

But both USEREXIT_SAVE_DOCUMENT_PREPARE and USEREXIT_SAVE_DOCUMENT are called from form BELEG_SICHERN. So what are you missing in form USEREXIT_SAVE_DOCUMENT_PREPARE ?

Regards,

Klaus

2 REPLIES 2

former_member195402
Active Contributor
0 Kudos

Hi Paul.

Please goto SPRO -> Sales and Distribution  ->  System Modification  -> UserExits  -> UserExit in Sales  -->  UserExit in Sales Document Processing.

There you can read, that USEREXIT_SAVE_DOCUMENT_PREPARE is the last possibility to change the sales document data.

But both USEREXIT_SAVE_DOCUMENT_PREPARE and USEREXIT_SAVE_DOCUMENT are called from form BELEG_SICHERN. So what are you missing in form USEREXIT_SAVE_DOCUMENT_PREPARE ?

Regards,

Klaus

0 Kudos

Thanks Klaus