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

combining internal tables

Former Member
0 Likes
649

HI

I HAVE 2 INTERNAL TABLES ITABLE AND ITABLE1.

I HAVE TO PRINT THE FIELDS FOUND IN BOTH ITABLE AND

ITABLE1.

COULD YOU PLS GIVE ME THE CODE TO COMBINE AND TO PRINT THOSE FIELDS !!!

THANKS IN ADVANCE

1 ACCEPTED SOLUTION
Read only

0 Likes
634

u can do like this

loop at ITABLE .

read table ITABLE1 with key F1 = ITABLE-F1.

if sy-subrc = 0 .

move-corresponding to ITABLE to ITABLE2

move-corresponding to ITABLE1 to ITABLE2

append ITABLE2.

endif.

endloop

where ITABLE2 is canting common fields which u need ..form ITABLE and ITABLE1 .

this will help ..if u want u can ask for clarification ... if is helpfull .. reward with some points...

u can do like this

loop at ITABLE .

read table ITABLE1 with key F1 = ITABLE-F1.

if sy-subrc = 0 .

move-corresponding to ITABLE to ITABLE2

move-corresponding to ITABLE1 to ITABLE2

append ITABLE2.

endif.

endloop

where ITABLE2 is canting common fields which u need ..form ITABLE and ITABLE1 .

this will help ..if u want u can ask for clarification ... if is helpfull .. reward with some points...

4 REPLIES 4
Read only

Former Member
0 Likes
634

Declear another internal table (final) containing all fields of ITAB n ITAB1.

Now looping the two table(condition Both common fields in that two ITAB n ITAB1) push all the data in to final table.

Display all the field of final table.

Message was edited by:

Kaushik Datta

Read only

Former Member
0 Likes
634

pl. check this sample report

DATA: BEGIN OF wa,

carrid TYPE spfli-carrid,

connid TYPE spfli-connid,

fldate TYPE sflight-fldate,

bookid TYPE sbook-bookid,

END OF wa,

itab LIKE SORTED TABLE OF wa

WITH UNIQUE KEY carrid connid fldate bookid.

SELECT pcarrid pconnid ffldate bbookid

INTO CORRESPONDING FIELDS OF TABLE itab

FROM ( ( spfli AS p

INNER JOIN sflight AS f ON pcarrid = fcarrid AND

pconnid = fconnid )

INNER JOIN sbook AS b ON bcarrid = fcarrid AND

bconnid = fconnid AND

bfldate = ffldate )

WHERE p~cityfrom = 'FRANKFURT' AND

p~cityto = 'NEW YORK' AND

fseatsmax > fseatsocc.

LOOP AT itab INTO wa.

AT NEW fldate.

WRITE: / wa-carrid, wa-connid, wa-fldate.

ENDAT.

WRITE / wa-bookid.

ENDLOOP.

Read only

0 Likes
635

u can do like this

loop at ITABLE .

read table ITABLE1 with key F1 = ITABLE-F1.

if sy-subrc = 0 .

move-corresponding to ITABLE to ITABLE2

move-corresponding to ITABLE1 to ITABLE2

append ITABLE2.

endif.

endloop

where ITABLE2 is canting common fields which u need ..form ITABLE and ITABLE1 .

this will help ..if u want u can ask for clarification ... if is helpfull .. reward with some points...

Read only

0 Likes
634

WHETHER I HAVE TO INCLUDE FIELDS IN BETWEEN THE CODE

MOVE CORRESPONDING ?????