Skip to Content
avatar image
Former Member

Retrieve partner for each item in VBPA

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 05, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 05, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded