cancel
Showing results for 
Search instead for 
Did you mean: 

How to join tables to show the Ship-to party of the SO...

Former Member
0 Kudos

To output a list not only show the Ship-to Party of the SO header, but also show the Ship-to party for every item of the SO.

Thanks!!!

How many tables coule get this done??

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Hoo Laa,

Table joint will be as follows:

(Table-Field) VBAK-VBELN = VBAP-VBELN

VBAK-VBELN = VBPA-VBELN & VBAP-POSNR-VBPA-POSNR

Regards,

Rajesh Banka

<b>Reward suitable points.

  • How to give points: Mark your thread as a question while creating it. In the answers you get, you can assign the points by clicking on the stars to the left. You also get a point yourself for rewarding (one per thread).</b>

Former Member
0 Kudos

Hi!

I had joined 3 tables. VBAK-VBAP-VBPA

(Table-Field) VBAK-VBELN = VBAP-VBELN

VBAK-VBELN = VBPA-VBELN & VBAP-POSNR-VBPA-POSNR

But I found it was strange that i could not get any data when i tried to input those into the selection screen:

-


Parner Function: WE(Or SH)

Date on: XX-XX-XXXX to XX-XX-XXXX

Sales order type: ZZZ

-


While when i set the Partner Function to Blank:

-


Parner Function: ___

Date on: XX-XX-XXXX to XX-XX-XXXX

Sales order type: ZZZ

-


The output list could be generated, but the value of the Parner Function in the list is SR (Sales Reps), and the corresponding customer name is the Sales Rep's name not the Ship-to Party.

It is really strange!!!

Anyone know why above situations would happen???

Thanks in advance!!!

By the way, if i dont want to get the Ship-to party for every item, i just want to get the ship-to party in SO header level. Then which table for me to join to get it??

Thanks!!!

Former Member
0 Kudos

I had joined 3 tables. VBAK-VBAP-VBPA

(Table-Field) VBAK-VBELN = VBAP-VBELN

VBAK-VBELN = VBPA-VBELN & VBAP-POSNR-VBPA-POSNR -> here do not compare with posnr with vbpa-posnr ( if you compare you get sy-subrc eq 4),vbpa-posnr contains 000000( so please remove posnr condition in select query )

always compare parvw = 'WE' then only you get results

Thanks

Seshu

Former Member
0 Kudos

Hi Seshu,

You are so great!!!

Resolved!!

Thanks!!!!

Message was edited by:

Hoo Laa

Former Member
0 Kudos

Hi Seshu,

Could you tell me what's the difference between 'WE' and 'SH'.

If they are the same, why SAP set these 2 fields to existe?

Former Member
0 Kudos

Hi Hoo Laa,

SP is English Term,but while saving to the database we need to use AG( German Word),SAP Internally validate on AG.

same thing for Ship to paty SP ( English),while saving to database ,we need to use WE(German Word).

Sold to party SP(english) AG (German)

Ship-to-party SH(english) WE(german)

Bill to party BP RE

Payer PY RG

Thanks

Seshu

Answers (2)

Answers (2)

Former Member
0 Kudos

Dear Hoo Laa,

VBAK Sales Document: Header Data

VBAP Sales Document: Item Data

VBEP Sales Document: Schedule Line Data

VTPA Shipping Partner

VFPA Partner for Shipment Costs

VBPA Sales Document: Partner

Regards,

Naveen.

Former Member
0 Kudos

then use

VBAK,

VBAP

VBPA Table ,Join all above tables and you get output for every line item

Thanks

Seshu

Former Member
0 Kudos

Hi Seshu,

In VBPA.

Which field indicated the Ship-to party for the item?

Thanks

Former Member
0 Kudos

Dear Hoo Laa,

You would need to fetch the data based on PARVW (Partner Function)

Regards,

Naveen.

Former Member
0 Kudos

It is PARVW

condition would be parvw = 'SH'. -> SH is ship to party.

Thanks

Seshu

Former Member
0 Kudos

Hi Naveen,

So the Partner Function should be set as 'SH' as the selection cretirea?

As 'SH' stands for Ship-to party.

thanks

Former Member
0 Kudos

Hi Hoo Laa,

Use Partner function WE as Ship to party ( While selecting the data use WE,do not use SH)

Check the below program :

REPORT Zxyz.

tables : vbak,

vbap,

vbpa.

data : begin of i_final occurs 0,

vbeln like vbak-vbeln,

vkorg like vbak-vkorg,

  • kunnr like vbak-kunnr," Sold to party

posnr like vbap-posnr,

matnr like vbap-matnr,

kwmeng like vbap-kwmeng,

netpr like vbap-netpr,

end of i_final.

data : begin of i_output occurs 0,

vbeln like vbak-vbeln,

vkorg like vbak-vkorg,

kunnr like vbpa-kunnr," Sold to party

posnr like vbap-posnr,

matnr like vbap-matnr,

kwmeng like vbap-kwmeng,

netpr like vbap-netpr,

end of i_output.

start-of-selection.

select avbeln avkorg

bposnr bmatnr bkwmeng bnetpr

into table i_final up to 100 rows

from vbak as a inner join vbap as b on bvbeln = avbeln.

loop at i_final.

select single * from vbpa into vbpa

where vbeln = i_final-vbeln

and parvw = 'WE'. -> Partner function

if sy-subrc eq 0.

i_output-kunnr = vbpa-kunnr.

endif.

i_output-vbeln = i_final-vbeln.

i_output-vkorg = i_final-vkorg.

i_output-posnr = i_final-posnr.

i_output-matnr = i_final-matnr.

i_output-kwmeng = i_final-kwmeng.

i_output-netpr = i_final-netpr.

append i_output.

endloop.

end-of-selection.

loop at i_output.

write:/ i_output-vbeln,i_output-vkorg,i_output-kunnr,i_output-posnr,

i_output-matnr,i_output-kwmeng,i_output-netpr.

endloop.

Thanks

Seshu

former_member188826
Active Contributor
0 Kudos

Yes! For every salses document in VBAP select the customer in VBPA who has SH as his partner function (PARVW) to list the shipto party.