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: 

Back Button works one way for execute and another for enter

Former Member
0 Kudos

I created a custom program that includes a selection screen and a detailed list/table output. When a user enters their selection criteria and hits enter (instead of execute) they'll go to the next screen, and when they are ready to back out, it goes back to the selection screen, which is correct. But when a users enters their selection criteria and hits the Execute button, they'll go to the detailed screen and when they press the back button, it backs out of the program completely. I don't understand why their is a difference between the two and how it would affect the back button. Also, I don't know how to get the execute button and the enter key to act the same way. Can any one offer any suggestions?

15 REPLIES 15

Former Member
0 Kudos

Check out the ok codes with the back button ,

execute and enter.

Also look to that UR clearing them properly.

In order to get the same functionality for both execute

button and the enter key give the same ok codes or write

the same functionality for both.

Former Member
0 Kudos

Hi

Whick kind is your program? Report or module pool?

How do you manage the calling to next screen by selection-screen?

Max

Former Member
0 Kudos

Hi Max,

This is a module pool program. (It is a copy of another program with a few modifications. The original program's back button works just fine). Once I gather all the data from the selection screen, I use the CALL SCREEN '100' statement to get to the next screen to display the information. Does this help?

0 Kudos

Hi

See the user command module of screen 100 and check how the BACK is managed.

Which are the stataments used?

Another question: where is the selection-screen generated?

Max

Former Member
0 Kudos

the user command module looks as follows:

save_ok_code = ok_code.

CLEAR ok_code.

CASE save_ok_code.

WHEN 'P+ ' OR 'P- '.

PERFORM scroll_table.

WHEN 'P++ '.

tc_exclude-top_line = tc_exclude-lines.

WHEN 'P-- '.

tc_exclude-top_line = 1.

WHEN 'SAVE'.

MODIFY zkotg903_excpts FROM TABLE zkotg903_excpts_tab.

IF sy-subrc = 0.

MESSAGE i080(zc) WITH 'Exclusion ' 'successfully saved'.

ELSE.

MESSAGE e128(zc).

  • Unable to save Country/Material Exclusions - contact help desk x4400

ENDIF.

WHEN OTHERS.

ENDCASE.

Where it is being managed is in module_exit at exit command, which states the following:

CASE sy-dynnr.

WHEN 0100.

SUPPRESS DIALOG.

SET SCREEN 0.

LEAVE SCREEN.

WHEN 1000.

LEAVE to screen 0.

WHEN OTHERS.

ENDCASE.

This does work for the original program (which this was copied from).

I have this problem on two programs (one is for create the other is for maintain). The selection screen on the create program uses parameters and is generated that way. On the maintain program it is generated via Selection-screen begin of...and end of.

0 Kudos

Hi

It's very strange abap code to back to old screen

CASE sy-dynnr.

WHEN 0100.

-


> SUPPRESS DIALOG: this statament suppresses output of the current screen, it's usually used in PBO to skip in PAI event. So it shouldn't need here.

-


> SET SCREEN 0. LEAVE SCREEN: this statament goes to the point where the screen was called, so after statament CALL SCREEN <....>.

So check the abap code after CALL SCREEN 100.

Max

Former Member
0 Kudos

Max,

Would it better for me to get rid of the sy-dynnr case in the PAI, and add the BACK ok_code logic to the user_command module?

0 Kudos

Uhm!

Perhaps... but I'm not sure because you need the same code you're using in case statament: i.e. SET SCREEN 0. LEAVE SCREEN.

So you'd change only the point where the calling for back is done.

Can you give me the code in the selection screen?.

Max

Former Member
0 Kudos

For the create program the selection screen logic is as follows:

parameters: s_matnr1 like mara-matnr,

s_kunnr like kna1-kunnr.

start-of-selection.

at selection-screen on s_matnr1.

if s_matnr1 is initial.

message i080(zc) with 'Material number is required' .

flag_error = 'Y'.

endif.

  • LOOP at s_matnr1 to flag all invalid materials. Display message.

select matnr

from mara up to 1 rows

into mara-matnr

where matnr eq s_matnr1.

endselect.

if sy-subrc ne 0.

message e080(zc) with 'Invalid Material'.

endif.

clear: process_kunnr,

process_matnr,

zkotg903_excpts_tab,

no_kunnr.

refresh: process_kunnr,

process_matnr,

zkotg903_excpts_tab.

at selection-screen on s_kunnr.

if s_kunnr is initial.

no_kunnr = 'Y'.

else.

no_kunnr = 'N'.

select kunnr from kna1 up to 1 rows

into kna1-kunnr

where kunnr eq s_kunnr.

endselect.

if sy-subrc ne 0.

message e080(zc) with 'Invalid Customer'.

endif.

endif.

perform get_material.

loop at process_matnr.

move process_matnr-matnr to zkotg903_excpts_tab-matnr.

if no_kunnr = 'N'.

select kunnr

from kna1

into table process_kunnr

where kunnr eq s_kunnr.

endif.

if sy-subrc = 0.

loop at process_kunnr.

select *

from zkotg903_excpts

where matnr = process_matnr-matnr

and kunnr = process_kunnr-kunnr.

endselect.

if sy-subrc <> 0.

move process_kunnr-kunnr to zkotg903_excpts_tab-kunnr.

zkotg903_excpts_tab-datbi = '99991231'."validity end date

zkotg903_excpts_tab-datab = sy-datlo. "validity begin date

zkotg903_excpts_tab-zzuname = sy-uname.

append zkotg903_excpts_tab.

else.

message i318(zc) with process_kunnr-kunnr

process_matnr-matnr.

flag_error = 'Y'.

endif.

endloop. "endloop for kunnr

else.

message i190(zc) with s_matnr1+3.

flag_error = 'Y'.

endif.

endloop. "endloop for matnr

  • if there isn't a customer, append material to zkotg903_excpts_tab.

if no_kunnr = 'Y'.

append zkotg903_excpts_tab.

endif.

if flag_error = 'N'.

call screen '100'.

else.

call selection-screen 1000.

endif.

The maintenance program is a little less involved as I am sure you know. If you would like to see that code as well, I can post it.

0 Kudos

Hi

check your code and it seem to work fine: perhaps when you haven't actived the gui of screen 100.

Try to run your program in debug: if user presses enter SY-UCOMM = SPACE, if user press F8 SY-UCOMM = 'ONLI'.

Max

Former Member
0 Kudos

I went through debug and when I press F8 SY-UCOMM = CRET. It is fine for Enter (SY-UCOMM = SPACE).

0 Kudos

CRET? I've never seen that code.

The SY-UCOMM value for "Execute button" (F8) usually is ONLI. Which is your release?

When a selection-screen is generated, the system loads the gui status %_00 of program RSSYSTDB.

I've created a program like your and it runs fine, this is the code:

REPORT ZMAX.

PARAMETERS: S_MATNR1 LIKE MARA-MATNR,

S_KUNNR LIKE KNA1-KUNNR.

DATA FLAG_ERROR.

DATA OK_CODE LIKE SY-UCOMM.

START-OF-SELECTION.

AT SELECTION-SCREEN ON S_MATNR1.

FLAG_ERROR = 'N'.

AT SELECTION-SCREEN ON S_KUNNR.

IF FLAG_ERROR = 'N'.

CALL SCREEN '100'.

ELSE.

CALL SELECTION-SCREEN 1000.

ENDIF.

&----


*& Module EXIT INPUT

&----


  • text

----


MODULE EXIT INPUT.

CASE SY-DYNNR.

WHEN 0100.

SUPPRESS DIALOG.

SET SCREEN 0.

LEAVE SCREEN.

WHEN 1000.

LEAVE TO SCREEN 0.

WHEN OTHERS.

ENDCASE.

ENDMODULE. " EXIT INPUT

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0100 OUTPUT

-


> Logic Flow of screen 100

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

PROCESS AFTER INPUT.

MODULE EXIT AT EXIT-COMMAND.

Max

Former Member
0 Kudos

Hi Max,

Maybe this will help some...I didn't have a Start-of-selection for this reason....when I did have that and a user would hit the Execute button, it would back out of the program completely and the Enter button was used for validation of data only.

I find this strange since this program was copied from another one like it and the original program works fine with the Start-of-selection.

We are on release 4.7

0 Kudos

Hi Danielle

It's very strange behavior and I can't think any other solution.

I should see your whole program, if you want you can download the program and e-mail it to me.

I'm on 4.7 too.

Max

gopalkrishna_baliga
Participant
0 Kudos

Hi

I am also facing this problem.

I am also getting the sy-ucomm to be 'CRET'

Did you get any solution to handle back button?

Thanks

Gopal