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: 

Get field name which was changed on screen

Former Member
0 Kudos

Hi Experts,

i have a requirement that i need to get the field name of any input field which value is changed on screen by user. I am sure there is something is available in ABAP to achieve.

Any help would be appriciated.

Thanks in advance

Regards,

Ashutosh

10 REPLIES 10

ipravir
Active Contributor
0 Kudos

Hi Ashutosh,

Can you give a details information of your requirement.

What is the mean by input fields. Can you provide some example of requirement.

Regards.

Praveer.

Former Member
0 Kudos

Hi Praaveer

My requirement is like suppose there are many input fields on a Z screen and user changes the value of any field. so when he press enter or any other button then in code i get that field name of that input field which value was changed.

I think by this i made you clear about my requirement.

Thanks & Regards

Ashutosh

ipravir
Active Contributor
0 Kudos

Hi Ashutosh,

You can use the Get Cusrsor Field V_Field Statement in your PBO.

here V_Field is any string variable.

It will return your the current selected / entered value field information or I can say your system cursor position in SAP screen.

Regards.

Praveer.

Former Member
0 Kudos

Hi Praveer,

Yes you are right it will return me the current selected or entered value field, but i need all the fields which were changed on screen.

Let say if 3 field have been changed on screen then i want those 3 field names.

Regards

Ashutosh

ipravir
Active Contributor
0 Kudos

Hi,

You can use the 'DYNP_VALUES_READ' function module to get the changed value information of the screen.

Regards.

Praveer.

ipravir
Active Contributor
0 Kudos

Hi Ashutosh,

Hope you got your solution.

Regards.

Praveer

SharathSYM
Contributor
0 Kudos

Hi Ashutosh,

TRy this...

PROCESS AFTER INPUT.

MODULE get_cursor.

MODULE get_CURSOR INPUT.

data : wa_cursor(40).

get CURSOR FIELD wa_cursor.

ENDMODULE.        

wa_cursor will have the field name which value is changed on screen by user.

Thanks,

Sharath

0 Kudos

Hi Sharath,

Thanks for your reply but by this method i will get only last changed field or the field which one has cursor on it. But if on that screen suppose i have changed 3 field's value then how would i get all the three fields.

I think i made you clear about my requirement.

Regards

Ashutosh

0 Kudos

Hi Ashutosh,

In Module pool, we use screen fields which are referred to Data dictionary objects, for e.g. Ztable-field1

we declare extra data objects which is of same structure of screen fields e.g. wa_table type ztable.

the wa_table fields are getting filled by the program logic, i.e. from select * from ztable.

in PBO, copy ztable fields from wa_table feilds.  i.e. ztable = wa_table.

in PAI, compare if ztable = wa_table?

IF ztable NE wa_table.

" Screen values have been changed.

" Compare all fields from both the structures to identify the changed fields & its values.

ENDIF.

0 Kudos

Logic for identifying the changed fields:-

DATA lr_structdescr   TYPE REF TO  cl_abap_structdescr.

DATA l_component    TYPE abap_compdescr .

FIELD-SYMBOLS:     <field_value1> TYPE any.

FIELD-SYMBOLS:    <field_value2> TYPE any.

lr_structdescr ?= cl_abap_typedescr=>describe_by_name( 'ZTABLE' ).

LOOP AT lr_structdescr->components INTO l_component

ASSIGN COMPONENT l_component-name OF STRUCTURE wa_table TO <field_value1>.

ASSIGN COMPONENT l_component-name OF STRUCTURE ztable     TO <field_value2>.

IF <field_value1> NE <field_value2>.

     "Field value has changed field name is in l_component-name

ENDIF.

ENDLOOP.