09-09-2014 9:48 AM
Dear All,
Good day.
I need to generate a form by pressing a pushbutton in driver program. The form generates but no data shows except page no.
The smartform works fine without pushbutton.
Here is the piece of code used.
SELECTION-SCREEN: PUSHBUTTON (10) w_button USER-COMMAND but1.
AT SELECTION-SCREEN.
IF sscrfields-ucomm EQ 'BUT1'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
..............
ENDIF.
09-09-2014 9:53 AM
Are you getting data in at selection screen?
You need to write :
Start-of-Selection.
IF sscrfields-ucomm EQ 'BUT1'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
..............
ENDIF.
It should work.
09-09-2014 10:35 AM
Thanks Ranjana for ur reply. But it not works. Using at selection screen i'm getting the print preview screen but start-of-selection not works.
09-09-2014 10:37 AM
Please check in debug whether are you getting data in table or variable.
09-09-2014 10:47 AM
Dear Ranjana,
The smartform works fine if push button is not used. But i need to use it under pushbutton.
09-09-2014 12:19 PM
NB: The START-OF-SELECTION event will only be executed when UCOMM is 'ONLI' or 'PRIN'.
Small snippet to test :
REPORT zsample.
TYPE-POOLS: icon.
TABLES: sscrfields.
SELECTION-SCREEN PUSHBUTTON 10(4) w_button USER-COMMAND but1.
INITIALIZATION.
w_button = 'BUT1'.
AT SELECTION-SCREEN.
IF sscrfields-ucomm EQ 'BUT1'.
MESSAGE 'BUT1' TYPE 'I'.
ENDIF.
START-OF-SELECTION.
MESSAGE 'START' TYPE 'I'.
Regards,
Raymond
09-09-2014 10:56 AM
Hi,
just check the value of sy-ucomm in debugging and check where the control goes after press the
pushbutton.
Regards
Arun VS
09-09-2014 11:09 AM
Dear Arun,
I have checked the value of sy-ucomm and found ok. I also get print preview page and if press print preview button a form generates with a blank page. I guess it needs some thing to pass to smartform but dont know what.
09-09-2014 11:38 AM
Hi ABAP 2,
After check the sy-ucomm, if it has meet your function code then after enter into your if condition please check that smartforms function module export parameters or table have the value.
Regards,
John.
09-09-2014 11:51 AM
Actually when i press the button, the parameter value is not passing to smartform. What to do ?
09-09-2014 11:56 AM
Hi ABAP 2,
Please go through the below code which is said by Ranjan.
Are you getting data in at selection screen?
You need to write :
Start-of-Selection.
IF sscrfields-ucomm EQ 'BUT1'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
..............
ENDIF.
It should work.
At selection screen for Whenever you make the action on selection screen that time only it will work so use Start-of-selection instead of At selection screen.
Regards,
John.
09-09-2014 12:08 PM
Hi Abap 2.
Try this hope it helps,
TABLES sscrfields.
data flag(01) TYPE c.
SELECTION-SCREEN:
BEGIN OF SCREEN 500 AS WINDOW TITLE title,
PUSHBUTTON 2(10) but1 USER-COMMAND cli1,
PUSHBUTTON 12(30) but2 USER-COMMAND cli2
VISIBLE LENGTH 10,
END OF SCREEN 500.
AT SELECTION-SCREEN .
CASE sscrfields.
WHEN 'CLI1'.
flag = 'X'.
...
WHEN 'CLI2'.
...
ENDCASE.
START-OF-SELECTION.
title = 'Push button'.
but1 = 'Button 1'.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_information
text = 'Button 2'
info = 'My quick info'
IMPORTING
RESULT = but2
EXCEPTIONS
OTHERS = 0.
CALL SELECTION-SCREEN '0500' STARTING AT 10 10.
if flag is NOT INITIAL.
PERFORM print. " Smartforms
endif.
Regards,
Venkat.
09-09-2014 12:09 PM
09-09-2014 12:14 PM
Hi ABAP 2,
Can you please send me the driver program code ?
Regards,
John.
09-09-2014 12:26 PM
Did you define sscrfields with a TABLES statement ?
What did you code after this FM call, here this FM get the generated FM name, then you have to execute this returned FM too
AT SELECTION-SCREEN.
IF sscrfields-ucomm EQ 'BUT1'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'FORMNAME'
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
* then fill parameters and call the fm
CALL FUNCTION fm_name
EXPORTING
control_parameters = ls_control
output_options = ls_options...
* etc.
ENDIF.
Regards,
Raymond
09-09-2014 12:32 PM
Hi,
Here is my code.
INITIALIZATION.
w_button = ' ENTER '.
DATA flag TYPE c.
AT SELECTION-SCREEN .
CASE sscrfields.
WHEN 'FCODE'.
flag = 'X'.
ENDCASE.
*
IF flag IS NOT INITIAL.
PERFORM code.
ENDIF.
FORM code.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = p_form6
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
fm_name = f_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CALL FUNCTION f_name
TABLES
it_final = it_final.
09-09-2014 12:34 PM
start-os-selection.
IF flag IS NOT INITIAL.
PERFORM code.
ENDIF.
FORM code.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = p_form6
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
fm_name = f_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CALL FUNCTION f_name
TABLES
it_final = it_final.
09-09-2014 12:36 PM
09-10-2014 3:55 AM
Dear Raymond,
Sorry for the late reply. IT_FINAL is filled before calling the FM for smartform in se38.
Note - The program works fine if i not use pushbutton. But i have to use that pushbutton to generate the smartform.
I guess when i am pressing the pushbutton, the button not gets the input parameter values. For that reason i'm getting blank page only. Is there any event to handle the button ? I have not used GUI here. It is in a simple selection screen.
09-10-2014 5:10 AM
Hi Abap2,
I would recommend you to debug your smartform to check if data is being transferred or not.if you execute your smartfrom you will get /1BCDWB/SF00000036 put sapl before SF like this
/1BCDWB/SAPLSF00000036 and open the code in se38 and put a breakpoint where you are passing the data.
Hope it helps.
Thanks.
09-10-2014 6:07 AM
hi,
try to fill it_final in form code for smartform separately I think it will work
Regards.
Jaydeep
09-10-2014 5:52 AM
Hi,
Is the driver program run by itself or called from another program ?
Please look at program SF_EXAMPLE_01 .
It is an a stand alone executable program .
Regards.
09-10-2014 6:13 AM
Ensure the Data is filled in the form interface. The form seems to be triggered without Data.
09-10-2014 6:57 AM
Are you passing the data to the smartform which needs to be displayed ?
If yes, then is the data fetched before the call to smartfrom ?
PS:You need to fetch the data before the call to smartform and not in START-OF-SELECTION if you want to print using that button.
Get an answer to the questions above and you will get the solution.
Regards,
Ashish
09-10-2014 7:21 AM
Hi,
You can put all yur selection logic inside a subroutine then in AT SELECTION SCREEN event where your smartform is being called you first call the data selection subroutine then call the smartform.
Another way,for the push button you can call another screen and then there you call all your selection logic.
OR best way you can use the AT USER COMMAND event then call the smartform.
Regrads,
Supratik