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 not changing value

Former Member
0 Likes
3,452

Hi All,

Thanks in advance.

I am new to module pool.The scenario is as follows:There are 4 screens namely 0001,0110,0120,0130. Screen 0001contains the input field as CARRID.It also has 3 Pushbuttons namely ADD,EDIT,DISPLAY. This screen also contains a GUI STATUS in which the functionality of BACK, EXIT and CANCEL are enabled. If the user click on ADD pushbutton then Screen 0110 gets opened which has some input fields. Screen 0110 has its GUI status in which SAVE,BACK, EXIT and CANCEL are enabled.Likewise is the case with other 2 screens.The ADD button has got the Function Code ADD.When I click on ADD button I see the OK_CODE = ADD.By this it will take to the Screen 0110.Till now everything is working fine.

Now I am in Screen 0110.After entering the data in input fields when I click on SAVE button of Application Toolbar Of GUI STATUS it is taking the same old OK_CODE = ADD instead it should take the OK_CODE = SAVE.

Please suggest me in this matter and guide me where I had committed mistake.

Thanks once again.

1 ACCEPTED SOLUTION
Read only

gerd_rother
Active Participant
0 Likes
1,985

Hi,

Have you checked the screen's OK field in all screens (last element in the 'Element list' in screen maintenance)?

Regards, Gerd Rother

12 REPLIES 12
Read only

gerd_rother
Active Participant
0 Likes
1,986

Hi,

Have you checked the screen's OK field in all screens (last element in the 'Element list' in screen maintenance)?

Regards, Gerd Rother

Read only

Former Member
0 Likes
1,985

i guess ok_code is a custom variable declared in the program. Check the value of sy-ucomm after you press save. If its 'SAVE' then you will have to move the sy-ucomm value to ok_code.

Vikranth

Read only

Former Member
0 Likes
1,985

Hi.

I think that u must define ok_code for each screen i.e ok_code_001 ok_code_002 .........

then after that use this ok_code wherever u are using.

Read only

Former Member
0 Likes
1,985

Hi Bharti,

Go to Element List of screen 0110... declare ok_code type sy-ucomm..

Similarly in the element list of other screens declare ok_code type sy-ucomm.

Also do check in the layout of the screens if a function code is given to all the buttons...

hope this solves your problem.....

Read only

Former Member
0 Likes
1,985

use clear ok_code after every event call...

case ok_code .

When 'ADD'

clear ok_code.

when 'SAVE'

clear ok_code.

endcase

and check if you have defined the same ok code for both the buttons.

and check the element list also to see if some name has been given for ok code.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,985

Have you activated the PF Status ?

This could be solved by debugging yourself.

Also check what vikranth has suggested, declare a variable in element list of the particular screen.

Read only

Former Member
0 Likes
1,985

Hi,

In the PAI pf every screen Pass the sy-ucomm value to the OK_CODE. So by doing like this your problem will get solved and declare the OK_CODE in the top of the module pool program.

With Regards,

Sumodh.P

Read only

0 Likes
1,985

Hi,

There is no need of passing the sy-ucomm value to ok_code variable

Just declare the variable in top include and include it in the element list ( type of screen OK ) of the particular screen.

Then while clicking a command the corresponding function code will be available in the variable.

Read only

0 Likes
1,985

Hi Keshav,

Thanks for updating.

With Regards,

Sumodh.P

Read only

Former Member
0 Likes
1,985

Hi All,

Thanks for such a prompt reply.It helped me a lot and my problem is solved for the first screen 0110.

Now in the screen 0120 I have created a table control which is to be filled with a ZTABLE named ZEMPLOY99 which has fields CARRIER,FIRST_NAME,LAST_NAME AND SO ON.From the screen 0001when CARRIER is selected and EDIT pushbutton is clicked it is coming to the screen 0120 with a table control MYTABLE.

The issue is that the data is not displayed in this table control.Suppose 6 rows should come then in the table contol I can see 6 rows in white and fron the 7th row it is grayed.Why the date is not appearing.Here is the code for screen 0120

PROCESS BEFORE OUTPUT.

MODULE SET_STATUS. "to set PF STATUS

MODULE GET_DETAIL. " to ge datain internal table

LOOP AT IT_ZEMPLOY99 INTO WA_ZEMPLOY99 WITH CONTROL MYTABLE.

MODULE TRANS_TO_TC.

ENDLOOP.

PROCESS AFTER INPUT.

MODULE USER_COMMAND.

LOOP AT IT_ZEMPLOY99.

FIELD ZEMPLOY99-MARK.

MODULE TRANS_FROM_TC .

ENDLOOP.

*****Module **********

MODULE GET_DETAIL OUTPUT.

SELECT * FROM ZEMPLOY99 INTO CORRESPONDING FIELDS OF TABLE IT_ZEMPLOY99 WHERE CARRIER = WA_SDYN_CONN-CARRID. "Here CARRIER is same as the CARRID of SDYN_CONN

DESCRIBE TABLE IT_ZEMPLOY99 LINES FILL.

MYTABLE-LINES = FILL.

"DESCRIBE TABLE IT_ZEMPLOY99 LINES MYTABLE-LINES.

ENDMODULE.

****Module*******

MODULE TRANS_TO_TC OUTPUT.

MOVE WA_ZEMPLOY99 TO IT_ZEMPLOY99 .

ENDMODULE.

*********Module*********

MODULE TRANS_FROM_TC INPUT.

MOVE SDYN_CONN-MARK TO WA_SDYN_CONN-MARK .

MODIFY IT_ZEMPLOY99 INDEX MYTABLE-CURRENT_LINE FROM WA_ZEMPLOY99 .

ENDMODULE.

Please guide me to correct my mistake.

Thanks in ADVANCE.

Read only

Former Member
0 Likes
1,985

Hi All,

I have solved the problem on my own.But now since the Screen 0001,0110,0120,0130 are are normal screens and in the screen 0120 I have the table control with the data present. In this screen I have made 3 pushbuttons to SORT ASCENDING,SORT DESCENDING AND CHANGE.When Sort ascending or descending is clicked then the table should be sorted in that manner based on the column selection .When I see in the internal table I see the data sorted but the changes are not reflected in the table control in the screen.A part of the code is as follows

CASE SAVE_OK_CODE.

WHEN 'SORTA'.

READ TABLE MYTABLE-COLS INTO WA_COLS WITH KEY SELECTED = 'X'.

IF SY-SUBRC = 0 .

SORT IT_ZEMPLOY99 BY (WA_COLS-SCREEN-NAME+13) ASCENDING .

ENDIF .

WHEN 'SORTD'.

READ TABLE MYTABLE-COLS INTO WA_COLS WITH KEY SELECTED = 'X'.

IF SY-SUBRC = 0 .

SORT IT_ZEMPLOY99 BY (WA_COLS-SCREEN-NAME+13) DESCENDING .

ENDIF .

ENDCASE.

Regarding CHANGE the scenario is as follows:When the user select a row and click on the CHANGE button then the data of that particular row should come in the subscreen in the input fields which will be shown below the screen 0120 and that too will be opened onle when CHANGE button is clicked.Else it should become invisible.

Please guide me in this matter as I am very new to Module Pool.

Read only

Former Member
0 Likes
1,985

Hi all,

Thanks for all the replies.It helped me a lot and the issue has been resolved.