Application Development and Automation 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: 
Read only

Kindly write some sample code for this scenario

Former Member
0 Likes
349

Kindly write some sample code for the below Logic.

For a set of Deliveries entered on the selection screen get the relevant data from LIKP & LIPS.

for all the deliveries selected get the sales order data from VBAK & VBAP based on the VGBEL & VGPOS in LIPS.

The Output internal table should contain only deliveries which are created with reference to a sales order.

Thanx in Advance.

Akshitha.

2 REPLIES 2
Read only

Former Member
0 Likes
324

Hi,

Select avbeln bposnr bmatnr blfimg bvgbel bvgpos into table ITAB

from likp as a join lips as b on Avbeln = bvbeln

where a~vbeln in s_vbeln..

if not itab[] is initial.

select avbeln bposnr b~matnr ... into table itab1 from vbak as a join vbap as b

on avbeln = bvbeln

for all entries in itab where avbeln = itab-vgbel and bposnr = itab-vgpos.

endif.

loop at itab.

read table itab1 with key vbeln = itab-vgbel posnr = itab-vgpos.

if sy-subrc <> 0.

delete itab index sy-tabix.

endif.

endloop.

Now ITAB will have only deliveries created against Sales orders.

reward points if useful

regards,

Anji

Read only

Former Member
0 Likes
324

DATA:

t_likp type table of likp with header line,

t_lips type table of lips with header line,

t_vbak type table of vbak with header line,

t_vbap type table of vbap with header line.

SELECT *

from likp

into table t_likp

up to 10 rows.

if sy-subrc eq 0.

SELECT *

from lips

into table t_lips

for all entries in t_likp

where vbeln eq t_likp-vbeln.

if sy-subrc eq 0.

select *

from vbap

into table t_vbap

for all entries in t_lips

where vbeln eq t_lips-vbeln

and posnr eq t_lips-posnr.

endif.

Try this....