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: 

SY-UCOMM

Former Member
0 Kudos

Hi,

I have three buttons in screen 0100. And their names are A, B, C respectively. When user pushes any of these buttons, I want to know which button is pushed. I wrote code, and I tried to learn which button is pushed. But, result of SY-UCOMM is only blank. There is nothing in SY-UCOMM. My full code is:

*&----------------------------------------------------
*& Program  ZPROJECT

PROGRAM  zproject.
DATA: save_code TYPE sy-ucomm,
        ok_code TYPE sy-ucomm.

CALL SCREEN '0100'.
INCLUDE ZPAIMODULES.

*-----------------------------------------------
* INCLUDE ZPAIMODULES.

MODULE user_command_0100 INPUT.

  SAVE_CODE = OK_CODE.

  DATA wa TYPE I.

  CASE SAVE_CODE.
    WHEN 'A'.
      WA = 5.
    WHEN 'B'.
      WA = 9.
    WHEN OTHERS.
      WA = 500.
  ENDCASE.

ENDMODULE.

*--------------------------------------------------
*SCREEN '0100'
PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.

I also wrote OK_CODE in element list of Screen 0100 for the last entry that type is OK. There is no code as I wrote above. I watched the execution of the program. And I watched SAVE_CODE value. It is all the time blank. I mean there is no value for it. Where is wrong? What should I do?

1 ACCEPTED SOLUTION

ssimsekler
Active Contributor
0 Kudos

Hi Huseyin

What OK_CODE can contain is the function code that you assign to a button, not its name. So, check whether you have assigned any function code to the buttons.

You can assign a function code to a button at Screen Painter. When you double-click the button element at the middle of attributes side-screen you can see the field to enter the function code.

By the way, you'd better restructuring your main program as:

PROGRAM  zproject.

DATA: save_code TYPE sy-ucomm,
      ok_code   TYPE sy-ucomm.

INCLUDE ZPAIMODULES.

START-OF-SELECTION . 
CALL SCREEN '0100'.
...

Hope this helps

*--Serdar

6 REPLIES 6

ssimsekler
Active Contributor
0 Kudos

Hi Huseyin

What OK_CODE can contain is the function code that you assign to a button, not its name. So, check whether you have assigned any function code to the buttons.

You can assign a function code to a button at Screen Painter. When you double-click the button element at the middle of attributes side-screen you can see the field to enter the function code.

By the way, you'd better restructuring your main program as:

PROGRAM  zproject.

DATA: save_code TYPE sy-ucomm,
      ok_code   TYPE sy-ucomm.

INCLUDE ZPAIMODULES.

START-OF-SELECTION . 
CALL SCREEN '0100'.
...

Hope this helps

*--Serdar

0 Kudos

Hi Serdar,

As you had said I wrote some key values that help me to learn which button is pressed into the function code tab. So, I solved problem.

Tesekkurler Serdar.

0 Kudos

Hi,

Good to know that the problem has been resolved. If you find it appropriate, please mark the thread as answered.

Regards

Message was edited by: Shehryar Khan

0 Kudos

Hi Huseyin

As Shehryar stated, you should close the thread either by assigning a 10 points or checking related checkbox at one of your reply post edit screen.

By the way, I recall your name? Are you a graduate of METU EE?

*--Serdar

0 Kudos

Hi,

I checked the related checbox. Because of I am new on this form,first I did not see such an application. Excuse..

Serdar, Now, I am at Dokuz Eylul University, Computer Engineering department, Class 4. I am deal with ABAP at a company that I am training at. I don't have any relation with METU EE. But, it is nice that there is an ABAP well-formed Turkish person at this form.

0 Kudos

Hey Huseyin,

The thread's still not closed... We do understand you are new to the forum Please close the thread by awarding Serdar 10 points (Problem Solved) radio button. This would not only close the thread, it would also award Serdar his rightfully deserved points.

Also, its really gr8 to have people like Serdar, Poornanand, Subramanian, Shehryar, and the likes to help us with our petty issues Thanks guys!

Regards,

Madhur