cancel
Showing results for 
Search instead for 
Did you mean: 

print program for smartforms

Former Member
0 Kudos

can any one give me how to write code for declaring the variable finction module in print program which can take the smartforms function module automat

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

help full

Former Member
0 Kudos

Hi venkat

try this.u need to call in ur report program

DATA: lv_form TYPE tdsfname VALUE 'ZSMART_DC_INVOIC', " ur form name

lv_fname TYPE rs38l_fnam .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = lv_form

VARIANT = ' '

DIRECT_CALL = ' '

IMPORTING

fm_name = lv_fname

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3

.

IF sy-subrc 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION lv_fname

EXPORTING

wa_header = wa_header

TABLES

it_item = it_item

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Former Member
0 Kudos

Hi

What Usha gave is one way of doing it. The other way is If you are configuring it in NACE..i.e the smartform and the print program then:

IF NOT tnapr-sform IS INITIAL.
    lf_formname = tnapr-sform. 
*  ELSE.
*    MESSAGE e001(smart/ssfcomposer).
  ENDIF.

* Determine smartform function module for purchase document
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = lf_formname
    IMPORTING
      fm_name            = lf_fm_name
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
  IF sy-subrc <> 0.
*  error handling
    ent_retco = sy-subrc.
    IF sy-subrc = 1.
      MESSAGE e001(smart/ssfcomposer).
    ENDIF.
    IF sy-subrc = 2.
      MESSAGE e002(smart/ssfcomposer) WITH tnapr-sform.
    ENDIF.
 



*>>>>> Change of Parameters <<<<<<<<<<<<<<<<<<<<<<<

CALL FUNCTION lf_fm_name
  EXPORTING
   ARCHIVE_INDEX               = toa_dara
*   ARCHIVE_INDEX_TAB          =
   ARCHIVE_PARAMETERS          = arc_params
   CONTROL_PARAMETERS          = ls_control_param
*   MAIL_APPL_OBJ              =
   MAIL_RECIPIENT              = ls_recipient
   MAIL_SENDER                 = ls_sender
   OUTPUT_OPTIONS              = ls_composer_param
   USER_SETTINGS               = 'X'
    IS_EKKO                    = l_doc-xekko
    IS_PEKKO                   = l_doc-xpekko
   IS_NAST                     = l_nast
   IV_FROM_MEM                 = l_from_memory
    IV_DRUVO                   = iv_druvo
    IV_XFZ                     = iv_xfz
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
  TABLES
    IT_EKPO                    = l_doc-xekpo[]
    IT_EKPA                    = l_doc-xekpa[]
    IT_PEKPO                   = l_doc-xpekpo[]
    IT_EKET                    = l_doc-xeket[]
    IT_TKOMV                   = l_doc-xtkomv[]
    IT_EKKN                    = l_doc-xekkn[]
    IT_EKEK                    = l_doc-xekek[]
    IT_KOMK                    = l_xkomk[]
 EXCEPTIONS
   FORMATTING_ERROR           = 1
   INTERNAL_ERROR             = 2
   SEND_ERROR                 = 3
   USER_CANCELED              = 4
   OTHERS                     = 5
          .
*IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
  IF sy-subrc <> 0.
    ent_retco = sy-subrc.
    PERFORM protocol_update_i.

* get SmartForm protocoll and store it in the NAST protocoll
    PERFORM add_smfrm_prot.
  ENDIF.

Regards,

Vishwa.

Former Member
0 Kudos

Data: gv_fu_name TYPE rs38l_fnam.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZTEST_FORM' "==> Smartform name

IMPORTING

fm_name = gv_fu_name

EXCEPTIONS no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

Call function gv_fu_name.

Former Member
0 Kudos

Hi,

Try like this.

DATA: FORMNAME TYPE TDSFNAME,

FM_NAME TYPE RS38L_FNAM.

FORMNAME = 'Z_TEST'. ( u r smartform name)

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = FORMNAME

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

  • EXCEPTIONS

  • NO_FORM = 1

  • NO_FUNCTION_MODULE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION FM_NAME(insted of FM number place FM_NAME)

the FM number is genarated in smartforms.