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

Selction

Former Member
0 Likes
357

Hi everybody...

I need selet data from 2 tables VBAP and VBAK.which am doing succesfully into internal table it_vbak and it_vbap.But i need to give both the tables data into it_final which am doing like below.But the problem is all the data is selected twice.Please help.

FORM populate_it_final .

LOOP at it_vbak.

LOOP at it_vbap.

clear it_final.

it_final-vbeln = it_vbak-vbeln.

it_final-netwr = it_vbak-netwr.

it_final-ernam = it_vbak-ernam.

it_final-audat = it_vbak-audat.

it_final-bstnk = it_vbak-bstnk.

it_final-auart = it_vbak-auart.

it_final-matnr = it_vbap-matnr.

it_final-posnr = it_vbap-posnr.

it_final-werks = it_vbap-werks.

APPEND it_final.

endloop.

endloop.

endform.

With Regadrs

Vijay

2 REPLIES 2
Read only

Former Member
0 Likes
329

Hi Vijay,

Use the below code snippet within ur code,

it_final[] = it_vbak[].

it_final[] = it_vbap[].

DELETE ADJACENT DUPLICATES.......

<b>Kindly Reward points if you found the reply helpful.</b>

Cheers,

CHAITANYA.

Read only

Former Member
0 Likes
329

Vijay,

Remove OCCURS 0 for IT_VBAK & IT_VBAP &IT_FINAL and do like this

Data: wa_vbak like line of it_vbak,
         wa_vbap like line of it_vbap,
         wa_final like line of it_final.

FORM populate_it_final .
sort it_vbap by vbeln.
LOOP at it_vbak into wa_vbak.

wa_final-vbeln = wa_vbak-vbeln.
wa_final-netwr = wa_vbak-netwr.
wa_final-ernam = wa_vbak-ernam.
wa_final-audat = wa_vbak-audat.
wa_final-bstnk = wa_vbak-bstnk.
wa_final-auart = wa_vbak-auart.
read table it_vbap into wa_vbap with key vbeln = wa_vbak-vbeln binary search. " Consider Item No also and compare here.
wa_final-matnr = wa_vbap-matnr.
wa_final-posnr = wa_vbap-posnr.
wa_final-werks = wa_vbap-werks.

APPEND wa_final to it_final.
clear wa_final.

endloop.

endform.

Regards,

Satish

Message was edited by:

Satish Panakala