02-13-2007 6:48 AM
Hi Guys,
Iam working on MV45AFZZ. User enters the product hierarchy for first line item, and I have to copy the same product hierarchy to other line items. I have written the code in Move_field_to_vbap. It is working fine for VA01. But it is not working for VA02 because the user changes the product heirarchy of first line item, the product heirarchy of remaining line items doesn't get changed. Even if the change the contents of XVBAP table, the changed values will be displayed but at the time of saving it will take the previous values.
If you know how to change in VA02,please let me know.
Thanks & Regards.
Harish.
02-13-2007 12:52 PM
Hi!
Check the following, working example, this is for modifying the VBEP table, but the logic will be the same:
This code copies the previously stored edatu from the first line to the following lines, you just have to rewrite it with your own data.
FORM USEREXIT_MOVE_FIELD_TO_VBEP.
IF vbep-posnr = '000001'.
MOVE vbep-edatu TO lv_edatu.
LOOP AT xvbep.
IF xvbep-posnr <> '000001'.
IF NOT lv_edatu IS INITIAL.
IF lv_edatu <> xvbep-edatu.
MOVE lv_edatu TO xvbep-edatu.
IF xvbep-updkz IS INITIAL.
MOVE 'U' TO xvbep-updkz. "VBEP table update
ENDIF.
MODIFY xvbep.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
Regards
Tamás
Message was edited by:
Tamás Nyisztor
02-13-2007 12:16 PM
Try to change the values of XVBAP in SAVE_Document_prepare or SAVE_Document.
02-13-2007 12:52 PM
Hi!
Check the following, working example, this is for modifying the VBEP table, but the logic will be the same:
This code copies the previously stored edatu from the first line to the following lines, you just have to rewrite it with your own data.
FORM USEREXIT_MOVE_FIELD_TO_VBEP.
IF vbep-posnr = '000001'.
MOVE vbep-edatu TO lv_edatu.
LOOP AT xvbep.
IF xvbep-posnr <> '000001'.
IF NOT lv_edatu IS INITIAL.
IF lv_edatu <> xvbep-edatu.
MOVE lv_edatu TO xvbep-edatu.
IF xvbep-updkz IS INITIAL.
MOVE 'U' TO xvbep-updkz. "VBEP table update
ENDIF.
MODIFY xvbep.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
Regards
Tamás
Message was edited by:
Tamás Nyisztor
02-13-2007 12:54 PM
Please have a look at below link. It may be useful to you.
http://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/content.htm
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers