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

Using string in instruction

Former Member
0 Likes
449

I want to do action in BRF which make field value substitution in some structure. I have table with 3 columns: Structure, Field, Value. two first columns are string.Now if i want make substitution i have to use multi and mulilevel CASE's. How can I make sunbstitution instruction using these strings like 'Structure'-'Field' = Value.

Thanks for any help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
418

Hi,

try something like this:


DATA:
  ls_mara   TYPE mara,
  lv_str1   TYPE string VALUE 'LS_MARA',
  lv_str2   TYPE string VALUE 'MATNR',
  lv_field  TYPE string.

FIELD-SYMBOLS:
  <fs>  TYPE ANY.

CONCATENATE lv_str1 '-' lv_str2 INTO lv_field.
ASSIGN (lv_field) TO <fs>.

Best regards,

Oliver

2 REPLIES 2
Read only

Former Member
0 Likes
419

Hi,

try something like this:


DATA:
  ls_mara   TYPE mara,
  lv_str1   TYPE string VALUE 'LS_MARA',
  lv_str2   TYPE string VALUE 'MATNR',
  lv_field  TYPE string.

FIELD-SYMBOLS:
  <fs>  TYPE ANY.

CONCATENATE lv_str1 '-' lv_str2 INTO lv_field.
ASSIGN (lv_field) TO <fs>.

Best regards,

Oliver

Read only

Clemenss
Active Contributor
0 Likes
418

Hi afromeen,

if I understand you correct, you want to substitute specific values in a table.

I would create a second table with same structure 3 columns: Structure, Field, Value. This table could be maintained using maintenance screen. Then put in here the Structure and Field names relevant for substitution and the substitution value.

Then loop at the original table. For each line, check if you have a substitution value. The substitution table can be loaded into a sorted or hashed key table and accessed quickly using READ TABLE WITH TABLE KEY. Use field-symbols to save time.

Regards,

Clemens