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: 

Adding new field in the Dynamic field symbol

Former Member
0 Kudos

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.

2 REPLIES 2

Former Member
0 Kudos

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.

former_member200338
Active Contributor
0 Kudos

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.