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: 

field symbols type standard table

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member200338
Active Contributor
0 Kudos

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.

5 REPLIES 5

krishna_k19
Contributor
0 Kudos

Hi Kaushik ,

     Instead of doing downloading & uploading , make a alv report with editable so user can edit and change values and then update the same , it will complete in one shot also less time consuming.

Regards,

Krishna

0 Kudos

Thanks for your prompt reply, but my requirement is like this only, and i can not change it.

My functional dont want even a single change, only i understand how i have been able to develop this program. If you ask me to explain my code, i can not do that even. In short, requirement is not feasiable. But still i have to do it, and i am stucked at the last point of my program .

former_member200338
Active Contributor
0 Kudos

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.

ipravir
Active Contributor
0 Kudos

Hi Kaushik,

The same way I have made a sample program, where in input field is a table name, based on the entered table name, all respective fields were displaying in below Table Control with three fields.

1. Table Field

2. Where Condition Field value

3. Update Field Value.

User can Provide a value in condition field, and Updated Values in Updated Fields.

After clicking the execute button, a pop-up message is displaying for information of total no of records would be update.

Based on the Yes / No, system will update the respective Table information.

table I have user : DD03L (which contains the all fields information of table)

Through the Dynamic Where Condition, system is updating the Information.

Dynamic Where Condition,

Create a internal table, like IT type standard table CHAR72.

The above thread has been removed by Mentors, due to system update information.

So try the Solution your self, its a very easy and try to provide a different way to update the Information in tables, as per your case, its bit different, because, you have to check the every fields to get the records from the Main table to update the Information.

Note: You can use the Dynamic Where Condition to loop the Dynamic Table.

Loop at <it> assign <wa> where ( it_dynamic ).

endloop,

it_dynaminc : ( MANDT eq '100'                     index 1

                      AND MATNR EQ '1121212'     index 2

                      AND  WERKS eq '1100' )          index 3.

regards.

Praveer.

former_member192023
Active Participant
0 Kudos

Hi Kushik,

Try function module "COMPARE_TABLES" in se37.

Regards.

Feiyun