Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

field symbols type standard table

Hi all,

My requirement is to have a dynamic internal table. Now when the user gives the table name in the selection screen, all the fields of this tables shall be displayed as alv, this part is done. Now, user will download the data, to excel sheet and make some changes into one of the field, and upload this.

Now, when the data is uploaded by the user, he has made some changes to the field. I have to check the difference between the internal table and the uploaded data. But, I am using field symbols type standard table, and all the uploaded data by user is in this field symbol type standard table.

How, do i loop this field symbol, so that i can check for the differences between the uploaded data and the data in the program .

The data in program is also in field symbol type standard table, how do i check for the difference between the uploaded data and the one in program.

As i can not loop the field symbol.

Thanks in advance.

Tags:
Former Member
Former Member replied

You need to find the list of components for the table. Then use assign statement and compare it one by one. Sample code below.

GT_COMPONENT is the internal table which has the list of the fields for the table.

GT_ORG is your original IT table

GT_MOD is your modified IT table.

Assuming both internal tables are sorted, have the same number of entries, matching entries row wise.

lv_index = 0.

DO.

add 1 to lv_index.

Read table gt_ORG assigning <ls_org> index lv_index.

if sy-subrc NE 0.

EXIT.

endif

Read table gt_MOD assigning <ls_mod> index lv_index.

if sy-subrc NE 0.

EXIT.

endif

loop at gt_component assigning <ls_component>.

assign component <ls_component>-fieldname of structure <ls_org> to <lv_org_val>.

check sy-subrc eq 0.

assign component <ls_component>-fieldname of structure <ls_mod> to <lv_mod_val>.

check sy-subrc eq 0.

if <lv_org_val> NE <lv_mod_val>.

* change in value

endif.

endloop.

ENDDO.

Note: This might create a performance issue. This is just an example. You need to optimize properly.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question