cancel
Showing results for 
Search instead for 
Did you mean: 

Extraction of Ship To party at item level of a billing document

former_member182378
Active Contributor
0 Kudos

A custom report consists of billing information at line item level. The field names are as follows -

Billing document number, Item number, Material, Quantity, Ship To party (Customer number)

In order to extract the Ship To party (Customer number) at item level of a billing document which table(s) should be used?

Many thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi T W

As per your requirement

all the data you can find but the problem is in ship to party detail

there is field called refrence document in item level  please findd the attachnment for the filed

Here you have two scenarios order related or delivery related billing  item

and that you can find out by checking VBRP-VGTYP field for checking the billing related item with Order or delivery

and then if your item is delivery related then you can pass the field value VBRP-VGBEL into the likp and can take the ship to party number

if the item is order related billing then you can pass this

order number into VBPA table and in partner function put 'WE' then you will have the ship to party number 

  Additional info   in case order also having different ship to parties        the you can pass this VBRP-vgpos filed int othe posnr filed

if it shows "no table entries "  then in the logic you have give a condn based

pass only VBRP-vgbel then you will have correct ship to party number

Hope this will solve your problem

Regards

Saurabh Gupta

former_member182378
Active Contributor
0 Kudos

Hi Saurabh,

Thank you for your post!

I find getting KUNNR (shipto party) from table LIKP by giving VBELN (delivery number) helpful. I was thinking of going to VBPA to get KUNNR. This was also suggested by Ravi.

The issue is - In the case when there are no entries found in VBPA for a VBELN and POSNR.

This case does not arise in a delivery, as SH is only one. But it could arise in sales orders, billing documents.

Ravi's post has given a solution (same as yours) go to delivery and get the KUNNR (with PARVW = WE) but the other process - for my client - is creating Invoice cancellation documents. The same issue would be faced during extraction of KUNNR (with PARVW = WE) for line items of an invoice cancellation document.

(as invoice cancellation document could have different SH in different line items; thus program would have to go to table VBPA.....)

Former Member
0 Kudos

Hi TW and All,

I know this post is couple of years old but I wanted to update so that the people you have this question can benefit.

The general reason why an item entry does not show in the VBPA is because  the ship to party is same as the header ship to party hence SAP do not see any reason to create all the item entries .

For example

Here is how entries show for a given scenario.

I have item  10     100266

                    20     100266
                    30     100211

                    40     100222

And the header ship to partner is 100211, as you can see only item 30 is missing from the item partner list and item 30 ship to partner is same as header partner.

So when you check the VBPA for an item , if the item does not result into successful retrieval of the ship to partner then you should look back into the VBPA table with item number '000000' and partner function WE and use that as a ship to party for that item.

Hope this helps. I'm not aware of any other reason for a missing item in entries in the VBPA table, let me know , if there are more reason for it.

Thanks

Pramodh

Answers (5)

Answers (5)

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

 

  for fetching the value for line item 20 you need to put some logic in that report program ,because in standard SAP for table VBPA if same value comes it ill show for one item, we need to put some condition for fetching the value by putting equal to, not equal to, <,> like wise.

    pls check the below link it will give your clear idea.

http://scn.sap.com/thread/659675

Thanks

Prasad

former_member182378
Active Contributor
0 Kudos

Hi prasad,

Unfortunately the link you have provided is not helpful. Furthermore "the correct answer" mentioned in that thread is incorrect.

Both you and Jignesh have suggested to use "POSNR (in VBPA) < = VBRP-POSNR". This was my initial thinking too. But I was searching / expecting for a "better" solution.

Thank you for your time and support!

Lakshmipathi
Active Contributor
0 Kudos

Execute VBPA where you can see all partner functions for one line item.  Here input the billing document and execute where you need to check for the two fields

  • PARVW  which should be SH and
  • KUNNR   which would be the SH customer code

G. Lakshmipathi

Former Member
0 Kudos

Hi,

  if you are maintaining different ship to party in both header and item level , pls try the below

Pass billing document number VBRP-VBELN and line item number VBRP-POSNR,in table VBPA with

and partner function PARVW = SH  fetch the value of VBPA- KUNNR (customer number of SH).

Thanks

Prasad

Former Member
0 Kudos

