2010 Aug 11 2:52 AM
hi SDN,
i hoped i posted in the correct section. how do i create a pushbutton in CMOD? i have a created an include file and when i created a push button using: SELECTION-SCREEN PUSHBUTTON 1(10) Execute USER-COMMAND EXEC it says "Within FORM routines and function modules, the SELECTION-SCREEN statement is not allowed".
i tried to create another include file in se38 and called it in the include in CMOD and put the pushbutton there but the error message is still the same. can anyone help me?
also, how do i put the push button in a specific screen? for example in tcode SUCOMP, i want to put the push button at the screen after entering the company name.
i have been slaving for a week over the internet and the forums to find the answers but so far i havent found it yet. can anyone please help me? thank you and any help will be appreciated!
2010 Aug 11 6:42 AM
Hi,
Find a screen exit in tcode, w/o screen exit you can not put a button to screen.
regards,
hi SDN,
i hoped i posted in the correct section. how do i create a pushbutton in CMOD? i have a created an include file and when i created a push button using: SELECTION-SCREEN PUSHBUTTON 1(10) Execute USER-COMMAND EXEC it says "Within FORM routines and function modules, the SELECTION-SCREEN statement is not allowed".
i tried to create another include file in se38 and called it in the include in CMOD and put the pushbutton there but the error message is still the same. can anyone help me?
also, how do i put the push button in a specific screen? for example in tcode SUCOMP, i want to put the push button at the screen after entering the company name.
i have been slaving for a week over the internet and the forums to find the answers but so far i havent found it yet. can anyone please help me? thank you and any help will be appreciated!
2010 Aug 11 6:42 AM
Hi,
Find a screen exit in tcode, w/o screen exit you can not put a button to screen.
regards,
2010 Aug 11 8:36 AM
hi thien,
thanks for the reply.
there is no screen exit in tcode sucomp only function exits but in MIRO tcode, there is. the screen exit is named:
SAPLMR1M 0400 CUSTSCR1 SAPLXM08 0400. i double clicked it and found PBO and PAI blocks. how do i create the push button and how do i specify which screen it would appear?
2010 Aug 11 8:46 AM
Hi jebster,
Switch into layout mode, you can create your push button there.
regards,
2010 Aug 11 9:08 AM
hi thien,
i have now created the push button but i cant seem to find where i could put the code for the button so that a web browser will open if it is clicked. also, do you happen to know in what screen the button will appear or if i could specify where and when it would appear? thanks again for you reply! you have been very helpful!
regards
Edited by: jebster8 on Aug 11, 2010 11:00 AM
2010 Aug 11 10:17 AM
Hi Jebster,
Thank you.
Once you created a push button, on attribute windows of it (by double-click on push button) set Function code at FctCode input field. Then, code your action in PAI module (MODULE user_command...).
Don't forget to active screen, you enhancement project, ... everything.
regards,
P/S: if you want more information about screen exit, you can refer to document BC425 Enhancements and Modifications
2010 Aug 12 3:28 AM
hi thien,
thank you so much for your reply.
i did what you said but i still cant launch the browser. im going to explain what i did cause i think im doing something wrong.
1. i went to CMOD and created ZCMOD
2. i entered SZRS0003 as an enhancement and went to Components
3. i double clicked EXIT_SAPLSZAR_001and double clicked and created the Include file ZXSZARU01
4. i wrote the code CALL SCREEN 100 and double clicked 100 which directed me to the screen painter.
5. i clicked on Layout. Generated the pushbutton: name = "BTN", fctcode = "BTN".
6. i activated the pushbutton and double clicked the MODULE under PAI
7. here is the code that i wrote:
DATA: OK_CODE LIKE SY-UCOMM.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'BTN'.
call function 'WS_EXECUTE'
exporting
program = 'iexplore'
commandline = 'http://www.sapfans.com'
inform = ' '
exceptions
prog_not_found.
WHEN OTHERS.
MESSAGE I398(00) WITH 'hello''.
ENDCASE.8. i activated everything and then finally activated the project
10. i entered "gb" in country and "uk" in timezone and pressed enter.
11. i see the button that i created but when i press it, nothing happens.
is there something wrong with what i did? i will be waiting for your reply. thank you so much for your help. i greatly appreciate it.
regards.
Edited by: jebster8 on Aug 12, 2010 4:58 AM
Edited by: jebster8 on Aug 12, 2010 4:59 AM
2010 Aug 12 4:09 AM
Hi Jebster,
Problem is you did not get right user-command. Use sy-ucomm instead of ok_code. In PAI, you must active module user_command_0100 input. Please read below for your reference:
CASE sy-ucomm.
WHEN 'FC_CALL'. "your function code
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = 'iexplore'
parameter = 'http://www.sapfans.com'
operation = 'OPEN'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDCASE.
One more thing, I think you should define a new GUI status for screen 100.
hope it help you,
regards,
Edited by: Thien M. Pham on Aug 12, 2010 10:10 AM
Edited by: Thien M. Pham on Aug 12, 2010 10:13 AM
2010 Aug 12 4:22 AM
hi thien
thank you for your reply! you have been most helpful! ill try out your suggestion. i wonder why our posts got messed up. i'll let you know when i fixed my problem. thanks so much and hopefully you will watch my post. thanks again!
regards
2010 Aug 12 4:48 AM
hi thien,
i have tried the code you gave me. the code works but i couldnt get it to work with the push button. i activated the module(i forgot to mention it in my last post). after i enter the country and time zone in SUCOMP, i see the button but nothing happens when i click it. how do u define a new GUI status for screen 100?
sorry for the trouble. thank you for helping me out.
regards
2010 Aug 12 5:20 AM
Hi Jebster,
It's good for me that you tell code works But did you get right FctCode for your button by your FctCode.
P/s: you can contact me directly by instant message, you can get my ID in my business card.
regards,
2010 Aug 12 6:10 AM
hi thien,
thanks again for your reply.
my fctcode is the correct. my fctcode is 'LINK' and i used that in my case block:
CASE SY-UCOMM.
WHEN 'LINK'.
(the code you gave here)
have you tried doing what i did? maybe there is something wrong with what i did prior to coding. i sent you an email in your gmail. thanks!
regards.
2010 Aug 12 4:25 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |