Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Update Field VBAP-ABGRU

Dear all.

I need to put some value in the field ABGRU. When the configuration of the Item is not completed. I'm try to used the program MV45AFZZ and the exit FORM USEREXIT_SAVE_DOCUMENT and USEREXIT_MOVE_FIELD_TO_VBAP.

But i cant update the field. A Example off my code:

Case VBAK-AUART.

WHEN 'ZXXX'.

IF vbap-PSTYV eq 'ZYYY' and vbap-kondm eq '02' and

vbap-stman eq '1'.

move 'Z1' to vbap-abgru.

modify vbap.

ELSEIF vbap-PSTYV eq 'ZYYY' and vbap-kondm NE '02' and vbap-stman NE '1' and vbap-abgru EQ 'Z1'.

move '' to vbap-abgru.

modify vbap.

ENDIF.

ENDCASE.

Tags:
Former Member
Former Member replied

Hi Pedro

Stop! Your code is wrong: YOU CAN'T DIRECTLY UPDATE VBAP TABLE:

Case VBAK-AUART.

WHEN 'ZXXX'.

IF vbap-PSTYV eq 'ZYYY' and vbap-kondm eq '02' and

vbap-stman eq '1'.

move 'Z1' to vbap-abgru.

modify vbap. <----


ERROR

ELSEIF vbap-PSTYV eq 'ZYYY' and vbap-kondm NE '02' and vbap-stman NE '1' and vbap-abgru EQ 'Z1'.

move '' to vbap-abgru.

modify vbap. <----


ERROR

ENDIF.

ENDCASE.

If you use the routine USEREXIT_MOVE_FIELD_TO_VBAP you need only to transfer the data to VBAP without to update it:

Case VBAK-AUART.

WHEN 'ZXXX'.

IF vbap-PSTYV eq 'ZYYY' and vbap-kondm eq '02' and

vbap-stman eq '1'.

move 'Z1' to vbap-abgru.

ELSEIF vbap-PSTYV eq 'ZYYY' and vbap-kondm NE '02' and vbap-stman NE '1' and vbap-abgru EQ 'Z1'.

move '' to vbap-abgru.

ENDDIF.

WHEN OTHERS.

ENDCASE.

Don't use USEREXIT_SAVE_DOCUMENT, but if you need the exit USEREXIT_SAVE_DOCUMENT_PREPARE. Here you have to change the data in internal table XVBAP:

Case VBAK-AUART.

WHEN 'ZXXX'.

LOOP AT XVBAP.

IF Xvbap-PSTYV eq 'ZYYY' and Xvbap-kondm eq '02' and

Xvbap-stman eq '1'.

move 'Z1' to Xvbap-abgru.

ELSEIF Xvbap-PSTYV eq 'ZYYY' and Xvbap-kondm NE '02' and xvbap-stman NE '1' and xvbap-abgru EQ 'Z1'.

move '' to vbap-abgru.

ENDDIF.

MODIFY XVBAP.

Max

ENDLOOP.

WHEN OTHERS.

ENDCASE.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question