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

Checkbox in Module Pool.

Former Member
11,383

Hi all,

This is a very easy question for most of you here. But I cant figure it out by myself.

What I need to do is a checkbox in a module pool.

When checkbox is tick, it will perform pop up message.

I am not sure where the checking should take it place.

Please help. Thanks a lot.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,390

Hi

check this program,

Validation in PAI....

PROGRAM demo_dynpro_check_radio .

DATA: radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,

field1(10) TYPE c, field2(10) TYPE c, field3(10) TYPE c,

box TYPE c.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

CALL SCREEN 100.

MODULE user_command_0100 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'RADIO'.

IF radio1 = 'X'.

field1 = 'Selected!'.

CLEAR: field2, field3.

ELSEIF radio2 = 'X'.

field2 = 'Selected!'.

CLEAR: field1, field3.

ELSEIF radio3 = 'X'.

field3 = 'Selected!'.

CLEAR: field1, field2.

ENDIF.

WHEN 'CANCEL'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE.

This is same program,which you can find in tcode ABAPDOCU, processing-->screens-->checkboxes and radiobuttons.

Check this link

http://www.sapmaterial.com/files/handaling_errors.pdf

a standard tcode TZ31 which will assist you for the check box

Mohinder

Edited by: Mohinder Singh Chauhan on Aug 4, 2008 5:17 AM

10 REPLIES 10
Read only

Former Member
0 Likes
5,390

Check box you can find it from Screen painter , screen elements.

Once you place the checkbox to the layout screen, double click on that , a pop with all the attributes related to checkbox appears. There you can enter Function code.

This function code will be useful when rising the message.

when ever you check it, this FUnction will be tirggered. then in PAI you catch the Ok_code and give the message appropriately.

Read only

Former Member
0 Likes
5,391

Hi

check this program,

Validation in PAI....

PROGRAM demo_dynpro_check_radio .

DATA: radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,

field1(10) TYPE c, field2(10) TYPE c, field3(10) TYPE c,

box TYPE c.

DATA: ok_code TYPE sy-ucomm,

save_ok TYPE sy-ucomm.

CALL SCREEN 100.

MODULE user_command_0100 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'RADIO'.

IF radio1 = 'X'.

field1 = 'Selected!'.

CLEAR: field2, field3.

ELSEIF radio2 = 'X'.

field2 = 'Selected!'.

CLEAR: field1, field3.

ELSEIF radio3 = 'X'.

field3 = 'Selected!'.

CLEAR: field1, field2.

ENDIF.

WHEN 'CANCEL'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE.

This is same program,which you can find in tcode ABAPDOCU, processing-->screens-->checkboxes and radiobuttons.

Check this link

http://www.sapmaterial.com/files/handaling_errors.pdf

a standard tcode TZ31 which will assist you for the check box

Mohinder

Edited by: Mohinder Singh Chauhan on Aug 4, 2008 5:17 AM

Read only

0 Likes
5,390

Hi,

Please see my code. I do not know which part goes wrong and there is nothing happen when I tick on the checkbox.

Please advice.


PROGRAM demo_dynpro_check_radio .

DATA: radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,
      checkbox1(1) TYPE c, checkbox2(1) TYPE c, checkbox3(1) TYPE c,
      field1(10) TYPE c, field2(10) TYPE c, field3(10) TYPE c,
      box TYPE c.

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

CALL SCREEN 0100.

MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
  WHEN 'RADIO'.
    IF radio1 = 'X'.
      field1 = 'Selected!'.
      CLEAR: field2, field3.
    ELSEIF radio2 = 'X'.
      field2 = 'Selected!'.
      CLEAR: field1, field3.
    ELSEIF radio3 = 'X'.
      field3 = 'Selected!'.
      CLEAR: field1, field2.
    ENDIF.

  WHEN 'CHECKBOX'.
    IF checkbox1 = 'X'.
      field1 = 'Selected!'.
      CLEAR: field2, field3.
    ELSEIF checkbox2 = 'X'.
      field2 = 'Selected!'.
      CLEAR: field1, field3.
    ELSEIF checkbox3 = 'X'.
      field3 = 'Selected!'.
      CLEAR: field1, field2.
    ENDIF.

  WHEN 'CANCEL'.
    LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.

Read only

0 Likes
5,390
WHEN 'CHECKBOX'.
    IF checkbox1 = 'X'.
      field1 = 'Selected!'.
      message 'check1 selected' type 'I'.
      CLEAR: field2, field3.
    ELSEIF checkbox2 = 'X'.
      field2 = 'Selected!'.
      message 'check2' selected' type 'I'.
      CLEAR: field1, field3.
    ELSEIF checkbox3 = 'X'.
      field3 = 'Selected!'.
       message 'check3' selected' type 'I'.
      CLEAR: field1, field2.
    ENDIF.

