Skip to Content
author's profile photo Former Member
Former Member

Need ABAP help to access field value of the table, where as required field name is stored in another column

My scenario looks like this

My source table is as follows:

Key Field

Data Field

Key Figure1

Key Figure2

Key Figure3

Key Figure4

1

Key Figure2

1

5

3

2

2

Key Figure1

8

3

17

6

3

Key Figure4

65

76

67

43

4

Key Figure2

56

97

887

21

I need records in Target table as follows:

Key Field

Key Figure

1

5

2

8

3

43

4

97

i.e. to get the key figure value for target record we need to identify which key figure need to be accessed from source table. The second field(i.e. Data field) in the source table provides this information. This "Data Field" stores the Key Figure field names/lables in it.

For example, for the first record i.e. with key field value '1', the key figure need to be accessed is Key Figure2, for the first record Key Figure2 value is 5, so it has to be stored as Key Figure value in this record

I have the solution to achieve this using CASE statement, in the example I have shown 4 key figures but it is not static , the number of key figures are not known in advance.. it may increase …so case statement will not do in this case..

Please provide me the dynamic ABAP code to achieve this.

Regards,

Hari Prasad Balija

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jan 11, 2013 at 10:00 AM

    Plz do not post same threads on multiple forums.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.