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: 

Field Symbols

Former Member
0 Kudos
69

I have to select the data from the internal table based on the fiscal period.(ie)

for example , if my fiscal period is 04 to 06 then

i need to select the field4 field 5 field 6.

I think i can use field symbols for this.Please tell me how to use me.

Regards,

Priya

1 ACCEPTED SOLUTION

Former Member
0 Kudos
51

Hi,

DATA: w_name(30) TYPE c,

w_period(3).

FIELD-SYMBOLS <fieldvalue> TYPE ANY.

It's assumed that w_period always contains value like 01,02,03,04...10 etc

It's assumed that IT_MAIN is the internal table which contains FIELD04,FIELD05 & FIELD06 defined in it.If period is 04 the content of it_main-field04 to be picked up, 05 then contents of it_main-field05 to be picked up etc etc....

*

CONCATENATE 'IT_MAIN-FIELD' w_period INTO w_name.

ASSIGN (w_name) TO <fieldvalue>.

*

Now <fieldvalue> will have contents of it_main-field04 if w_period 04

<fieldvalue> will have contents of it_main-field05 if w_period 05 etc etc.

I hope this helps,

Regards

Raju Chitale

3 REPLIES 3

Former Member
0 Kudos
51

using case endcase you can handle this requirement

e.g.

case fiscal period.

when 04 to 06.

*use field4 field5 field6

.

.

.

endcase.

Former Member
0 Kudos
51

hi Priya,

There is a function module 'GET_COMPONENT_LIST' which gives an internal table containing fields of the internal table u specify in the importing parameter.

Once u get this, u can loop over the resultant internal table and with some logic in the loop..endloop u can extract the data.

Hope this helps priya.

Thank you.

Award points if found useful

Former Member
0 Kudos
52

Hi,

DATA: w_name(30) TYPE c,

w_period(3).

FIELD-SYMBOLS <fieldvalue> TYPE ANY.

It's assumed that w_period always contains value like 01,02,03,04...10 etc

It's assumed that IT_MAIN is the internal table which contains FIELD04,FIELD05 & FIELD06 defined in it.If period is 04 the content of it_main-field04 to be picked up, 05 then contents of it_main-field05 to be picked up etc etc....

*

CONCATENATE 'IT_MAIN-FIELD' w_period INTO w_name.

ASSIGN (w_name) TO <fieldvalue>.

*

Now <fieldvalue> will have contents of it_main-field04 if w_period 04

<fieldvalue> will have contents of it_main-field05 if w_period 05 etc etc.

I hope this helps,

Regards

Raju Chitale