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: 

Dynamic field in read statement

0 Kudos
273

Hi All,

Can i write the statement like below . i am getting error .

here table ct_data type is Table .

1 ) ASSIGN ct_data[ 1 ] -('myfield name here ') to fieldsymbol(<lv_value>).

2 ) data(lv_value ) = lt_mseg[ grund = '<Some value>' ]-grund

second statement giving the dump . tried in try catch block also still its not working .

Regards,

Srikanth

4 REPLIES 4

Sandra_Rossi
Active Contributor
0 Kudos
182

1)

ASSIGN ct_data[ 1 ] TO FIELD-SYMBOL(<ls_data>).
ASSIGN COMPONENT ('myfield name here') OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<lv_value>).

2)

"giving the dump"

What dump?

"tried in try catch"

What code?

former_member876
Participant
0 Kudos
182

If you can paste your code, it will help solve the issue.

0 Kudos
182

Thanks for Reply Sandr

I understood from your comment that below statement does not work properly. am i correct ? .

 ASSIGN ct_data[ 1 ]-('dynamic field') to fieldsymbol(<lv_value>). 
 

0 Kudos
182

You didn't answer our questions yet, so I will wait before answering myself.

PS:

  • If you do a comment under a question/answer and you want to target someone else than the question/answer' author, the only solution is to copy/paste their hyperlinked name so that the person receives a warning (NB: @ doesn't work/but typing this character will suggest hyperlinked names)
  • Please use the COMMENT button for comments, questions, adding details, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.