2024 Nov 19 7:46 AM - edited 2024 Nov 19 7:49 AM
as of now I am doing the value assignment using FOR LOOP as shown below, I was curious the same can be done using MAPPING keyword?
Source and Target structure are not identical. Source is a simple internal table and target is a deep internal table.
et_ds_rel_map_upd = VALUE #( FOR <fs_ds_rel_map> IN lt_ds_relmap_upd_U
( %key-ds = <fs_ds_rel_map>-ds_id
%key-dsfld = <fs_ds_rel_map>-ds_fld
%key-rcon = 'M'
sourceds = <fs_ds_rel_map>-for_ds_id
sourcedsfld = <fs_ds_rel_map>-for_ds_fld
%control = VALUE #( sourceds = if_abap_behv=>mk-on
sourcedsfld = if_abap_behv=>mk-on
sourcedsexpr = if_abap_behv=>mk-on )
) ).
Thanks in advance.
Request clarification before answering.
I think you can use CORRESPONDING with MAPPING. Have you tried it?
Here is ABAP documentation link and example code from it:
DATA: BEGIN OF struct1,
mcomp1 TYPE i VALUE 1,
mcomp2 TYPE i VALUE 2,
BEGIN OF substruc,
subcomp1 TYPE i VALUE 1,
subcomp2 TYPE i VALUE 2,
subcomp3 TYPE i VALUE 3,
END OF substruc,
END OF struct1.
DATA: BEGIN OF struct2,
comp2 TYPE i,
comp1 TYPE i,
BEGIN OF substruc,
comp3 TYPE i,
comp2 TYPE i,
comp1 TYPE i,
END OF substruc,
END OF struct2.
struct2 =
CORRESPONDING #(
struct1 MAPPING comp1 = mcomp1
comp2 = mcomp2
( substruc = substruc MAPPING comp1 = subcomp1
comp2 = subcomp2
comp3 = subcomp3 ) ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
40 | |
15 | |
10 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.