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

Simple Button Example

Former Member
0 Likes
1,705

Hello Everyone!

I have some stupid beginner questions... and it would be great i someone could help me!

For now i learned how to make some buttons on a Toolbar via cl_gui_custom_container & cl_gui_toolbar.

This one is for now cristal clear!

But stupid thing is that I'm not able to make my simple program with few pushbuttons work!!!

First i've docked some PushButtons trough the ScreenPainter and assigned them Function Codes, TextDisplay & Name. and then i'm not able to get any actions of that pushbuttons when i executes the program. When i click tem they simply do nothing!!!

i checked and my screen is activated tough...

stupid thing is when i Test my screen trough Sscreen painter one of buttons, explicitly the EXIT button do work and is exiting my program, but the other one does nothng, just like they bth do when i execute my program.

Please Can anyone help me with this one???

if u have some, please do provide me a sample code but not the simpliest one, because i do write my programs with classes, modules and etc...

Thank you all in advance!

kind regards, mya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,626

Hi ,

in your PAI, the name of the <b>fcode</b> for the particular push button should be used .

Regards,

Kunal.

11 REPLIES 11
Read only

sreekanthgo
Contributor
0 Likes
1,626

Hi mya,

In PAI of your screen write something like this...


  CASE SY-UCOMM.
    WHEN 'DISP'.
*-- Write some logic
    WHEN 'CHNG'.
*-- Write some logic
    WHEN 'BACK' OR 'CANC'.
      LEAVE PROGRAM.
  ENDCASE.

Here 'DISP','CHNG','BACK','CANC' are the function codes of my buttons

Thanks,

Sreekanth

Read only

Former Member
0 Likes
1,627

Hi ,

in your PAI, the name of the <b>fcode</b> for the particular push button should be used .

Regards,

Kunal.

Read only

0 Likes
1,626

Hi i've done this in:

MODULE user_command_0100 INPUT.

CASE ok_code.

WHEN 'EXIT'.

LEAVE TO SCREEN 0.

WHEN 'DIALOG'.

PERFORM show_dialog_box.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

is a simple button that, i put in ScreenPainter, aka dynpro button??? or for that kind of button i need extra things to do???

Thanks!

Read only

0 Likes
1,626

hi,

To do some action on the button click you need to write some code in the PAI(Process after input) of the screen. The code in PAI is executed once the user do some action, example a button click, selecting a radio button or checking a check box...

So in PAI, you can write the code and do various things on click of differed button with different function codes.

Also you need to capture the ok_code. So you need to define an element in element list : OK_CODE.

Case OK_CODE.

when 'FCODE1'

perform FUNC_BUTTON_1

when 'FCODE2'

perform FUNC_BUTTON_2

when 'FCODE3'

perform FUNC_BUTTON_3

endcase.

in this way you can write different functionalities for different buttons.

Regards,

Richa

Read only

0 Likes
1,626

Hi Maja,

Goto Screen List tab of the screen painter.

Have you declared the variable OK_CODE...?

Regards,

SP.

Read only

0 Likes
1,626

Hi Maja,

A small correction. Goto <b>Element list</b> of the screen painter. Declare a variable OK_CODE. This should work fine.

Regards,

SP.

Read only

0 Likes
1,626

Hi!

Sorry. Where is Element List in Screen Painter?

:(...

Read only

0 Likes
1,626

The Thing With the Element List solved the problem!!!!

Thank you alll!!!

Read only

0 Likes
1,626

go to se51.

Enter Program name and screen number.

choose the radio-button for Element list.

and press change/display.

Regards,

Ravi

Read only

0 Likes
1,626

Hi Maja,

In the main program, where you write CALL SCREEN 200.

Double clicking on 200 will lead you to screen painter window.There are 3 tabs

1.Attributes

2.Element List

3.Flow Logic

In the element list, corresponding to ok code, you have to declare a variable (OK_CODE in your case).

Activate it and come back.

Activate the main program and execute.

This should work.

Regards,

SP.

Read only

0 Likes
1,626

hi

Its simple.

Goto SE80 and enter your program name or se51 and enter your screen name and no.

on right side you will get 3 tab strips.

Attribute /element list and flow logic.

In the tabstrip element list you need an element with the name OK_CODE

Regards,

Richa