Smartform Output Amount display in Parenthesis

Hi,
In a Smartform Output my varaible (X_VAR type p decimals 2) is printing out as 434543.65-.
I want my output to be in this format (434543.65) rather than with negative Sign.
Due to my requirement I can't change the type of variables.
Any idea how to Show it on Smartform .Unfortunately Concatenation doesn't work with Variables of Type p.
Any ideas?
Regards
Vara

Omitting the Leading Sign:
The ITCDP-TDULPOS field contains the value -100.00. The ABAP Dictionary definition for this field includes a leading sign.
&ITCDP-TDULPOS& -> 100.00-
&ITCDP-TDULPOS(S)& -> 100.00
You might be getting syntax error since smart form editor
is case sensitive. Try with all capital.
Hope this helps..
Thanks,
vamshi

Similar Messages

  • Smartform output not displaying, no formatting affected on output and shows formatting Error.

    Hi Guys,
    I am new to SAP and working in Smartforms now. I am facing an issue that the output screen is not showing any formatting done during the design phase. Not even font changes are displaying, instead only showing the default Courier font. No Bold as well as italics too. And borders also showing some problems.
    It was working properly till the last day and suddenly it gone faulty. Hence I cannot run the form and when  I try to run it, it displays nothing. I have been designing a Tax Invoice. When I tried to execute the smartform from the form itself, it was showing Formatting Error.
    What is the solution for this? I am using ECC 6. Please share your views.

    Hi Sanjeev,
    I've not made any changes to the formatting (Fonts and Borders) and I cross checked it many times.
    Everything is fine and Times used everywhere as Font. It is showing the same in the design too but in the output, it comes as Courier !! (May be default settings in case there is some exceptions, I don't know)
    I tried another report, pick list form, which too showing the same things. As we have developed only two reports, we cannot check more. The standard SAP forms are displaying as is, but the problem is with the newly designed ones.(Standard forms too are displaying in Courier font)
    I think it might be any problem related to the output graphical properties of the smart forms...!!! I am not sure but I need expert advice from you if there is any such scenarios...

  • Displaying amount field in smartform output

    hi experts,
    i am printing amount field in smartform output. like this 11,200.
    but i need to display like this $11,200.
    i need to print $ with amount field .
    can u give me some idea?
    Thanks

    Hi,
    Try like this.
    Data : v_amount type i value 11200,
              v_final type string
    If u r getting currency, then check the currency.
    If Curr  eq 'USD'
    concatenate '$' v_amount into v_final separated by space.
    endif.
    Print V_FINAL where do u want.

  • Problem in displaying data in the smartform output.

    Dear Freinds,
                    I have a requirement as per my requirement i have to display the employee dependents details in the smartform output.
    I have taken a table in smartform and collected all teh employee dependents details . Each dependents his own  details around 8 fields. so iam displaying in the smartform it is working till now no problem ........iam getting data as below
    Dependentrelation | dependentname|passportno|expirydate|visano|visadate|visa expire date| ResidenceNo|Residence issuedate|
    spouse                 | Raja                   |123456       |10/09/2009|122233|10/01/2009|10/01/2010 | 1001             |10/01/2009
    These are the one of the dependentds details iam having till now , like this i have another dependts details. Now the problem i have
    to add some fields to this list ( to this internal table) ...........if iam adding one more feild data is getting truncated as i dont have any more fields to add to right in the horizontal line........how can i solve this issue and how can i add further fields to this list
    like date of birth of the dependents and gender
    please could any one tell how i can solve this issue.
    regards
    divya.

    If this is a Tablethen only thing you can do is re-size the grid and font size to adjust your data. Like, displaying HEADINGS & DATAs in 2 rows instead of 1, etc.
    Nothing else can be done. Otherwise you have to trim down the data to adjust in one page.

  • How to display smartform output?

    Hi,
       Can anybody give me some hint on how to display a smartform output containing tables and texts in a bsp?? I have searched the forum but since I am new to bsp,I am not finding a caompact solution by following which I can get the idea. Please help..

    Hi,
    Check this link [Smartform PDF output in BSP|Smartform PDF output in BSP;
    Hope this helps you.
    Regards,
    Rajani

  • CRM Service Quotation-display the configured smartform output-in SAP GUI ;

    Hi All,
    I have displayed the SAP CRM Service Quotation using SAP Transaction crmd_order (in SAP GUI not from web UI);
    Appreciate if you let me know how I can display the configured smartform output - in SAP GUI ;
    I am about to do some changes to the smartform but I dont know how to test;
    Thank you very much
    Iver - Sorry I am new to SAP CRM

    Hi Iver
    I think following should work
    Go to  transaction Data->Actions tab in CRMD_ORDER transaction.
    If action is already defined then you can select the action adn see the preview
    Regards
    Naresh

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

  • Convert smartform output in to PDF using CONVERT_OTF function  how to do it

    Hi Anil , and  Hi All
             I am trying to display smartforms output in java webdynpro
             for that i have got the following code in sdn.
               can anybody please clarify these doubts in the  below code
               1) What are the mandatory input and output parameters
                   I have to pass here in this code to my application
               2) please check my previous post also in this regards please
       . Please reply at the very earliest. Check the below code
    Convert smartform output in to PDF using CONVERT_OTF function module and you can write pdf using parameter 'binfile' of this function in WebDynpro using the following code:
    It is copied from my prg. I hope you understand it.
    public void onActionGetQuote(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    //@@begin onActionGetQuote(ServerEvent)
    wdThis.wdGetOppt_QwriterCustController().executeZquote_Writer_Input();
    String fileName = wdContext.currentZquote_Writer_InputElement().getOrder().toString().trim() + System.currentTimeMillis() + ".pdf";
    String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
    if (pdfOutput != null)
    try
    String pdfResoucePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), fileName);
    FileOutputStream fileOutputStream = new FileOutputStream(new File(pdfResoucePath));
    PrintStream ps = new PrintStream(fileOutputStream);
    ps.print(pdfOutput);
    ps.close();
    //Display the PDF to the browser
    String fileURL = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(), fileName);
    IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(fileURL, "Pdf Browser", false);
    window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
    window.removeWindowFeature(WDWindowFeature.MENU_BAR);
    window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
    window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
    window.open();
    // To collect all the file created in the server by user
    quoteFiles.add(quoteFiles.size(), pdfResoucePath);
    } catch (Exception e)
    throw new WDRuntimeException(e);
    //@@end

    Hi
        ABAPers prepared a BAPI function module which calls Smart form , how can i execute it from java Webdynpro, so that I can display the smart form in Webdynpro. Pleas reply at the very earliest.  Every answer will be rewarded.
    regards
    jalandhar

  • Produce smartform output in word doc

    I want to get my smartform output in a word doc instead of PDF. I've gone thorough the previous threads for the same thing but couldn't find any exact solution. can anyone tell me how this is to be done?
    <promise removed by moderator>
    Moderator message: please do more research before asking.
    Edited by: Thomas Zloch on Apr 13, 2011 3:26 PM

    Hi yogesh.,
    There is no standard possibility to do Word outputs in SAP.
    you can do manually..
    After the print preview, Select the menu Goto->List Display.
    Now select the menu System->List->Save->Local File.
    Now you can select the radio buttion Rich Text Format.
    Now you save the document as a .doc file (say test.doc)
    That is it!!!!!
    Anyway you can develop connection of Mail-merge technology of Microsoft and SAP ABAP class i_oi_document_proxy.
    http://help.sap.com/saphelp_sm32/helpdata/EN/e9/0be980408e11d1893b0000e8323c4f/content.htm
    with interface get_mail_merge_interface:
    http://help.sap.com/saphelp_sm32/helpdata/en/6e/8fc2e3dd0d11d2bdba080009b4534c/content.htm
    Refer this use ful link for word output
    http://www.sap2word.de/abap.html
    hope this helps.,
    Thanks & Regards
    Kiran
    Moderator message: copy/pasted from several sources, please do not repeat if you want to keep your user ID!
    http://www.google.com/search?q=%22Aftertheprintpreview%2CSelectthemenu+Goto%22&hl=en&source=hp&lr=&aq=f&aqi=&aql=&oq=
    http://www.google.com/search?hl=en&source=hp&q=%22AnywayyoucandevelopconnectionofMail-merge%22&meta=lr%3D&aq=f&aqi=&aql=&oq=
    Edited by: Thomas Zloch on Apr 13, 2011 3:35 PM

  • Logo in Smartform output to pdf format is coming as Junk Character

    Hi All,
    I have a requirement to generate the Smartform output in PDF file. But when i am doing that i am getting the LOGO as Junk character in the PDF file. Can any one help me to resolve this issue?.
    Thanks,
    Muruganand.K

    Yes check the spool and the output displayed correctly in the spool it means there is a problem when you convert OTF to PDF. Check that part of the code and try different options.

  • Multiple smartform Outputs in Single PDF

    Hi,
    I am displaying ALV report , from there I am converting my smartform output into PDF using CONVERT_OTF and Downloading it to my desktop.
    Now user is looking for push button in ALV, i.e Display PDF in Single File. I have created the pushbutton and tried to convert the OTF data PDF as per below link.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450?quicklink=index&overridelayout=true
    My file is downloading to the desired path. When i tried to open that file it is giving error message as below.
    THERE WAS AN ERROR OPENING THIS DOCUMENT .  THE FILE IS DAMAGED AND COULD NOT BE REPAIRED.
    when i seleted the rows seperatly, it is displaying as PDF correctly, but if i tried to append the lines as per the above reference link i am getting the problem.
    Can anyone please help me out to solve this.
    Thanks & Regards,
    Srinivas Bhavanam
    Moderator message - Cross post locked
    Edited by: Rob Burbank on Mar 24, 2010 6:25 PM

    This article is correct about the //. First make sure you remove them correctly, and nothing else. Only 2 // must remain, one at the beginning, one at the end.

  • Text and table structure getting jumbled up in the smartform output

    Hi all ,
    While viewing the print preview of a smartform output , i am facing  a strange issue.
    The hardcoded text is getting jumbled up .For eg:"As soon as possible"  becomes " as possible . soon as"
    The structure of the table is also getting reversed.That is the table is now getting displayed with the last couloum first.The data in the table is also coming in the reverse order.
    While executing the smartform directly , the layout is coming in the proper order.But while executing this through a transaction (FINT) , this issue is coming up.The print program is a standard program.
    I have tried deleting the window , copying it to a new smartform etc.I have also tried in different systems to check whether if it is an issue with the system.
    If anyone has faced a similar issue , please let me know how to solve it.Thanks a lot in advance.
    Regards,
    Rashmi

    Hi
    Please check the Printout rather the print Preview. and also check the Structure/table entries also that u printing and also if u r using template, then check the assignment 1 of 1 , etc to the texts.
    surya

  • PDF Conversion of Smartform Output

    Hi All,
    Requirement : Be able to provide customers with reprinting old invoices.
    As Is : We have a standard way of doing it by reissuing a print of the Invoice by going into transaction VF02. But in doing so we have a chance that if some master data changes for that customer or the material those changes will get reflected in the new smartform output.
    To Be : We want to be able to exactly reproduce the invoice which was sent out at the time of invoice creation, what I mean to say is on initial issue of the print output, is there any way we can store that output(may be as raw data) and retrieve it and issue a print at a later stage.
    Any help in this regard would be greatly appreciated.
    Karthik

    hi
    check this link...it will help you
    https://www.sdn.sap.com/irj/scn/advancedsearch?query=sendalvtomailas+pdf&cat=sdn_all
    or
    REPORT zsuresh_test.
    Variable declarations
    DATA:
    w_form_name TYPE tdsfname VALUE 'ZSURESH_TEST',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions TYPE ssfcompop,
    W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = w_fmodule
    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.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
                                                        " for print preview
    w_cparam-getotf = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = w_outoptions
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    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_otf_from_fm-otfdata[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
    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_pdf_tab
    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.
    To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
    WINDOW_TITLE =
    DEFAULT_EXTENSION =
    DEFAULT_FILE_NAME =
    FILE_FILTER =
    INITIAL_DIRECTORY =
    WITH_ENCODING =
    PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 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.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = T_pdf_tab
    FIELDNAMES =
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards
    Ansumesh

  • Sending smartform output as PDF attachment, Error opening PDF attachment

    Hi Experts,
    I am using the code form the following link to send a smartform output as PDF attachment. I can able to see the message, but can not open PDF document.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/convertSmartformtoPDFformat&
    The information should be on my smartform are some text, company logo and a barcode.
    With all of these received error: "There was an error opening this document. The file is damaged and could not be repaired."
    I tried different ways like only text, text with company logo, text with barcode. I got the following errors:
    An unrecognized token 'Td0' was found
    There was problem reading this document(16).
    There was problem reading this document(111).
    Does anyone have idea of these ? Your help is greatly appreciated.
    Thank you,
    Surya

    please see this code  ...  for sending the  Email as  PDF attach file,
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    * Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    * Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    * Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    * Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    * Write statement to represent report output. Spool request is created
    * if write statement is executed in background. This could also be an
    * ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    *** Alternative way could be to submit another program and store spool
    *** id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
    *        to sap-spool
    *        spool parameters   %_print
    *        archive parameters %_print
    *        without spool dynpro
    *        and return.
    * Get spool id from program called above
    *  IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
    *       FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
    *       FORM get_job_details                                          *
    FORM get_job_details.
    * Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
    *       FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    * Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
    *       FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    *  perform send_email using p_email2.
    ENDFORM.
    *       FORM send_email                                               *
    *  -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    * Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    *  CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    * If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    * Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
    *       FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *       Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    * Fill the document data.
      w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    * Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    * Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           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.
    * Populate zerror return code
      ld_error = sy-subrc.
    * Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    reward  points  if it is usefull ....
    Girish

  • How can we save smartform output as word document

    Hi Friends,
    Can anybody help me, how to save Smartform output as Word document instead of PDF file.
    Thanks,
    Ramana.

    Hi Venkat,
    I think you can do it manually.
    After the print preview, Select the menu <b>Goto->List Display</b>.
    Now select the menu <b>System->List->Save->Local File</b>.
    Now you can select the radio buttion <b>Rich Text Format</b>.
    Now you save the document as a .doc file (say test.doc)
    That is it!!!!!
    <b>Award points if found useful.</b>
    Regards,
    SP.

Maybe you are looking for