in the above code if you want some messae then you have to use message

Read only

0 Likes
5,390

Hi,

You dont get the function code for the checkbox... so you use IF condition... like IF Checkbox1 = 'X' ..... ENDIF.

Specify the condition in PAI module... so after the screen has appeared and if you check the checkbox and execute the program then it will check the condition in PAI module...

In your program Checkbox does not return SY-UCOMM value ie Function code.. if you want to cross check you can do it in Debug mode.

Hope this would help you.

Good luck,

Narin

Read only

0 Likes
5,390

Hi all,

Thanks for the answers.

Finally I know why the CHECKBOX was not working in my Module pool. It is because I didnt set the CHECKBOX in the Function code for pushbutton.

Thanks all.

Read only

Former Member
0 Likes
5,390

hi,

You can code like this in your PAI.

if check_box1 = 'X'.

< here call function 'POPUP_TO_CONFIRM' >

endif.

Read only

Former Member
0 Likes
5,390

Hi Wong,

once go through this code.

create four checkboxes in module pool program. name the first checkbox as CBOX1,second as CBOX2, third as CBOX3, fourth as LEAVE.

keep the FCT code as common for the first second and third checkboxs i.e, CBOX

for the fourth one, the FCT code name is 'LEAVE'.

DATA: CBOX1 TYPE C,

CBOX2 TYPE C,

CBOX3 TYPE C,

LEAVE TYPE C,

OK_CODE TYPE SY-UCOMM.

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module USER_COMMAND_0100 input.

CASE OK_CODE.

WHEN 'CBOX'.

IF CBOX1 = 'X'.

CLEAR: CBOX2, CBOX3.

MESSAGE 'FIRST BOX IS SELECTED ' TYPE 'I'.

ELSEIF CBOX2 = 'X'.

CLEAR: CBOX3, CBOX1.

MESSAGE 'SECOND BOX IS SELECTED ' TYPE 'I'.

ELSEIF CBOX3 = 'X'.

CLEAR: CBOX1, CBOX2.

MESSAGE 'THIRD BOX IS SELECTED ' TYPE 'I'.

ENDIF.

WHEN 'LEAVE'.

LEAVE PROGRAM.

ENDCASE.

endmodule. " USER_COMMAND_0100 INPUT

Regards,

S.Gangireddy.

Read only

Former Member
0 Likes
5,390

Hi myahsam,

In ur PAI u need to write :

if check_box = 'X'.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

titlebar = ' check-box Pop-Up '

  • DIAGNOSE_OBJECT = ' '

text_question = 'Do you like to save the changes??'

text_button_1 = 'YES'(001)

  • ICON_BUTTON_1 = ' '

text_button_2 = 'NO'(002)

  • ICON_BUTTON_2 = ' '

  • DEFAULT_BUTTON = '1'

  • DISPLAY_CANCEL_BUTTON = 'X'

  • USERDEFINED_F1_HELP = ' '

  • START_COLUMN = 25

  • START_ROW = 6

  • POPUP_TYPE =

  • IV_QUICKINFO_BUTTON_1 = ' '

  • IV_QUICKINFO_BUTTON_2 = ' '

IMPORTING

answer = answer

  • TABLES

  • PARAMETER =

  • EXCEPTIONS

  • TEXT_NOT_FOUND = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

ENDIF.

endif.

In TOP declare

data : answer type c.

i hope this will help u.

Regards

saurabh asthana

Read only

Former Member
0 Likes
5,390

Do the following steps.

1) Place a check box in layout editor for the screen

2)Double click on it to display the 'attributes' dialog box

3) Give a funciton code (Fct Code) and the funciton type (Fct Type) as ''E'.

4) In the PAI module of the screen , add 'AT EXIT-COMMAND'

For eg :

PROCESS BEFORE OUTPUT.
       MODULE STATUS_9000.
     PROCESS AFTER INPUT.
     MODULE USER_COMMAND_9000 AT EXIT-COMMAND.

5)In the module do the following coding

data : ok_code type sy-ucomm,
         check type c.
      if ok_code = the Fct Code of check box.
     if Check <> 'X'.
          " Do coding for the pop up"
      End if.
    Endif.

ok_code is also declared in the element list of the screen .

check is the name of the check box defined in the screen layout

Hope this helps