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: 

Moving a field to a struct

Former Member
0 Kudos
109

Hi all,

The cdpos has a field tabkey which is equalent to the concatented fields(client + BOM type + BOM + Node + position + counter ie: first 6 fields in the table stpo)

If I create a data type of these stpo fields

TYPES:
  BEGIN OF lty_cdtabkey_str,
   client(3) TYPE c,    
   bomtype(1) TYPE c,     
   BOM(6) TYPE c,      
   nODE(5) TYPE c,  
  POSITION(5) TYPE c, 
 counter(5) TYPE c,   
                
  END   OF lty_cdtabkey_str.
DATA:
  ls_cdtabkey TYPE lty_cdtabkey_str,

and if I make a move like

MOVE itab_cdpos-tabkey INTO ls_cdtabkey.

Will it break it down into the individual fields.

Thanks

K

1 ACCEPTED SOLUTION

krishnendu_laha
Active Contributor
0 Kudos
66

hello,

Yes it will move...

I only doubt about client field, do not think it is required...please check

Thanks

3 REPLIES 3

kesavadas_thekkillath
Active Contributor
0 Kudos
66

Try this


call method cl_abap_container_utilities=>read_container_c
exporting
im_ container = itab_cdpos-tabkey
importing
ex_ value = ls_cdtabkey
exceptions
illegal_parameter_type = 1
others = 2. 

krishnendu_laha
Active Contributor
0 Kudos
67

hello,

Yes it will move...

I only doubt about client field, do not think it is required...please check

Thanks

0 Kudos
66

Thanks....