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

internal table

Former Member
0 Likes
650

Hi all,

i have three tables (suppose lfa1,kna1,vbak).i want to get all the data in to an internal table based on lifnr(select-option).can any body provide sample piece of code for this.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
551

hi Venkat,

do this way ..

 select a~lifnr 
      INTO CORRESPONDING FIELDS OF TABLE itab          
          from lfa1 as a
             INNER JOIN kna1 AS b
             on<common fields>
             INNER JOIN vbak AS c
             on<common fields>
    where a~lifnr in s_lifnr.

But it is not advisable to use joins when you are mainitaining a huge data so use for all entries statement instead of joins

Regards,

Santosh

5 REPLIES 5
Read only

Former Member
0 Likes
551

You know how to write the join conditions then you can do it.

like

SELECT DISTINCT avbeln amatnr bexdat brdoc b~kunwe FROM vbrp AS a

INNER JOIN j_1iexchdr AS b

ON avbeln = brdoc

INTO CORRESPONDING FIELDS OF TABLE i_exchdr

WHERE b~exdat IN s_exdat

AND TRNTYP = 'DLFC'

AND pstyv NE 'L2N'.

hope it will help you

Read only

Former Member
0 Likes
552

hi Venkat,

do this way ..

 select a~lifnr 
      INTO CORRESPONDING FIELDS OF TABLE itab          
          from lfa1 as a
             INNER JOIN kna1 AS b
             on<common fields>
             INNER JOIN vbak AS c
             on<common fields>
    where a~lifnr in s_lifnr.

But it is not advisable to use joins when you are mainitaining a huge data so use for all entries statement instead of joins

Regards,

Santosh

Read only

Former Member
0 Likes
551

Try this:

SELECT <required fields> from LAF1 AS a

INNER JOIN KNA1 AS b ON alifnr = blifnr

INNER JOIN VBAK AS c ON alifnr = clifnr

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE a~lifnr IN s_lifnr.

P.S. Reward for the useful answers.

Susanth

Read only

0 Likes
551

Sorry Venkat,

There is no field as LIFNR in VBAK table so slight alteration in the query is:

SELECT <required fields> from LAF1 AS a

INNER JOIN KNA1 AS b ON alifnr = blifnr

INNER JOIN VBAK AS c ON bkunnr = ckunnr

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE a~lifnr IN s_lifnr.

P.S. Reward for the useful answers.

Susanth

Read only

Former Member
0 Likes
551

SELECT ALIFNR BKUNNR CVBELN INTO CORRESPONDING FIELDS OF TABLE ITAB FROM LFA1 AS A INNER JOIN KNA1 AS B ON ALIFNR = BLIFNR INNER JOIN VBAK AS C ON BKUNNR = CKUNNR WHERE ALIFNRIN S_LIFNR.

S_LIFNR IS SELECT-OPTION...

REGARDS

SHIBA DUTTA