Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch delivery details against schedule line

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Clemenss
Active Contributor
0 Kudos

Hi Karthik,

it looks as if the assignment should be other way round, a = b will move content of b to a.

if sy-subrc eq 0.
 move-corresponding it_header to it_main.
 it_main-delivery =  it_lips-vbeln.
 it_main-lfimg    = it_lips-lfimg.
 append it_main.
else.

You may put the move-corresponding in front to avaoid inadverntly overwriting.

Regards,

Clemens

3 REPLIES 3

Clemenss
Active Contributor
0 Kudos

Hi Karthik,

it looks as if the assignment should be other way round, a = b will move content of b to a.

if sy-subrc eq 0.
 move-corresponding it_header to it_main.
 it_main-delivery =  it_lips-vbeln.
 it_main-lfimg    = it_lips-lfimg.
 append it_main.
else.

You may put the move-corresponding in front to avaoid inadverntly overwriting.

Regards,

Clemens

Clemenss
Active Contributor
0 Kudos

Hi Karthik,

it looks as if the assignment should be other way round, a = b will move content of b to a.

if sy-subrc eq 0.
 move-corresponding it_header to it_main.
 it_main-delivery =  it_lips-vbeln.
 it_main-lfimg    = it_lips-lfimg.
 append it_main.
else.

You may put the move-corresponding in front to avaoid inadverntly overwriting.

Regards,

Clemens

Former Member
0 Kudos

Hi Clemens,

Thank You !!

It was a typo error ..I have moved like what you have mentioned, please can give solution for mu issue.

Please advice