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

move only two fields instead a complete workarea to itab

Former Member
0 Likes
1,004

Hello!

Can I move specific fields instead corresponding fields to an internal tables line.

This example below overwrites some fields if e.g. wa_sel_affpersdat_tab and

wa_injuries have the same fields after move-corresponding command.

Is it possible to say not move-corresponding wa_sel_affpersdat_tab to lt_ZEHS_INCIDENT_LI.

but wa_sel_affpersdat_tab-Nr and wa_sel_affpersdat_tab-Name to lt_ZEHS_INCIDENT_LI.

Regards

ilhan

LOOP AT  l_api_header_tab INTO  l_api_header2_wa .

LOOP AT lt_affpersdat INTO wa_sel_affpersdat_tab
                              WHERE RECNROOT = l_api_header2_wa-RECNROOT.

LOOP AT lt_injuries INTO wa_injuries
                              WHERE RECNROOT = l_api_header2_wa-RECNROOT.

move-corresponding l_api_header2_wa      to lt_ZEHS_INCIDENT_LI.
move-corresponding wa_sel_affpersdat_tab to lt_ZEHS_INCIDENT_LI.
move-corresponding wa_injuries           to lt_ZEHS_INCIDENT_LI.
append lt_ZEHS_INCIDENT_LI.

ENDLOOP.
ENDLOOP.
ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Sm1tje
Active Contributor
0 Likes
882

use move: structure1-fielda to structure2-fieldb. Do this per field.

Hello!

Can I move specific fields instead corresponding fields to an internal tables line.

This example below overwrites some fields if e.g. wa_sel_affpersdat_tab and

wa_injuries have the same fields after move-corresponding command.

Is it possible to say not move-corresponding wa_sel_affpersdat_tab to lt_ZEHS_INCIDENT_LI.

but wa_sel_affpersdat_tab-Nr and wa_sel_affpersdat_tab-Name to lt_ZEHS_INCIDENT_LI.

Regards

ilhan

LOOP AT  l_api_header_tab INTO  l_api_header2_wa .

LOOP AT lt_affpersdat INTO wa_sel_affpersdat_tab
                              WHERE RECNROOT = l_api_header2_wa-RECNROOT.

LOOP AT lt_injuries INTO wa_injuries
                              WHERE RECNROOT = l_api_header2_wa-RECNROOT.

move-corresponding l_api_header2_wa      to lt_ZEHS_INCIDENT_LI.
move-corresponding wa_sel_affpersdat_tab to lt_ZEHS_INCIDENT_LI.
move-corresponding wa_injuries           to lt_ZEHS_INCIDENT_LI.
append lt_ZEHS_INCIDENT_LI.

ENDLOOP.
ENDLOOP.
ENDLOOP.

2 REPLIES 2
Read only

Former Member
0 Likes
882

hi,

in that case move only specific field of the work area i.e, Also try avoiding the nested loops and use read table statement instead of it ....

LOOP AT l_api_header_tab INTO l_api_header2_wa .

LOOP AT lt_affpersdat INTO wa_sel_affpersdat_tab

WHERE RECNROOT = l_api_header2_wa-RECNROOT.

LOOP AT lt_injuries INTO wa_injuries

WHERE RECNROOT = l_api_header2_wa-RECNROOT.

move-corresponding l_api_header2_wa to lt_ZEHS_INCIDENT_LI.

lt_ZEHS_INCIDENT_LI-field1 = wa_sel_affpersdat_tab-field1.

lt_ZEHS_INCIDENT_LI-field2 = wa_sel_affpersdat_tab-field2.

lt_ZEHS_INCIDENT_LI-field3 = wa_sel_affpersdat_tab-field3.

lt_ZEHS_INCIDENT_LI-field4 = wa_sel_affpersdat_tab-field4.

.................

move-corresponding wa_injuries to lt_ZEHS_INCIDENT_LI.

append lt_ZEHS_INCIDENT_LI.

ENDLOOP.

ENDLOOP.

ENDLOOP.

Read only

Sm1tje
Active Contributor
0 Likes
883

use move: structure1-fielda to structure2-fieldb. Do this per field.