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

Function code

Former Member
0 Likes
1,793

can anybody tell me What is a function code? and what is it used for?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
768

HI,

see when u developed one screen it may contains some buttons that is by clicking on it it performs some action then in the program u know that user has pressed button with the function code assigned to it

see suppose u r screen accepts two nubers and it has two buttons say additon function code is say add

and subtract say function code is sub then if user presse additon then sy-ucomm field will automatically gets this ADD and sub whne perforem subtraction

this is the function code

i think i am clear to u please reward if it is useful...

plzz dont forget to reward if it is useful....

5 REPLIES 5
Read only

Former Member
0 Likes
769

HI,

see when u developed one screen it may contains some buttons that is by clicking on it it performs some action then in the program u know that user has pressed button with the function code assigned to it

see suppose u r screen accepts two nubers and it has two buttons say additon function code is say add

and subtract say function code is sub then if user presse additon then sy-ucomm field will automatically gets this ADD and sub whne perforem subtraction

this is the function code

i think i am clear to u please reward if it is useful...

plzz dont forget to reward if it is useful....

Read only

paruchuri_nagesh
Active Contributor
0 Likes
768

using Function code system can identify user interaction to perform the action

usually function code stores in SY-UCOMM system variable

Regards

Nagesh.Paruchuri

Read only

Former Member
0 Likes
768

friend for every button there are two things defined

1. text over that button

2. function code

function code is that code which gets copied into sy-ucomm whenever u click that button .

it is used in event AT USER COMMAND. when u want certain action on button click

e.g. case sy-ucomm.

when 'BAK'

<code>

when 'ENTER'

<code>

here BAK & ENTER are function codes of two buttons

plz reward if useful

keep rockin

vivek

Read only

Former Member
0 Likes
768

Function code is attached with any GUI items( like push button or radio button or any menu item) so that we can identify those GUI item events ( such click in the push button) in our program and process accordingly.

Ex:

PROGRAM demo_dynpro_push_button .

DATA: ok_code TYPE sy-ucomm,
      save_ok LIKE ok_code,
      output(8) TYPE c.

CALL SCREEN 100.

MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'BUTTON_EXIT'.
      LEAVE PROGRAM.
    WHEN 'BUTTON_1'.
      output = 'Button 1'(001).
    WHEN 'BUTTON_2'.
      output = 'Button 2'(002).
    WHEN 'BUTTON_3'.
      output = 'Button 3'(003).
    WHEN 'BUTTON_4'.
      output = 'Button 4'(004).
    WHEN OTHERS.
      output = save_ok.
  ENDCASE.
ENDMODULE.

here various ok-codes 'BUTTON_EXIT' , 'BUTTON_1' ect are attached with the push buttons.

Read only

former_member156446
Active Contributor
0 Likes
768

Context menu can be used in relation with the various screen elements

like I/O fields, subscreen,group box,table control but not with push buttons,radio,check buttons.

It can be used to show related options when the user right clicks on the screen elements. It is a type of status. SAP automatically creates a default context menu for dialog statuses consisting of all the function codes available

http://sap.niraj.tripod.com/id25.html