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

retrieving data into internal table

Former Member
0 Likes
402

Hi,

I am struck at a point where i have to retrieve data from 4 database table to a single internal table with some conditions. can anyone please help me in resolving this issue. your help will be highly appreciated.

some details are: tables used are-linv,mch1,makt,ausp.

data: begin of t_outtab,--


final internal table.---output to be displayed

lgnum LIKE linv-lgnum,

ivnum LIKE linv-ivnum,

werks LIKE linv-werks,

lgtyp LIKE linv-lgtyp,

matnr LIKE linv-matnr,

bestq LIKE linv-bestq,

charg LIKE linv-charg,

maktx LIKE makt-maktx,

vfdat LIKE mch1-vfdat,

atwrt LIKE ausp-atwrt,

END OF t_outtab.

input parameters:-- linv-lgnum and linv-ivnum.

conditions:1. Where MAKT-MATNR = LINV-MATNR and MAKT-SPRAS = ‘logon language user’

2. Where MCH1-CHARG = LINV-CHARG AND MCH1-MATNR = LINV-MATNR)

3. SELECT AUSP-ATWRT Where AUSP-OBJEK = MCH1- CUOBJ_BM and MCH1-CHARG = LINV-CHARG AND MCH1-MATNR = LINV-MATNR

Regards

Victor

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
368

select <data fields> into it_linv from LINV where LGNUM = linv-lgnum and IVNUM = linv-ivnum.

select <data fields> into it_mch1 from mch1 as a inner join makt as b on aMATNR = bMATNR for all entries of it_linv where amatnr = it_linv-matnr and acharg = it_linv-charg and b~langu = sy-langu.

select <data fields> into it_ausp from ausp for all entries of it_mch1 where AUSP-OBJEK = it_mch1- CUOBJ_BM.

now loop it_linv and use read statement for it_mch1, it_ausp and move data to final table..

Reward and close duplicate threads.

1 REPLY 1
Read only

Former Member
0 Likes
369

select <data fields> into it_linv from LINV where LGNUM = linv-lgnum and IVNUM = linv-ivnum.

select <data fields> into it_mch1 from mch1 as a inner join makt as b on aMATNR = bMATNR for all entries of it_linv where amatnr = it_linv-matnr and acharg = it_linv-charg and b~langu = sy-langu.

select <data fields> into it_ausp from ausp for all entries of it_mch1 where AUSP-OBJEK = it_mch1- CUOBJ_BM.

now loop it_linv and use read statement for it_mch1, it_ausp and move data to final table..

Reward and close duplicate threads.