Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Fetch delivery details against schedule line

Hi Experts,

For example :

In it_LIPS table I have:

VBELN                  VGBEL     VGPOS     LFIMG
2000002990          75534         10             20
2000002991          75534         10             55
2000002992          75534         20           130

In header Table ( includes VBAK, VBAP, VBEP )

VBELN    POSNR    ETENR      BMENG
 75534         10           1              20
 75534         10           2              25                   "add 25 + 30   =  55
 75534         10           3              30                   "add 25 + 30   =  55              ->lips~lfimg
 75534         20           1              30                   "add 30 + 40   + 60  =  130 
 75534         20           2              40                   "add 30 + 40   + 60  =  130 
 75534         20           3              60                   "add 30 + 40   + 60  =  130   ->lips~lfimg

Please advice how to fetch Delivery details against the schedule;

Currently I have applied the logic like;

loop at it_header.
at new vbeln_posnr.
 clear: lv_qty
endat.
lv_qty = lv_qty + it_header~bmeng.
read table it_lips with key vgbel = it_header-vbeln
                                          vgpos = it_header-psonr
                                          lfimg = lv_qty.
if sy-subrc eq 0.
 it_lips-vbeln = it_main-delivery.
 it_lips-lfimg = it_main-lfimg.
 move-corresponding it_header to it_main.
 append it_main.
else.
 move-corresponding it_header to it_main.
 append it_main.
endif. 
endloop.

but my o/p is like:

VBELN    POSNR    ETENR      BMENG           DELIVERY            LIPS~LFIMG
 75534         10           1              20                2000002990              20
 75534         10           2              25                 SPACE                   SPACE
 75534         10           3              30               2000002991               55   
 75534         20           1              30                    SPACE                SPACE
 75534         20           2              40                    SPACE                SPACE
 75534         20           3              60               2000002992              130

But I am expecting the o/p like:

VBELN    POSNR    ETENR      BMENG           DELIVERY            LIPS~LFIMG
 75534         10           1              20               2000002990              20
 75534         10           2              25               2000002991              55
 75534         10           3              30               2000002991              55   
 75534         20           1              30               2000002992             130
 75534         20           2              40               2000002992             130
 75534         20           3              60               2000002992             130

Please advice

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question