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
463

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
430

Hai Victor,

It is<b> better to create a database</b> view for your problem because each time the time to run the query takes much larger time.

Coming to the solution ...

Create a database view with the condition

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

The view itself takes the duty of joining and checking the conditions after mensioning the joining conditions:

<b>Reward points if it helps you.</b>

Regds,

Rama chary.Pammi

2 REPLIES 2
Read only

Former Member
0 Likes
431

Hai Victor,

It is<b> better to create a database</b> view for your problem because each time the time to run the query takes much larger time.

Coming to the solution ...

Create a database view with the condition

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

The view itself takes the duty of joining and checking the conditions after mensioning the joining conditions:

<b>Reward points if it helps you.</b>

Regds,

Rama chary.Pammi

Read only

Former Member
0 Likes
430

Hi,

Create a database view for the tables which you are using. The view itself will propose the join conditions which you can consider. Also you can specify the Where clause conditions in the tab 'select conditions'. This will also helps you to retreive the data at a faster rate in programs.

thanks,

sksingh.