‎2009 Jun 24 5:33 PM
Hi every body,
I have an internal table which is generated by a function, this table contains two fields: id_field and value_field.
when the internal table is created, it will be completed as follows:
___________________________________________
id_field | value_field |
|________________|__________________________|
| PARTNER | 0020023658 |
TYPE | type 1 |
BPKIND | val1 |
BU_GROUP | val2 |
BPEXT | val3 |
|________________|__________________________|
I want to retrieve the values of each field in id_field in a structure, like this:
ls_struct-partner = '0020023658'.
ls_struct-type = 'type 1'.
ls_struct-bpkind = 'val1'.
ls_struct-bu_group = 'val2'.
ls_struct-bpext = 'val3'.
and it should dynamically, because I have more than one partner and I have lot of fields.
If you have any idea, help !
Mll Mat
‎2009 Jun 24 6:57 PM
Hi,
You can achive this with READ also.
With symbols you can do as follows:-
data: <fs> type any.
loop at itab into wa.
assign component wa-id_field of structure ls_struct
to <fs>.
<fs> = wa-value_field.
endloop.
Now ls_struct will contain all the values in the corresponding fields.
Regards,
Ankur Parab
‎2009 Jun 24 6:19 PM
‎2009 Jun 24 6:28 PM
Hi Krishna,
How can I use Fied symbol ? I never use it
can you help me please.
Mll Mat
‎2009 Jun 24 6:57 PM
Hi,
You can achive this with READ also.
With symbols you can do as follows:-
data: <fs> type any.
loop at itab into wa.
assign component wa-id_field of structure ls_struct
to <fs>.
<fs> = wa-value_field.
endloop.
Now ls_struct will contain all the values in the corresponding fields.
Regards,
Ankur Parab
‎2009 Jun 24 8:13 PM
>
> Hi every body,
>
> I have an internal table which is generated by a function, this table contains two fields: id_field and value_field.
> when the internal table is created, it will be completed as follows:
> ___________________________________________
> | id_field | value_field |
> |________________|__________________________|
> | PARTNER | 0020023658 |
> | TYPE | type 1 |
> | BPKIND | val1 |
> | BU_GROUP | val2 |
> | BPEXT | val3 |
> |________________|__________________________|
>
> I want to retrieve the values of each field in id_field in a structure, like this:
>
> ls_struct-partner = '0020023658'.
> ls_struct-type = 'type 1'.
> ls_struct-bpkind = 'val1'.
> ls_struct-bu_group = 'val2'.
> ls_struct-bpext = 'val3'.
>
Check the following code:
data: itab_struct type standard table of struct,
ls_struct type struct.Let itab_fm be the internal table that will be populated after executing the FM and wa_fm be the work area of the same.
Let struct be the structure of the ls_struct that you have mentioned containing id_field and value_field as elements.
Loop at itab_fm into wa_fm.
ls_struct-(wa_fm-id_field) = wa_fm-value_field.
endloop.
append ls_struct to itab_struct.Hope this helps. This is without field-symbols for your ease.
Thanks & Regards,
Anand Patil
‎2009 Jun 25 9:59 AM
Hi,
Thank you for reply.
- Thank you very very much Ankur Parab for your reply, it works well.
- Thank you Anand Patil for your reply but it dosn't work, "ls_struct-(wa_fm-id_field)" is
unknown
Mll Mat