Application Development 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: 

How to link between smartform and driver program using pushbutton ?

former_member308418
Participant
0 Kudos

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.

24 REPLIES 24

former_member249399
Active Participant
0 Kudos

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.

0 Kudos

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.

0 Kudos

Please check in debug whether are you getting data in table or variable.

0 Kudos

Dear Ranjana,

The smartform works fine if push button is not used. But i need to use it under pushbutton.

0 Kudos

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

venuarun
Active Participant
0 Kudos

Hi,

just check the value of sy-ucomm in debugging and check where the control goes after press the

pushbutton.

Regards

Arun VS

0 Kudos

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.

0 Kudos

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.

0 Kudos

Actually when i press the button, the parameter value is not passing to smartform. What to do ?

0 Kudos

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.



0 Kudos

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(10but1 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.

0 Kudos

Dear John,

Start-of-selection not works.

Thanks.

0 Kudos

Hi ABAP 2,

Can you please send me the driver program code ?

Regards,

John.

raymond_giuseppi
Active Contributor
0 Kudos

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

0 Kudos

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.

0 Kudos


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.

0 Kudos

Where is it_final filled ?

Regards,

Raymond

0 Kudos

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.

0 Kudos

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.

0 Kudos

hi,

try to fill it_final in form code for smartform separately  I think it will work

Regards.

Jaydeep

rosenberg_eitan
Active Contributor
0 Kudos

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.

satyabrata_sahoo3
Contributor
0 Kudos

Ensure the Data is filled in the form interface. The form seems to be triggered without Data.

former_member289261
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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