SmartForm Header Maintainance.

Hi All,
I had copied a std smartform into my zsmartform and tried to run it for a preview. now it so happens that in the standard smartform there is no hardcoded text in the header of the SmartForm (SF) but i happenend to find out thru debugging that it still displays a header by fetching its records from the STXFTXT DB table based upon the logon language and the formname and text type.Now my problem is there are no records maintained in this DB table for my copied zsmartform. Could you tell me how could i maintain this DB table "STXFTXT" and if not that way then how do i maintain the header for my zsmartform.

Hi,
Actually the procedure goes in this way.
1.Smartform after creation will be assigned to a Transaction from where it is printed(send to spool).
2.With in the Transaction we can assign the text .
For eg: Go to VA02(Change sales order).Pick one sales order .Press enter. Go to menu path : GOTO->header->text,add or change some text.the same will be printed in the assigned smartform.
(i.e) The text which corresponds to that particular SALES ORDER will be printed.
This will update the tables which you have mentioned.

Similar Messages

  • Smartform Header options

    Hi,
    I ma printing a smartform as per the following format:
    Header1
    Header2
    Table
    there are two pages in smartform,the first page includes all the 3 parts mentioned,the second page does not want a Header2
    .I have created Header 2 using a template.Should I create it using a table so as to avoid the blank space between Header1  and table in page 2.
    please advice.
    Thanks.

    Hello,
    If you have created three windows for
    Header1
    Header2
    Table
    copy only header1 and table windows to page 2
    adjust height of table windows so that header2 windows space will be removed.
    Or if all Header1
    Header2
    Table
    are in one window.
    Then copy header1 first from page one and paste at second page
    then copy table and paste in second page.
    Try this

  • Smartforms output as HTML in email

    Hi,
    I want to send the output of a smartform as html in email body.
    I found and used this bolg: :<a href="/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp HTML Email from SAP CRM/ERP</a>
    I did everything as per the blog.
    However I am getting the email as:
    sf @media print {.xsfnoprint{ display : none ;}}/* Default css layout information for SAP Smart Forms (XSF Output) Last modified: 12.05.2003 /@media screen { body { background-color : #EFEFEF ; }}@media screen { .page { border-style : outset ; border-width : 2pt ; background-color : white ; }}/@media print { .page { overflow: hidden; }}// unification browser-dependent settings /table { border-spacing: 0pt; empty-cells: show;}tr { vertical-align: top; }td input img img.icon / End of default.css */.SYSTEM div#B.par{ font-family : "Courier New" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : justify ; clear : both ;}.SYSTEM div#L.par{ font-family : "Courier New" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; clear : both ;}.SYSTEM a.SYSTEM span#H.char{ font-weight : bold ;}.SYSTEM span#I.char{ font-style : italic ;}.SYSTEM span#U.char{ text-decoration : underline ;}#sfPAGE1-001.page@media screen {#MAIN.win{ overflow : auto ;}}@media print {#MAIN.win{ overflow : hidden ;}}#sfPAGE1-001.page #MAIN.win
    Welcome
    <IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48">
    I am using: Lotus notes client for email and my smartform contains only two text elements: one containing text Welcome and other containing text
    <IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48">
    When I display the document using SOST, I get the output as
    Address bar has this:  C:\Documents and Settings\EDC LTIL02\SapWorkDir\TESTHTMLEMAILFROMSMARTFORMOUTPUT_20070928154506.046_X.MHT
    and window contains:
    Welcome
    <IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48"> "
    Regards,
    Reema
    Message was edited by:
            Reema Shahbazkar
    In case anyone needs to have a look at my code:
    REPORT  ZSMARTFORM_2_HTML_EMAIL.
    get generated function module for the smartform
    DATA: FM_NAME TYPE RS38L_FNAM.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSF_SAMPLE_HTML'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = FM_NAME
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    get smartform contetnt
    set smartform output options
    data:
      control_parameters type SSFCTRLOP,
      OUTPUT_OPTIONS     TYPE SSFCOMPOP,
      DOCUMENT_OUTPUT_INFO  TYPE SSFCRESPD,
      JOB_OUTPUT_INFO  TYPE SSFCRESCL,
      JOB_OUTPUT_OPTIONS TYPE SSFCRESOP,
      XSFPARAM_LINE TYPE SSFXSFP,
      P_HTML TYPE TRFRESULT,
      P_GRAPHICS TYPE TSF_XSF_GR,
      WA_RETURN TYPE BAPIRET2.
    CONSTANTS: C_GR_DIR TYPE TDTEXT VALUE '/MYGRAPHICS'.
    control_parameters-NO_DIALOG = 'X'.
    *control_parameters-GETOTF = 'X'.
    OUTPUT_OPTIONS-TDNEWID = SPACE.
    OUTPUT_OPTIONS-TDIMMED = SPACE.
    OUTPUT_OPTIONS-XSFCMODE = 'X'.  "RUNTIME SETTINGS FROM SMARTFORM HEADER TO BE USED
    OUTPUT_OPTIONS-XSF = 'X'.  "XSF OUTPUT ACTIVATED
    OUTPUT_OPTIONS-XSFOUTMODE = 'A'.  "XSF OUTPUT STREAM PASSED DIRECTLY TO CALLING PROGRAM AS AN INTERNAL TABLE.
    CLEAR: OUTPUT_OPTIONS-XSFOUTDEV.  "OUTPUT SPOOL DEVICE
    OUTPUT_OPTIONS-XSFFORMAT = 'X'.  "ADDITIONALLLY TO XSF, HTML AND CSS LAYOUT INFORMATION IS ALSO PASSED TO CALLING PROGRAM
    XSFPARAM_LINE-NAME = 'GRAPHICS'.
    XSFPARAM_LINE-VALUE = 'EXTRACT'.
    APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
    XSFPARAM_LINE-NAME = 'GRAPHICS-DIRECTORY'.
    XSFPARAM_LINE-VALUE = C_GR_DIR.
    APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
    XSFPARAM_LINE-NAME = 'CONTENT-ID'.
    XSFPARAM_LINE-VALUE = 'ENABLE'.
    APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
    CALL GENERATED FUNCTION MODULE TO GET FORM CONTENTS
    CALL FUNCTION FM_NAME
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = CONTROL_PARAMETERS
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = OUTPUT_OPTIONS
      USER_SETTINGS              = 'X'
    IMPORTING
       DOCUMENT_OUTPUT_INFO       = DOCUMENT_OUTPUT_INFO
       JOB_OUTPUT_INFO            = JOB_OUTPUT_INFO
       JOB_OUTPUT_OPTIONS         = 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.
    SEPARATE HTML GRAPHICAL N CSS LAYOUT CONTENT
    P_HTML = JOB_OUTPUT_INFO-XMLOUTPUT-TRFRESULT.
    P_GRAPHICS[] = JOB_OUTPUT_INFO-XMLOUTPUT-XSFGR[].
    PROCEED TO SEND EMAIL
    DATA: HTML_DATA TYPE TRFRESULT,
          L_HTML_RAW LIKE LINE OF HTML_DATA-CONTENT,
          HTML_XSTR TYPE XSTRING.
    CLEAR: HTML_XSTR.
    LOOP AT P_HTML-CONTENT INTO L_HTML_RAW.
      CONCATENATE HTML_XSTR L_HTML_RAW INTO HTML_XSTR IN BYTE MODE.
    ENDLOOP.
    HTML_XSTR = HTML_XSTR(P_HTML-LENGTH).
    SPECIAL CHARACTER CONVERSION
    DATA: HTML_STR TYPE STRING,
          HTML_LEN TYPE I.
    CALL FUNCTION 'SCP_TRANSLATE_CHARS'
      EXPORTING
        INBUFF                   = HTML_XSTR
      INBUFFLG                 = 0
       INCODE                   = '4110'  "utf-8
      OUTBUFFLG                = 0
      OUTCODE                  = '0000'
       CSUBST                   = 'X'
      SUBSTC_HASH              = ' '
      SUBSTC_DOT               = ' '
       SUBSTC_SPACE             = 'x'
      SUBSTC                   = '00035'
    IMPORTING
      INUSED                   =
       OUTBUFF                  = HTML_STR
      OUTOVERFLOW              =
       OUTUSED                  = HTML_LEN
      SUBSTED                  =
      INPUT_ENDS_IN_CHAR       =
      ERRMSG                   =
    EXCEPTIONS
      INVALID_CODEPAGE         = 1
      INTERNAL_ERROR           = 2
      CANNOT_CONVERT           = 3
      FIELDS_BAD_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.
    CHANGE ENCODING UTF-8 TO LATIN1
    REPLACE ALL OCCURRENCES OF 'UTF-8' IN HTML_STR WITH 'iso-8859-1' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '<IMG' IN HTML_STR WITH '<IMG' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '/>' IN HTML_STR WITH '/>' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '<A>' IN HTML_STR WITH '' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '<' IN HTML_STR WITH '<' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '>' IN HTML_STR WITH '>' IGNORING CASE.
    HTML_LEN = STRLEN( HTML_STR ).
    DATA: L_OFFSET TYPE I,
          L_LENGTH TYPE I,
          L_DIFF TYPE I,
          LT_SOLI TYPE SOLI_TAB,
          LS_SOLI TYPE SOLI.
    L_OFFSET = 0.
    L_LENGTH = 255.
    WHILE L_OFFSET < HTML_LEN.
      L_DIFF = HTML_LEN - L_OFFSET.
      IF L_DIFF > L_LENGTH.
        LS_SOLI-LINE = HTML_STR+L_OFFSET(L_LENGTH).
      ELSE.
        LS_SOLI-LINE = HTML_STR+L_OFFSET(L_DIFF).
      ENDIF.
      APPEND LS_SOLI TO LT_SOLI.
      ADD L_LENGTH TO L_OFFSET.
    ENDWHILE.
    DATA: LO_MIME_HELPER TYPE REF TO CL_GBT_MULTIRELATED_SERVICE.
    CREATE OBJECT LO_MIME_HELPER
      EXPORTING
        CODEPAGE = '1133'.
    CALL METHOD LO_MIME_HELPER->SET_MAIN_HTML
      EXPORTING
        CONTENT     = LT_SOLI
       FILENAME    =
       DESCRIPTION =
    HANDLE GRAPHICS
    DATA: L_GRAPHIC TYPE SSF_XSF_GR,
          GR_XSTR TYPE XSTRING,
          L_GR_RAW TYPE BAPICONTEN,
          L_CONTENT_ID TYPE STRING,
          L_CONTENT_TYPE TYPE W3CONTTYPE,
          L_OBJ_LEN TYPE SO_OBJ_LEN,
          L_FILENAME TYPE STRING,
          LT_SOLIX TYPE SOLIX_TAB,
          LS_SOLIX TYPE SOLIX.
    LOOP AT P_GRAPHICS INTO L_GRAPHIC.
      CLEAR: GR_XSTR.
      LOOP AT L_GRAPHIC-CONTENT INTO L_GR_RAW.
        CONCATENATE GR_XSTR L_GR_RAW-LINE INTO GR_XSTR IN BYTE MODE.
      ENDLOOP.
      GR_XSTR = GR_XSTR(L_GRAPHIC-LENGTH).
      L_OFFSET = 0.
      L_LENGTH = 255.
      CLEAR LT_SOLIX[].
      WHILE L_OFFSET < L_GRAPHIC-LENGTH.
        L_DIFF = L_GRAPHIC-LENGTH - L_OFFSET.
        IF L_DIFF > L_LENGTH.
          LS_SOLIX-LINE = GR_XSTR+L_OFFSET(L_LENGTH).
        ELSE.
          LS_SOLIX-LINE = GR_XSTR+L_OFFSET(L_DIFF).
        ENDIF.
        APPEND LS_SOLIX TO LT_SOLIX.
        ADD L_LENGTH TO L_OFFSET.
      ENDWHILE.
      CONCATENATE C_GR_DIR L_GRAPHIC-GRAPHICS '.BMP' INTO L_FILENAME.
      CONCATENATE C_GR_DIR L_GRAPHIC-GRAPHICS '.BMP' INTO L_CONTENT_ID.
      L_CONTENT_TYPE = L_GRAPHIC-HTTPTYPE.
      L_OBJ_LEN = L_GRAPHIC-LENGTH.
    ADD IMAGES TO EMAIL
      CALL METHOD LO_MIME_HELPER->ADD_BINARY_PART
        EXPORTING
          CONTENT      = LT_SOLIX
         FILENAME     =
         EXTENSION    =
         DESCRIPTION  =
          CONTENT_TYPE = L_CONTENT_TYPE
          LENGTH       = L_OBJ_LEN
          CONTENT_ID   = L_CONTENT_ID
    ENDLOOP.
    DATA: LO_DOC_BCS TYPE REF TO CL_DOCUMENT_BCS,
          P_SUBJECT TYPE SO_OBJ_DES,
          LV_GBT_MIME TYPE REF TO CX_GBT_MIME,
          LV_BCOM_MIME TYPE REF TO CX_BCOM_MIME,
          LV_DOCUMENT_BCS TYPE REF TO CX_DOCUMENT_BCS.
      P_SUBJECT = 'TEST HTML EMAIL FROM SMARTFORM OUTPUT'.
      TRY.
      CALL METHOD CL_DOCUMENT_BCS=>CREATE_FROM_MULTIRELATED
        EXPORTING
          I_SUBJECT          = P_SUBJECT
          I_LANGUAGE         = SY-LANGU
          I_IMPORTANCE       = '5'
          I_SENSITIVITY      = 'F'
          I_MULTIREL_SERVICE = LO_MIME_HELPER
        RECEIVING
          RESULT             = LO_DOC_BCS
       CATCH CX_DOCUMENT_BCS INTO LV_DOCUMENT_BCS.
       CATCH CX_BCOM_MIME INTO LV_BCOM_MIME.
       CATCH CX_GBT_MIME INTO LV_GBT_MIME.
      ENDTRY.
    RECEIVERS
    DATA: P_RECEIVERS TYPE TABLE OF SOMLRECI1,
          RECEIVER TYPE SOMLRECI1,
          L_MAIL_ADDRESS TYPE AD_SMTPADR,
          LO_BCS TYPE REF TO CL_BCS,
          LV_SEND_REQ_BCS TYPE REF TO CX_SEND_REQ_BCS,
          L_USERNAME TYPE UNAME,
          SEND_PARTNER TYPE BU_PARTNER,
          LI_SENDER TYPE REF TO IF_SENDER_BCS,
          LV_ADDRESS_BCS TYPE REF TO CX_ADDRESS_BCS,
          LV_SENT_TO_ALL TYPE BOOLEAN.
    CLEAR RECEIVER.
    RECEIVER-RECEIVER = '[email protected]'.
    RECEIVER-REC_TYPE = 'U'.
    RECEIVER-COM_TYPE = 'INT'.
    APPEND RECEIVER TO P_RECEIVERS.
    L_USERNAME = SY-UNAME.
    CLEAR RECEIVER.
    LOOP AT P_RECEIVERS INTO RECEIVER.
      L_MAIL_ADDRESS = RECEIVER-RECEIVER.
      TRY.
      CALL METHOD CL_BCS=>CREATE_PERSISTENT
        RECEIVING
          RESULT = LO_BCS
       CALL METHOD LO_BCS->SET_DOCUMENT
         EXPORTING
           I_DOCUMENT = LO_DOC_BCS
       CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
      ENDTRY.
    CREATE SENDER
    CLASS CL_CAM_ADDRESS_BCS DEFINITION LOAD.
    TRY.
      IF L_USERNAME NS '@'.
        L_USERNAME = SEND_PARTNER.
        TRANSLATE L_USERNAME TO UPPER CASE.
        LI_SENDER ?= CL_SAPUSER_BCS=>CREATE( L_USERNAME ).
      ELSE.
        DATA: L_FROM_MAIL_ADDRESS TYPE AD_SMTPADR.
        L_FROM_MAIL_ADDRESS = L_USERNAME.
        LI_SENDER ?= CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( I_ADDRESS_STRING = L_FROM_MAIL_ADDRESS ).
      ENDIF.
      CALL METHOD LO_BCS->SET_SENDER
        EXPORTING
          I_SENDER = LI_SENDER
    CATCH CX_ADDRESS_BCS INTO LV_ADDRESS_BCS.
    CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
    ENDTRY.
    create recepient
    data: LO_RECEPIENT TYPE REF TO IF_RECIPIENT_BCS.
    TRY.
    CALL METHOD CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS
       EXPORTING
         I_ADDRESS_STRING = L_MAIL_ADDRESS
        I_ADDRESS_NAME   =
        I_INCL_SAPUSER   =
       RECEIVING
         RESULT           = LO_RECEPIENT
      CATCH CX_ADDRESS_BCS INTO LV_ADDRESS_BCS.
    ENDTRY.
    TRY.
    CALL METHOD LO_BCS->ADD_RECIPIENT
       EXPORTING
         I_RECIPIENT  = LO_RECEPIENT
        I_EXPRESS    =
        I_COPY       =
        I_BLIND_COPY =
        I_NO_FORWARD =
      CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
    ENDTRY.
    SEND EMAIL DOCUMENT
    TRY.
    CALL METHOD LO_BCS->SEND_REQUEST->SET_REQUESTED_STATUS
      EXPORTING
        I_REQUESTED_STATUS = 'N'
    TRY.
    CALL METHOD LO_BCS->SEND
    EXPORTING
       I_WITH_ERROR_SCREEN = SPACE
      RECEIVING
        RESULT              = LV_SENT_TO_ALL
    CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
    ENDTRY.
    ENDTRY.
    ENDLOOP.
    COMMIT WORK.

    Hi,
    I want to send the output of a smartform as html in email body.
    I found and used this bolg: :<a href="/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp HTML Email from SAP CRM/ERP</a>
    I did everything as per the blog.
    However I am getting the email as:
    sf @media print {.xsfnoprint{ display : none ;}}/* Default css layout information for SAP Smart Forms (XSF Output) Last modified: 12.05.2003 /@media screen { body { background-color : #EFEFEF ; }}@media screen { .page { border-style : outset ; border-width : 2pt ; background-color : white ; }}/@media print { .page { overflow: hidden; }}// unification browser-dependent settings /table { border-spacing: 0pt; empty-cells: show;}tr { vertical-align: top; }td input img img.icon / End of default.css */.SYSTEM div#B.par{ font-family : "Courier New" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : justify ; clear : both ;}.SYSTEM div#L.par{ font-family : "Courier New" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; clear : both ;}.SYSTEM a.SYSTEM span#H.char{ font-weight : bold ;}.SYSTEM span#I.char{ font-style : italic ;}.SYSTEM span#U.char{ text-decoration : underline ;}#sfPAGE1-001.page@media screen {#MAIN.win{ overflow : auto ;}}@media print {#MAIN.win{ overflow : hidden ;}}#sfPAGE1-001.page #MAIN.win
    Welcome
    <IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48">
    I am using: Lotus notes client for email and my smartform contains only two text elements: one containing text Welcome and other containing text
    <IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48">
    When I display the document using SOST, I get the output as
    Address bar has this:  C:\Documents and Settings\EDC LTIL02\SapWorkDir\TESTHTMLEMAILFROMSMARTFORMOUTPUT_20070928154506.046_X.MHT
    and window contains:
    Welcome
    <IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48"> "
    Regards,
    Reema
    Message was edited by:
            Reema Shahbazkar
    In case anyone needs to have a look at my code:
    REPORT  ZSMARTFORM_2_HTML_EMAIL.
    get generated function module for the smartform
    DATA: FM_NAME TYPE RS38L_FNAM.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSF_SAMPLE_HTML'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = FM_NAME
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    get smartform contetnt
    set smartform output options
    data:
      control_parameters type SSFCTRLOP,
      OUTPUT_OPTIONS     TYPE SSFCOMPOP,
      DOCUMENT_OUTPUT_INFO  TYPE SSFCRESPD,
      JOB_OUTPUT_INFO  TYPE SSFCRESCL,
      JOB_OUTPUT_OPTIONS TYPE SSFCRESOP,
      XSFPARAM_LINE TYPE SSFXSFP,
      P_HTML TYPE TRFRESULT,
      P_GRAPHICS TYPE TSF_XSF_GR,
      WA_RETURN TYPE BAPIRET2.
    CONSTANTS: C_GR_DIR TYPE TDTEXT VALUE '/MYGRAPHICS'.
    control_parameters-NO_DIALOG = 'X'.
    *control_parameters-GETOTF = 'X'.
    OUTPUT_OPTIONS-TDNEWID = SPACE.
    OUTPUT_OPTIONS-TDIMMED = SPACE.
    OUTPUT_OPTIONS-XSFCMODE = 'X'.  "RUNTIME SETTINGS FROM SMARTFORM HEADER TO BE USED
    OUTPUT_OPTIONS-XSF = 'X'.  "XSF OUTPUT ACTIVATED
    OUTPUT_OPTIONS-XSFOUTMODE = 'A'.  "XSF OUTPUT STREAM PASSED DIRECTLY TO CALLING PROGRAM AS AN INTERNAL TABLE.
    CLEAR: OUTPUT_OPTIONS-XSFOUTDEV.  "OUTPUT SPOOL DEVICE
    OUTPUT_OPTIONS-XSFFORMAT = 'X'.  "ADDITIONALLLY TO XSF, HTML AND CSS LAYOUT INFORMATION IS ALSO PASSED TO CALLING PROGRAM
    XSFPARAM_LINE-NAME = 'GRAPHICS'.
    XSFPARAM_LINE-VALUE = 'EXTRACT'.
    APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
    XSFPARAM_LINE-NAME = 'GRAPHICS-DIRECTORY'.
    XSFPARAM_LINE-VALUE = C_GR_DIR.
    APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
    XSFPARAM_LINE-NAME = 'CONTENT-ID'.
    XSFPARAM_LINE-VALUE = 'ENABLE'.
    APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
    CALL GENERATED FUNCTION MODULE TO GET FORM CONTENTS
    CALL FUNCTION FM_NAME
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = CONTROL_PARAMETERS
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = OUTPUT_OPTIONS
      USER_SETTINGS              = 'X'
    IMPORTING
       DOCUMENT_OUTPUT_INFO       = DOCUMENT_OUTPUT_INFO
       JOB_OUTPUT_INFO            = JOB_OUTPUT_INFO
       JOB_OUTPUT_OPTIONS         = 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.
    SEPARATE HTML GRAPHICAL N CSS LAYOUT CONTENT
    P_HTML = JOB_OUTPUT_INFO-XMLOUTPUT-TRFRESULT.
    P_GRAPHICS[] = JOB_OUTPUT_INFO-XMLOUTPUT-XSFGR[].
    PROCEED TO SEND EMAIL
    DATA: HTML_DATA TYPE TRFRESULT,
          L_HTML_RAW LIKE LINE OF HTML_DATA-CONTENT,
          HTML_XSTR TYPE XSTRING.
    CLEAR: HTML_XSTR.
    LOOP AT P_HTML-CONTENT INTO L_HTML_RAW.
      CONCATENATE HTML_XSTR L_HTML_RAW INTO HTML_XSTR IN BYTE MODE.
    ENDLOOP.
    HTML_XSTR = HTML_XSTR(P_HTML-LENGTH).
    SPECIAL CHARACTER CONVERSION
    DATA: HTML_STR TYPE STRING,
          HTML_LEN TYPE I.
    CALL FUNCTION 'SCP_TRANSLATE_CHARS'
      EXPORTING
        INBUFF                   = HTML_XSTR
      INBUFFLG                 = 0
       INCODE                   = '4110'  "utf-8
      OUTBUFFLG                = 0
      OUTCODE                  = '0000'
       CSUBST                   = 'X'
      SUBSTC_HASH              = ' '
      SUBSTC_DOT               = ' '
       SUBSTC_SPACE             = 'x'
      SUBSTC                   = '00035'
    IMPORTING
      INUSED                   =
       OUTBUFF                  = HTML_STR
      OUTOVERFLOW              =
       OUTUSED                  = HTML_LEN
      SUBSTED                  =
      INPUT_ENDS_IN_CHAR       =
      ERRMSG                   =
    EXCEPTIONS
      INVALID_CODEPAGE         = 1
      INTERNAL_ERROR           = 2
      CANNOT_CONVERT           = 3
      FIELDS_BAD_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.
    CHANGE ENCODING UTF-8 TO LATIN1
    REPLACE ALL OCCURRENCES OF 'UTF-8' IN HTML_STR WITH 'iso-8859-1' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '<IMG' IN HTML_STR WITH '<IMG' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '/>' IN HTML_STR WITH '/>' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '<A>' IN HTML_STR WITH '' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '<' IN HTML_STR WITH '<' IGNORING CASE.
    REPLACE ALL OCCURRENCES OF '>' IN HTML_STR WITH '>' IGNORING CASE.
    HTML_LEN = STRLEN( HTML_STR ).
    DATA: L_OFFSET TYPE I,
          L_LENGTH TYPE I,
          L_DIFF TYPE I,
          LT_SOLI TYPE SOLI_TAB,
          LS_SOLI TYPE SOLI.
    L_OFFSET = 0.
    L_LENGTH = 255.
    WHILE L_OFFSET < HTML_LEN.
      L_DIFF = HTML_LEN - L_OFFSET.
      IF L_DIFF > L_LENGTH.
        LS_SOLI-LINE = HTML_STR+L_OFFSET(L_LENGTH).
      ELSE.
        LS_SOLI-LINE = HTML_STR+L_OFFSET(L_DIFF).
      ENDIF.
      APPEND LS_SOLI TO LT_SOLI.
      ADD L_LENGTH TO L_OFFSET.
    ENDWHILE.
    DATA: LO_MIME_HELPER TYPE REF TO CL_GBT_MULTIRELATED_SERVICE.
    CREATE OBJECT LO_MIME_HELPER
      EXPORTING
        CODEPAGE = '1133'.
    CALL METHOD LO_MIME_HELPER->SET_MAIN_HTML
      EXPORTING
        CONTENT     = LT_SOLI
       FILENAME    =
       DESCRIPTION =
    HANDLE GRAPHICS
    DATA: L_GRAPHIC TYPE SSF_XSF_GR,
          GR_XSTR TYPE XSTRING,
          L_GR_RAW TYPE BAPICONTEN,
          L_CONTENT_ID TYPE STRING,
          L_CONTENT_TYPE TYPE W3CONTTYPE,
          L_OBJ_LEN TYPE SO_OBJ_LEN,
          L_FILENAME TYPE STRING,
          LT_SOLIX TYPE SOLIX_TAB,
          LS_SOLIX TYPE SOLIX.
    LOOP AT P_GRAPHICS INTO L_GRAPHIC.
      CLEAR: GR_XSTR.
      LOOP AT L_GRAPHIC-CONTENT INTO L_GR_RAW.
        CONCATENATE GR_XSTR L_GR_RAW-LINE INTO GR_XSTR IN BYTE MODE.
      ENDLOOP.
      GR_XSTR = GR_XSTR(L_GRAPHIC-LENGTH).
      L_OFFSET = 0.
      L_LENGTH = 255.
      CLEAR LT_SOLIX[].
      WHILE L_OFFSET < L_GRAPHIC-LENGTH.
        L_DIFF = L_GRAPHIC-LENGTH - L_OFFSET.
        IF L_DIFF > L_LENGTH.
          LS_SOLIX-LINE = GR_XSTR+L_OFFSET(L_LENGTH).
        ELSE.
          LS_SOLIX-LINE = GR_XSTR+L_OFFSET(L_DIFF).
        ENDIF.
        APPEND LS_SOLIX TO LT_SOLIX.
        ADD L_LENGTH TO L_OFFSET.
      ENDWHILE.
      CONCATENATE C_GR_DIR L_GRAPHIC-GRAPHICS '.BMP' INTO L_FILENAME.
      CONCATENATE C_GR_DIR L_GRAPHIC-GRAPHICS '.BMP' INTO L_CONTENT_ID.
      L_CONTENT_TYPE = L_GRAPHIC-HTTPTYPE.
      L_OBJ_LEN = L_GRAPHIC-LENGTH.
    ADD IMAGES TO EMAIL
      CALL METHOD LO_MIME_HELPER->ADD_BINARY_PART
        EXPORTING
          CONTENT      = LT_SOLIX
         FILENAME     =
         EXTENSION    =
         DESCRIPTION  =
          CONTENT_TYPE = L_CONTENT_TYPE
          LENGTH       = L_OBJ_LEN
          CONTENT_ID   = L_CONTENT_ID
    ENDLOOP.
    DATA: LO_DOC_BCS TYPE REF TO CL_DOCUMENT_BCS,
          P_SUBJECT TYPE SO_OBJ_DES,
          LV_GBT_MIME TYPE REF TO CX_GBT_MIME,
          LV_BCOM_MIME TYPE REF TO CX_BCOM_MIME,
          LV_DOCUMENT_BCS TYPE REF TO CX_DOCUMENT_BCS.
      P_SUBJECT = 'TEST HTML EMAIL FROM SMARTFORM OUTPUT'.
      TRY.
      CALL METHOD CL_DOCUMENT_BCS=>CREATE_FROM_MULTIRELATED
        EXPORTING
          I_SUBJECT          = P_SUBJECT
          I_LANGUAGE         = SY-LANGU
          I_IMPORTANCE       = '5'
          I_SENSITIVITY      = 'F'
          I_MULTIREL_SERVICE = LO_MIME_HELPER
        RECEIVING
          RESULT             = LO_DOC_BCS
       CATCH CX_DOCUMENT_BCS INTO LV_DOCUMENT_BCS.
       CATCH CX_BCOM_MIME INTO LV_BCOM_MIME.
       CATCH CX_GBT_MIME INTO LV_GBT_MIME.
      ENDTRY.
    RECEIVERS
    DATA: P_RECEIVERS TYPE TABLE OF SOMLRECI1,
          RECEIVER TYPE SOMLRECI1,
          L_MAIL_ADDRESS TYPE AD_SMTPADR,
          LO_BCS TYPE REF TO CL_BCS,
          LV_SEND_REQ_BCS TYPE REF TO CX_SEND_REQ_BCS,
          L_USERNAME TYPE UNAME,
          SEND_PARTNER TYPE BU_PARTNER,
          LI_SENDER TYPE REF TO IF_SENDER_BCS,
          LV_ADDRESS_BCS TYPE REF TO CX_ADDRESS_BCS,
          LV_SENT_TO_ALL TYPE BOOLEAN.
    CLEAR RECEIVER.
    RECEIVER-RECEIVER = '[email protected]'.
    RECEIVER-REC_TYPE = 'U'.
    RECEIVER-COM_TYPE = 'INT'.
    APPEND RECEIVER TO P_RECEIVERS.
    L_USERNAME = SY-UNAME.
    CLEAR RECEIVER.
    LOOP AT P_RECEIVERS INTO RECEIVER.
      L_MAIL_ADDRESS = RECEIVER-RECEIVER.
      TRY.
      CALL METHOD CL_BCS=>CREATE_PERSISTENT
        RECEIVING
          RESULT = LO_BCS
       CALL METHOD LO_BCS->SET_DOCUMENT
         EXPORTING
           I_DOCUMENT = LO_DOC_BCS
       CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
      ENDTRY.
    CREATE SENDER
    CLASS CL_CAM_ADDRESS_BCS DEFINITION LOAD.
    TRY.
      IF L_USERNAME NS '@'.
        L_USERNAME = SEND_PARTNER.
        TRANSLATE L_USERNAME TO UPPER CASE.
        LI_SENDER ?= CL_SAPUSER_BCS=>CREATE( L_USERNAME ).
      ELSE.
        DATA: L_FROM_MAIL_ADDRESS TYPE AD_SMTPADR.
        L_FROM_MAIL_ADDRESS = L_USERNAME.
        LI_SENDER ?= CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( I_ADDRESS_STRING = L_FROM_MAIL_ADDRESS ).
      ENDIF.
      CALL METHOD LO_BCS->SET_SENDER
        EXPORTING
          I_SENDER = LI_SENDER
    CATCH CX_ADDRESS_BCS INTO LV_ADDRESS_BCS.
    CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
    ENDTRY.
    create recepient
    data: LO_RECEPIENT TYPE REF TO IF_RECIPIENT_BCS.
    TRY.
    CALL METHOD CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS
       EXPORTING
         I_ADDRESS_STRING = L_MAIL_ADDRESS
        I_ADDRESS_NAME   =
        I_INCL_SAPUSER   =
       RECEIVING
         RESULT           = LO_RECEPIENT
      CATCH CX_ADDRESS_BCS INTO LV_ADDRESS_BCS.
    ENDTRY.
    TRY.
    CALL METHOD LO_BCS->ADD_RECIPIENT
       EXPORTING
         I_RECIPIENT  = LO_RECEPIENT
        I_EXPRESS    =
        I_COPY       =
        I_BLIND_COPY =
        I_NO_FORWARD =
      CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
    ENDTRY.
    SEND EMAIL DOCUMENT
    TRY.
    CALL METHOD LO_BCS->SEND_REQUEST->SET_REQUESTED_STATUS
      EXPORTING
        I_REQUESTED_STATUS = 'N'
    TRY.
    CALL METHOD LO_BCS->SEND
    EXPORTING
       I_WITH_ERROR_SCREEN = SPACE
      RECEIVING
        RESULT              = LV_SENT_TO_ALL
    CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
    ENDTRY.
    ENDTRY.
    ENDLOOP.
    COMMIT WORK.

  • Smartforms error

    Hi experts
    i did a print prg for sending the pdf attachment by smartforms.
    but it's getting dumpped,this is my code
    plz help me,its urgent.
    i checked even SDN Forums also.i made some changes,
    even though i don't get the output.
    it shows not matching the I_OBJBIN in "SO_NEW_DOCUMENT_ATT_SEND_API1" function module.
    REPORT  ZCS_SF6.
    Internal Table declarations
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          i_tline TYPE TABLE OF tline WITH HEADER LINE,                i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,        i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,     
    Objects to send mail.
          i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,  
          i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
          w_objhead TYPE soli_tab,     
          w_ctrlop TYPE ssfctrlop,
          w_compop TYPE ssfcompop,
          w_return TYPE ssfcrescl,     
          w_doc_chng typE sodocchgi1,  
          w_data TYPE sodocchgi1,
          w_buffer TYPE string,       
    Variables declarations
          v_form_name TYPE rs38l_fnam,
          v_len_in LIKE sood-objlen,   
          v_len_out LIKE sood-objlen,  
          v_len_outn TYPE i,
          v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
      formname = 'ZCS_FORM6'
    importing
      fm_name = v_form_name
    exceptions
      no_form = 1
      no_function_module = 2
      others = 3.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION v_form_name
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = W_CTRLOP
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = W_COMPOP
       USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = W_RETURN
      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.
    i_otf[] = w_return-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format = 'PDF'              
      max_linewidth = 132         
    LINES-TDLINE
    IMPORTING
      bin_filesize = v_len_in     
    TABLES
      otf = i_otf                 
      lines = i_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.
    Convert PDF from 132 to 255.
    LOOP AT i_tline.
    Replacing space by ~
    TRANSLATE i_tline USING '~'.
    CONCATENATE w_buffer i_tline INTO w_buffer.
    ENDLOOP.
    Replacing ~ by space
    TRANSLATE w_buffer USING '~'.
    DO.
    i_record = w_buffer.
    Appending 255 characters as a record
    APPEND i_record.
    SHIFT w_buffer LEFT BY 255 PLACES.
    IF w_buffer IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Attachment
    Refresh: i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
    clear w_objhead.
    Object with PDF.
    i_objbin[] = i_record[].
    *******DESCRIBE TABLE i_objbin LINES v_lines_bin.
    Object with main text of the mail.
    i_objtxt = 'Find attached the output of the smart form.'.
    APPEND i_objtxt.
    *i_objtxt = 'Regards,'.
    *APPEND i_objtxt.
    *i_objtxt = 'Chandu'.
    *APPEND i_objtxt.
    DESCRIBE TABLE i_objtxt LINES v_lines_txt.
    read table i_objtxt index v_lines_txt.
    Document information.
    w_doc_chng-obj_name = 'Smartform'.         
    w_doc_chng-expiry_dat = sy-datum + 10.     
    w_doc_chng-obj_descr = 'Smart form output'.
    w_doc_chng-sensitivty = 'F'.               
    w_doc_chng-doc_size = v_lines_txt * 255.   
    Pack to main body as RAW.
    CLEAR i_objpack-transf_bin.         
    i_objpack-head_start = 1.           
    i_objpack-head_num = 0.             
    i_objpack-body_start = 1.           
    i_objpack-body_num = v_lines_txt.   
    i_objpack-doc_type = 'RAW'.   
    APPEND i_objpack.
    Packing as PDF.
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 1.
    i_objpack-body_start = 1.
    describe table i_objbin lines v_lines_bin.
    read table i_objbin index v_lines_bin.
    i_objpack-doc_size = v_lines_bin * 255.    
    i_objpack-body_num = v_lines_bin.          
    i_objpack-doc_type = 'PDF'.                
    i_objpack-obj_name = 'Smartform'.          
    i_objpack-obj_descr = 'sf output'
    APPEND i_objpack.
    Document information.
    CLEAR i_reclist.
    e-mail receivers.
    i_reclist-receiver = '[email protected]'. 
    *i_reclist-express = 'X'.    "Send express
    i_reclist-rec_type = 'U'.                             
    APPEND i_reclist.
    Sending mail.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data = w_doc_chng 
      put_in_outbox = 'X'        
    TABLES
      packing_list = i_objpack   
      object_header = w_objhead  
      contents_hex = i_objbin    
      contents_txt = i_objtxt    
      receivers = i_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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    points wl be rewarded,if it is useful
    thanks in advance.

    HI,
      Here is the complete program for you.. I have done the same requirment..
                 P R O G R A M     D E C L A R A T I O N                 *
    PROGRAM ID            : ZF_QUERY_BANK
    AUTHOR                : Mahesh Raganmoni
    OWNER(Process Team)   :
    CREATE DATE           : 03/04/2004
    R/3 RELEASE VERSION   : 4.72
    BASED-ON PROGRAM      : none
    ADS                   : BP14.B&CF.301
    DESCRIPTION           : This program calles the Bank Query Smartform
                            and sends this smartforms as an email to the
                            bank
    MODIFICATION LOG CONTROL (Most recent on top):
    DATE             AUTHOR              CTS REQ     DESCRIPTION
    *09/13/2004    Mahesh Raganmoni        DR1K901766  Original Version    *
                          T   A   B   L   E   S                          *
    TABLES : BUT021, "BP: Address usages
             BUT020, "BP: Addresses
             T001,   "Company Codes
             DFKKZP, "Payment lot: Data for payment
             BUT000, "BP: General data I
             ADR3,   "Fax Numbers (Business Address Services)
             BNKA,   "Bank master record
             T012.   "House Banks
                            Internal Tables                       *
    *Address Details of Business Partner
    DATA :IT_ADDRESS LIKE STANDARD TABLE OF BUS020_EXT WITH HEADER LINE.
    *Return Table
    DATA :  IT_RETURN LIKE STANDARD TABLE OF BAPIRET2.
    PDF Data to hold the data to be sent as an attachment
    DATA : IT_PDF_NUC_DATA TYPE STANDARD TABLE OF SOLI.
    Converted data from OTF
    DATA : IT_PDF_TABLE TYPE RCL_BAG_TLINE.
    Data Declaration for Sendig Email
    DATA: IT_OBJPACK    LIKE SOPCKLSTI1 OCCURS  1 WITH HEADER LINE,
          IT_OBJHEAD    LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE,
          IT_OBJTXT     LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          IT_OBJBIN     LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          IT_OBJHEX     LIKE SOLIX      OCCURS 10 WITH HEADER LINE,
          IT_RECLIST    LIKE SOMLRECI1  OCCURS  1 WITH HEADER LINE,
          IT_LISTOBJECT LIKE ABAPLIST   OCCURS  1 WITH HEADER LINE.
                             Structures                            *
    DATA :WA_BUS000 TYPE BUS000_EXT,         "Business Partner Details
          WA_ADDRESS TYPE BAPIADDR3,         "Collector Address
          WA_OUTPUT_OPTIONS TYPE SSFCOMPOP,
          WA_CONTROL_PARAMETERS TYPE SSFCTRLOP,
          WA_OUTPUT_DATA TYPE SSFCRESCL,
          WA_HEADER TYPE ZFCOLL_HEADER,  "Smartform Header Info
          WA_DFKKZP TYPE DFKKZP,
          WA_DOCDATA    LIKE SODOCCHGI1.
                             Variables                             *
    DATA : W_FORMNAME TYPE TDSFNAME,             "Smartform Name
           W_NAME_ORG TYPE CHAR35,               "Business Partner Name
           W_ADDRNUMBER LIKE BUT021-ADDRNUMBER,  "Address Number of BP
           W_ADDRESS1 TYPE CHAR35,               "Address Line 1
           W_ADDRESS2 TYPE CHAR35,               "Address Line 2
           W_ADDRESS3 TYPE CHAR35,               "Address Line 3
           W_GE_NAME TYPE CHAR35,                "GE Contact Name
           W_GE_PHONE TYPE CHAR35,               "GE Contact Phone
           W_GE_PHONE1 TYPE CHAR35,               "GE Contact Phone
           W_GE_PHONE_EX TYPE CHAR10,               "GE Contact Phone
           W_GE_EMAIL TYPE CHAR35,               "GE Contact Email
           W_CLIENT_NAME TYPE CHAR30,            "Client Name
           W_GE_FAX TYPE CHAR35,                 "GE Fax No
           W_GE_FAX1 TYPE CHAR35,                "GE Fax No
           W_CLIENT_FAX TYPE CHAR35,             "Client's Fax No
           W_PDF_LEN TYPE I,                     "Length of PDF file
           W_ERR_MESG(120) TYPE C,               "Error Message
           W_ORG1R LIKE DFKKCR-ORG1R,            "Company Code
           W_REFERENCE LIKE DFKKCR-REFERENCE,    "Payment Reference
           W_FNAME TYPE RS38L_FNAM,              "Smartform Function Module
                                                 "     Name
           W_SFNAME TYPE TDSFNAME,   " Smart Form Name
           W_BANKN TYPE CHAR18,   "Bank Account Number
           W_BETRZ TYPE CHAR15,   " Credit AMount
           W_WAERS TYPE CHAR5,    " Credit Currency
           W_VALUT TYPE DFKKZP-VALUT.   " Value Date
    VARIABLES FOR EMAIL
    DATA: W_TAB_LINES  TYPE I,
          W_DOC_SIZE   TYPE I,
          W_ATT_TYPE   LIKE SOODK-OBJTP,
          W_DATFM TYPE XUDATFM.
    VARIABLES FOR DATE
    DATA: W_DAY(2) TYPE C,
          W_MONTH(2) TYPE C,
          W_YEAR(4) TYPE C,
          W_DATE(10) TYPE C.
                             Constants                            *
    DATA : C_SELECTED TYPE C VALUE 'X', "Constant for Checked
           C_COMMA(2) TYPE C VALUE ', ',"Constant for  Comma
           C_HYPHEN TYPE C VALUE '-'.   "Constant for Hypen
                      Selection Screen                            *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: P_KEYZ1 TYPE RFKZ0-KEYZ1 OBLIGATORY, "Payment Lot
                P_POSZA TYPE DFKKZP-POSZA OBLIGATORY. "Item Number
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: P_REMIT TYPE C AS CHECKBOX DEFAULT 'X', " Remitter Form
                P_GENRL TYPE C AS CHECKBOX USER-COMMAND RG1, " General Form
                P_TEXT TYPE AD_SMTPADR  MODIF ID SC1. " Free Text
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS:P_MAIL TYPE C AS CHECKBOX USER-COMMAND RG2, "Send Email
              P_MAILID TYPE AD_SMTPADR MODIF ID SC2.
    SELECTION-SCREEN END OF BLOCK b3.
                     Initialization                               *
    WA_OUTPUT_OPTIONS-XDFCMODE = 'X'.
    WA_OUTPUT_OPTIONS-XDF =  SPACE.
    WA_OUTPUT_OPTIONS-XSFCMODE = 'X'.
    WA_OUTPUT_OPTIONS-XDF = SPACE.
              At Selection Screen Output                          *
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'SC1'.
          IF P_GENRL = C_SELECTED.
            SCREEN-INPUT = 1.
          ELSE.
            CLEAR P_TEXT.
            SCREEN-INPUT = 0.
          ENDIF.
        ENDIF.
        IF SCREEN-GROUP1 = 'SC2'.
          IF P_MAIL = C_SELECTED.
            SCREEN-INPUT = 1.
          ELSE.
            CLEAR P_MAILID.
            SCREEN-INPUT = 0.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    AT SELECTION-SCREEN.
      IF P_REMIT NE C_SELECTED AND P_GENRL NE C_SELECTED.
        MESSAGE E004 WITH TEXT-004.
      ENDIF.
                      Start of selection                          *
    START-OF-SELECTION.
      IF P_GENRL EQ C_SELECTED.
        IF P_TEXT IS INITIAL.
          MESSAGE I004 WITH TEXT-023.
          STOP.
        ENDIF.
      ENDIF.
      IF P_MAIL EQ C_SELECTED.
        IF P_MAILID IS INITIAL.
          MESSAGE I004 WITH TEXT-005.
          STOP.
        ENDIF.
      ENDIF.
    **Getting Payment Lot and Payment Lot number
      PERFORM GET_PAYMENT_DETAILS.
      IF NOT WA_DFKKZP IS INITIAL.
    Getting the Bank  Details
        PERFORM GET_BANK_DETAILS.
    **Getting the  Ge Contact Details
        PERFORM GET_GE_CONTACT_DETAILS .
    Populating the Structure fields to pass to smartform
        PERFORM FILL_EXPORT_STRUCTURES.
        CLEAR W_FNAME.
    Getting the Function Module name for the Smartform
        IF  P_REMIT EQ C_SELECTED AND P_GENRL NE C_SELECTED.
          W_SFNAME = 'ZF_REMITTER_FORM'.
          PERFORM GET_FORMNAME .
        ELSEIF P_REMIT NE C_SELECTED AND P_GENRL EQ C_SELECTED.
          W_SFNAME = 'ZF_GENERAL_FORM'.
          PERFORM GET_FORMNAME .
        ELSEIF P_REMIT EQ C_SELECTED AND P_GENRL EQ C_SELECTED.
          W_SFNAME = 'ZF_QUERY_BANK_FORM'.
          PERFORM GET_FORMNAME .
        ENDIF.
        IF NOT W_FNAME IS INITIAL.
          PERFORM CALL_FORM.
          IF P_MAIL EQ 'X'.
            IF NOT P_MAILID IS INITIAL.
              PERFORM SET_PARAMETERS.
              PERFORM DEVICE_TYPE.
              PERFORM CALL_FORM.
              PERFORM CONVERT_TO_PDF.
              PERFORM CONVERT_PDF_TO_BINARY.
              PERFORM SEND_MAIL_NO_DISPLAY.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    *&      Form  GET_FORMNAME
         Fetch the Function module name for the Smartform
    FORM GET_FORMNAME .
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = W_SFNAME
        IMPORTING
          FM_NAME            = W_FNAME
        EXCEPTIONS
          NO_FORM            = 1
          NO_FUNCTION_MODULE = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " GET_FORMNAME
    *&      Form  CALL_FORM
    To Call the Smartform
    FORM CALL_FORM .
      SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
      CALL FUNCTION W_FNAME
        EXPORTING
          CONTROL_PARAMETERS = WA_CONTROL_PARAMETERS
          OUTPUT_OPTIONS     = WA_OUTPUT_OPTIONS
          USER_SETTINGS      = 'X'
          S_HEADER           = WA_HEADER
          V_ACNO             = W_BANKN
          V_AMOUNT           = W_BETRZ
          V_CURR             = W_WAERS
          V_DATE             = W_VALUT
          V_TEXT             = P_TEXT
        IMPORTING
          JOB_OUTPUT_INFO    = WA_OUTPUT_DATA
        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.
    ENDFORM.                    " CALL_FORM
    *&      Form  FILL_EXPORT_STRUCTURES
    Populate the structure to send to the smartform as input
    FORM FILL_EXPORT_STRUCTURES .
      WA_HEADER-BANKA = BNKA-BANKA.
      WA_HEADER-ADDR_1  = BNKA-STRAS.
      WA_HEADER-ADDR_2 = BNKA-ORT01.
      WA_HEADER-ADDR_3 = BNKA-PROVZ.
      WA_HEADER-ZZSRCBPNM = T012-NAME1.
      SHIFT WA_HEADER-ZZSRCBPNM LEFT DELETING LEADING SPACE.
      WA_HEADER-FAX_NUMBER = W_CLIENT_FAX.
      WA_HEADER-BUTXT = T001-BUTXT.
      WA_HEADER-NAME1 = W_GE_NAME.
      WA_HEADER-TEL_NUMBER = W_GE_PHONE.
      WA_HEADER-TEL_EXTENS = W_GE_PHONE_EX.
      WA_HEADER-SMTP_ADDR = W_GE_EMAIL.
      WA_HEADER-GE_FAX_NUMBER = W_GE_FAX.
    ENDFORM.                    " FILL_EXPORT_STRUCTURES
    *&      FORM  CONVERT_TO_PDF
    Convert the final doucment (OTF FORMAT) into pdf format
    FORM CONVERT_TO_PDF .
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = W_PDF_LEN
        TABLES
          OTF                   = WA_OUTPUT_DATA-OTFDATA
          LINES                 = IT_PDF_TABLE
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          ERR_BAD_OTF           = 4
          OTHERS                = 5.
    ENDFORM.                    " CONVERT_TO_PDF
    *&      FORM  SET_PARAMETERS
    Set control parameters to get the output format (OTF) from smart form*
    FORM SET_PARAMETERS .
      WA_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
      WA_CONTROL_PARAMETERS-GETOTF    = 'X'.
      WA_CONTROL_PARAMETERS-LANGU = SY-LANGU.
    ENDFORM.                    " SET_PARAMETERS
    *&      FORM  DEVICE_TYPE
    Get the Device type
    FORM DEVICE_TYPE .
      CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          I_LANGUAGE             = WA_CONTROL_PARAMETERS-LANGU
        IMPORTING
          E_DEVTYPE              = WA_OUTPUT_OPTIONS-TDPRINTER
        EXCEPTIONS
          NO_LANGUAGE            = 1
          LANGUAGE_NOT_INSTALLED = 2
          NO_DEVTYPE_FOUND       = 3
          SYSTEM_ERROR           = 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.
    ENDFORM.                    " DEVICE_TYPE
    *&      FORM  CONVERT_PDF_TO_BINARY
    To convert PDF file to Binary format
    FORM CONVERT_PDF_TO_BINARY .
      CALL FUNCTION 'QCE1_CONVERT'
        TABLES
          T_SOURCE_TAB         = IT_PDF_TABLE
          T_TARGET_TAB         = IT_PDF_NUC_DATA
        EXCEPTIONS
          CONVERT_NOT_POSSIBLE = 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.
    ENDFORM.                    " CONVERT_PDF_TO_BINARY
    *&      FORM  SEND_MAIL_NO_DISPLAY
    To send a email
    FORM SEND_MAIL_NO_DISPLAY .
      DATA: L_SLINE(255) TYPE C,
            L_INDEX TYPE SY-TABIX.
      IT_OBJBIN[] =  IT_PDF_NUC_DATA[].
      Title and Description of the mail
      WA_DOCDATA-OBJ_DESCR = TEXT-012.
    Mail Body content
      PERFORM MAIL_BODY.
      DESCRIBE TABLE IT_OBJTXT LINES W_TAB_LINES.
      READ     TABLE IT_OBJTXT INDEX W_TAB_LINES INTO L_SLINE.
      L_INDEX = W_TAB_LINES + 1.
      WA_DOCDATA-DOC_SIZE = ( W_TAB_LINES ) * 255 + STRLEN( L_SLINE ).
      WA_DOCDATA-OBJ_EXPDAT = '29991231'.
      WA_DOCDATA-SENSITIVTY = 'O'.
      WA_DOCDATA-OBJ_PRIO =  '5'.
      WA_DOCDATA-EXPIRY_DAT = '29991231'.
      WA_DOCDATA-PROC_TYPE = 'R'.
      CLEAR  IT_OBJPACK-TRANSF_BIN .
      IT_OBJPACK-HEAD_START = 0.
      IT_OBJPACK-HEAD_NUM   = 0.
      IT_OBJPACK-BODY_START = 1.
      IT_OBJPACK-BODY_NUM   = W_TAB_LINES.
      IT_OBJPACK-DOC_TYPE   = 'RAW'.
      IT_OBJPACK-OBJ_DESCR  = TEXT-013.
      APPEND IT_OBJPACK.
    Create message attachment
      W_ATT_TYPE = 'PDF'.
      DESCRIBE TABLE IT_OBJBIN LINES W_TAB_LINES.
      READ     TABLE IT_OBJBIN INDEX W_TAB_LINES.
      L_INDEX = W_TAB_LINES + 1.
      IT_OBJPACK-DOC_SIZE = ( W_TAB_LINES ) * 255 .
      IT_OBJPACK-TRANSF_BIN = 'X'.
      IT_OBJPACK-HEAD_START = 0.
      IT_OBJPACK-HEAD_NUM   = 0.
      IT_OBJPACK-BODY_START = 1.
      IT_OBJPACK-BODY_NUM   = W_TAB_LINES.
      IT_OBJPACK-DOC_TYPE   = W_ATT_TYPE.
      IT_OBJPACK-OBJ_DESCR  = TEXT-013.
      APPEND IT_OBJPACK.
    Create receiver list
      IT_RECLIST-RECEIVER = P_MAILID.  "<-- CHANGE ADDRESS
      IT_RECLIST-REC_TYPE = 'U'.
      IT_RECLIST-EXPRESS = 'X'.
      APPEND IT_RECLIST.
    Send Email
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = WA_DOCDATA
          PUT_IN_OUTBOX              = 'X'
          COMMIT_WORK                = 'X'     "USED FROM REL.6.10
        TABLES
          PACKING_LIST               = IT_OBJPACK
          CONTENTS_BIN               = IT_OBJBIN
          CONTENTS_TXT               = IT_OBJTXT
          RECEIVERS                  = IT_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.
        MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
                WITH WA_DOCDATA-OBJ_NAME.
      ELSE.
        SUBMIT RSCONN01 WITH MODE = 'INT' AND RETURN.
        SET SCREEN 0.
      ENDIF.
    ENDFORM.                    " SEND_MAIL_NO_DISPLAY
    *&      Form  GET_PAYMENT_DETAILS
    Get the Payment Lot and Payment Number
    FORM GET_PAYMENT_DETAILS .
    Get the Payment Lot and Payment Number
      SELECT SINGLE BETRZ
                    BVRKO
                    BUKRS
                    WAERS
                    VALUT
                    BANKS
                    BANKL
                    BANKN
                    FROM  DFKKZP
                    INTO (WA_DFKKZP-BETRZ,WA_DFKKZP-BVRKO,
                      WA_DFKKZP-BUKRS,WA_DFKKZP-WAERS,WA_DFKKZP-VALUT,
                      WA_DFKKZP-BANKS,WA_DFKKZP-BANKL,WA_DFKKZP-BANKN)
                    WHERE KEYZ1 = P_KEYZ1
                    AND   POSZA = P_POSZA.
      IF SY-SUBRC NE  0.
        MESSAGE I004 WITH TEXT-100.
        EXIT.
      ELSE.
        W_ORG1R = WA_DFKKZP-BUKRS.
        W_BETRZ = WA_DFKKZP-BETRZ.
        W_BANKN = WA_DFKKZP-BANKN.
        W_WAERS = WA_DFKKZP-WAERS.
        W_VALUT = WA_DFKKZP-VALUT.
      ENDIF.
    ENDFORM.                    " GET_PAYMENT_DETAILS
    *&      Form  GET_BANK_DETAILS
    To Retrive the Bank Details
    FORM GET_BANK_DETAILS .
    *Get the Bank Address Details
      SELECT SINGLE BANKA
                    STRAS
                    ORT01
                    PROVZ
                    FROM BNKA
                    INTO (BNKA-BANKA,BNKA-STRAS,BNKA-ORT01,BNKA-PROVZ)
                    WHERE BANKS = WA_DFKKZP-BANKS
                    AND BANKL = WA_DFKKZP-BANKL.
      IF SY-SUBRC NE 0.
       MESSAGE I004 WITH TEXT-101.
       EXIT.
      ENDIF.
    GET The Bank Contact Name.
      SELECT SINGLE NAME1
                    FROM T012
                    INTO T012-NAME1
                   WHERE BANKS = WA_DFKKZP-BANKS
                   AND   BANKL = WA_DFKKZP-BANKL.
      IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF NOT W_ORG1R IS INITIAL.
    Get the GE Legal Entity Name
        SELECT SINGLE  BUTXT FROM T001
               INTO T001-BUTXT
               WHERE BUKRS = W_ORG1R.
        IF SY-SUBRC NE  0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " GET_BANK_DETAILS
    *&      Form  GET_COLLECTOR_DETAILS
    To get the Collector Address Details
    FORM GET_GE_CONTACT_DETAILS .
    *Getting the Collector details
      CALL FUNCTION 'BAPI_USER_GET_DETAIL'
        EXPORTING
          USERNAME = SY-UNAME
        IMPORTING
          ADDRESS  = WA_ADDRESS
        TABLES
          RETURN   = IT_RETURN.
      IF NOT WA_ADDRESS IS INITIAL.
        CONCATENATE WA_ADDRESS-FIRSTNAME0(18) WA_ADDRESS-LASTNAME0(17)
                    INTO W_GE_NAME SEPARATED BY SPACE.
        W_GE_PHONE = WA_ADDRESS-TEL1_NUMBR.
        W_GE_PHONE_EX = WA_ADDRESS-TEL1_EXT.
        W_GE_EMAIL = WA_ADDRESS-E_MAIL.
        IF NOT WA_ADDRESS-FAX_EXTENS IS INITIAL.
          CONCATENATE WA_ADDRESS-FAX_NUMBER C_HYPHEN WA_ADDRESS-FAX_EXTENS
                       INTO W_GE_FAX.
        ELSE.
          W_GE_FAX = WA_ADDRESS-FAX_NUMBER.
        ENDIF.
      ENDIF.
    ENDFORM.                    " GET_GE_CONTACT_DETAILS
    *&      Form  MAIL_BODY
    To Build the email body
    FORM MAIL_BODY .
      PERFORM  GET_USER_DATE_FORMAT.
      W_YEAR = W_VALUT+0(4).
      W_MONTH = W_VALUT+4(2).
      W_DAY = W_VALUT+6(2).
      PERFORM GET_DATE.
      IF P_REMIT EQ 'X' .
        CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
                                SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-021 WA_HEADER-BUTXT  ',' TEXT-022
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
        CONCATENATE TEXT-024 W_DATE
        TEXT-025  W_BETRZ W_WAERS TEXT-026
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-027.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = WA_HEADER-NAME1.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-028 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-029.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
                           SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-032 WA_HEADER-SMTP_ADDR INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-033 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
      ELSEIF P_GENRL EQ 'X'.
        CLEAR IT_OBJTXT.
        REFRESH IT_OBJTXT.
        CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
                                SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-021 WA_HEADER-BUTXT '.'
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-034 P_TEXT '.'
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-027.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = WA_HEADER-NAME1.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-028 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-029.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
                           SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-032 WA_HEADER-SMTP_ADDR INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
      ELSEIF ( P_REMIT EQ 'X' AND P_GENRL EQ 'X' ).
        CONCATENATE TEXT-020 WA_HEADER-ZZSRCBPNM ',' INTO IT_OBJTXT-LINE
                                 SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-021 WA_HEADER-BUTXT  ',' TEXT-022
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        SHIFT W_BETRZ LEFT DELETING LEADING SPACE.
        CONCATENATE TEXT-024 W_DATE TEXT-025  W_BETRZ W_WAERS TEXT-026
        INTO IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-027.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = WA_HEADER-NAME1.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-028 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        IT_OBJTXT-LINE = TEXT-029.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-030 W_GE_FAX INTO IT_OBJTXT-LINE
                           SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE TEXT-031 W_GE_PHONE TEXT-035 W_GE_PHONE_EX INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-032 WA_HEADER-SMTP_ADDR INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
        CONCATENATE SPACE SPACE SPACE INTO IT_OBJTXT-LINE.
        APPEND IT_OBJTXT.
        CONCATENATE  TEXT-033 WA_HEADER-BUTXT INTO
        IT_OBJTXT-LINE SEPARATED BY SPACE.
        APPEND IT_OBJTXT.
      ENDIF.
    ENDFORM.                    " MAIL_BODY
    *&      Form  get_user_date_format
    to get the User Date Format from USR01 table
    FORM GET_USER_DATE_FORMAT.
      CLEAR W_DATFM.
      SELECT SINGLE DATFM INTO W_DATFM
                          FROM USR01
                          WHERE BNAME = SY-UNAME.
    ENDFORM.                    " get_user_date_format
    *&      Form  GET_DATE
          Get the date in the user format
    FORM GET_DATE .
      CLEAR W_DATE.
      CASE W_DATFM.
        WHEN '1'.
          CONCATENATE W_DAY '.' W_MONTH '.' W_YEAR INTO W_DATE.
        WHEN '2'.
          CONCATENATE W_MONTH '/' W_DAY '/' W_YEAR INTO W_DATE.
        WHEN '3'.
          CONCATENATE W_MONTH '-' W_DAY '-' W_YEAR INTO W_DATE.
        WHEN '4'.
          CONCATENATE W_YEAR '.' W_MONTH '.' W_DAY INTO W_DATE.
        WHEN '5'.
          CONCATENATE W_YEAR '/' W_MONTH '/' W_DAY INTO W_DATE.
        WHEN '6'.
          CONCATENATE W_YEAR '-' W_MONTH '-' W_DAY INTO W_DATE.
      ENDCASE.
    ENDFORM.                    " GET_DATE
    Thanks
    Mahesh

  • Header and Item text details not displaying in Capital and Import PO......

    Hi Abapers,
               I copied the standard PO /SMB40/MMPO_A to ZForm, and customized like changing logos,address,footer  etc.., after activating the form and while print previewing the standard  purchase order all details displaying including header,item,terms of payment,delivery schedule.
             But for Import and Capital PO, the  header,item,terms of payment,delivery schedule,etc..,  details not displaying nor printing in the form.I didnt changed or customized the above windows in the form, but the above details want to display in the form for Capital and Import PO.
             I am getting all the details for Standard PO, but not for Capital and Import PO.
    Let me give some suggestions for the above issue.
    Thanks & Regards,
    Dilip.B

    Hi Surya,
                       Thanks for your reply.
    I am using only one form for all the PO document types, and there is no codes with conditons blocking for Capital and Import PO's.
    I am using the standard Purchase Order for this.
    I checked the standard smartform, and their is no condition for blocking import and capital PO texts. The below is the  code written for retrieving header text in smartform header window..,
    * read IMG setting -- table T166K
    * append texts allowed to GT_HD_TEXTS
    * Head Text Part
    CLEAR LS_TEXT.
    LOOP AT LT_TEXTS INTO LS_TEXT.
    SELECT SINGLE *  FROM T166K  INTO LS_T166K
    WHERE DRUVO     = IV_DRUVO  AND
    BSTYP     = IS_EKKO-BSTYP  AND
    BSART     = IS_EKKO-BSART  AND
    TDOBJECT  = LS_TEXT-TDOBJECT AND
    TDID      = LS_TEXT-TDID.
    IF SY-SUBRC = 0.
    APPEND LS_TEXT TO GT_HD_TEXTS.
    ENDIF.
    CLEAR LS_TEXT.
    ENDLOOP.
    Thanks & Regards,
    Dilip.B
    Edited by: Dilipkumar B on Oct 22, 2009 7:58 AM

  • Po header text doesn't display on po printing?

    Hi experts,
    We create new po doc type. Now we found when we create po and input header text manually, it can't be previewed in po form. We check some table ,it seems T166K / xT166K doesn't include this text.
    May I know for new doc type, any text config need be done? Or how to setup text with doc type ?
    Thanks
    Alice

    check in SPRO:
    Materials ManagementPurchasingMessagesDefine Texts for Purchase Order- > Text for Document Header , maintain your doc type , object EKKO , Text id F01, and try again.

  • Prinitng smartform tables in full sheet

    Dear All Gurus,
    This is my request. I need to print a customized smartform (ex :GRN) according to below.
    Format of Smartform(1 page Smartform) :
    Header Windows (Adress / LOGO)
    Table Data
    Footer window (signatuees / agreement texts)
    (If the smartform prints 3 sheets (due to a lot of rows in the table) -
    1st sheet should show the header windows & table
    2nd sheet will carry out printing rest of the table data without priniting Header window (The total page space should be taken by table)
    3rd sheet will print the last rows of table & footer windows )
    I have designed the smartform & prints pages as above. But I cant figure out the way to expand the size of the table in the 2nd page to print it in full page.
    Plz Help
    Thanks'

    HI,
    Thank you for the reply..
    Kindly note that this smartform is 01 page smartform. (I have designed everything in single page.)
    Header Windows (Adress / LOGO)
    Main window (Table Data )
    Bottom window (signatuees / agreement )
    What happens here is if the table has 5 rows of Data, it is printed perfectly in a single A4 sheet according to my requirement because space is enough to print everything.
    But if there are 500 rows of Data in the table, what needs to be done is from 2nd  A4 sheet onwards  the table should acquire the total space of the sheet (including space given to LOGO, Address windows & bottom windows) until the loop ends.
    How do I get the total space because the table doesnt expand the size in main window of the smartform.
    Can we get that by expanding main window in 2nd page as you said?
    Thanks

  • How to do a spinning heads effect with a single footage? (link to a video for clarification)

    hi.
    Could anybody give me a hint how to create this spinning heads effect demonstrated in this video (starting from 0:08):
    https://www.youtube.com/watch?v=05ZvII57p_M
    The biggest mystery for me is how the spinning heads maintain their 3-dimensionality throughout the cycle. I attempted to do something similar with my own head's footage by applying CC Cylinder, but with only this effect the face becomes flat when it turns to 90 degrees. 
    The author of this video claimed in multiple interviews that he uses only After Effects for all of his videos, so i'm pretty sure AE was used in this one too.

    Go buy a lazy suzan bearing at Home Depot, Set a chair on it. Center your head on the turning axis and put a green screen behind you. Shoot your head as you spin around.
    (edit: or sit on a stool with a seat that will spin as Dave suggested)
    Shoot a clean plate (the actor is not in the scene) then have the actor walk in. Roto out the head so the clean plate is in the background. Key out your spinning head green screen footage and put it between the clean plate and the rooted actor.

  • Material item text not appearing in PO Print Preview

    Hi experts,
    We have created a new PO type .  We have assigned it with PO text via Spro>Purchasing>Purchase Order > Message > Text for messages > define text for purchase order
    Maintained text for document header
    Maintained  text for document item
    But still in Purchase Order , the material PO text at item level , is not appearing at the time of print preview / print out.
    Please suggest .
    Regards,
    ( Rajneesh Gulati )

    If I understand correctly, you want to copy the purchase order text from the material master directly into the PO's for this material.
    I got the same problem; text appears in PO item text, but doesn't appear on print preview.
    => check your forms first
    => if you can't find an error here, check the copying control in
    SPRO -> Materials Management -> Purchasing -> Purchase Order -> Texts for purchase orders -> Define copying rules for item texts
    go to the text linkages of the text type that you want to see appearing
    => make sure that the entries with source object 'material master' have the Fix value (blank) rather than N or * (if you see the text appearing in the PO but not on the print out, this means that this setting is currently set on *)
    Hope this helps

  • Create a Sales Order with Reference to Contract using IDoc / LSMW  ( AFS )

    Hi Gurus,
    I need to crate a Sales Order with reference to a Contract. I need to upload Sales Orders with reference to contract via LSMW.
    So far, I've been able to create the Sales Order with ref to contract. But, the Sales Order Quantity is not getting deducted from the Original Qty in Referred Contract ( When try to create another Sales Order referring to the same Contract.) When a Sales Order is created manually, this is working fine.
    Please tell me if I've missed some parameter which stopping it create the link to exact schedule line ( Sizes level )
    The Details of the IDoc which is been created via LSMW are as follows;
    Message Type: ORDERS
    Basic Type     : /AFS/ORDERS05
    Process Code : ORDE / DELO
    ( Tried with both process codes.  But the Identification is the same for both: IDOC_INPUT_ORDERS )
    *_In Header;_
    Segment : E1EDK02  - IDoc: Document header reference data *
    Qualifier : '043' - Vendor Contract Number ( Tried with ' 005' - Customer Contract, but it's not working )
    Contract Order is mapped for field BELNR
    *_In Item;_
    Segment : E1EDP02  - IDoc: Document Item Reference Data *
    Qualifier : '043' - Vendor Contract Number ( Tried with ' 005' - Customer Contract, but it's not working )
    Contract Order is mapped to field BELNR
    Line Item of the Contract is mapped to field ZEILE
    I also tried passing the Schedule line of Contract in Segment :  E1J3P01 AFS IDoc: Doc.item general data
    to following fields;
    J_3AETENV
    J_3AVGETE
    /AFS/UETENR
    Still its not getting updated in the VBEP also..
    Please help me with regard to this. Points will be awarded for your valuable contribution.
    Thanks.

    Hi,
    This issue is been resolved.
    One of my friend helped me with resolving this issue..
    Once the below mentioned configurations were done on SPRO, the Sales Order was created with reference to Contract and the Qty was reflected when tried to create a new Order referring the same contract.;
    u2022     SPRO --> SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Define Sales Document Types  --> Field : Outline agreement message; from blank to u201CBu201D.
    u2022     SPRO  -->SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Maintain Sales Document Types for AFS  --> Field : Outline agreement message; from blank to u201CAu201D

  • Sales order with reference to contract using IDOC_INPUT_ORDERS

    Hi all,
    I had the requirement to create sales order with reference to contract based on some validations of idoc values and then passing the modified idoc data table to IDOC_INPUT_ORDERS. I have completed the coding till the modification of data in a new function module ('Z') and then calling the IDOC_INPUT_ORDERS FM inside that. Now my problem is while creating the sales order, the bdc for Txn VA01 is not populating those values to screen fields which I want to populate. I could find out that some modifs needs to be done in some user exit for reference to contract case.But finding difficulty in getting the exact place to make the modifications. Any pointer to this problem would be highly appreciated.
    Regards,
    Divya

    Hi,
    This issue is been resolved.
    One of my friend helped me with resolving this issue..
    Once the below mentioned configurations were done on SPRO, the Sales Order was created with reference to Contract and the Qty was reflected when tried to create a new Order referring the same contract.;
    u2022     SPRO --> SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Define Sales Document Types  --> Field : Outline agreement message; from blank to u201CBu201D.
    u2022     SPRO  -->SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Maintain Sales Document Types for AFS  --> Field : Outline agreement message; from blank to u201CAu201D

  • Capture  & Post Invoice at the time of Goods Receipt in one Step

    Hi,
    We are doing the following for Goods Receipt (as decided by other consultant)
    1. Goods Receipt (Only Part I) - currently being done by Stores
    2. Capture Invoice (J1IEX) - currently being done by Purchase
    3. Post Invoice (J1IEX) -  currently being done by Finance
    We tried to capture & Post Invoice in single step at the time of Goods Receipt. The system is allowing us to do so. Can we do the goods receipt & capture & post invoice at the time of GR only.
    What is the difference or benefit in doing GR & capturing invoice separately?
    Regards,

    >
    PK wrote:
    > Hi,
    >
    > We are doing the following for Goods Receipt (as decided by other consultant)
    > 1. Goods Receipt (Only Part I) - currently being done by Stores
    > 2. Capture Invoice (J1IEX) - currently being done by Purchase
    > 3. Post Invoice (J1IEX) -  currently being done by Finance
    >
    > We tried to capture & Post Invoice in single step at the time of Goods Receipt. The system is allowing us to do so. Can we do the goods receipt & capture & post invoice at the time of GR only.
    >
    > What is the difference or benefit in doing GR & capturing invoice separately?
    >
    > Regards,
    Hi PK,
    Standard SAP provides different stages based on business criticality.
    Since a warehouse person may not be aware of Excise functionalities he should only be allowed to capture the invoice, however Posting excise credit is a critical business function hence site Excise clerks should be allowed for these rights.
    However based on business scenario or size of business the same can be done at one place.
    So as your business demands the process can be changed with that. However criticality of the matter & process lies with the business finally. 
    There are scenarios where actual material reciept is short at times hence credit allowed has to be reduced than original, there may be scenarios where a critical excisable product may have wrong chapter heading maintained at PO level which needs to be changed at credit availment/capture stages to show correct chapter in excise registers...
    these all cases support the process to be splitted & responsibilities segrigated....
    Hope it assits....
    regards
    ak

  • Possible to use a field code first name in mail?

    Hi
    I want to sent a mail to my contacts. And I like to start the mail with Hello <first name of the contact>,
    Is it possible to do that in this mail software?
    Kind regards,
    Rene

    You can achieve your requirement through partner determination for sales doc header.
    To Create Sales Personnel (if you are not using HR module for Sales Personal) in SAP, use Tcode VPE1.
    You have to Maintain Partner Determination in SPRO:
      IMG - SD - Basic Functions - Partner Determination - Set up Partner Determination
    As you can set it up in Sales Order (say, At Header),
    Click: -Set up Partner Determination for Sales Document Header
    Maintain a Partner Determination procedure ZIN - Inquiry Order.(copy TA - Standard Order)
    Make PE-Sales employee as mandatory in ZIN - PE-Sales employee in Partner Function Procedure in Partner Determination procedure.
    Now, From Left-hand side tree, click on:
    Partner determination procedure assignment.
    Here assign ZIN to your Sales Doc type (Say, IN - Inquiry).
    Again from Left-hand tree, select
    Account groups - Function Assignment
    Here, Link all Customer Acct Grps to PE/ VE
    Now in Sales Order (T. Code: VA11/ 12), to include Sales Employee:
    Goto --> Header --> Partner
    here, in Column Partner. Function: Select VE/ PE as defined for Sales Employee.
    Hope this can assist you.
    Thanks & Regards
    JP

  • PO output medium as 'External Send' for Language BG giving '#' instead of character in PDF output

    Hi Experts,
    When we maintain the PO output medium as ‘External Send’ for Language ‘BG’, the PO pdf is showing # instead of character.
    But, if the output medium is PRINT and language is ‘BG’, the PO pdf prints correctly in BG language.I have checked the output type
    NEU and find that same smartform is maintained for both the case.
    Also it is working fine in the Quality as well as in development server.. issue is coiming only in PRD.
    Thanks in advance!!
    Regards
    Mrinal

    Hi,
    PLease review the steps from SAP note 191470.
    Best Regards,
    Arminda Jack

  • Component unit in BOM

    Hi ,
    I have a product whose base unit is KG. In the bill of material we are maintaining as G(because qty is very less).
    When i run the MRP this quantity is getting rounded to 1.0.
    What do i need to check .
    Regards
    ShankarR

    Normally the base UoM is the lowest measurable unit. Since you have maintained KG for this, give this a try in your sandbox to check if it works in your business context.
    For the BOM header maintain a base unit say as 1000 or 10,000 then in the component for this material which is maintained in grams increase the qty in relation to the base qty. which you have maintained for the header.
    Now load demand & check if it meets your need.

Maybe you are looking for

  • Perfomance  issue :  inner join on buffered db dable

    I have done a inner join between 2 tables . one of the table is fully buffered. i get a performance error   "(H) SELECT on buffered table in a JOIN" kindly help

  • ITS VERY URGENT MY PROJECT SUBMISSION IS NEARER

    Hi any one can help me iam using java wireless toolkit i developed a program to upload a video into the server which i created buy iam getting error like " Msgjava.lang.SecurityException: Application not authorized to access the restricted API " plea

  • What will NWBC be called?

    Following the announcement SAP NetWeaver Branding Simplification I guess there will be a name change for NWBC too. I'm guessing it will be called Business Client but what will be the acronym? It can't be BC since it is reserved for Basis Component as

  • Adobe flash player 11 stopped

         my adobe flash player 11 just completely stopped. i went to your website. i followed the steps for windows 8. i even did a re-installation thinking that might work. it still does not work. can you please give me step by step instructions to fix

  • How to redo modifications when new ESS MSS SP is imported

    Hi, Current Systems have SP 14 version of ESS/MSS in the landscape. Lot of customization is done in-house on these standard WebDynpro components. Now planning to import xSS SP18. In order to do the same, we are listing the modifications done on the o