OUTPUT DEVICE SEND TO SMARTFORMS

Dear All,
              I have to send output device of smartforms from my driver program.
Waiting for reply.
Regards,
Shrikant.

Hi,
Please check this code.
DATA:  lx_ssfctrlop      TYPE ssfctrlop,
         lx_ssfcompop     TYPE ssfcompop.
lx_ssfcompop-tddest    = 'output device'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname                 = l_fname
         IMPORTING
           fm_name                  = l_fm_name
         EXCEPTIONS
           no_form                      = 1
           no_function_module   = 2
           OTHERS                      = 3
CALL FUNCTION l_fm_name
          EXPORTING
           output_options             = lx_ssfcompop
Thanks
Abhijit

Similar Messages

  • Output device in SPAD/Smartform

    Hi All,
    We have a ouput device created through SPAD transaction with a name of 14 characters.
    We want to pass the output device name to the Smartform. But the smartform has a parameter of ssfcompop-tdest of only 4 characters.
    We do not want to change the output device name from 14 characters to 4 characters.
    Is there any alternative to pass the Output device name to smartform without changing the name of output device.
    Thanks in advance,
    Best regards,
    Prashant

    Hi prashant,
    even you create 14 chars or 20 chars it doesn't matter. but we will pass the short name not the name which you created 14 chars. i guess you might gave <b>short name</b> for your printer in SPAD while creating check it, that you have to pass.
    Regards
    vijay

  • Output device tddest in smartforms

    Hi,
    I am using smartforms to convert the otf data to pdf. The coding is as follows:
    * Set the Parameters of smartform
      l_s_ssfctrlop-no_dialog   = 'X'.
      l_s_ssfctrlop-getotf      = 'X'.
      l_s_output_options-tdnoprint = 'X'.
    * call FM to get the name of the FM of smart for smart form
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = g_form_name
        IMPORTING
          fm_name            = l_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 l_fm_name
        EXPORTING
          control_parameters = l_s_ssfctrlop
          output_options     = l_s_output_options
          user_settings      = ' '
        IMPORTING
          job_output_info    = l_s_job_output_info
        TABLES
          g_t_datatab        = g_t_datatab
        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.
      REFRESH g_t_pdf_tab.
    *Convert to OTF Format
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
        IMPORTING
          bin_filesize          = l_byte_count
        TABLES
          otf                   = l_s_job_output_info-otfdata[]
          lines                 = g_t_pdf_tab
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          OTHERS                = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    I am not passing tddest (output device) to 'l_s_output_options' as I don't want to print it.
    I just want to convert the otf data obtained to pdf and use it for further processing.
    Will there be any problem if I don't assign any ouput device.
    Please note that in the system ouput device 'LOCL' is not maintained.
    Thanks,
    Soumya.

    Hi Valerie,
    I am using below code to get the printer name by default , even i want to skip that screen that asks for the printer name. But am unable to get this requirement. I have tried with various combinations but its not working. Please suggest.
    control-preview = 'X'.
    control-no_dialog = SPACE.
    output_options-tddest = 'LP01'.
      CALL FUNCTION lv_fmname
    EXPORTING
    output_options     = output_options
    contol             = control
      p_matnr            = p_matnr
      user_settings      = 'X'
        TABLES
      gt_stpo            = gt_stpo
      EXCEPTIONS
        formatting_error   = 1
        internal_error     = 2
         send_error         = 3
         user_cancelled     = 4
         OTHERS             = 5.
    Thanks & Regards
    Jatin

  • Output device issue in smartform

    Hi All,
    I have configured smartform and driver program throough nace and testing output . I am facing the problem of  alignment of  output which is changing  depening on Printer. i.e., for printer one the field KOMVD-KBETR(VAT) is prining properly .But if we give another printer or MAIL_PDF as output device then it is moving towards left and alignemnt is wront.
    Please let me know if any solution and max points will provided.
    Thanks,
    J.P
    Edited by: Prakash Jeevakala on Sep 14, 2009 2:00 PM

    When using SAPscript or SmartForms, HP (PCL based) printers in SAP will generate an extra 1/4 inch or so on the left margin.
    Design your form for the specific printer.  If multiple printer types will be used, design the form to fit regardless of the margin adjustment.

  • Output device option in smartform

    Hi,
    I am getting the below error in a program which calls a smartform.
    'Output device LOCL is not defined'.  As the output device LOCL is not maintained in the system through tcode SPAD, ia m getting this.
    My doubt is if i remove the option of giving output device, will it work.
    The coding is as follows:
    * Set the Parameters of smartform
      l_s_ssfctrlop-no_dialog   = 'X'.
      l_s_ssfctrlop-getotf      = 'X'.
      l_s_output_options-tddest = 'LOCL'.  --------> if I comment this line, will it work without any error as I don't want to print it.
      l_s_output_options-tdnoprint = 'X'.
    * call FM to get the name of the FM of smart for smart form
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = g_form_name
        IMPORTING
          fm_name            = l_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 l_fm_name
        EXPORTING
          control_parameters = l_s_ssfctrlop
          output_options     = l_s_output_options
          user_settings      = ' '
        IMPORTING
          job_output_info    = l_s_job_output_info
        TABLES
          g_t_datatab        = g_t_datatab
        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.
    Thanks & Regards,
    Soumya

    Hi,
    One more doubt if I give the parameter
    l_s_output_options-tdnoprint = 'X'. will it prevent the printing of the form generated or is it just to disable the print button in the pop up.
    Thanks & Regards,
    Soumya.

  • SmartForms : Printing Non-English characters with SWIN output device?

    I have a Japanese Text (entered in Unicode at So10) and I want to print it from my SmartForms application using SWIN device type.
    I thought SWIN converted all the components into graphics before sending to printer. To my surprise, the Japanese text printed out as "########".
    I even tried duplicate the SWIN output device to another output device and changed the character set to 4103 UTF-16LE Unicode / ISO/IEC 10646 but then the print process hang.
    Anyone knows how to overcome the problem so that I can print Japanese with SWin output device?

    I have a Japanese Text (entered in Unicode at So10) and I want to print it from my SmartForms application using SWIN device type.
    I thought SWIN converted all the components into graphics before sending to printer. To my surprise, the Japanese text printed out as "########".
    I even tried duplicate the SWIN output device to another output device and changed the character set to 4103 UTF-16LE Unicode / ISO/IEC 10646 but then the print process hang.
    Anyone knows how to overcome the problem so that I can print Japanese with SWin output device?

  • Problem in sending the Smartform Output as PDF through Mail

    Dear All,
    I am sending the Smartform Output as an attachment by converting it into PDF. But when I am recieve this attachment I am unable to open the PDF file, it is giving error that FILE IS DAMAGED. Below is the code:
    REPORT  Y_SEND_MAIL2.
    TABLES: vbrk, vbrp.
    TYPE-POOLS: abap.
    DATA: it_vbrk TYPE TABLE OF vbrk WITH HEADER LINE.
    DATA: i_formname      TYPE       tdsfname,
          i_fm_name       TYPE       rs38l_fnam,
          it_vbak TYPE TABLE OF vbak WITH HEADER LINE,
          it_ekko TYPE TABLE OF ekko WITH HEADER LINE.
    DATA:  is_bil_invoice TYPE lbbil_invoice,
           output_options      TYPE ssfcompop,
           control_parameters  TYPE ssfctrlop,
           e_devtype           TYPE rspoptype,
           job_output_info     TYPE ssfcrescl,
           bin_file            TYPE xstring,
           lines               TYPE TABLE OF tline WITH HEADER LINE,
           doctab_archive      TYPE TABLE OF docs WITH HEADER LINE,
           filelength          TYPE i,
           bin_filesize        TYPE i,
           docs          TYPE TABLE OF docs WITH HEADER LINE.
    *"Types
    TYPES: t_document_data TYPE sodocchgi1,
           t_packing_list TYPE sopcklsti1,
           t_attachment TYPE solisti1,
           t_body_msg TYPE solisti1,
           t_receivers TYPE somlreci1,
           t_pdf TYPE tline.
    *"Workareas
    DATA :w_document_data TYPE t_document_data,
          w_packing_list TYPE t_packing_list,
          w_attachment TYPE t_attachment,
          w_body_msg TYPE t_body_msg,
          w_receivers TYPE t_receivers,
          w_pdf TYPE t_pdf.
    *internal tables
    DATA : i_document_data TYPE STANDARD TABLE OF t_document_data,
           i_packing_list TYPE STANDARD TABLE OF t_packing_list,
           i_attachment TYPE STANDARD TABLE OF t_attachment,
           i_body_msg TYPE STANDARD TABLE OF t_body_msg,
           i_receivers TYPE STANDARD TABLE OF t_receivers,
           i_pdf TYPE STANDARD TABLE OF t_pdf.
    DATA: BEGIN OF line_bin,
             data(1024) TYPE x,
          END OF line_bin.
    DATA: data_tab_bin LIKE STANDARD TABLE OF line_bin.
    So please suggest a solution.
    Regards,
    Vishal

    Continued:
    SELECT-OPTIONS: s_vbeln FOR vbrk-vbeln,
                    s_fkdat FOR vbrk-fkdat OBLIGATORY DEFAULT sy-datum.
    SELECT * FROM vbrk
    INTO TABLE it_vbrk
    WHERE fkdat IN s_fkdat
          AND vbeln IN s_vbeln.
    i_formname = 'Z_SD_JINDAL_INVOICE10'.
    output_options-tddest        = 'LP02'.
    output_options-tdimmed       = 'X'.
    output_options-tdnewid       = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname           = i_formname
      IMPORTING
        fm_name            = i_fm_name
      EXCEPTIONS
        no_form            = 1
        no_function_module = 2
        OTHERS             = 3.
    IF sy-subrc <> 0.          "checking subrc
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.                     "IF sy-subrc <> 0
    READ TABLE it_vbrk INDEX 1.
    IF sy-subrc = 0.
      is_bil_invoice-hd_gen-bil_number = it_vbrk-vbeln.
    ENDIF.
    control_parameters-no_dialog = 'X'.
    control_parameters-getotf = 'X'.
    CALL FUNCTION i_fm_name        "'/1BCDWB/SF00000097'
      EXPORTING
       control_parameters         = control_parameters
       output_options             = output_options
       user_settings              = space
       is_bil_invoice             = is_bil_invoice
    IMPORTING
       job_output_info            = job_output_info
    TABLES
       it_vbak                    = it_vbak
    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.
    *FORM convert_otf_2_pdf.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
    *      EXPORTING
    *        USE_OTF_MC_CMD               = 'X'
    *        ARCHIVE_INDEX                =
        IMPORTING
          bin_filesize                 = bin_filesize
        TABLES
          otf                          = job_output_info-otfdata[]
          doctab_archive               = docs[]
          lines                        = lines[]
        EXCEPTIONS
          err_conv_not_possible        = 1
          err_otf_mc_noendmarker       = 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.
    *ENDFORM.                    "convert_otf_2_pdf

  • Smartforms, Output device WA_EKPO-NETPR not defined., ME9F

    Hi
    I am creating a form of purchase order, I am trying to have the price printed, but I have the following message when I try to print:
    Output device WA_EKPO-NETPR not defined.
    Message no. SSFCOMPOSER011
    Diagnosis
    The output device specified is not known in the SAP System. Valid output devices are maintained in spool administration.
    System Response
    The system issues an error message.
    Procedure
    Choose an output device from the possible entries help on the printer dialog box.
    Procedure for System Administration
    Check the output devices defined in spool administration.
    thanks

    hi, i guess you havent defined your printer (i.e) output type.
    if you use driver program then when you call your sf just insert the below code.
    also please check your reference field
    NETPR in > global declaration >Currency / Quant. Fields and select either currency or quantity.
      call function 'SSF_FUNCTION_MODULE_NAME'
              exporting
                formname                 = f_sf_formname
    *   VARIANT                  = ' '
    *   DIRECT_CALL              = ' '
              importing
                fm_name                  =  f_sf_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.
    st_control_parameters-no_dialog = 'X'.
    st_control_parameters-preview = 'X'.
    st_output_options-tddest = 'WINDEFAULT'.
    and also please check your smartform -> form attributes -> output tab page format and also check output format.
    regards,
    koolspy.

  • Change output device in smartform when using gui_diwnload

    can any one please tell me how to change the output device for gui_download into pdf for a smartform.
    (i want the setting to be done in my report -driver program ,   not in sap application tool bar settings)
    kindly please suggest me,
    thanks in advance,
    koolspy.

    I give you an example
      DATA: ls_control_param      TYPE ssfctrlop.
      DATA: ls_composer_param     TYPE ssfcompop.
        Parametros por defecto para la generación de la orden de spool.
          ls_composer_param-tddataset = 'PDF'.
          ls_composer_param-tdsuffix1 = 'FACT.'.
          ls_composer_param-tdsuffix2 = nast-OBJKY.
          ls_composer_param-TDDEST   = 'LP02'.
        output_options-tdprinter = 'PRINTER'.
          ls_composer_param-tdnewid = 'X'.
          ls_composer_param-tddelete = 'X'.
          ls_composer_param-tdfinal = ' '.
          ls_composer_param-tdlifetime = 8.
          ls_control_param-no_dialog = 'X'.
          ls_control_param-preview = ' '.
          ls_composer_param-tdimmed = ' '.
          ls_control_param-getotf = 'X'.
    call smartform invoice
          CALL FUNCTION lf_fm_name
            EXPORTING
              archive_index        = toa_dara
              archive_parameters   = arc_params
              control_parameters   = ls_control_param
              mail_recipient       = ls_recipient
              mail_sender          = ls_sender
              output_options       = ls_composer_param
              user_settings        = space
              is_bil_invoice       = ls_bil_invoice
              is_nast              = nast
              is_repeat            = repeat
              is_vbdkr             = is_vbdkr
            IMPORTING
              job_output_info      = job_output_info
              document_output_info = document_output_info
              job_output_options   = job_output_options
            TABLES
              gt_vbdpr             = gt_vbdpr
            EXCEPTIONS
              formatting_error     = 1
              internal_error       = 2
              send_error           = 3
              user_canceled        = 4
              OTHERS               = 5.
        Convertimos el fichero OTF a PDF
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                      = 'PDF'
            MAX_LINEWIDTH               = 132
            ARCHIVE_INDEX               = ' '
            COPYNUMBER                  = 0
            ASCII_BIDI_VIS2LOG          = ' '
            PDF_DELETE_OTFTAB           = ' '
          IMPORTING
            bin_filesize                = file_size
            BIN_FILE                    =
          TABLES
            otf                         = job_output_info-otfdata
            lines                       = lt_pdf
          EXCEPTIONS
            err_max_linewidth           = 1
            err_format                  = 2
            err_conv_not_possible       = 3
            err_bad_otf                 = 4
            OTHERS                      = 5
    Hope it helps.

  • Default output device for smartform

    Hi all
    how can we assign a default output device to a smart form so that the every time we execute a smartform it doesnt ask for a output device?
    thanks in advance....

    Hi
    First see what your default out put device is.
    That you can see in SU3>Default>OutputDevice.
    Suppose it is set as 'PRINTER' .
    Then in ur print program you have to write the logic as below.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME           = 'Z_smartform
        IMPORTING
          FM_NAME            = WF_FUNCMODULENAME
        EXCEPTIONS
          NO_FORM            = 1
          NO_FUNCTION_MODULE = 2
          OTHERS             = 3.
      CLEAR: WA_CONTROL_PARAMETERS.
        WA_CONTROL_PARAMETERS-GETOTF    = 'X'.
        WA_CONTROL_PARAMETERS-LANGU = 'E'.
      WA_CONTROL_PARAMETERS-DEVICE = 'PRINTER'.
        CALL FUNCTION WF_FUNCMODULENAME
          EXPORTING
            CONTROL_PARAMETERS   = WA_CONTROL_PARAMETERS "Control Params
            OUTPUT_OPTIONS       = WA_OUTPUT_OPT  "Output Options
            WF_CARRID            = WF_CARRID
            WF_CONNID            = WF_CONNID
            WF_FLDATE            = WF_FLDATE
          IMPORTING
            DOCUMENT_OUTPUT_INFO = WA_DOCUMENT_OUTPUT_INFO
            JOB_OUTPUT_INFO      = WA_JOB_OUTPUT_INFO
            JOB_OUTPUT_OPTIONS   = WA_JOB_OUTPUT_OPTIONS
          EXCEPTIONS
            FORMATTING_ERROR     = 1
            INTERNAL_ERROR       = 2
            SEND_ERROR           = 3
            USER_CANCELED        = 4
            OTHERS               = 5.

  • Output_options in SF; selecting output device

    Hi all,
    i've been struggling with the following, maybe anyone can help?
    In a smartforms i want to, dynamically determine the printer for output.
    Whatever i do, i cant get it to work. I have set 'print directly' OFF so i can catch the printjobs in the spool. When i look in the Spool, allways the default printer is selected. And when i delete my default printer, i get an error while printing saying i have to define a printer.
    This is what i tried so far:
    -set USER_SETTINGS to SPACE in the form
    - set OUTPUT_OPTIONS-DDEST to the short printername
    - set the OUTPUT_OPTIONS-TDPRINTEr to the long printer name
    - i even tried the following code which comes with a popup to select th eoutput device..
    data : g_dest TYPE rspopname,
    g_printer TYPE rspoptype.
    *FM to accept the device type and returns the short name of the output device
    CALL FUNCTION 'EFG_GET_PRINTER'
    EXPORTING
    x_no_dialog = ' '
    x_obligatory = 'X'
    IMPORTING
    y_tddest = g_dest
    EXCEPTIONS
    cancelled = 1
    failed = 2
    OTHERS = 3.
    *device type name for the output device
    SELECT SINGLE patype "#EC CI_NOFIELD
    FROM tsp03d
    INTO g_printer
    WHERE padest = g_dest.
    output_options-tddest = g_dest.
    output_options-tdprinter = g_printer.
    The result is allways the same: in the Spool, it has the default printer defined...
    What am i doing wrong?
    Is it wrong to send the jobs to the spool, where i've deactiveted 'print directly'?
    Is it wrong to look at the spool-job for determining on which printer it will be printed?
    Hope someone can help!
    thanks
    Joris Bots

    Hi Ravi,
    My default printer in Own data is set to let's say PR2007.
    I'm not sure what other default printer you mean.
    What i want is to send the smartform to a printer
    depending on the user's printer in its Own Data.
    so if a usre has defined printer PR2007, then the smartform should go to PR2557
    if the user has defined printer PR3004, then the form should go to PR3557, etc.
    Thank you for your help
    Joris
    Message was edited by:
            Joris Bots

  • Selecting output device

    Is there any way to select the output device for ITunes?
    I have several, and don't want the one for music to be the same as the default one for the windows sounds.

    Hi Ravi,
    My default printer in Own data is set to let's say PR2007.
    I'm not sure what other default printer you mean.
    What i want is to send the smartform to a printer
    depending on the user's printer in its Own Data.
    so if a usre has defined printer PR2007, then the smartform should go to PR2557
    if the user has defined printer PR3004, then the form should go to PR3557, etc.
    Thank you for your help
    Joris
    Message was edited by:
            Joris Bots

  • Problem in sending the smartform as an email in a country specific language

    Hi,
    I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
    the program is working fine for english.
    Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
    Please help.
    Arun.
    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(/smb40/ssfcomposer).
        ENDIF.
        IF sy-subrc = 2.
          MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
        ENDIF.
        PERFORM protocol_update_i.
      ENDIF.
    *Start of changes <Arun K Singarapu> C082493 <04/28/2008>
    *for print preview
      IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            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
            job_output_info    = wa_return
          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.
        EXIT.
      ELSE.
        wa_ctrlop-LANGU = nast-spras.
        wa_ctrlop-getotf = 'X'.
        wa_ctrlop-no_dialog = 'X'.
        wa_compop-tdnoprev = 'X'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            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
            job_output_info    = wa_return
          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.
    *Convert the data from OTF to PDF format
        it_otf[] = wa_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = l_len_in
            bin_file              = lp_xcontent
          TABLES
            otf                   = it_otf
            lines                 = it_tline
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            OTHERS                = 4.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        TRY.
      ---------- create persistent send request ----------------------
            send_request = cl_bcs=>create_persistent( ).
            len = XSTRLEN( lp_xcontent ).
    transform to solix tab
            lt_solix =
              cl_document_bcs=>xstring_to_solix(
                ip_xstring = lp_xcontent ).
    Create Body to the E-mail.
            APPEND Text-005 TO l_text.
    Attachment Name
            l_ponumber = text-004.
            CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
    Subject for the E-Mail.
            l_subject = text-001.
            CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
    *create document E-Mail.
            CALL METHOD cl_document_bcs=>create_document
              EXPORTING
                i_type    = 'RAW'
                i_subject = l_subject
                i_length  = '13'
                i_text    = l_text
              RECEIVING
                result    = l_email_object.
    *Create PDF Document
            bcs_doc =  cl_document_bcs=>create_document(
                                            i_type     = 'PDF'
                                            i_subject  = l_ponumber
                                            i_length   = len
                                            i_language = nast-spras
                                            i_hex     = lt_solix
    *Type casting
            obj_pdf_file ?= bcs_doc.
    Add PDF document as an attachment
            CALL METHOD l_email_object->add_document_as_attachment
              EXPORTING
                im_document = obj_pdf_file.
    get the attachments of the PO for each line item
            SELECT ebeln
                   ebelp
                   FROM ekpo
                   INTO TABLE it_ekpo
                   WHERE ebeln = l_doc-xekko-ebeln.
    concatenate PO and the Line Item Numebr to get the Object key
            LOOP AT it_ekpo INTO wa_ekpo.
              CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
              APPEND wa_temp TO it_temp.
              CLEAR: wa_temp,wa_ekpo.
            ENDLOOP.
    *Get data from table DRAD
            IF it_temp[] IS NOT INITIAL.
              SELECT dokar
                     doknr
                     dokvr
                     doktl
                     objky
                     FROM drad
                     client specified
                     INTO TABLE it_drad
                     FOR ALL ENTRIES IN it_temp
                     WHERE mandt = sy-mandt
                     AND objky = it_temp-objky.
            ENDIF.
            IF NOT it_drad IS INITIAL.
              SELECT * FROM dms_doc2loio
                       INTO TABLE it_dms_doc2loio
                       FOR ALL ENTRIES IN it_drad
                       WHERE dokar = 'SRM'
                         AND doknr = it_drad-doknr
                         AND dokvr = it_drad-dokvr
                         AND doktl = it_drad-doktl.
            ENDIF.
    Get the Physical object class and Object ID of the attachment
            IF NOT it_dms_doc2loio IS INITIAL.
              SELECT * FROM dms_ph_cd1
                       INTO TABLE it_dms_ph_cd1
                       FOR ALL ENTRIES IN it_dms_doc2loio
                       WHERE loio_id = it_dms_doc2loio-lo_objid.
            ENDIF.
    Get the file from the DMS server using the below function module.
            LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
              wa_object_id-class = wa_dms_ph_cd1-ph_class.
              wa_object_id-objid = wa_dms_ph_cd1-phio_id.
              CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
                EXPORTING
                  object_id           = wa_object_id
                  client              = sy-mandt
                TABLES
                  file_access_info    = it_file_access_info
                  file_content_binary = it_sdokcntbin
                EXCEPTIONS
                  not_existing        = 1
                  not_authorized      = 2
                  no_content          = 3
                  bad_storage_type    = 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.
              READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
              IF wa_file_access_info-mimetype = 'application/msword'.
                l_doc_type = 'DOC'.
                CLEAR: a_xstring,len.
                LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
                  CONCATENATE a_xstring wa_sdokcntbin-line
                         INTO a_xstring IN BYTE MODE.
                ENDLOOP.
                len = XSTRLEN( a_xstring ).
        transform to solix tab - adding additional attachments
                REFRESH lt_solix.
                lt_solix =
                  cl_document_bcs=>xstring_to_solix(
                    ip_xstring = a_xstring ).
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_solix
    *Type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for PDF document
              ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
                l_doc_type = 'PDF'.
                file_size = wa_file_access_info-file_size.
    Convert the 1022 binary data to xstring
                CLEAR a_xstring.
                CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
                  EXPORTING
                    input_length = file_size
                  IMPORTING
                    buffer       = a_xstring
                  TABLES
                    binary_tab   = it_sdokcntbin
                  EXCEPTIONS
                    failed       = 1
                    OTHERS       = 2.
                IF sy-subrc <> 0.
                  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                ENDIF.
                DATA: w_output_length TYPE i.
    Convert Xstring to 255 RAW
                CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
                  EXPORTING
                    buffer        = a_xstring
                  IMPORTING
                    output_length = w_output_length
                  TABLES
                    binary_tab    = lt_content_bin.
                len = w_output_length.
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_content_bin
           type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for Excel Document
              ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
                l_doc_type = 'XLS'.
                CLEAR: a_xstring,len.
                LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
                  CONCATENATE a_xstring wa_sdokcntbin-line
                         INTO a_xstring IN BYTE MODE.
                ENDLOOP.
                len = XSTRLEN( a_xstring ).
        transform to solix tab - adding additional attachments
                REFRESH lt_solix.
                lt_solix =
                  cl_document_bcs=>xstring_to_solix(
                    ip_xstring = a_xstring ).
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_solix
    *Type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for text doxument
              ELSEIF wa_file_access_info-mimetype = 'plain/text'.
                l_doc_type = 'TXT'.
                file_size = wa_file_access_info-file_size.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
                  EXPORTING
                    input_length = file_size
                  TABLES
                    binary_tab   = it_sdokcntbin
                    text_tab     = file_data
                  EXCEPTIONS
                    failed       = 1
                    OTHERS       = 2.
                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 METHOD cl_document_bcs=>create_document
                  EXPORTING
                    i_type    = l_doc_type
                    i_subject = l_filename
                    i_text    = file_data
                  RECEIVING
                    result    = bcs_doc1.
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
              ENDIF.
              CLEAR:it_file_access_info,it_sdokcntbin.
              CLEAR:wa_object_id,wa_file_access_info,file_size.
            ENDLOOP.
            CALL METHOD send_request->set_document( l_email_object ).
    *Get the address number for the vendor
            SELECT SINGLE adrnr
                          FROM lfa1
                          INTO l_adrnr
                          WHERE lifnr = l_doc-xekko-lifnr.
            MOVE l_adrnr TO l_addrno.
    Get the Email Address for the vendor using address number
            CALL FUNCTION 'ADDR_GET_REMOTE'
              EXPORTING
                addrnumber        = l_addrno
              TABLES
                adsmtp            = it_adsmtp
              EXCEPTIONS
                parameter_error   = 1
                address_not_exist = 2
                internal_error    = 3
                OTHERS            = 4.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            sender = cl_sapuser_bcs=>create( sy-uname ).
            CALL METHOD send_request->set_sender
              EXPORTING
                i_sender = sender.
            READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
            IF sy-subrc = 0.
              LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
                CALL METHOD cl_cam_address_bcs=>create_internet_address
                  EXPORTING
                    i_address_string = wa_adsmtp-smtp_addr
                  RECEIVING
                    result           = recipient.
                CALL METHOD send_request->add_recipient
                  EXPORTING
                    i_recipient = recipient
                    i_express   = 'X'.
              ENDLOOP.
            ELSE.
              READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
              IF sy-subrc = 0.
                CALL METHOD cl_cam_address_bcs=>create_internet_address
                  EXPORTING
                    i_address_string = wa_adsmtp-smtp_addr
                  RECEIVING
                    result           = recipient.
                CALL METHOD send_request->add_recipient
                  EXPORTING
                    i_recipient = recipient
                    i_express   = 'X'.
              ENDIF.
            ENDIF.
            CALL METHOD send_request->send(
             EXPORTING
               i_with_error_screen = 'X'
              RECEIVING
                result              = l_sent_to_all ).
          CATCH cx_bcs INTO bcs_exception.
            WRITE: 'Fehler aufgetreten.'(001).
            WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
            EXIT.
        ENDTRY.
      ENDIF.

    Hi,
    I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
    the program is working fine for english.
    Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
    Please help.
    Arun.
    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(/smb40/ssfcomposer).
        ENDIF.
        IF sy-subrc = 2.
          MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
        ENDIF.
        PERFORM protocol_update_i.
      ENDIF.
    *Start of changes <Arun K Singarapu> C082493 <04/28/2008>
    *for print preview
      IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            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
            job_output_info    = wa_return
          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.
        EXIT.
      ELSE.
        wa_ctrlop-LANGU = nast-spras.
        wa_ctrlop-getotf = 'X'.
        wa_ctrlop-no_dialog = 'X'.
        wa_compop-tdnoprev = 'X'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            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
            job_output_info    = wa_return
          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.
    *Convert the data from OTF to PDF format
        it_otf[] = wa_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = l_len_in
            bin_file              = lp_xcontent
          TABLES
            otf                   = it_otf
            lines                 = it_tline
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            OTHERS                = 4.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        TRY.
      ---------- create persistent send request ----------------------
            send_request = cl_bcs=>create_persistent( ).
            len = XSTRLEN( lp_xcontent ).
    transform to solix tab
            lt_solix =
              cl_document_bcs=>xstring_to_solix(
                ip_xstring = lp_xcontent ).
    Create Body to the E-mail.
            APPEND Text-005 TO l_text.
    Attachment Name
            l_ponumber = text-004.
            CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
    Subject for the E-Mail.
            l_subject = text-001.
            CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
    *create document E-Mail.
            CALL METHOD cl_document_bcs=>create_document
              EXPORTING
                i_type    = 'RAW'
                i_subject = l_subject
                i_length  = '13'
                i_text    = l_text
              RECEIVING
                result    = l_email_object.
    *Create PDF Document
            bcs_doc =  cl_document_bcs=>create_document(
                                            i_type     = 'PDF'
                                            i_subject  = l_ponumber
                                            i_length   = len
                                            i_language = nast-spras
                                            i_hex     = lt_solix
    *Type casting
            obj_pdf_file ?= bcs_doc.
    Add PDF document as an attachment
            CALL METHOD l_email_object->add_document_as_attachment
              EXPORTING
                im_document = obj_pdf_file.
    get the attachments of the PO for each line item
            SELECT ebeln
                   ebelp
                   FROM ekpo
                   INTO TABLE it_ekpo
                   WHERE ebeln = l_doc-xekko-ebeln.
    concatenate PO and the Line Item Numebr to get the Object key
            LOOP AT it_ekpo INTO wa_ekpo.
              CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
              APPEND wa_temp TO it_temp.
              CLEAR: wa_temp,wa_ekpo.
            ENDLOOP.
    *Get data from table DRAD
            IF it_temp[] IS NOT INITIAL.
              SELECT dokar
                     doknr
                     dokvr
                     doktl
                     objky
                     FROM drad
                     client specified
                     INTO TABLE it_drad
                     FOR ALL ENTRIES IN it_temp
                     WHERE mandt = sy-mandt
                     AND objky = it_temp-objky.
            ENDIF.
            IF NOT it_drad IS INITIAL.
              SELECT * FROM dms_doc2loio
                       INTO TABLE it_dms_doc2loio
                       FOR ALL ENTRIES IN it_drad
                       WHERE dokar = 'SRM'
                         AND doknr = it_drad-doknr
                         AND dokvr = it_drad-dokvr
                         AND doktl = it_drad-doktl.
            ENDIF.
    Get the Physical object class and Object ID of the attachment
            IF NOT it_dms_doc2loio IS INITIAL.
              SELECT * FROM dms_ph_cd1
                       INTO TABLE it_dms_ph_cd1
                       FOR ALL ENTRIES IN it_dms_doc2loio
                       WHERE loio_id = it_dms_doc2loio-lo_objid.
            ENDIF.
    Get the file from the DMS server using the below function module.
            LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
              wa_object_id-class = wa_dms_ph_cd1-ph_class.
              wa_object_id-objid = wa_dms_ph_cd1-phio_id.
              CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
                EXPORTING
                  object_id           = wa_object_id
                  client              = sy-mandt
                TABLES
                  file_access_info    = it_file_access_info
                  file_content_binary = it_sdokcntbin
                EXCEPTIONS
                  not_existing        = 1
                  not_authorized      = 2
                  no_content          = 3
                  bad_storage_type    = 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.
              READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
              IF wa_file_access_info-mimetype = 'application/msword'.
                l_doc_type = 'DOC'.
                CLEAR: a_xstring,len.
                LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
                  CONCATENATE a_xstring wa_sdokcntbin-line
                         INTO a_xstring IN BYTE MODE.
                ENDLOOP.
                len = XSTRLEN( a_xstring ).
        transform to solix tab - adding additional attachments
                REFRESH lt_solix.
                lt_solix =
                  cl_document_bcs=>xstring_to_solix(
                    ip_xstring = a_xstring ).
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_solix
    *Type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for PDF document
              ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
                l_doc_type = 'PDF'.
                file_size = wa_file_access_info-file_size.
    Convert the 1022 binary data to xstring
                CLEAR a_xstring.
                CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
                  EXPORTING
                    input_length = file_size
                  IMPORTING
                    buffer       = a_xstring
                  TABLES
                    binary_tab   = it_sdokcntbin
                  EXCEPTIONS
                    failed       = 1
                    OTHERS       = 2.
                IF sy-subrc <> 0.
                  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
                ENDIF.
                DATA: w_output_length TYPE i.
    Convert Xstring to 255 RAW
                CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
                  EXPORTING
                    buffer        = a_xstring
                  IMPORTING
                    output_length = w_output_length
                  TABLES
                    binary_tab    = lt_content_bin.
                len = w_output_length.
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_content_bin
           type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for Excel Document
              ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
                l_doc_type = 'XLS'.
                CLEAR: a_xstring,len.
                LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
                  CONCATENATE a_xstring wa_sdokcntbin-line
                         INTO a_xstring IN BYTE MODE.
                ENDLOOP.
                len = XSTRLEN( a_xstring ).
        transform to solix tab - adding additional attachments
                REFRESH lt_solix.
                lt_solix =
                  cl_document_bcs=>xstring_to_solix(
                    ip_xstring = a_xstring ).
                CLEAR l_filename.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                bcs_doc1 =  cl_document_bcs=>create_document(
                                                i_type     = l_doc_type
                                                i_subject  = l_filename
                                                i_length   = len
                                                i_language = sy-langu
                                                i_hex     = lt_solix
    *Type casting
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
    for text doxument
              ELSEIF wa_file_access_info-mimetype = 'plain/text'.
                l_doc_type = 'TXT'.
                file_size = wa_file_access_info-file_size.
            Get the file name
                l_filename = wa_file_access_info-file_name.
                CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
                  EXPORTING
                    input_length = file_size
                  TABLES
                    binary_tab   = it_sdokcntbin
                    text_tab     = file_data
                  EXCEPTIONS
                    failed       = 1
                    OTHERS       = 2.
                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 METHOD cl_document_bcs=>create_document
                  EXPORTING
                    i_type    = l_doc_type
                    i_subject = l_filename
                    i_text    = file_data
                  RECEIVING
                    result    = bcs_doc1.
                obj_file ?= bcs_doc1.
    Add Attachment as a document to the email object
                CALL METHOD l_email_object->add_document_as_attachment
                  EXPORTING
                    im_document = obj_file.
              ENDIF.
              CLEAR:it_file_access_info,it_sdokcntbin.
              CLEAR:wa_object_id,wa_file_access_info,file_size.
            ENDLOOP.
            CALL METHOD send_request->set_document( l_email_object ).
    *Get the address number for the vendor
            SELECT SINGLE adrnr
                          FROM lfa1
                          INTO l_adrnr
                          WHERE lifnr = l_doc-xekko-lifnr.
            MOVE l_adrnr TO l_addrno.
    Get the Email Address for the vendor using address number
            CALL FUNCTION 'ADDR_GET_REMOTE'
              EXPORTING
                addrnumber        = l_addrno
              TABLES
                adsmtp            = it_adsmtp
              EXCEPTIONS
                parameter_error   = 1
                address_not_exist = 2
                internal_error    = 3
                OTHERS            = 4.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            sender = cl_sapuser_bcs=>create( sy-uname ).
            CALL METHOD send_request->set_sender
              EXPORTING
                i_sender = sender.
            READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
            IF sy-subrc = 0.
              LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
                CALL METHOD cl_cam_address_bcs=>create_internet_address
                  EXPORTING
                    i_address_string = wa_adsmtp-smtp_addr
                  RECEIVING
                    result           = recipient.
                CALL METHOD send_request->add_recipient
                  EXPORTING
                    i_recipient = recipient
                    i_express   = 'X'.
              ENDLOOP.
            ELSE.
              READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
              IF sy-subrc = 0.
                CALL METHOD cl_cam_address_bcs=>create_internet_address
                  EXPORTING
                    i_address_string = wa_adsmtp-smtp_addr
                  RECEIVING
                    result           = recipient.
                CALL METHOD send_request->add_recipient
                  EXPORTING
                    i_recipient = recipient
                    i_express   = 'X'.
              ENDIF.
            ENDIF.
            CALL METHOD send_request->send(
             EXPORTING
               i_with_error_screen = 'X'
              RECEIVING
                result              = l_sent_to_all ).
          CATCH cx_bcs INTO bcs_exception.
            WRITE: 'Fehler aufgetreten.'(001).
            WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
            EXIT.
        ENDTRY.
      ENDIF.

  • Output device LOCL is not defined

    Hi,
    I am getting an error message while executing a report containing smartform
    'Output device LOCL is not defined'.
    The coding is as follows:
      l_s_ssfctrlop-no_dialog   = 'X'.
      l_s_ssfctrlop-getotf      = 'X'.
      l_s_output_options-tddest = 'LOCL'.
      l_s_output_options-tdnoprint = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    Please let me know what is the issue here.
    Thanks,
    Soumya.

    Hi,
    Might be the local printer is not defined. Try using LP01.
    To verify for LOCL...
    Goto SPAD tcodeFull Administrations>Mention the LOCL in the Output Device I/0 Field.
    Regards,
    Aditya

  • Output device not defined error while saving the quotation

    Hi all,
    We have some custom output types (ZGEN, ZSSO, ZQTO, ZJT)configured in the nace transaction for Application V1.  Whenever i am creating / saving a quotation one of the output type(ZQTO) is not processing for mail (External Send) and it is displaying an error as 'Output device not defined'.  If i remove all the output types while changing the quotation in VA22 from header, it is processing.
    I checked with all other output types combination.  The error is trigerred only when we  have ZJT output type along with ZQTO.
    We are not able to recognise the error.  Please help out to solve this issue.  Its very urgent.
    Thanks.

    Hi Remi
    Thanks for your reply. As per your reply I followed procedure and it allowed me to save Basic Pay Infotype (0008)
    Thanks a ton.
    Regards
    Prakash Bhave

Maybe you are looking for