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

loop at <lt_pay_data>.

Former Member
0 Likes
1,227

i read this blog

/people/glen.simpson/blog/2011/07/07/gain-programmatic-access-to-data-of-sapgui-alv-reports

my qa is :

how i can make change in <lt_pay_data>..

and how i can read data from <lt_pay_data>. and move it to new internal table.

1 ACCEPTED SOLUTION
Read only

Shahid
Product and Topic Expert
Product and Topic Expert
0 Likes
1,092

BELOW is the sample code to change the <lt_pay_tab>

you can copy the required records to other table of same type by APPEND statement

DATA: dref_tab TYPE REF TO data.

DATA: dref TYPE REF TO data.

DATA: ls_fieldname TYPE string.

FIELD-SYMBOLS: <fs_tab> TYPE ANY TABLE,

<fs_str> TYPE ANY,

<fs_val> TYPE ANY.

    • prepare an internal table

  • Define table

CREATE DATA dref_tab TYPE STANDARD TABLE OF mara." or (tabname).

ASSIGN dref_tab->* TO <fs_tab>.

  • Define WA

CREATE DATA dref TYPE mara. " or (iv_struc_name).

ASSIGN dref->* TO <fs_str>.

SELECT * UP TO 4 ROWS

FROM mara " (tabname) - for importing a table name

INTO TABLE <fs_tab>.

LOOP AT <fs_tab> ASSIGNING <fs_str>.

ls_fieldname = 'MATNR'. " THESE FIELDS CAN BE DYNAMICALLY READ

ASSIGN COMPONENT ls_fieldname OF STRUCTURE <fs_str> TO <fs_val>.

<fs_val> = '1000'.

ENDLOOP.

i read this blog

/people/glen.simpson/blog/2011/07/07/gain-programmatic-access-to-data-of-sapgui-alv-reports

my qa is :

how i can make change in <lt_pay_data>..

and how i can read data from <lt_pay_data>. and move it to new internal table.

4 REPLIES 4
Read only

former_member302911
Active Participant
0 Likes
1,092

Hi,

use this statement:



FIELD-SYMBOLS <VALUE> TYPE ANY.

ASSIGN COMPONENT number or name of field OF STRUCTURE <lt_pay_data> TO <value>.

MOVE 'Some values' TO <value>.

Regards,

Angelo.

Read only

former_member156446
Active Contributor
0 Likes
1,092
field-symbols: <fs_read> type line of  <lt_pay_data>.

read table  <lt_pay_data> assigning <fs_read> with key fieldname = ' '.
if sy-subrc eq 0.
append <fs_read> to new_itab
endif.
Read only

Shahid
Product and Topic Expert
Product and Topic Expert
0 Likes
1,093

BELOW is the sample code to change the <lt_pay_tab>

you can copy the required records to other table of same type by APPEND statement

DATA: dref_tab TYPE REF TO data.

DATA: dref TYPE REF TO data.

DATA: ls_fieldname TYPE string.

FIELD-SYMBOLS: <fs_tab> TYPE ANY TABLE,

<fs_str> TYPE ANY,

<fs_val> TYPE ANY.

    • prepare an internal table

  • Define table

CREATE DATA dref_tab TYPE STANDARD TABLE OF mara." or (tabname).

ASSIGN dref_tab->* TO <fs_tab>.

  • Define WA

CREATE DATA dref TYPE mara. " or (iv_struc_name).

ASSIGN dref->* TO <fs_str>.

SELECT * UP TO 4 ROWS

FROM mara " (tabname) - for importing a table name

INTO TABLE <fs_tab>.

LOOP AT <fs_tab> ASSIGNING <fs_str>.

ls_fieldname = 'MATNR'. " THESE FIELDS CAN BE DYNAMICALLY READ

ASSIGN COMPONENT ls_fieldname OF STRUCTURE <fs_str> TO <fs_val>.

<fs_val> = '1000'.

ENDLOOP.

Read only

Former Member
0 Likes
1,092

my field is

ls_fieldname = 'MARA-MATNR' and not ls_fieldname = 'MATNR' only.

bcs of that i a have a problem