2009 Mar 18 6:19 AM
Hi,
I have a requirement where in I have a dynamic internal table which is been refererred by a work area.
Say <ls_table> for which the columns can be FIELD1, FIELD2, FIELD3,..... I exactly donno the no of columns.
I have a string separated by a delimiter. The no of delimiters decides the no of columns for <ls_table>.
Say, string = 'ABC | GH '.
Then my <ls_table> has <ls_table>-FIELD1 and <ls_table>-FIELD2.
Now my problem is how can i assign the value to this workarea?
I mean, i know the value of <ls_table>-FIELD1 is ABC but how can I assign it to <ls_table>-FIELD1 without specifying the field name?
To conclude,
I have fieldname and fieldvalue in two different variables... how can i equate them?
say, l_fieldname = <ls_table>-field1.
l_fieldvalue = 'XYZ'.
Now, all i want is to get <ls_table>-field1 = 'XYZ'.
Anyone has any idea how i can achieve this?
Regards,
Suganya
2009 Mar 18 6:30 AM
this might help u...
count the number of delimiters.
assign component count of structure <ls_table> to <fs>.
<fs> = l_fieldvalue .
2009 Mar 18 6:30 AM
this might help u...
count the number of delimiters.
assign component count of structure <ls_table> to <fs>.
<fs> = l_fieldvalue .
2009 Mar 18 6:53 AM
2009 Mar 18 6:40 AM
HI,
You can try this...
DATA: data(100),
tb_final(100) OCCURS 0 WITH HEADER LINE,
lines TYPE i.
FIELD-SYMBOLS: <fs_data> TYPE ANY.
data = 'ABC hcbu ffr vfg vergreg vfg'.
ASSIGN data TO <fs_data>.
DO.
IF NOT data IS INITIAL.
SPLIT data AT space INTO <fs_data> data.
tb_final = <fs_data>.
APPEND tb_final.
CLEAR tb_final.
ELSE.
EXIT.
ENDIF.
ENDDO.
DESCRIBE TABLE tb_final LINES lines.
Now lines will give you the number of columns for the output. Now, based on this you can decide how to proceed further.
Hope this helps...
2009 Mar 18 6:41 AM
Hi,
Check this logic:
DATA: wa_mara TYPE mara,
lv_var TYPE char30 VALUE '<FS_MARA>-MATNR',
lv_value TYPE mara-matnr VALUE '000001'.
FIELD-SYMBOLS: <fs_mara> TYPE mara,
<fs> TYPE ANY.
ASSIGN wa_mara TO <fs_mara>.
IF sy-subrc = 0.
ASSIGN (lv_var) TO <fs>.
IF sy-subrc = 0.
<fs> = lv_value.
ENDIF.
ENDIF.
write: 'MATNR value : ', wa_mara-matnr.
Hope that this helps you,
Regards.