01-31-2015 11:00 AM
Dear Technical Experts,
I want to add one more new field ( customer ) in my one of field symbol structure. Basically am getting dynamic structure during run time. Its having multiple fields. i want to add one new field in that structure to compare into another structure.
how to add new field in the struture, after my comparison i want to remove the added field in the structure.
Anone guide me.
01-31-2015 12:20 PM
Example please ?
Why don't you just compare components you want to compare ?
e.g.
in some loop...around loop
ASSIGN COMPONENT 'CUSTOMER' OF STRUCTURE <line> TO <field>.
ASSIGN COMPONENT 'CUSTOMER' OF STRUCTURE <line2> TO <field2>.
IF <field> <> <field2>.
..blahblah...
l_bool_not_equal = 'X'.
EXIT.
ENDIF.
Just loop thru everything and compare.
02-02-2015 5:28 AM
Not sure of your exact requirement. But if you need as what you have mentioned, try below logic.
1. Pass your field symbol to method CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_DATA and get the reference.
2. Use get_ddic_field_list method of importing reference to get the list of fields
3. Create a new fieldcatalog by using above fields and add your new field to this fieldcatlog internal table(at the end).
4. Use cl_alv_table_create=>create_dynamic_table to create a dynamic internal table
5. Create a workarea for the above internal table.
You can use this new work area for your manipulation.