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

OK_CODE for screen 200

Former Member
0 Likes
2,517

Hi everyone,

I have problem with serve screen number 200.

First I call screen 100, when I push button I need to go to screen 200.

I do that and everything is fine.

Now on displayed screen 200 are two pushbuttons (B1, B2).

When i push the button2 I want to back to screen 100, but only when i push B1 not B2.

I think that I have to check ok_code varable in PAI 200 and I do that exactly.

But in result ok_code seems to be empty.

In PAI sreen's 100 it works fine.

Please help..

Regards

Greg.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,552

hi,

try like this.

assign function codes for all push buttons in screen 100, 200. and

In PAI module of screen 200

at line-selection. [ in screen 200 ]

case sy-ucomm.

when 'BUTTON1'. [ psuh button 1 in screen 200 ]

leave to screen 100.

when 'button2'. [ push button 2 in screen 200 ]

................

............

endcase.

if helpful reward some points.

with regards,

suresh.

6 REPLIES 6
Read only

Former Member
0 Likes
1,552

Hi,

Have u declared the OK_CODE in the Layout Screen?

If not Goto Screen 200 -> Element List -> There will be one row with Type OK,Give Ok_Code in the Name Column for that Row.

Remember,the Name OK_Code must be same in the Elemnt List & in the Program must be Same.

Then Write Codings in PAI of the Screen 200:

When 'B1'.

Leave To Screen '100'.

Regards,

Padmam.

Read only

Former Member
0 Likes
1,552

Hi

Did you add field ok_code for your screen 200? Or check what value is there in sy-ucomm when you press button B1.

Based on the button pressed you say, <b>Leave to screen '0100'</b>.

Regards

Raj

Read only

Former Member
0 Likes
1,552

Hi,

REPORT demo_dynpro_subscreens.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

DATA: number1(4) TYPE n VALUE '0110',

number2(4) TYPE n VALUE '0130',

field(10) TYPE c, field1(10) TYPE c, field2(10) TYPE c.

CALL SCREEN 100.

MODULE status_100 OUTPUT.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

MODULE fill_0110 OUTPUT.

field = 'Eingabe 1'(001).

ENDMODULE.

MODULE fill_0120 OUTPUT.

field = field1.

ENDMODULE.

MODULE fill_0130 OUTPUT.

field = 'Eingabe 2'(002).

ENDMODULE.

MODULE fill_0140 OUTPUT.

field = field2.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE save_ok INPUT.

save_ok = ok_code.

CLEAR ok_code.

ENDMODULE.

MODULE user_command_0110 INPUT.

IF save_ok = 'OK1'.

number1 = '0120'.

field1 = field.

CLEAR field.

ENDIF.

ENDMODULE.

MODULE user_command_0130 INPUT.

IF save_ok = 'OK2'.

number2 = '0140'.

field2 = field.

CLEAR field.

ENDIF.

ENDMODULE.

MODULE user_command_100 INPUT.

CASE save_ok.

WHEN 'SUB1'.

number1 = '0110'.

WHEN 'SUB2'.

number1 = '0120'.

CLEAR field1.

WHEN 'SUB3'.

number2 = '0130'.

WHEN 'SUB4'.

number2 = '0140'.

CLEAR field2.

ENDCASE.

ENDMODULE.

The next screen number of screen 100 is 100 (statically-defined). Its layout is as follows:

There are four pushbuttons with the function codes SUB1 to SUB4, and two subscreen areas AREA1 and AREA2.

In the same ABAP program, there are four subscreen screens 110 to 140. Each of these fits the subscreen area exactly. The layout is:

The input/output field of all four subscreen screens has the name FIELD. The function codes of the pushbuttons on the subscreen screens 110 and 130 are OK1 and OK2.

The screen flow logic for screen 100 is as follows:

PROCESS BEFORE OUTPUT.

MODULE status_100.

CALL SUBSCREEN: area1 INCLUDING sy-repid number1,

area2 INCLUDING sy-repid number2.

PROCESS AFTER INPUT.

MODULE cancel AT EXIT-COMMAND.

MODULE save_ok.

CALL SUBSCREEN: area1,

area2.

MODULE user_command_100.

The screen flow logic of subscreen screens 110 and 130 is:

PROCESS BEFORE OUTPUT.

MODULE fill_0110|0130.

PROCESS AFTER INPUT.

MODULE user_command_0110|0130.

The screen flow logic of subscreen screens 120 and 140 is:

PROCESS BEFORE OUTPUT.

MODULE fill_0120|0150.

PROCESS AFTER INPUT.

When you run the program, a screen appears on which subscreens 110 and 130 are displayed. The pushbuttons on the main screen allow you to choose between two subscreen screens for each screen area. The pushbuttons on the subscreens allow you to transfer the data from subscreens 110 and 130 to subscreens 120 and 140.

Since the same field name FIELD is used on all subscreens, the identically-named ABAP field is transferred more than once in each PBO and PAI event of the main screen. For this reason, the values have to be stored in the auxiliary fields FIELD1 and FIELD2 in the ABAP program.

The pushbuttons on the subscreen screens have different function codes, and they are handled normally in an ABAP field. If the function codes had had the same names, it would again have been necessary to use auxiliary fields.

Don't foget to reward if useful.....

Read only

Former Member
0 Likes
1,553

hi,

try like this.

assign function codes for all push buttons in screen 100, 200. and

In PAI module of screen 200

at line-selection. [ in screen 200 ]

case sy-ucomm.

when 'BUTTON1'. [ psuh button 1 in screen 200 ]

leave to screen 100.

when 'button2'. [ push button 2 in screen 200 ]

................

............

endcase.

if helpful reward some points.

with regards,

suresh.

Read only

Former Member
0 Likes
1,552

Hi

Check in the element list of SCREEN 200 if you have defined OK_CODE.

If yes, then check if you have passed the value of SY-UCOMM to OK_CODE.

Rest all seems to be fine..

Thanks and Regards,

Kunjal Patel

Read only

Former Member
0 Likes
1,552

Hi,

now it's ok.

don't know why ok_code isn't filled, so

I used sy_comm

CASE sy-ucomm.

WHEN 'BACK'.

and is fine.

Thanks a lot

Regards,

Greg.