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

calling smartform by user command

Former Member
0 Likes
2,323

I created alv report and also smartform now i need to call that smartform by alv report . When user mark checkbox for any doucument number and then execute in the alv output . it should call the smartform for that same document number . but my issue is that when i am selecting and then trying to execute nothing is happening . i think it is not calling smartform.

FORM USER_COMMAND USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
CASE r_ucomm.
data: name1 type lfa1-NAME1 ,
wrbtr type bseg-WRBTR,
h_budat type bseg-H_BUDAT.

WHEN '&IC1'.
IF rs_selfield-fieldname = 'Belnr'.
READ TABLE GI_final ASSIGNING <GWA_FINAL> INDEX rs_selfield-tabindex.
<GWA_FINAL>-CK = 'X'.
MODIFY table GI_FINAL FROM <GWA_FINAL> TRANSPORTING CK .
RS_SELFIELD-REFRESH = 'X'.
IF GI_FINAL IS INITIAL.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZTEST_SB_SMARTFORM'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

IF FM_NAME IS NOT INITIAL.

CONTROL_PARAMETERS-preview = 'X'.
CONTROL_PARAMETERS-no_dialog = 'X'.
OUTPUT_OPTIONS-TDDEST = 'LP01'.

CALL FUNCTION FM_NAME "'/1BCDWB/SF00000009'
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = CONTROL_PARAMETERS
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = OUTPUT_OPTIONS
USER_SETTINGS = 'X'
name1 = NAME1
h_budat = H_BUDAT
wrbtr = WRBTR
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

ENDIF.

ENDIF.

*
ENDIF.

ENDCASE.

ENDFORM.

8 REPLIES 8
Read only

FredericGirod
Active Contributor
0 Likes
2,137

did you try to debut it to check, itf your FM have been called ?

Read only

Former Member
0 Likes
2,137

May be check with your code line "CALL FUNCTION FM_NAME "'/1BCDWB/SF00000009'" is correctly working or not.

Read only

0 Likes
2,137

call function fm_name

..

user_settings = 'X'

..

first, check your user_settings/spool-settings with TC su01d tab Defaults or menu: System-User Profile-Own Data-Defaults

Read only

0 Likes
2,137

User setting is fine i checked

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,137

Did you just handled the &IC1 function code for detail display/double click ?

You should also handle the function code associated to your execute icon, loop in the internal table for selected records (select field not initial) and call the martforms FM in the loop. When no record currently selected, but the cursor is on a valid line, rs_selfield-tabindex not initial, consider execution of the smartforms for this line else raise an error 'no line selected'.

  • Also check your layout, seems you have two select fields displayed (did you fill IS_LAYOUT-BOX_FIELDNAME =' CK')
  • If you don't change the form parameters any longer, replace the generated FM name with the variable returned by SSF_FUNCTION_MODULE_NAME.
  • Use classes for new ALV development (cl_salv_table, cl_gui_alv_grid) and not obsolete FM
Read only

Former Member
0 Likes
2,137

CALL FUNCTION FM_NAME "'/1BCDWB/SF00000009' this is working fine in smartform tcode but not calling in alv report

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,137

Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).

Example:

FORM USER_COMMAND 
USING
r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

CASE r_ucomm.

data: name1 type lfa1-NAME1 ,
wrbtr type bseg-WRBTR,
h_budat type bseg-H_BUDAT.
WHEN '&IC1'. ....

(PS: don't put code between CASE and the first WHEN)

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,137

Add a breakpoint at the beginning of USER_COMMAND and tell us if it's called. If yes, then debug step by step and tell us what happens...