Application Development and Automation 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: 
Read only

Screen programming checking

john_wayne
Participant
0 Likes
1,357

Hi i want to ask how can i check the screen fields whether they have been edited?

So far i used the method of chain endchain but one limitation is that when the user changes the field and then clicks back the PAI is not triggered which results in the chain endchain not functioning. The reason is because my fields are in a subscreen and the user command is in the main screen.

Another method i tried is the comparing the work areas of the screen fields and the work area used to populate the screen fields. Im encountering the same problem as the chain endchain where the PAI is not triggered means the fields are not changed.

I see in SAP standard programs all of them have checking when you edit a field and then you exit the program it prompts a message asking if you want to save the changes. Im actually trying to achieve the same thing. Your help is greatly appreciated.

12 REPLIES 12
Read only

former_member191735
Active Contributor
0 Likes
1,327

Use SY-DATAR field. if it is 'X' - Modified screen else no.... SAP uses this field.

Read only

0 Likes
1,327

Your suggestion partly solves my problem but then when i edit the field the system field returns an X which is what i want but then when i edit the field and try to update it the edited field does not store the changes that i have made. I think this is because it has not entered the PAI of the screen. So any solution to that problem?

Read only

0 Likes
1,327

Try these. You should be able to capture any changes on the screen. It is not impossible.

chain.

field: wa_wa-field1

module chain_input_field1 on chain-input.

endchain.

chain.

field: wa_wa1-field2,

wa_wa1-field3

module chain_request_fld2_3 on chain-request.

endchain.

Read only

0 Likes
1,327

I mention this above in my first post. I edit the details on the screen and then exit the screen. With the system field you provided before i managed to popup a confirmation box to save the changed data. When i select yes the data that is to be saved is not the changed data due to the fact that the screen has not entered the PAI part of the screen which means that using the chain statement would not work.

Read only

0 Likes
1,327

Alright.

the PAI part will be executed no matter what you do on the screen unless you enter (/nxxx) in command line. Did you try to put a breakpoint under PAI? if not, put a break point. if not already clear, you should enter into PAI no matter what you do on the screen.

update portion:

If it is a table control and you would like to update, you better use chain with options. Have you used on chain-input, on chain-request in the module that you put between chain and endchain. if yes, post your code here.

For example if there are few fields...

Chain.

field: field1,

field2

module modify_my_entries_here on chain-request.

endchain.

If it is a table control then

loop with control mytable_control_name.

chain.

field: field1,

field2

module change_my_data_here on chain-request.

endchain.

module modify_changed_data. (within this module => modify my_itab from my_workarea index my_table_control-current_line.

endloop.

module handle_user_command.

if this doesn't work. Don't just ask but tell us what you have done so far and post the code and mention where you are not getting the changed data.

Read only

0 Likes
1,327

CHAIN.

FIELD: ztt_einfo-cpl_id,

ztt_einfo-srs_id,

ztt_einfo-ref_no,

ztt_einfo-tic_ownr,

ztt_einfo-itdesc

MODULE trans_from_sdyn_9210 ON CHAIN-REQUEST.

ENDCHAIN.

this is my code in the PAI for the chain. I tested with a break point in the module that is in the PAI and it still wont trigger.

Read only

0 Likes
1,327

I edit the details on the screen and then exit the screen. With the system field you provided before i managed to popup a confirmation box to save the changed data. When i select yes the data that is to be saved is not the changed data due to the fact that the screen has not entered the PAI part of the screen which means that using the chain statement would not work.

Not quite. PAI is triggered, but presumably, your BACK and EXIT functions are set as exit commands which means processing flows directly to the exit command module. This means that the normal field transport (screen field to program field), which is forced by the CHAIN and FIELD commands in your screen, does not happen. You need to scrape the screen using the DYNP_VALUES_READ function to get the current values. It would be better if you just transitioned out of exit command processing and into your normal ok code processing for saving the data if that choice is made. Field transport would be assured in that case...

Read only

0 Likes
1,327

so what your saying is that the the user commands are set to the exit command which means it will skip the chain and go straight to the exit command module?

Read only

0 Likes
1,327

Yes. Exit commands skip all processing regardless of screen flow logic order and go directly to the exit-command module logic defined...

Read only

0 Likes
1,327

Oh Well, did you assign the exit commands to your back / cancel / exit buttons? are you handing them in your PAI anywhere?

if yes, brad is right.

Read only

0 Likes
1,327

>

> Yes. Exit commands skip all processing regardless of screen flow logic order and go directly to the exit-command module logic defined...

I think this is only the case for a module called AT EXIT-COMMAND.

Rob

Read only

0 Likes
1,327

Yes, of course. I simply assumed that would be the case if you define an exit command. I never define a main screen without it; I guess I shouldn't assume that's the case for others ;-).

It's really the only explanation for the lack of field transport the poster is describing unless we're missing some other info OR there's a module defined in the flow logic before the CHAIN/FIELD statements in question and that's where this back handling is occuring.