Application Development and Automation 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: 
Read only

Need help regarding the dynamic data and fields

Former Member
0 Likes
374

Hello All,

Please help me code regarding the dynamic fields and tables. Here is my requirement.

1. A custome table is maintained with the set of infotypes.

2. After 'GET PERNR' statement in the report, i need to get the data of the infotypes maintained in that table

FIELD-SYMBOLS: <table> TYPE table.

GET pernr.

LOOP AT it_ithrlogctl INTO wa_ithrlogctl.

p_table = wa_ithrlogctl-infotype.

CREATE DATA r_tab TYPE TABLE OF (p_table).

ASSIGN r_tab->* to <table>.

concatenate 'P' p_table into p_table.

MOVE P0000[] to <table>.

ENDLOOP.

In the above code, i had hardcoded P0000[] , please suggest me how i can replace it.

Thanks in advance.

Radha.

Hello All,

Please help me code regarding the dynamic fields and tables. Here is my requirement.

1. A custome table is maintained with the set of infotypes.

2. After 'GET PERNR' statement in the report, i need to get the data of the infotypes maintained in that table

FIELD-SYMBOLS: <table> TYPE table.

GET pernr.

LOOP AT it_ithrlogctl INTO wa_ithrlogctl.

p_table = wa_ithrlogctl-infotype.

CREATE DATA r_tab TYPE TABLE OF (p_table).

ASSIGN r_tab->* to <table>.

concatenate 'P' p_table into p_table.

MOVE P0000[] to <table>.

ENDLOOP.

In the above code, i had hardcoded P0000[] , please suggest me how i can replace it.

Thanks in advance.

Radha.

1 REPLY 1
Read only

Former Member
0 Likes
339

Hi

You can use the field-symbols:

FIELD-SYMBOLS: <TABLE_FROM> TYPE ANY.

FIELD-SYMBOLS: <table> TYPE table.

GET pernr.

LOOP AT it_ithrlogctl INTO wa_ithrlogctl.

p_table = wa_ithrlogctl-infotype.

CREATE DATA r_tab TYPE TABLE OF (p_table).

ASSIGN r_tab->* to <table>.

concatenate 'P' p_table into p_table.

V_TABLE = 'P0000[]'.

ASSIGN (V_TABLE) TO <TABLE_FROM>.

<table> = <TABLE_FROM>.

ENDLOOP.

Now you need only a rule in order to fill correclty V_TABLE (i.e I don't I can get the name of internal table), and probably I don't know if you need to create an internal table dynamically, perhaps a field-symbol is enough

Max