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.

Similar Messages

  • Problem in sending the smartform as email for other language except english

    Hi Experts,
    I could not send the smartform as an attachment for other languages, but where as i could send it in english.
    The program is working fine with print priview but not when sending the SF as an attachment
    (in other languages except english).
    Please do find the below code which i used to send the smartform as an attachment.
    Please let me know if there is any mistake in the code.
        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.
    *TRY.
    CALL METHOD cl_document_bcs=>create_document
      EXPORTING
        i_type        = 'RAW'
        i_subject     = l_subject
        i_length      = '13'
        i_language    = nast-spras
       i_importance  =
       i_sensitivity =
        i_text        = l_text
       i_hex         =
       i_header      =
       i_sender      =
      receiving
        RESULT        = l_email_object
    CATCH cx_document_bcs .
    *ENDTRY.
           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.

    hi,
    i tried with ur problem.but i am able send mail in other languages also.actaullly i wrote a msg whether the mail has been sent or not.i got success message. i am placing my code here please go thorugh it,and do relavant modifications.
    *& Report  ZPPS_SMARTFORM_TO_PDF
    REPORT  ZPPS_SMARTFORM_TO_PDF.
    PARAMETER: p_date LIKE sy-datum.
    PARAMETER: p_rea TYPE char255.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = 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.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
        MYDATE                     = p_date
        REASON                     = p_rea
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    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.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 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.
    loop at t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    APPEND T_OBJTXT.
    DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
    READ TABLE T_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR T_OBJPACK-TRANSF_BIN.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    T_OBJPACK-BODY_NUM = V_LINES_TXT.
    T_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND T_OBJPACK.
    Attachment (pdf-Attachment)
    T_OBJPACK-TRANSF_BIN = 'X'.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
    READ TABLE T_OBJBIN INDEX V_LINES_BIN.
    T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    T_OBJPACK-BODY_NUM = V_LINES_BIN.
    T_OBJPACK-DOC_TYPE = 'PDF'.
    T_OBJPACK-OBJ_NAME = 'smart'.
    T_OBJPACK-OBJ_DESCR = 'test'.
    APPEND T_OBJPACK.
    CLEAR T_RECLIST.
    T_RECLIST-RECEIVER = 'MAIL-ID'.
    T_RECLIST-REC_TYPE = 'U'.
    APPEND T_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = WA_DOC_CHNG
        PUT_IN_OUTBOX              = 'X'
        COMMIT_WORK                = 'X'
      TABLES
        PACKING_LIST               = T_OBJPACK
        OBJECT_HEADER              = WA_OBJHEAD
        CONTENTS_BIN               = T_OBJBIN
        CONTENTS_TXT               = T_OBJTXT
        RECEIVERS                  = T_RECLIST
      EXCEPTIONS
        TOO_MANY_RECEIVERS         = 1
        DOCUMENT_NOT_SENT          = 2
        DOCUMENT_TYPE_NOT_EXIST    = 3
        OPERATION_NO_AUTHORIZATION = 4
        PARAMETER_ERROR            = 5
        X_ERROR                    = 6
        ENQUEUE_ERROR              = 7
        OTHERS                     = 8.
    IF SY-SUBRC <> 0.
      WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
      WRITE:/ 'Mail sent'.
    ENDIF.
    and i thought of one more soluyion u can write
    wa_ctrlop-langu = T002-spras. i think it will also help for u.
    revert back if any questions.
    please reward me if helpful.
    gupta.pullipudi

  • 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

  • Problems with sending the Job_ID with activity EMAIL from a processflow

    Hello everybody,
    i have a problem with a simple process flow.
    I want to send an EMail that contains in the MESSAGE_BODY the Job_ID from the started workflow. For that reason i wrote a function with a select statement that gives back the number.
    Code:
    l_owb_id VARCHAR2(20);
    BEGIN
    select to_char(top_level_execution_audit_id)
    into l_owb_id
    from ALL_RT_AUDIT_EXECUTIONS
    where task_name = 'XYZ'
    and created_on like sysdate;
    return (l_owb_id);
    END;
    The function works fine. So i placed it into my workflow. Now i wanted to bind the MESSAGE_BODY from the activity EMAIL with the parameter of the function. But when i click validate it shows following error:
    VLD-10042: Parameter MESSAGE_BODY of EMAIL is incorrectly bound. Output of cannot be converted into a constant value.
    VLD-10042: Activity MESSAGE_BODY of EMAIL is currently bound to parameter GET_OWB_ID of .Activities must be bound through an intermediate variable
    Can anyone help me how to fix that proplem. How can i send the Process ID per activity EMAIL in a Workflow. On the internet i didn't found anything helpful, so any help would be appreiciated.
    Kind regards,
    Daniel

    You need to create Variable and then bind the value from your function to that variable and than use that variable as parameter for email MESSAGE_BODY.
    So you will have:
    Variable: p_id
    Return parameter of your function will be bind to p_id and message_body of your email will be bind to p_id.

  • Configuration to send the smartform through fax

    Hi,
    I have used CONVERT_OTF_AND_FAX and SO_OBJECT_SEND FM's to send the smartform through fax.After executing SO_OBJECT_SEND function module,I am getting sy-subrc alue as 9(OBJECT_NOT_SEND).I am able to send the document through fax.But when I click on display in SOST transaction it is just printing the output of the smartform.It is not coming in PDF format.
    The code looks fine.I think there is some problem with confuration settings.Is there any configuration to be done to send the smartform  output through fax?
    Please reply.
    Regards,
    Hema

    Hi,
    Actually,my requirement is to send the smartform output through email with medium 'external send'.I have done some coding for that.it is working fine and I am able to send the smartform through email and open the attachment in PDF format.
    But if the email id of the recipient is not present then the smartform output has to be sent through fax with the same medium 'external send'.
    So I have done some coding to send the smartform through fax when the email id is not present.
    I am able to send the output of smartform through fax.But when I clicked on display in SOST transaction,it is not coming in PDF format.It is coming in RAW format.
    Is it possible to send the smartform output through fax with medium 'external send'?
    Regards,
    Hema

  • Logo Problem While sending the smart form as an attachment via Email

    Hi ,
    I am using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send the smartforma as an attachement into the mailbox . it is sent correctly but the COLOR LOGO are not coming correctlly .
    I checked the OTF to PDF file is getting converted correctly .i.e. if i am downloading the foem then it is displaying correctly , but in case of sending it to mailbox as an attached PDF file ,the logo are not comming correctly ,
    If anybody faced such type of problem can u please clarify .
    I am thinking the problem is in FM  SO_NEW_DOCUMENT_ATT_SEND_API1 . this FM is not sending the Attached PDF file correctly .
    All the TExt/variables are displaying  correctly in the PDF file except the LOGO.while opening the PDF file one Warnng message is getting displayed : "An error occured while opening the Image" .
    PLease help ..
    Thanks,
    sachi

    Hi,
    Edit your  logo as 256 color bit map image and save it  and upload  into SE78,
    And also better to use this FM :SO_DOCUMENT_SEND_API1  it is good for new versions.
    thanks,
    venkat.
    Edited by: Satya venkat Rao.R on Dec 13, 2011 6:02 AM

  • How do I make a button onj the form which will submit and send the pdf as an email?

    how do I make a button on the form which will submit and send the pdf as an email?

    You can set up a button with a "Submit a form" action and use a mailto type URL to specify the email address you want the forms sent do. If you want to send the entire PDF, select that option and not FDF or anything else. The mailto URL should not include any spaces and the "mailto" part should be lowercase, like:
    mailto:[email protected]
    This will attempt to initiate an email using the users default email client. If the user does not have one set up or there is some other problem, the email might not get initiated. If it needs to work with Reader versions prior to 11, then the form needs to be Reader-enabled, which you do in Acrobat 11 by selecting: File > Save As Other > Reader Extended PDF > Enable More Tools

  • How to send a SMARTFORM as an email ?

    Hello,
    How can we send a smart form as an email?
    Please explain with an exmaple.
    ANy proper explonation will be appreciated...
    Have a great day!
    Thanks & Regards,
    Krishna Chaitanya

    Hi Krishna,
    When you pass the values to the Smartform by using the Function Module name of the Smartform, it will return you thr OTF format of the Smartform in the Importing Parameter 'job_output_info'. The following code will help you regarding the mail sending part:
    If you still need help, Please let  me know.If helpfull reward me points.*
      TYPES: BEGIN OF tp_lips,
             vbeln LIKE lips-vbeln,
             posnr LIKE lips-posnr,
             matnr LIKE lips-matnr,
             lfimg LIKE lips-lfimg,
             vgbel LIKE lips-vgbel,
             vgpos LIKE lips-vgpos,
             uecha  LIKE lips-uecha,
             END OF tp_lips,
             BEGIN OF tp_vbap,
             vbeln LIKE vbap-vbeln,
             posnr LIKE vbap-posnr,
             matnr LIKE vbap-matnr,
             kbmeng LIKE vbap-kbmeng,
             werks LIKE vbap-werks,
             END OF tp_vbap,
           BEGIN OF tp_lips_tmp ,
             uecha  LIKE lips-uecha,
             vbeln LIKE lips-vbeln,
             posnr LIKE lips-posnr,
             matnr LIKE lips-matnr,
             lfimg LIKE lips-lfimg,
             vgbel LIKE lips-vgbel,
             vgpos LIKE lips-vgpos,
            END OF tp_lips_tmp,
          BEGIN OF tp_lips_split ,
             uecha  LIKE lips-uecha,
             vbeln LIKE lips-vbeln,
             posnr LIKE lips-posnr,
             matnr LIKE lips-matnr,
             lfimg LIKE lips-lfimg,
             vgbel LIKE lips-vgbel,
             vgpos LIKE lips-vgpos,
            END OF tp_lips_split.
      CONSTANTS :   c_5(1)       TYPE c VALUE '5',
                    c_otf(3)     TYPE c VALUE 'OTF',
                    c_printer(7) TYPE c VALUE 'PRINTER',
                    c_x(1)       TYPE c VALUE 'X',
                    c_pdf(3)     TYPE c VALUE 'PDF',
                    c_o(1)       TYPE c VALUE 'O',
                    c_mail(5)    TYPE c VALUE 'EMAIL' ,
                    c_e          TYPE so_escape VALUE 'E',
                    c_int        TYPE tddevice VALUE 'INT' ,
                    c_ext(3)     TYPE c VALUE 'EXT',
                    c_raw(3)     TYPE c VALUE 'RAW',
                    c_b          LIKE soos1-recesc VALUE 'B'.
      DATA: ls_print_data_to_read TYPE ledlv_print_data_to_read.
      DATA: ls_dlv_delnote        TYPE ledlv_delnote.
      DATA: lf_fm_name            TYPE rs38l_fnam.
      DATA: ls_control_param      TYPE ssfctrlop.
      DATA: ls_composer_param     TYPE ssfcompop.
      DATA: ls_recipient          TYPE swotobjid.
      DATA: ls_sender             TYPE swotobjid.
      DATA: lf_formname           TYPE tdsfname.
      DATA: ls_addr_key           LIKE addr_key.
      DATA: l_w_object_hd_change    TYPE sood1,
            l_w_header              LIKE  sood1-objdes.
    *--Binary Data
      DATA:   BEGIN OF l_t_solix OCCURS 0.
              INCLUDE STRUCTURE solix.
      DATA:   END OF l_t_solix.
    *--Content to be mailed
      DATA:   BEGIN OF l_t_objcont OCCURS 0.
              INCLUDE STRUCTURE soli.
      DATA:   END OF l_t_objcont.
    *--PDF Data
      DATA:   BEGIN OF l_t_htline OCCURS 10.
              INCLUDE STRUCTURE tline.
      DATA:   END   OF l_t_htline.
      DATA:   BEGIN OF l_t_object_hd_change.
              INCLUDE STRUCTURE sood1.
      DATA:   END OF l_t_object_hd_change.
    *-- Recipient table with send attributes
      DATA:   BEGIN OF l_t_receivers OCCURS 0.
              INCLUDE STRUCTURE soos1.
      DATA:   END OF l_t_receivers.
      DATA:   BEGIN OF l_t_objhead OCCURS 0.
              INCLUDE STRUCTURE soli.
      DATA:   END OF l_t_objhead.
      DATA:   l_t_lips TYPE tp_lips OCCURS 0 WITH HEADER LINE,
              l_t_vbap TYPE tp_vbap OCCURS 0 WITH HEADER LINE,
              l_t_lips_tmp TYPE tp_lips_tmp OCCURS 0 WITH HEADER LINE,
              l_t_lips_split TYPE tp_lips_split OCCURS 0 WITH HEADER LINE.
      DATA :   l_v_document_number TYPE likp-vbeln,
               l_t_ssfcrespd       TYPE ssfcrespd,
               l_t_ssfcrescl       TYPE ssfcrescl,
               l_t_ssfcresop       TYPE ssfcresop,
               l_v_adrnr           TYPE kna1-adrnr,
               l_v_ls_address      TYPE szadr_addr1_complete,
               w_ls_adsmtpline     TYPE szadr_adsmtp_line,
               l_v_mail            LIKE adr6-smtp_addr,
               l_t_otf             LIKE itcoo OCCURS 0,
               l_v_hformat(10)     TYPE c,
               l_v_ld_binfile      TYPE xstring,
               l_v_doc_size        TYPE i,
               l_v_i               TYPE i,
               l_v_n               TYPE i,
               l_v_hkora(50)       TYPE c,
               w_soli              TYPE soli,
               w_solix             TYPE solix,
               l_v_var1(46)        TYPE c  ,
               l_v_linecount       TYPE p,
               l_v_sent_to_all     LIKE sonv-flag,
               l_v_document_type   LIKE soodk-objtp,
               l_v_horiginator     LIKE  soos1-recextnam ,
               l_w_lips            TYPE   tp_lips,
               l_w_vbap            TYPE   tp_vbap,
               l_v_avl_date        TYPE   erdat,
               l_f_oos_status      TYPE   flag,
               l_lfimg LIKE lips-lfimg.
      l_v_document_number  =  nast-objky.
    *--To get the smartform name
      lf_formname = tnapr-sform.
    *-- Determine print data
      PERFORM set_print_data_to_read USING    lf_formname
                                     CHANGING ls_print_data_to_read
                                     cf_retcode.
      IF cf_retcode = 0.
    *--select print data
        PERFORM get_data USING    ls_print_data_to_read
                         CHANGING ls_addr_key
                                  ls_dlv_delnote
                                  cf_retcode.
      ENDIF.
    *-- Begin of Insertion AG2K946177 Scan - Avail date
      CLEAR: l_t_lips,
             l_t_vbap.
    *-- Get the items from the delivery table
      SELECT vbeln posnr matnr lfimg vgbel vgpos uecha FROM lips INTO TABLE l_t_lips
              WHERE vbeln = nast-objky.
      IF sy-subrc = 0.
        IF NOT l_t_lips[] IS INITIAL.
    *-- Get the items from the order table
          SELECT vbeln posnr matnr kbmeng werks FROM vbap INTO TABLE l_t_vbap
                  FOR ALL ENTRIES IN l_t_lips
                  WHERE vbeln = l_t_lips-vgbel AND
                        posnr = l_t_lips-vgpos.
          IF sy-subrc = 0.
            LOOP AT l_t_lips.
                MOVE l_t_lips-vbeln TO  l_t_lips_tmp-vbeln.
                MOVE l_t_lips-posnr TO  l_t_lips_tmp-posnr.
                MOVE l_t_lips-matnr TO  l_t_lips_tmp-matnr.
                MOVE l_t_lips-lfimg TO  l_t_lips_tmp-lfimg.
                MOVE l_t_lips-vgbel TO  l_t_lips_tmp-vgbel.
                MOVE l_t_lips-vgpos TO  l_t_lips_tmp-vgpos.
                MOVE l_t_lips-uecha TO  l_t_lips_tmp-uecha.
              APPEND l_t_lips_tmp.
              CLEAR l_t_lips_tmp.
            ENDLOOP.
            LOOP AT l_t_lips INTO l_w_lips where uecha is INITIAL.
              CLEAR: l_lfimg.
              LOOP AT l_t_lips_tmp WHERE uecha = l_w_lips-posnr.
                MOVE l_t_lips_tmp-vbeln TO  l_t_lips_split-vbeln.
                MOVE l_t_lips_tmp-uecha  TO  l_t_lips_split-uecha.
                MOVE l_t_lips_tmp-posnr TO  l_t_lips_split-posnr.
                MOVE l_t_lips_tmp-matnr TO  l_t_lips_split-matnr.
                MOVE l_t_lips_tmp-vgbel TO  l_t_lips_split-vgbel.
                MOVE l_t_lips_tmp-vgpos TO  l_t_lips_split-vgpos.
                l_lfimg = l_lfimg + l_t_lips_tmp-lfimg.
                AT END OF uecha.
                  l_t_lips_split-lfimg = l_lfimg.
                  APPEND l_t_lips_split.
                  CLEAR l_t_lips_split.
                ENDAT.
              ENDLOOP.
              READ TABLE l_t_lips_split WITH KEY uecha = l_w_lips-posnr.
              IF sy-subrc = 0 .
                READ TABLE l_t_vbap INTO l_w_vbap WITH KEY vbeln = l_w_lips-vgbel
                                                           posnr = l_w_lips-vgpos.
                IF sy-subrc = 0.
                  IF l_t_lips_split-lfimg LT l_w_vbap-kbmeng.
                    SELECT SINGLE avl_dat FROM /mars/ou_avl_dat INTO l_v_avl_date
                          WHERE werks = l_w_vbap-werks AND
                                matnr = l_w_vbap-matnr.
                    IF sy-subrc = 0.
                      IF l_v_avl_date IS INITIAL OR l_v_avl_date < sy-datum.
                        l_f_oos_status = c_x.
                        t_objcont-line = l_w_vbap-matnr.
                        APPEND t_objcont.
                        CLEAR t_objcont.
                      ENDIF.
                    ELSE.
                      l_f_oos_status = c_x.
                      t_objcont-line = l_w_vbap-matnr.
                      APPEND t_objcont.
                      CLEAR t_objcont.
                    ENDIF.
                  ENDIF.
                ENDIF.
              ELSE.
                READ TABLE l_t_vbap INTO l_w_vbap WITH KEY vbeln = l_w_lips-vgbel
                                                            posnr = l_w_lips-vgpos.
                IF sy-subrc = 0.
                  IF l_t_lips-lfimg LT l_w_vbap-kbmeng.
                    SELECT SINGLE avl_dat FROM /mars/ou_avl_dat INTO l_v_avl_date
                          WHERE werks = l_w_vbap-werks AND
                                matnr = l_w_vbap-matnr.
                    IF sy-subrc = 0.
                      IF l_v_avl_date IS INITIAL OR l_v_avl_date < sy-datum.
                        l_f_oos_status = c_x.
                        t_objcont-line = l_w_vbap-matnr.
                        APPEND t_objcont.
                        CLEAR t_objcont.
                      ENDIF.
                    ELSE.
                      l_f_oos_status = c_x.
                      t_objcont-line = l_w_vbap-matnr.
                      APPEND t_objcont.
                      CLEAR t_objcont.
                    ENDIF.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
      ENDIF.
      IF l_f_oos_status NE c_x.
    *-- End of Insertion AG2K946177 Scan - Avail date
    *-- Begin of Insertion AG2K942430 Delivery Note
        IF cf_retcode = 0.
          IF nast-nacha NE c_5.
    *-- End of Insertion AG2K942430 Delivery Note
            PERFORM set_print_param USING    ls_addr_key
                                    CHANGING ls_control_param
                                             ls_composer_param
                                             ls_recipient
                                             ls_sender
                                             cf_retcode.
            ls_control_param-no_dialog   =  space .
    *-- Begin of Insertion AG2K942430 Delivery Note
          ELSEIF nast-nacha EQ c_5.
            SELECT SINGLE adrnr FROM kna1 INTO l_v_adrnr WHERE kunnr = nast-parnr.
            IF sy-subrc = 0.
              CLEAR l_v_ls_address.
    -- To get the address Details
              CALL FUNCTION 'ADDR_GET_COMPLETE'
                EXPORTING
                  addrnumber     = l_v_adrnr
                IMPORTING
                  addr1_complete = l_v_ls_address
                EXCEPTIONS
                  OTHERS         = 5.
              IF sy-subrc  = 0.
                LOOP AT l_v_ls_address-adsmtp_tab INTO w_ls_adsmtpline
                                                     WHERE date_from <= sy-datlo.
                  IF ( NOT w_ls_adsmtpline-adsmtp-smtp_addr IS INITIAL ).
    *--Email Address
                    l_v_mail = w_ls_adsmtpline-adsmtp-smtp_addr.
                  ENDIF.
                ENDLOOP.
              ENDIF.
    *--To fill the control paramters for Email
              IF NOT l_v_mail IS INITIAL AND nast-nacha EQ c_5.
                ls_control_param-device      =  c_printer.
                ls_control_param-no_dialog   =  c_x.
                ls_control_param-langu       =  sy-langu.
                ls_control_param-preview     =  space.
                ls_control_param-getotf      =  c_x.
    *--Setting LS_COMPOSER_PARAM values
                ls_composer_param-tddest     =  nast-ldest.
                ls_composer_param-tdimmed    =  space.
                ls_composer_param-tdnoprev   =  c_x.
                ls_composer_param-faxformat  =  c_otf.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
    *-- End of Insertion AG2K942430 Delivery Note
        IF cf_retcode = 0.
    *-- Determine smartform function module for delivery note
          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
            cf_retcode = sy-subrc.
            PERFORM protocol_update.
          ENDIF.
        ENDIF.
        IF cf_retcode = 0.
    *-- Call smartform delivery note
          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_dlv_delnote       = ls_dlv_delnote
                        is_nast              = nast
    *-- Begin of Insertion AG2K942430 Delivery Note
            IMPORTING
                       document_output_info  = l_t_ssfcrespd
                       job_output_info       = l_t_ssfcrescl
                       job_output_options    = l_t_ssfcresop
    *-- End of Insertion AG2K942430 Delivery Note
             EXCEPTIONS
                        formatting_error     = 1
                        internal_error       = 2
                        send_error           = 3
                        user_canceled        = 4
                        OTHERS               = 5.
          IF sy-subrc <> 0.
    *-- Error handling
            cf_retcode = sy-subrc.
            PERFORM protocol_update.
    *-- Get SmartForm protocol and store it in the NAST protocoll
            PERFORM add_smfrm_prot.
          ENDIF.
        ENDIF.
    *-- Begin of Insertion AG2K942430 Delivery Note
        IF nast-nacha EQ c_5.
          IF NOT l_t_ssfcrescl-otfdata[] IS INITIAL .
            MOVE l_t_ssfcrescl-otfdata[] TO l_t_otf[].
          ENDIF.
          IF NOT l_t_otf[] IS INITIAL.
            IF l_v_hformat IS INITIAL.
              l_v_hformat = c_pdf.
            ENDIF.
            CLEAR   l_t_htline.
            REFRESH l_t_htline.
    *-- Convert OTF Data to PDF Data
            CALL FUNCTION 'CONVERT_OTF'
              EXPORTING
                format                = l_v_hformat
              IMPORTING
                bin_filesize          = l_v_doc_size
                bin_file              = l_v_ld_binfile
              TABLES
                otf                   = l_t_otf
                lines                 = l_t_htline
              EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                OTHERS                = 4.
            IF sy-subrc = 0.
              CLEAR l_t_solix.
              REFRESH l_t_solix.
              CLEAR   l_t_objcont.
              REFRESH l_t_objcont.
              l_v_i = 0.
              l_v_n = XSTRLEN( l_v_ld_binfile ).
              WHILE l_v_i < l_v_n.
                l_t_solix-line = l_v_ld_binfile+l_v_i.
                APPEND l_t_solix.
                CLEAR l_t_solix.
                l_v_i = l_v_i + 255.
              ENDWHILE.
              FIELD-SYMBOLS: <ptr_hex> TYPE solix.
              LOOP AT l_t_solix INTO w_solix.
                CLEAR w_soli.
                ASSIGN w_soli TO <ptr_hex> CASTING.
                MOVE w_solix TO <ptr_hex>.
                APPEND w_soli TO l_t_objcont.
              ENDLOOP.
              IF l_v_hformat = c_pdf.
    *--Do nothing
              ELSE.
                CLEAR   l_t_objcont.
                REFRESH l_t_objcont.
                LOOP AT l_t_htline.
                  l_t_objcont = l_t_htline.
                  APPEND l_t_objcont.
                  CLEAR l_t_htline.
                ENDLOOP.
              ENDIF.
            ENDIF.
    *--To Suppress zero's
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
              EXPORTING
                input  = l_v_document_number
              IMPORTING
                output = l_v_document_number.
            CONCATENATE text-001 l_v_document_number  INTO l_v_var1 SEPARATED BY space.
            l_v_hkora = l_v_var1.
            CLEAR l_t_object_hd_change.
            l_t_object_hd_change-objnam    = c_mail.
            l_t_object_hd_change-objdes    = l_v_hkora.
            l_t_object_hd_change-objla     = sy-langu.
            l_t_object_hd_change-objsns    = c_o.
            l_t_object_hd_change-objlen    = l_v_doc_size .
            IF l_v_hformat = c_pdf.
              l_t_object_hd_change-file_ext  = c_pdf.
            ENDIF.
            CLEAR   l_t_receivers.
            REFRESH l_t_receivers.
            l_t_receivers-recextnam    = l_v_mail.
            l_t_receivers-recesc       = c_e.
            l_t_receivers-sndart       = c_int.
            APPEND l_t_receivers.
            CLEAR l_t_receivers.
            DESCRIBE TABLE l_t_objcont LINES l_v_linecount.
            CLEAR    l_t_objhead.
            REFRESH  l_t_objhead.
            IF l_v_hformat = c_pdf.
              l_v_document_type = c_ext.
            ELSE.
              l_v_document_type = c_raw.
              l_t_objhead = l_v_linecount.
              APPEND l_t_objhead.
              CLEAR l_t_objhead.
            ENDIF.
            l_v_horiginator = sy-uname.
    *--Sending the PDF data as Email attachment
            CALL FUNCTION 'SO_OBJECT_SEND'
              EXPORTING
                object_hd_change           = l_t_object_hd_change
                object_type                = l_v_document_type
                originator                 = l_v_horiginator
                originator_type            = c_b
              IMPORTING
                sent_to_all                = l_v_sent_to_all
              TABLES
                objcont                    = l_t_objcont
                objhead                    = l_t_objhead
                receivers                  = l_t_receivers
              EXCEPTIONS
                active_user_not_exist      = 1
                communication_failure      = 2
                component_not_available    = 3
                folder_not_exist           = 4
                folder_no_authorization    = 5
                forwarder_not_exist        = 6
                note_not_exist             = 7
                object_not_exist           = 8
                object_not_sent            = 9
                object_no_authorization    = 10
                object_type_not_exist      = 11
                operation_no_authorization = 12
                owner_not_exist            = 13
                parameter_error            = 14
                substitute_not_active      = 15
                substitute_not_defined     = 16
                system_failure             = 17
                too_much_receivers         = 18
                user_not_exist             = 19
                originator_not_exist       = 20
                x_error                    = 21
                OTHERS                     = 22.
           IF sy-subrc = 0.
             COMMIT WORK AND WAIT.
           ENDIF.
          ENDIF.
        ENDIF.
    *-- End of Insertion AG2K942430 Delivery Note
    *-- Begin of Insertion AG2K946177 Scan - Avail date
      ELSE.
    *-- Get the details for sending the email
        PERFORM get_details TABLES   t_objparb
                                     t_receivers
                            CHANGING v_obj_type
                                     v_owner
                                     v_sender
                                     w_object_hd_change.
    *-- Sending Email
        PERFORM send_email.
      ENDIF.
    *-- End of Insertion AG2K946177 Scan - Avail date
    ENDFORM.                    "PROCESSING
    *-- Begin of Insertion AG2K946177 Scan - Avail date
    *&      Form  get_details
          Get details for Sending Email
         -->P_T_OBJPARB             Parameter for Dialog Modules
         -->P_T_RECEIVERS           recipient with attributes
         <--P_V_OBJ_TYPE            Code for document class
         <--P_V_OWNER               Owner
         <--P_V_SENDER              Sender
         <--P_W_OBJECT_HD_CHANGE    object definition, change attributes
    FORM get_details  TABLES   p_t_objparb STRUCTURE t_objparb
                               p_t_receivers STRUCTURE t_receivers
                      CHANGING p_v_obj_type
                               p_v_owner
                               p_v_sender
                               p_w_object_hd_change.
      CONSTANTS: c_colon(1)   TYPE c VALUE ':'.
      DATA:
    *-- To Get the Entry from ZZOURULE
            BEGIN OF l_w_zzourule,
              zzvalue1_1 LIKE zzourule-zzvalue1_1,
              zzvalue2_1 LIKE zzourule-zzvalue2_1,
              zzvalue3_1 LIKE zzourule-zzvalue3_1,
            END OF l_w_zzourule,
    *-- To get the entry from sofd
            BEGIN OF l_w_sofd,
              foltp LIKE sofd-foltp,
              folyr LIKE sofd-folyr,
              folno LIKE sofd-folno,
            END OF l_w_sofd,
    *-- To get the entry from sofm
            BEGIN OF l_w_sofm,
              foltp LIKE sofm-foltp,
              folyr LIKE sofm-folyr,
              folno LIKE sofm-folno,
              doctp LIKE sofm-doctp,
              docyr LIKE sofm-docyr,
              docno LIKE sofm-docno,
            END OF l_w_sofm,
            BEGIN OF l_w_swotobjid,
              logsys  LIKE swotobjid-logsys,
              objtype LIKE swotobjid-objtype,
              objkey  LIKE swotobjid-objkey,
            END OF l_w_swotobjid.
      DATA: l_w_header LIKE  sood1-objdes.
    *-- Fill exporting parameters of FM SO_OBJECT_SEND
      CONCATENATE text-004 nast-objky c_colon text-002 INTO l_w_header SEPARATED BY space.
    l_w_header = text-002.
      w_object_hd_change-objla    = sy-langu.
      w_object_hd_change-objnam   = c_notify.
      w_object_hd_change-objdes   = l_w_header.
      v_obj_type = c_raw.
      v_owner    = sy-uname.
      v_sender   = sy-uname.
      t_objparb-name = c_wi_id.
      APPEND t_objparb.
      CLEAR t_objparb.
      t_objparb-name = text-003.
      t_objparb-value = sy-datum.
      APPEND t_objparb.
      CLEAR t_objparb.
    *-- Get the folder Name from the ZZOURULE table
      SELECT zzvalue1_1 zzvalue2_1 zzvalue3_1
      FROM zzourule INTO l_w_zzourule UP TO 1 ROWS
      WHERE zzprog = sy-repid AND
            zzdata = c_oos.
      ENDSELECT.
      IF sy-subrc = 0.
        SELECT foltp folyr folno
               FROM sofd INTO l_w_sofd UP TO 1 ROWS
               WHERE objnam = l_w_zzourule-zzvalue1_1 AND
                     folrg  = c_q.
        ENDSELECT.
        IF sy-subrc = 0.
          SELECT foltp folyr folno doctp docyr docno
                    FROM sofm INTO l_w_sofm UP TO 1 ROWS
            WHERE doctp =      l_w_sofd-foltp AND
                  docyr =      l_w_sofd-folyr AND
                  docno =      l_w_sofd-folno.
          ENDSELECT.
          IF sy-subrc = 0.
            CLEAR t_receivers.
            MOVE l_w_zzourule-zzvalue1_1  TO t_receivers-recnam.
    *-- C means Shared distribution List
            MOVE c_c TO t_receivers-recesc.
            APPEND t_receivers.
            CLEAR t_receivers.
            l_w_swotobjid-logsys  = l_w_zzourule-zzvalue2_1.
            l_w_swotobjid-objtype = l_w_zzourule-zzvalue3_1.
            CONCATENATE l_w_sofm-foltp
                        l_w_sofm-folyr
                        l_w_sofm-folno
                        l_w_sofm-doctp
                        l_w_sofm-docyr
                        l_w_sofm-docno INTO l_w_swotobjid-objkey.
            t_receivers-recextnam = l_w_swotobjid.
    *-- J means external Object
            MOVE c_j TO t_receivers-recesc.
            APPEND t_receivers.
            CLEAR t_receivers.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  send_email
          Sending Email
    FORM send_email .
    *-- Email send to the receipent maintained in the shared folder
      CALL FUNCTION 'SO_OBJECT_SEND'
        EXPORTING
          object_hd_change           = w_object_hd_change
          object_type                = v_obj_type
          owner                      = v_owner
          sender                     = v_sender
        IMPORTING
          object_id_new              = w_object_id_new
          sent_to_all                = v_sent_to_all
        TABLES
          objcont                    = t_objcont
          objhead                    = t_objhead
          objparb                    = t_objparb
          receivers                  = t_receivers
        EXCEPTIONS
          active_user_not_exist      = 1
          communication_failure      = 2
          component_not_available    = 3
          folder_not_exist           = 4
          folder_no_authorization    = 5
          forwarder_not_exist        = 6
          note_not_exist             = 7
          object_not_exist           = 8
          object_not_sent            = 9
          object_no_authorization    = 10
          object_type_not_exist      = 11
          operation_no_authorization = 12
          owner_not_exist            = 13
          parameter_error            = 14
          substitute_not_active      = 15
          substitute_not_defined     = 16
          system_failure             = 17
          too_much_receivers         = 18
          user_not_exist             = 19
          x_error                    = 20
          OTHERS                     = 21.
    ENDFORM.                    " send_email
    *-- End of Insertion AG2K946177 Scan - Avail date

  • Error send a smartform PDF by Email to Vendor

    Hi Expert,
    Please help me.........................
    I want to send a PO (Smartform) as Email to Vendor.
    In SAPScript the PO send by Email is working fine, but in Smartforms it is not working.
    Normally, I will use via Smartforms the Program = YBAA_FM06P, FORM routine = ENTRY_NEU, PDF/Smartform Form = ZYBAA_MMPO1.
    A communication strategy has communication type as INT has been defined.
    This communication strategy has been set as default in the output type ZNEU. The transmission medium has been set to 5 (External Send) and the partner function as VN (Vendor).
    The e-mail address of the vendor has also been maintained.
    In transaction MN04, i have also made an entry for output type ZNEU and set the document type as NB.
    But message output do not create.
    How to send a smartform PDF by Email to vendor?
    Thanks,

    Hi,
    I can convert the PO output in to PDF from SOST I can sent it to external vendor using the Mail triggering configuration settings but meassage output do not create.
    Please tell me how can I do.
    Thank,

  • How to send a SmartForm output as Email to external id?

    I want the Smartform output to email to extrenal email-id.
    I don't want the Smartform output as any kind of attachment, but the Smartform output needs to be shown on the main email body. Can anyone pls. help me out?

    First, thanks for your responses.
    I haven't found the demo program 'BCS_EXAMPLE_6' in SAP 4.7. But then I got it in SAP 5.0 version. But this program only describes how to send Form output as PDF attachment with email. But this is well-known and I haven't asked for this. I want the Smartform output within the mail-body without attachment.
    The weblog at "/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp seems a more logical one, though I have already tried it out. Here the html page creation and graphics load -- everything is going right. But this HTML page is being delivered as an Attachment within the email. The normal HTML Email is not coming. I think this technique wouldn't work with all mailing tools. Here in the weblog, Pavan has shown the example with Microsoft Outlook. But I have tested with Lotus Notes and Yahoo. And In both cases, the mail is coming with attached HTML file (in .mht format), but not as a notmal html mail without attachments.

  • Display and Send the Smartforms

    Hi,
    I send the smartfoms with pdf attachment.
    But My client requirement is send and display the smartform.
    can you please help me.
    Thanks & Regards,
    venkatesh

    After sending the Smartform, you could call the assigned FM again to display the form in print preview mode... something like this:
    wa_control_parameters-no_dialog = 'X'.
    wa_control_parameters-preview = 'X'.
    wa_output_options-tddest = 'LOCL'.
    CALL FUNCTION fmname
      EXPORTING
        control_parameters = wa_control_parameters
        output_options     = wa_output_options
      IMPORTING
        job_output_info    = wa_job_output_info
      EXCEPTIONS
        formatting_error   = 1
        internal_error     = 2
        send_error         = 3
        user_canceled      = 4
        OTHERS             = 5.
    There was a similar thread a few days ago, where the requirement was to download the form in PDF and display it: "OTF end command // missing in OTF data" while converting smartform to pdf
    There is a working test program in that thread, you could replace the downloading part with the email logic that you already wrote. Then call the FM again at the end for the form display.

  • I have three iPads and one iPod and one iPhone.  How can I message between them without sending the message to all of them.  You send the message to your email address but all of them are set up und one account.

    I have three iPads and one iPod and one iPhone.  How can I message between them without sending the message to all of them.  You send the message to your email address but all of them are set up under one account.

    You can have a different receiving email in the Messages app on each device : Settings > Messages > Receive At . I'm not sure that there is a different way to have the message only go to one device.

  • Regarding Pages: I can't access the document I was writting on at all. I have tried to send the document to my email, I've tried to make a copy but nothing seems to work, it just shows up blank.

    Regarding Pages: I was writing using the app Pages when I left the page I was writting on but now I can't access it at all. I have tried to send the document to my email, I've tried to make a copy but nothing seems to work. The document still exists and I can see my writting as I can with all other documents but I can't open that page.

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Connect the iPad to your computer and try to get the document via File sharing
    - Try getting the document from iCloud.com if you are using iCloud

  • How do I make a submit button that sends the form to an email address?

    I can see how to link to an email which then opens up an email someone could attach the form to. But I do not see how to make a button that automatically sends the form to an email address. Can someone provide assistance? Thanks!

    I have the same question. You'd thing this would be a no brainer requirement for a form.

  • I have to send large files like 5MB or biger via mobile phone, but in that cases phone is telling mi to plug in power. And when I do that, there is no problem to send the file. For smaller files there is no problem. How can I solve the problem? Because wh

    I have to send large files like 5MB or biger via mobile phone, but in that cases phone is telling mi to plug in power. And when I do that, there is no problem to send the file. For smaller files there is no problem. How can I solve the problem? Because when I'm not at home I can't plug in the power.

    hi,
    I am sending file from server to client i.e client will request for a file and service will send it back....... no socket connection is there...I am using JBOSS and apache axis.
    pls help me out.....
    Rashi

Maybe you are looking for