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: 
SAP Community Downtime Scheduled for This Weekend

MV45AFZZ

Former Member
0 Kudos
231

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
82

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

3 REPLIES 3

Former Member
0 Kudos
82

Try to change the values of XVBAP in SAVE_Document_prepare or SAVE_Document.

Former Member
0 Kudos
83

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

Former Member
0 Kudos
82

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