cancel
Showing results for 
Search instead for 
Did you mean: 

using two forms for a single print program

Former Member
0 Kudos

hi everybody, i am using two forms for a single print program with the help of rdio buttons. but in teh FM ssf_func_mod_name...hw can i dclare two form names and two fm modules at a time...cld any one help me regarding this...thnx in advance...

santosh.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi if u r using the radio buttons then call the ssf_func_mod_name only once using by passing the form name in a variable.

eg..

if r1 = 'X'.
       l_fmname = 'zsmartfom1'.
     elseif.
      l_fmname = 'zsmartfom2'.
      endif.

the call the SSF* FM

while calling the smartform u can only one if u r passing same Interface other wise u have use the same

if r1 = 'X'.
 call v_from1
  xxxxx
  xxxx
elseif r2 = 'X'.
 call v_from1.
xxxxxxx
endif.

Former Member
0 Kudos

hi naresh....i didnt understand what u said properly. cld u pls xplain somewhat clear once again...thnk u...

Former Member
0 Kudos

we call the SSF* FM to get the active functionmodule name of the Smartforms.

wht i am telling u is

data:  V_form type TDSFNAME
if Radiobutto1 = 'X'.
V_form = 'form1'.
elseif Radiobutto2 = 'X'.
V_form = 'form2'
endif. 
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  EXPORTING
    FORMNAME           = V_form
  IMPORTING
    FM_NAME            = V_FORM_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.

now u will get the active FM name of the smartform
if if Radiobutto1 = 'X'.
CALL FUNCTION V_FORM_NAME
  EXPORTING
    CONTROL_PARAMETERS = W_CTRLOP
    OUTPUT_OPTIONS     = W_COMPOP
    USER_SETTINGS      = 'X'
  IMPORTING
    JOB_OUTPUT_INFO    = W_RETURN
  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.

elseif Radiobutto2 = 'X'.

CALL FUNCTION V_FORM_NAME
  EXPORTING
    CONTROL_PARAMETERS = W_CTRLOP
    OUTPUT_OPTIONS     = W_COMPOP
    USER_SETTINGS      = 'X'
  IMPORTING
    JOB_OUTPUT_INFO    = W_RETURN
  TABLES
    IT_MARA                  = IT_tab_MARA
  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.

endif.

if bothe Forms have the sam function moudule interface and same impor tand export and table paramters the u can call the form only once other wise u have to as above

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

i am sending u the code which i have written in my print program 4 same situation.

we simply declare a table 'TNAPR'.

then on some condition in TNAPR-SFORM initialise different smartforms and pass this in function module .

DATA : inv_code LIKE vbak-vbeln.

BILL_DOC_EXP-SPRAS = 'E'.

BILL_DOC_EXP-VBELN = nast-objky(10).

inv_code = nast-objky(10).

SELECT SINGLE WERKS INTO L_WERKS FROM J_1IEXCHDR WHERE RDOC =

inv_code.

select * from vbrp into table i_vbrp where vbeln = inv_code.

      • lf_formname = tnapr-sform.

  • IF L_WERKS = '2000'.

tnapr-sform = 'ZSD_FACTORY_INVOICE'.

  • ELSE.

  • tnapr-sform = 'ZSD_FACTORY_EXCISE_INVOICE_PAT'.

  • ENDIF.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = tnapr-sform

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = L_FMNAME

  • 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.

revert points if useful.

Regards,'

santosh.