cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically set language of Smartform output

Former Member
0 Kudos

Hi,

I am first time working on smartforms after training which was held an year back. I have to add the below logic in the smartform.

Can you please help me, where I have to add this logic in an smartform exactly?

The Form’s basic language should be determined along the lines of the following rule:

For Priority (QMEL-PRIOK) = ‘05’ only:

a)    Find the country location (T001W-LAND1) for the plant (QMEL-MAWERK). Then get the country location’s language (T005-SPRAS).

b)    Find the country location (LFA1-LAND1) for the vendor (QMEL- LIFNUM). Then get the country location’s language (T005-SPRAS).

c)    Compare both languages. If the languages are identical, then set the form’s language to that language code. If not, then set the language code as ‘EN’ (English).

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Control_Parameters-Langu is selected from the tables.

 

FORM get_control_parameters CHANGING fp_control_parameters TYPE ssfctrlop
                                     fp_output_options TYPE ssfcompop.

  CONSTANTS lc_printer TYPE char7 VALUE 'PRINTER'.
  DATA wl_t390 TYPE t390_u.
  IF g_userexit IS INITIAL.
* wworkpaper contains SMARTFORMS output options
    MOVE : wa_workpaper-tddest TO fp_output_options-tddest,
           wa_workpaper-tdcopies TO fp_output_options-tdcopies,
           wa_workpaper-tdnewid TO fp_output_options-tdnewid,
           wa_workpaper-tdimmed TO fp_output_options-tdimmed,
           wa_workpaper-tddelete TO fp_output_options-tddelete,
           wa_workpaper-tdcover TO fp_output_options-tdcover,
           wa_workpaper-tdcovtitle TO fp_output_options-tdcovtitle,
           wa_workpaper-tdreceiver TO fp_output_options-tdreceiver,
           wa_workpaper-tdarmod TO fp_output_options-tdarmod,
           wa_workpaper-tdtelenum TO fp_output_options-tdtelenum,
           wa_workpaper-tdtelenum TO fp_output_options-tdtelenum.

* Printing language from shop paper
    MOVE : wa_workpaper-print_lang TO fp_control_parameters-langu.

* SMARTFORMS control parameters
    fp_control_parameters-no_dialog = c_set.
    fp_control_parameters-device = lc_printer.
    IF sy-ucomm = c_preview.
      fp_control_parameters-preview = c_set.
    ELSE.
      fp_control_parameters-getotf = c_set.
    ENDIF.
  ELSE.
    SELECT SINGLE * FROM t390_u
                    INTO wl_t390
                    WHERE pm_appl EQ 'N'
                    AND workpaper EQ 'ZSUP'.
    IF sy-subrc IS INITIAL.
      MOVE : wl_t390-tddest TO fp_output_options-tddest,
             wl_t390-tdcopies TO fp_output_options-tdcopies,
             wl_t390-tdnewid TO fp_output_options-tdnewid,
             wl_t390-tdimmed TO fp_output_options-tdimmed,
             wl_t390-tddelete TO fp_output_options-tddelete,
             wl_t390-tdcover TO fp_output_options-tdcover,
             wl_t390-tdcovtitle TO fp_output_options-tdcovtitle,
             wl_t390-tdreceiver TO fp_output_options-tdreceiver,
             wl_t390-tdarmod TO fp_output_options-tdarmod,
             wl_t390-tdtelenum TO fp_output_options-tdtelenum,
             wl_t390-tdtelenum TO fp_output_options-tdtelenum.
* Printing language from shop paper
      MOVE : wl_t390-print_lang TO fp_control_parameters-langu.
    ENDIF.
* SMARTFORMS control parameters
    fp_control_parameters-no_dialog = c_set.
    fp_control_parameters-device = lc_printer.
    fp_control_parameters-getotf = c_set.
  ENDIF.
ENDFORM.                    "get_control_parameters

Former Member
0 Kudos

Hi,

I never did it by myself.

But did you check the CONTROL_PARAMETERS-LANGU field in the Form FM Interface? In the driver program apply the logic and put the language in CONTROL_PARAMETERS-LANGU field while calling the smartform FM. If it does not work try passing the language in the OUTPUT_OPTIONS-BCS_LANGU. You can try it first in debug mode and if it works you can apply the logic.

Let me know if it works or not.

Hope it helps.

Regards,

R