12-05-2007 5:53 PM
Hi everyone.
I have an issue due to the way SAP stores the data in VBPA.
I explain : for each different partner (at item level), they only store one item in VBPA. It compress the data like they say in OSS note 380507.
My problem is how can i retrieve all the items for a document ?
Is there any FM for that ?
exemple : in my diocument i have the following :
posnr -kunnr
1------ 123
2------ 123
In VBPA, i will only find the first line. I need a solution to retrieve the second one.
Thanks for your help.
12-05-2007 6:11 PM
Hi Helder,
VPBPA POSNR zero (initial) will hold the header partners valid for all items unless specified otherwiese on item level.
Regards,
Clemens
12-05-2007 6:05 PM
Hi
If a partner is valid for all items of the document u can see only one hit in VBPA where the item has the value of the header => 000000
Only if a partner is valid for a certain item you should find an hit for that item.
So if you need to get all partners:
TABLES VBAK.
PARAMETERS: P_VBELN TYPE VBAK-VBELN.
DATA: T_VBAP LIKE STANDARD TABLE OF VBAP WITH HEADER LINE,
T_VBPA LIKE STANDARD TABLE OF VBPA WITH HEADER LINE.
START-OF-SELECTION.
* Get Items
SELECT * FROM VBAP INTO TABLE T_VBAP WHERE VBELN = P_VBELN.
* Get partners
SELECT * FROM VBPA INTO TABLE T_VBPA WHERE VBELN = P_VBELN.
LOOP AT T_VBPA.
IF T_VBPA-POSNR = '000000'. "<--- It means is valid for all items
LOOP AT T_VBAP.
WRITE: / T_VBAP-POSNR, T_VBPA-PARVW, T_VBPA-KUNNR.
ENDLOOP.
ELSE. <--- It means is valid for only certain items
LOOP T_VBAP WHERE POSNR = T_VBPA-POSNR.
WRITE: / T_VBAP-POSNR, T_VBPA-PARVW, T_VBPA-KUNNR.
ENDLOOP.
ENDIF.
ENDLOOP.
Max
12-05-2007 6:11 PM
Hi Helder,
VPBPA POSNR zero (initial) will hold the header partners valid for all items unless specified otherwiese on item level.
Regards,
Clemens
12-06-2007 8:10 AM
In fact we can have different partners depending on the item. That's why we can't use the header partner related to the header.
12-06-2007 8:14 AM
Hi Helder,
that's what we are talking about.
If you have a partner at item level, it is populated for corresponding VBPA-POSNR. If you do not have a partner at VBPA-POSNR, then the partner is at item zero (initial POSNR).
Regards,
Clemens
12-06-2007 8:31 AM
I think you have misunderstood what i said.
Every item has a partner at his level, but in VBPA, SAP only stores one item for each partner.
Example :
This is what i have in the document
Posnr - Partner
1 - 10
2 - 10
3 - 20
4 - 20
In VBPA i will only have the following lines:
1 - 10
3 - 20
12-06-2007 9:08 AM
Hi Helder,
then partners for 2 and 4 are missing. I can hardly believe you have no record with initial POSNR in VBPA. Was the document created with SAP standard?
Regards,
Clemens
01-06-2011 1:24 PM
Hi,
The solution is to read the partner information with VBPA-POSNR=VBRP-POSPA in stead of VBPA-POSNR=VBRP-POSNR.
Kind regards,
Danië
06-11-2013 10:00 PM
This should be marked as the actual correct answer. It allows you to find the correct partner at a document item level.