Application Development 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: 

Code

Former Member
0 Kudos

I have data for 3 fields in one internal table. Now I have a Z table with 4 fields, of which last 3 fields are same the 3 fields of internal table. Now I need to move the data from the Internal table to Z Table, by calling the FM 'ABC', whose output shoud be transferred to the first field in the Z Table and the rest 3 fields from internal table. Please suggest.

1 ACCEPTED SOLUTION

jj
Active Contributor
0 Kudos

I have data for 3 fields in one internal table. Now I have a Z table with 4 fields, of which last 3 fields are same the 3 fields of internal table. Now I need to move the data from the Internal table to Z Table, by calling the FM 'ABC', whose output shoud be transferred to the first field in the Z Table and the rest 3 fields from internal table. Please suggest.

internal table it_tab

with fields : field1 field2 field3.

Ztable with zfield1 zfield2 zfield3 zfield4.

zfield2 is same as field1

zfield3 is same as field2

zfield4 is same as field3

my suggestion.

table: ztable.

call function ABC

importing

value = zfield1.

Loop at it_tab.

zfield2 = field1.

zfield3 = field2.

zfield4 = field3.

Modify ztable.

endloop.

2 REPLIES 2

former_member188827
Active Contributor
0 Kudos

data wa_tab type ztab.

loop at itab into wa.

CALL FUNCTION 'ABC'

EXPORTING

<ur_parameters>

IMPORTING

ztab-field1 = wa_tab-field1

.

IF SY-SUBRC = 0.

move wa-field1 to wa_tab-field2.

move wa-field1 to wa_tab-field3.

move wa-field1 to wa_tab-field4.

insert ztab from wa_tab.

ENDIF.

endloop.

plz reward points if this helps..

jj
Active Contributor
0 Kudos

I have data for 3 fields in one internal table. Now I have a Z table with 4 fields, of which last 3 fields are same the 3 fields of internal table. Now I need to move the data from the Internal table to Z Table, by calling the FM 'ABC', whose output shoud be transferred to the first field in the Z Table and the rest 3 fields from internal table. Please suggest.

internal table it_tab

with fields : field1 field2 field3.

Ztable with zfield1 zfield2 zfield3 zfield4.

zfield2 is same as field1

zfield3 is same as field2

zfield4 is same as field3

my suggestion.

table: ztable.

call function ABC

importing

value = zfield1.

Loop at it_tab.

zfield2 = field1.

zfield3 = field2.

zfield4 = field3.

Modify ztable.

endloop.