cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP-SD

Former Member
0 Kudos

i want to update the ship-to-party customer no and address with delivary agent address and address no in VBPA table while creation of VA01 application before saving based on item category but updations are not happening . sample code i'm placing here , this is used in user-exit

if li_vbap[] is not initial.

    • LOOP AT li_vbap1 INTO lw_vbap1.

    • IF lw_vbap1-pstyv EQ 'ZNTC' OR lw_vbap1-pstyv EQ 'ZNTI'.

**

    • READ TABLE xvbpa INTO xvbpa WITH KEY parvw = 'ZA'.

    • IF sy-subrc EQ 0.

    • lv_kunnr = xvbpa-kunnr.

    • lv_adrnr = xvbpa-adrnr.

  • lv_exec = lctrue.

    • ELSE.

    • MESSAGE i085(yd01).

    • ENDIF.

    • if lv_exec eq lc_true.

    • read table xvbpa into xvbpa with key parvw = 'we'.

    • if sy-subre eq 0.

**

    • xvbpa-kunnr = lv_kunnr.

    • xvbpa-adrnr = lv_adrnr.

    • MODIFY xvbpa FROM xvbpa TRANSPORTING kunnr adrnr .

    • clear lv_kunnr,

    • lv_adrnr.

    • ENDIF.

    • endif.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Krishna,

Generally the partner function codes will be in capital letters.

Change the value from 'we' to 'WE' in the read statement.

Check this code in bold and do accordingly.

if li_vbap[] is not initial.

    • LOOP AT li_vbap1 INTO lw_vbap1.

    • IF lw_vbap1-pstyv EQ 'ZNTC' OR lw_vbap1-pstyv EQ 'ZNTI'.

**

    • READ TABLE xvbpa INTO xvbpa WITH KEY parvw = 'ZA'.

    • IF sy-subrc EQ 0.

    • lv_kunnr = xvbpa-kunnr.

    • lv_adrnr = xvbpa-adrnr.

  • lv_exec = lctrue.

    • ELSE.

    • MESSAGE i085(yd01).

    • ENDIF.

    • if lv_exec eq lc_true.

<b>** read table xvbpa into xvbpa with key parvw = 'WE'.</b>

    • if sy-subre eq 0.

**

    • xvbpa-kunnr = lv_kunnr.

    • xvbpa-adrnr = lv_adrnr.

    • MODIFY xvbpa FROM xvbpa TRANSPORTING kunnr adrnr .

    • clear lv_kunnr,

    • lv_adrnr.

    • ENDIF.

    • endif.

Thanks,

Vinay

Answers (2)

Answers (2)

Former Member
0 Kudos

HI.,

Please check whether your desired item category is there in the xVBAP table or not,If yes Then LOOP at your xVBPA table and modify the customer no & adress with in the loop for t he desired partner function

REWARD if helpfull

Thanks & Regards

Narayana

Former Member
0 Kudos

Hi Krishna,

I'm not sure if the code is correct.

There is no endloop.

Is the table xvbpa is an exporting table.

Why do you want to use the same work area(xvbpa) as the table (xvbpa ).

Also, check if your user-exit is called while creating the sales order. You can probably put a break-point over there and try to debug.

Hope this will help.

Regards,

Naveen.