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: 

How to read a offset of bapi_marax?

styrolution_accenture
Participant
0 Kudos

Hello Experts,

I have a case where i have the structure bapi_marax which hold the fields and their corresponding offset value i.e. 'X'.

now after using function module "DDIF_TABL_GET" i am getting list of fields and check for all the fields who has the value x.

after the function module we get the list of field not the value so while looping how we read the corresponding field value.

like FM DDIF_TABL_GET give itab which has all the field.

Loop at itab into wa.

now wa-rollname has the field name and i need to read the structure bapi_marax to get the offset value either X or not.

how can we do this...

endloop.

I did not get any class/method for this.

Please help.

BR,

Rajesh

1 ACCEPTED SOLUTION

brad_bohn
Active Contributor
0 Kudos

There are multiple ways to do it. One simple option is


WHILE sy-subrc EQ 0.
  ASSIGN COMPONENT sy-index OF STRUCTURE bapi_marax TO <fs_field>.
  CHECK <fs_field> EQ 'X'.
  READ TABLE itab INDEX sy-index.
  WRITE itab-fieldname.
ENDWHILE.

2 REPLIES 2

brad_bohn
Active Contributor
0 Kudos

There are multiple ways to do it. One simple option is


WHILE sy-subrc EQ 0.
  ASSIGN COMPONENT sy-index OF STRUCTURE bapi_marax TO <fs_field>.
  CHECK <fs_field> EQ 'X'.
  READ TABLE itab INDEX sy-index.
  WRITE itab-fieldname.
ENDWHILE.

0 Kudos

Thanks Brod,

This looks convincing to me and works very well as per my need. thanks alot for the support.

Out of my curiosity i would like to know the other way to do the same. Please let me know what other way we have to do it as i am looking for some more option with much better performance.

Thanks again.

BR,

Rajesh