Hi,

   For getting ship to party , pass the VBRP-VBELN (billing document number ) to VBRK-VBELN (billing document number and get the value of the field VBRK-KUNWE ( ship to party).

      If you want to get the full name of the ship to party . pass VBRK-KUNWE in KNA1.

Thanks

Prasad

former_member182378
Active Contributor
0 Kudos

Hi,

I have to extract SH from item level of the billing document (not from header level). There could be different SH at item level (e.g. Billing document: Item 10 - 20010, Item 20 - 30020 etc., Header - 44000). Could you please advise?

Former Member
0 Kudos

hi,

Your reply is nice but the field described by prasad will fullfill your needs .It will track all the ship to party from that fields

jignesh_mehta3
Active Contributor
0 Kudos

Hello T W,

Ship-To-Party is not available in VBRK (Invoice Header) in SAP Standard.

To get Line Time wise Ship-To-Party from Invoice, pass the Invoice Number (VBRK - VBELN) to table - VBPA along with line item number (10,20,30....).

Here you will find Customer Code of partner Function "SH" (Ship-to-Party) for each line of Invoice.

Thanks,

Jignesh Mehta

former_member182378
Active Contributor
0 Kudos

Hi Jignesh, prasad, Lakshmipathi,

I too have gone forward with table VBPA. But I am finding below issue -

Billing document has 3 line items. Line item 10 and 20 have the same SH (customer number with PARVW = WE).

Then entries in VBPA are (where VBELN = Billing doc number, PARVW = WE) -

Billing doc # , POSNR, Customer #

90001557,        10,         42500

90001557,         30,        53600

There is no line with POSNR = 20

Now when the functional specification is fetch KUNNR, by passing VBRK-VBELN, VBRP-POSNR and PARVW = WE in table VBPA and fetch KUNNR. This logic does NOT work for POSNR = 20. As there is no record for this POSNR in table VBPA.

Have you faced the same issue? Please advice.

Many thanks!

Former Member
0 Kudos

HI,

  pls check the line item 20 whether that partner function is there or not, if it is there means it will shown in the table VBPA.

   

  I think line item 20 was different item category , if it means pls check the configuration of partner determination settings for item level.

   path : SD- basic function-partner determination- setup partner determination-setup partner determination for sale order item.

Thanks

Prasad

former_member182378
Active Contributor
0 Kudos

Hi Prasad,

Message was edited by: T W - In VF03, Item 20, Tab Item Partners, WE (customer number) is present and identical to the one in item 10.

Item 20 has the same item category as item 10 and 30.

I have done extensive testing. I don't think it is related to Partner configuration settings.

Please test this and advise.

Message was edited by: T W

former_member184555
Active Contributor
0 Kudos

Hi T W,

Just to cross check, take the reference document number of this line item in the invoice (VBRP-VGBEL) and with this number, check the VBPA table for the WE partner.

Regards,

Ravi

former_member182378
Active Contributor
0 Kudos

I have cross checked. The reference document has a KUNNR (customer number with PARVW = WE).

This is reference for Item 20, in billing document. This line item does NOT feature in VBPA. (as it is same as customer number in Item 10)

former_member184555
Active Contributor
0 Kudos

Since the delivery can have a single Ship To (WE)...irrespective of the line item number, you can fetch the WE partner from VBPA with the delivery reference from the invoice line item.

former_member182378
Active Contributor
0 Kudos

Ravi,

I like the way  your suggestion. But maybe it would be "a round about way".

1. Take billing doc # and item #, go to VBPA, fetch KUNNR, if found stop.

2. If not found then find preceeding document from table VBFA

3. Fetch KUNNR by passing (preceeding doc #) VBELN (delivery #) and PARVW in VBPA

This might affect performance.

I am interested to know - Item 20 NOT featuring in VBPA, my above example. Is this standard SAP?

jignesh_mehta3
Active Contributor
0 Kudos

Hello T W,

Yes, What you sid is correct. If the Partner Code is same in LIne Items, then the Line Item is not repeated in VBPA. Meaning to say that if "WE" is same for LIne Items 10 & 20, then there is no entry for line Item 20 in VBPA table.

In that case you will have to put a code in your ABAP Program to check for Partner Code in Preceeding LIne Item i.e. in LIne Item 10.

Thanks,

Jignesh Mehta

former_member184555
Active Contributor
0 Kudos

1. Take billing doc # and item #, go to VBPA, fetch KUNNR, if found stop.

2. If not found then find preceeding document from table VBFA

3. Fetch KUNNR by passing (preceeding doc #) VBELN (delivery #) and PARVW in VBPA

I am interested to know - Item 20 NOT featuring in VBPA, my above example. Is this standard SAP?

When the reference document is available in the VBRP-VGBEL...I believe, you do not need the steps 1 and 2. You can pass the VBRP-VGBEL value and the PARVW in VBPA.

But, incase of invoice items that do not have a delivery...you have to take the order reference from invoice item.

I do not have any idea about the missing WE details in VBPA for Item20. If this is SAP standard...how will it show when a invoice has multiple line items and the WE is same for Item 10, 20 and 40...and similarly the Items 30, 50 and 60 have another WE? In this scenario you cannot take the WE of item 40 from Item 30.

Regards,

Ravi Sankar

former_member182378
Active Contributor
0 Kudos

In the "second" half of your post you have asked a question. Please find the answer below -

In billing document, the SH To parties for line items is as follows -

10 - 500

20 - 500

30 - 999

40 - 500

50 - 999

60 - 999

Then entries in VBPA, for the billing document number (VBELN) and PARVW = SH, is -

10 - 500

30 - 999

40 - 500

50 - 999

With the above entries, you can find out the customer number (with PARVW = SH) for any of the line items. I hope the above explanation makes "output entries" of VBPA clearer.

jignesh_mehta3
Active Contributor
0 Kudos

Hello,

That is exactly why I suggested in my previous post that you will have to incorporate a logic in your ABAP Program to look for partner code for "WE" in previous Item if it is not availalbe for current item in VBPA.

Seems SAP Standard program is also doing the same thing.

Thanks,

Jignesh mehta

former_member182378
Active Contributor
0 Kudos

Hi Jignesh,

I was also thinking of VBPA - POSNR < = Item number of the line item....after doing some investigation.

But I was hoping to find a "simpler" solution from members.

1. Would incoroparting this "< = " etc. logic - for extraction of information, in to my report - impact performance? (e.g. Would execution would take too much time?)

2. Could you please elaborate on your comment "Seems SAP Standard program is also doing the same thing."?