cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Field symbol with component "MARA-MTART"

AJeB
Participant
0 Likes
1,124

Hi experts,

I have a field symbol like this 

MARA-MATNRMARA-MTARTMARA-MAKTL
1test_mtart1test_matkl1
2test_mtart2test_matkl2
3test_mtart3test_matkl3

and I want to change the MARA-MTART values but the problem is I can't pass the value from variable to the internal table, after <fs_mtart>- , I can't put the mara-mtart .

how can I pass the value if the component of itab is something like this -> MARA-MTART ?

My sample code

 

 

FIELD-SYMBOLS: <ft_mtart> TYPE table, "this is a standard declaration
               <fs_mtart> TYPE any. "this is a standard declaration

DATA: lv_mtart TYPE mara-mtart.

"lets say the mtart is always 5
lv_mtart = '5'.

ASSIGN (lv_mtart) TO <fs_mtart>-mara-mtart. "not working
<fs_mtart>-mara-mtart = lv_mtart "not working

"I tried to create an internal table but not working
TYPES: begin of ts_mtart,
      mtart TYPE mara-mtart,
       end of ts_mtart.
DATA: ls_mtart TYPE ts_mtart
ASSIGN COMPONENT sy-index OF STRUCTURE ls_mtart TO <fs_mtart>-mara-mtart.

 

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

vulturas4
Explorer
0 Likes
FIELD-SYMBOLS: <fs_mara> TYPE mara.
DATA: l_mtart TYPE mara-mtart.

l_mtart = '5'.

<fs_mara>-mtart = l_mtart.

" ¯\_(ツ)_/¯
AJeB
Participant
0 Likes

<fs_mara>-mtart = l_mtart. will not work because the component is "MARA-MTART", If the component is "MTART" only your solution will work

AJeB_0-1718030662970.pngAJeB_1-1718030673276.png

 

 

vulturas4
Explorer
0 Likes
data lt_mara type table of mara.

lt_mara = value #( ( mtart = '5' ) ).

assign lt_mara[ mtart = '5' ] to field-symbol(<fs_mara>).
cl_demo_output=>display( <fs_mara>-mtart ).

 

Improved 🙂 Will that help?

AJeB
Participant
0 Likes
thanks for trying but still not working