Problem in printing of smartform

Hi All,
I have designed a smartform.Everything looks perfect in print preview.But when i take a printout nothing is as per print preview.Fields get positoned anywhere and many fields get overlapped.front and backside of page gets mixed.
I checked in FormPainter no windows are getting overlapped.Page Format used is DINA4.
Could anyone please tell me what can be the reason for this and solution to this problem.
Regards,
Shital.

Hi,
Ya, this may be due to problem in your printer installation or problem with the parameters u r passing to the printer while printing.
Regards,
Sankar

Similar Messages

  • Problem in Printing the Smartform in Duplex

    Dear Experts,
                   I had an issue in printing the Smartform in Duplex Page.
    I had 4 windows in the Smartform, Which i had to print the Terms & Conditions. We have the Pages as
    Page1
    Page2
    Page3
    Page4.
    In my case i had to print the Terms and Conditions at the back side of the Page1. I put the print mode as D for the First Page. and also i change the print settings. Like
    Page1  --> D --> Terms
    Terms --> ' ' --> Page1
    Page2 --> ' ' --> Page1
    Page3 --> ' ' --> Page3
    Page4.--> ' ' --> Page4.
    But unable to print the Terms & Conditions at the back side of Page1. Will you please help me if my query is wrong.
    Thanks in Advance.
    Srini

    why don't you close unanswered, and repost as a question in the form printing forum....probably get better response...

  • Problem with printing in SMARTFORM

    Hello,
    I have a problem with a printout. I wrote form in SMARTFORM.
    There is a HP LJ2420 printer in our local network. This printer is my local printer (LP1) and it is defined in SAP (for example S005). When I print this form on LP1 printout is ok. If  I print this form on S005 the same printer prints black belts.
    When I save this printout in .pdf or .html file , there are no black belts.
    Regards
    Ela

    This is related to printer settings. Nothinh to doas far as coding is concerned. Just check the printer settings in SPAD transaction. You can contact your basis team  or your superior.
    Regards,
    Nageswar

  • Problem with Print of Smartforms

    Hi Experts,
    I am facing problem with the Smartforms related to purchase order and Request for Quotation.
    when i see the print preview of these two forms the preview was coming correctly. But when i give the print the data in the footer  was Truncted. I changed thepage from Letter to A4. Even then also i am facing the issue.
    So can any one tell me where would be th problem.
    Thanks & Regards,
    Ramana

    Dear Ramana,
    there is no big issue in this just you have to
    check the window at footer in which window(output option )
    tick must be there at lines with
    and always draw boxes and shading.
    tamplet paramets must match to the window.
    do this if still problem is there keep in touch
    and send me the error of output.
    pls keep in touch.
    REWARDS expected.
    vivek srivastava

  • Problem while printing in smartforms

    Hi, My Login language is AR and i m trying to print English on the smart form. The string I am trying to print is "JOANNOU & PARASKEVAIDES  (OVERSEAS)  LTD." which is stored in company address details. But in smart form it is printing like ".OVERSEAS LTD JOANNOU & PARASKEVAIDES "
    note:  It is printing first half at the left side and the second half at the right side as shown above.
    please help me to solve this issue.

    Hi,
    Here comes that where is the problem exactly. Pls read below thread. There are some SAP note that gives you the idea abt using Arabic language in Smart form..
    The sap note 823303 & 940429
    [Arabic letters & RTL in Smartform;
    Edited by: Lokesh Tarey on May 4, 2010 9:05 AM

  • Problems by printing in background

    Hi experts,
    we have a problem by printing a smartform. The problem is in authority check of an object. When we run only the print preview, everything is working fine. But when we run the direct print it looks like, that the authority check is skiped. The direct print is running in background in update task.
    Do you know where is the problem?
    Thanks,
    Pavol.

    The problem may be with the location of the code for authority check written.
    Write it just before calling the FORM.
    Or try to debug to know the reason of skipping the code.
    Regds,
    Anil

  • Problem in printing SMARTFORM

    Hello experts,
    I am having problem in print preview when I am calling a SMARTFORM from a program where I have used selection screen. I don't know what I am doing wrong. Please help me out.
    This is the code----
    REPORT YL_CN_FI .
    TABLES : BKPF,    "Accounting Header Data
             BSEG,    "Accounting Item Data
             SKAT,   "GL Text
             T001W,
             ADDR,
             YADDR,
             BSEC.
    DATA : AMT_IN_WRD LIKE SPELL,
           AMT_LINE1 LIKE ADDR-LINE0,
           AMT_LINE2 LIKE ADDR-LINE0,
           GL1 LIKE BSEG-HKONT,
           GL2 LIKE BSEG-HKONT,
           GLDESC1 LIKE SKAT-TXT50,
           GLDESC2 LIKE SKAT-TXT50,
           AMT1    LIKE BSEG-WRBTR,
           AMT2    LIKE BSEG-WRBTR,
           ORD1    LIKE BSEG-AUFNR,
           ORD2    LIKE BSEG-AUFNR,
           CC1     LIKE BSEG-KOSTL,
           CC2     LIKE BSEG-KOSTL,
           W_IND,
           CNT    TYPE N,
           TAXCNT TYPE N,
           OFFICE LIKE YADDR-ADD6,
           TADR_NUM LIKE T001W-ADRNR,
           RADI .
    --header text--
    DATA BEGIN OF TLINES OCCURS  0.
            INCLUDE STRUCTURE TLINE.
    DATA END OF TLINES.
    DATA : HDTEXT LIKE THEAD-TDNAME,
           HLINE1 LIKE TLINE-TDLINE,
           HLINE2 LIKE TLINE-TDLINE,
           HLINE3 LIKE TLINE-TDLINE,
           HLINE4 LIKE TLINE-TDLINE,
           HLINE5 LIKE TLINE-TDLINE.
    DATA : MTEXT LIKE THEAD-TDNAME,
           MLINE1 LIKE TLINE-TDLINE,
           MLINE2 LIKE TLINE-TDLINE,
           MLINE3 LIKE TLINE-TDLINE,
           MLINE4 LIKE TLINE-TDLINE,
           MLINE5 LIKE TLINE-TDLINE.
    DATA: POST_DT     LIKE BKPF-BUDAT,
          FM_NAME     TYPE RS38L_FNAM,
          LF_FORMNAME TYPE TDSFNAME.
    ----   pricing   -
    DATA BEGIN OF IT_BSEG OCCURS 0.
            INCLUDE STRUCTURE BSEG.
    DATA END OF IT_BSEG.
    DATA BEGIN OF IT_YADDR OCCURS 0.
            INCLUDE STRUCTURE YADDR.
    DATA END OF IT_YADDR.
    DATA BEGIN OF BR_YADDR OCCURS 0.
            INCLUDE STRUCTURE YADDR.
    DATA END OF BR_YADDR.
    --end of internal table declaration--
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS OPT_CN  RADIOBUTTON GROUP RADI .
    PARAMETERS OPT_DN  RADIOBUTTON GROUP RADI .
    SELECT-OPTIONS  DOCNO FOR BSEG-BELNR DEFAULT '0007100000'.
    PARAMETERS      YEAR LIKE BSEG-GJAHR DEFAULT '2006' .
    PARAMETERS      COMP LIKE BSEG-BUKRS DEFAULT 'FCL'.
    SELECTION-SCREEN END OF BLOCK B1.
    --main--
    SELECT * FROM BSEG INTO TABLE IT_BSEG
    WHERE BUKRS = COMP AND BELNR IN DOCNO
    AND   GJAHR = YEAR AND KOART = 'D'.
    LOOP AT IT_BSEG.
      CALL FUNCTION 'Y_ADDRESS'        " Customer Address
           EXPORTING
               VC_FLAG     = 'C'
                PARTY_CODE = IT_BSEG-KUNNR
           IMPORTING
               IT_YADDR   = IT_YADDR
           EXCEPTIONS
                OTHERS     = 1.
      IF IT_BSEG-KUNNR EQ '0000005001' .
        SELECT SINGLE * FROM BSEC WHERE BUKRS = IT_BSEG-BUKRS
        AND BELNR = IT_BSEG-BELNR AND GJAHR = IT_BSEG-GJAHR.
        IF SY-SUBRC EQ 0.
          IT_YADDR-ADD1 = BSEC-NAME1.
          IT_YADDR-ADD2 = BSEC-NAME2.
          IT_YADDR-ADD3 = BSEC-NAME3.
          IT_YADDR-ADD4 = BSEC-NAME4.
          IT_YADDR-ADD5 = BSEC-ORT01.
          IT_YADDR-ADD6 = BSEC-PSTLZ.
        ENDIF.
      ENDIF.
    ----  Branch Address  -
      SELECT SINGLE * FROM T001W
                 where werks = 'PCAB'.
      WHERE WERKS = IT_BSEG-GSBER .
      TADR_NUM = T001W-ADRNR.
      CALL FUNCTION 'Y_ADDRESS'
        EXPORTING
          VC_FLAG    = 'P'
          PARTY_CODE = TADR_NUM
        IMPORTING
          IT_YADDR   = BR_YADDR
        EXCEPTIONS
          OTHERS     = 1.
    ----  Branch Address  -
      SELECT BUDAT BLART INTO (BKPF-BUDAT, BKPF-BLART) FROM BKPF
      WHERE BUKRS = IT_BSEG-BUKRS
      AND   BELNR = IT_BSEG-BELNR AND GJAHR = IT_BSEG-GJAHR.
      ENDSELECT.
      POST_DT = BKPF-BUDAT.
      CASE BKPF-BLART.
        WHEN 'C1' OR 'D1'. OFFICE = '****'.
        WHEN 'C2' OR 'D2'. OFFICE = '*****'.
        WHEN 'C3' OR 'D3'. OFFICE = '*******'.
      ENDCASE.
      PERFORM READ_HEADER_TEXT.
      PERFORM GET_ITEM.
      CALL FUNCTION 'SPELL_AMOUNT'
        EXPORTING
          AMOUNT    = IT_BSEG-WRBTR
          CURRENCY  = 'INR'
          FILLER    = ' '
          LANGUAGE  = SY-LANGU
        IMPORTING
          IN_WORDS  = AMT_IN_WRD
        EXCEPTIONS
          NOT_FOUND = 1
          TOO_LARGE = 2
          OTHERS    = 3.
      CONCATENATE AMT_IN_WRD-WORD ' ONLY' INTO AMT_IN_WRD-WORD.
      CALL FUNCTION 'RKD_WORD_WRAP'
           EXPORTING
                TEXTLINE            = AMT_IN_WRD-WORD
                 DELIMITER           = ' '
                OUTPUTLEN           = 70
           IMPORTING
                OUT_LINE1           = AMT_LINE1
                OUT_LINE2           = AMT_LINE2
                 OUT_LINE3           =
            TABLE
                 OUT_LINES           =
           EXCEPTIONS
                OUTPUTLEN_TOO_LARGE = 1
                OTHERS              = 2.
      IF OPT_CN = 'X'.
        PERFORM ITEM_PRINT_CN.
      ELSEIF OPT_DN = 'X'.
        PERFORM ITEM_PRINT_DN.
      ENDIF.
      PERFORM INITALIZE.
    ENDLOOP.
    --end of main--
    *&      Form  GET_ITEM
    FORM GET_ITEM.
      NETVAL   = 0.
      MATVAL   = 0.
      DISVAL   = 0.
      BEDVAL   = 0.
      FGTURS   = 0.
      TAXABLE  = 0.
      FGTVAL   = 0.
      ENTRYTAX = 0.
      SALTAX   = 0.
      SURCHG   = 0.
      SALTOT   = 0.
      TAXCNT = 0.
      CNT = 1.
      SELECT HKONT WRBTR BSCHL AUFNR KOSTL
      INTO (BSEG-HKONT, BSEG-WRBTR, BSEG-BSCHL, BSEG-AUFNR, BSEG-KOSTL)
      FROM BSEG
      WHERE BUKRS = IT_BSEG-BUKRS
      AND   GJAHR = IT_BSEG-GJAHR
      AND   BELNR = IT_BSEG-BELNR
      AND   KOART NE 'D'.
        CASE BSEG-HKONT.
          WHEN '0000600000' OR '0000601000' OR '0000603000' OR
               '0000604000' OR '0000606000' OR '0000609000'.
            MATVAL = BSEG-WRBTR.
          WHEN '0000764100'.
            IF BSEG-BSCHL = '50'.
              DISVAL = BSEG-WRBTR.
            ELSE.
              PERFORM GLACC.
            ENDIF.
          WHEN '0000611000'.
            FGTVAL = FGTVAL + BSEG-WRBTR. "Changed on 24.08.2007
          WHEN '0000760003'.
            FGTURS = BSEG-WRBTR.
          WHEN  '0000570001' OR '0000570002' OR '0000570003' OR
                '0000570000' OR '0000570004' OR '0000570005' OR
                '0000570006' OR '0000570007' OR '0000570008' OR
                '0000570009' OR '0000570010' OR '0000570011' OR
                '0000570012' OR '0000570013' OR '0000570014' OR
                '0000570015' OR '0000570016' OR '0000570017' OR
                '0000570018' OR '0000570019' OR '0000570020'.
            TAXCNT = TAXCNT + 1.
            CASE TAXCNT.
              WHEN 1.  SALTAX = BSEG-WRBTR.
              WHEN 2.  SURCHG = BSEG-WRBTR.
              WHEN 3.  SALTOT = BSEG-WRBTR.
            ENDCASE.
          WHEN  '0000571001' OR '0000571002' OR '0000571003' OR
                '0000571000' OR '0000571004' OR '0000571005' OR
                '0000571006' OR '0000571007' OR '0000571008' OR
                '0000571009' OR '0000571010' OR '0000571011' OR
                '0000571012' OR '0000571013' OR '0000571014' OR
                '0000571015' OR '0000571016' OR '0000571017' OR
                '0000571018' OR '0000571019' OR '0000571020'.
            TAXCNT = TAXCNT + 1.
            CASE TAXCNT.
              WHEN 1.  SALTAX = BSEG-WRBTR.
              WHEN 2.  SURCHG = BSEG-WRBTR.
              WHEN 3.  SALTOT = BSEG-WRBTR.
            ENDCASE.
          WHEN '0000610000'.
            BEDVAL = BSEG-WRBTR.
          WHEN '0000491110'.
            ENTRYTAX = BSEG-WRBTR.
          WHEN '0000764500'.
            IF BSEG-BSCHL = '50'.
              NETVAL = NETVAL - BSEG-WRBTR.
            ELSE.
              NETVAL = NETVAL + BSEG-WRBTR.
            ENDIF.
          WHEN OTHERS.
            PERFORM GLACC.
        ENDCASE.
      ENDSELECT.
      IF ENTRYTAX EQ 0.
        W_IND = '0'.
      ELSE.
        W_IND = '1'.
      ENDIF.
      TAXABLE = MATVAL - DISVAL + BEDVAL + ENTRYTAX + FGTURS.
      NETVAL = NETVAL + IT_BSEG-WRBTR.
    ENDFORM.                    " GET_ITEM
    *&      Form  READ_HEADER_TEXT
    FORM READ_HEADER_TEXT.
      CLEAR : HLINE1 ,HLINE2 ,HLINE3, HLINE4, HLINE5 , HDTEXT .
      CLEAR TLINES.
      REFRESH TLINES.
      CONCATENATE  IT_BSEG-BELNR IT_BSEG-GJAHR INTO HDTEXT.
      CONCATENATE  IT_BSEG-BUKRS HDTEXT INTO HDTEXT SEPARATED BY SPACE.
      CALL FUNCTION 'READ_TEXT'
           EXPORTING
            CLIENT                  = SY-MANDT
                ID                      = '0002'
                LANGUAGE                = SY-LANGU
                NAME                    =  HDTEXT
                OBJECT                  = 'BELEG'
            ARCHIVE_HANDLE          = 0
       IMPORTING
            HEADER                  =
           TABLES
                LINES                   = TLINES
           EXCEPTIONS
                ID                      = 1
                LANGUAGE                = 2
                NAME                    = 3
                NOT_FOUND               = 4
                OBJECT                  = 5
                REFERENCE_CHECK         = 6
                WRONG_ACCESS_TO_ARCHIVE = 7
                OTHERS                  = 8.
      LOOP AT TLINES.
        CASE SY-TABIX.
          WHEN 1.  HLINE1 = TLINES-TDLINE.
          WHEN 2.  HLINE2 = TLINES-TDLINE.
          WHEN 3.  HLINE3 = TLINES-TDLINE.
          WHEN 4.  HLINE4 = TLINES-TDLINE.
          WHEN 5.  HLINE5 = TLINES-TDLINE.
        ENDCASE.
      ENDLOOP.
    EXTRACT TOWARDS TEXT ELEMENT
      MTEXT = '0061003423'.
      CALL FUNCTION 'READ_TEXT'
           EXPORTING
            CLIENT                  = SY-MANDT
                ID                      = '0004'
                LANGUAGE                = SY-LANGU
                NAME                    =  MTEXT
                OBJECT                  = 'VBBK'
            ARCHIVE_HANDLE          = 0
       IMPORTING
            HEADER                  =
           TABLES
                LINES                   = TLINES
           EXCEPTIONS
                ID                      = 1
                LANGUAGE                = 2
                NAME                    = 3
                NOT_FOUND               = 4
                OBJECT                  = 5
                REFERENCE_CHECK         = 6
                WRONG_ACCESS_TO_ARCHIVE = 7
                OTHERS                  = 8.
      LOOP AT TLINES.
        CASE SY-TABIX.
          WHEN 1.  MLINE1 = TLINES-TDLINE.
          WHEN 2.  MLINE2 = TLINES-TDLINE.
          WHEN 3.  MLINE3 = TLINES-TDLINE.
          WHEN 4.  MLINE4 = TLINES-TDLINE.
          WHEN 5.  MLINE5 = TLINES-TDLINE.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " READ_HEADER_TEXT
    *&      Form  GET_GLDESC
          text
    -->  p1        text
    <--  p2        text
    FORM GET_GLDESC USING P1 P2 .
      P2 = ''.
      SELECT TXT50 INTO (P2 ) FROM SKAT
      WHERE SPRAS = SY-LANGU
      AND   KTOPL = 'FCOA' AND SAKNR = P1.
      ENDSELECT.
    ENDFORM.                    " GET_GLDESC
    *&      Form  GLACC
          text
    -->  p1        text
    <--  p2        text
    FORM GLACC.
      IF CNT EQ 1.
        GL1  = BSEG-HKONT.
        AMT1 = BSEG-WRBTR.
        ORD1 = BSEG-AUFNR.
        CC1  = BSEG-KOSTL.
        PERFORM GET_GLDESC CHANGING GL1 GLDESC1.
        CNT = CNT + 1.
      ELSE.
        GL2  = BSEG-HKONT.
        AMT2 = BSEG-WRBTR.
        ORD2 = BSEG-AUFNR.
        CC2  = BSEG-KOSTL.
        PERFORM GET_GLDESC CHANGING GL2 GLDESC2.
      ENDIF.
    ENDFORM.                    " GLACC
    *&      Form  INITALIZE
          text
    -->  p1        text
    <--  p2        text
    FORM INITALIZE.
      CLEAR : HLINE1 ,HLINE2 ,HLINE3, HLINE4, HLINE5 , HDTEXT .
      IT_BSEG-KUNNR = ''.
      MATVAL = 0.
      DISVAL = 0.
      FGTVAL = 0.
      SALTAX = 0.
      GL1     = ''.   GL2     = ''.
      GLDESC1 = ''.   GLDESC2 = ''.
      CC1     = ''.   CC2     = ''.
      ORD1    = ''.   ORD2    = ''.
      AMT1    = 0.    AMT2    = 0.
    ENDFORM.                    " INITALIZE
    *&      Form  ITEM_PRINT
          text
    -->  p1        text
    <--  p2        text
    FORM ITEM_PRINT_CN .
      LF_FORMNAME = 'YL_CN_FI'.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
                 EXPORTING  FORMNAME           = LF_FORMNAME
                    variant            = ' '
                    direct_call        = ' '
                 IMPORTING  FM_NAME            = FM_NAME
                 EXCEPTIONS NO_FORM            = 1
                            NO_FUNCTION_MODULE = 2
                            OTHERS             = 3.
        IF SY-SUBRC <> 0.
      error handling
        ENDIF.
        CALL FUNCTION FM_NAME
    ENDFORM.                    " ITEM_PRINT

    I did that...actually It was not coming in that page because of the character limitation. The program is not executing. why??
      CALL FUNCTION FM_NAME
        EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS        = ''
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
       USER_SETTINGS             = 'X'
          POST_DT                    = POST_DT
          OFFICE                     = OFFICE
          HLINE1                     = HLINE1
          HLINE2                     = HLINE2
          HLINE3                     = HLINE3
          HLINE4                     = HLINE4
          HLINE5                     = HLINE5
          MLINE1                     = MLINE1
          MLINE2                     = MLINE2
          W_IND                      = W_IND
          MATVAL                     = MATVAL
          NETVAL                     = NETVAL
          DISVAL                     = DISVAL
          BEDVAL                     = DISVAL
          FGTURS                     = FGTURS
          TAXABLE                    = TAXABLE
          FGTVAL                     = FGTVAL
          ENTRYTAX                   = ENTRYTAX
          SALTAX                     = SALTAX
          SURCHG                     = SURCHG
          SALTOT                     = SALTOT
          AMT_LINE1                  = AMT_LINE1
          AMT_LINE2                  = AMT_LINE2
          GL1                        = GL1
          GL2                        = GL2
          GLDESC1                    = GLDESC1
          GLDESC2                    = GLDESC2
          AMT1                       = AMT1
          AMT2                       = AMT2
          ORD1                       = ORD1
          ORD2                       = ORD2
          CC1                        = CC1
          CC2                        = CC2
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
      JOB_OUTPUT_INFO            =
      JOB_OUTPUT_OPTIONS         =
        TABLES
          IT_YADDR                   = IT_YADDR
          IT_BSEG                    = IT_BSEG
          BR_YADDR                   = BR_YADDR
      EXCEPTIONS
        FORMATTING_ERROR           = 1
        INTERNAL_ERROR             = 2
        SEND_ERROR                 = 3
        USER_CANCELED              = 4
        OTHERS                     = 5
    IF SY-SUBRC <> 0.
    ENDIF.

  • 'AND' symbol is not printing in smartform output.

    Hi all,
    I am facing problem while printing  '&'   symbol using READ_TEXT FM  in smartforms . I have maintained header text in PO header in that text am using special characters like  "&"  , <5  and >5 . While displaying this data in out put it is giving junk characters like .
      i have changed editor also  but no use .
    Regards,
    Rakhi

    Hi,
    try Note 447596.
    Jshree

  • '&' symbol is not printing in smartform output.

    Hi,
    I am facing problem while printing  '&'   symbol using READ_TEXT FM  in smartforms .
    I have maintained header text in PO header in that text am using special characters like
    "&"  , <5  and >5 . While displaying this data in out put it is giving junk characters like 
    >(>&<)<   and  >(>5<)<.
    i have changed editor also  but no use .
    Regards,
    Rakhi
    Moderator Message: Cross-posting is not allowed in the forums
    Edited by: Suhas Saha on Jul 5, 2011 3:59 PM

    Hi,
    try Note 447596.
    Jshree

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

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

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

  • Printing a smartform to a different printer than my default

    I have a function module that gets passes a delivery number and the short-name of a printer.  The function module is supposed to print a smartform (pick list) for that delivery to the specified printer.  The problem is that no matter what I put in for the printer, it prints to my default printer.  If I change it, it will go there.  I'm sure I'm just missing some kind of setting.  Here is what I got:
    printer is the shortname for the printer i want, type RSPOPTYPE
    *Print Smartfomr picklist for  delivery
      data: ls_ctrl_prnt type ssfctrlop,
            ls_outp_opts type ssfcompop.
      ls_ctrl_prnt-no_dialog = 'X'.        " Suppres dialog
      ls_ctrl_prnt-device    = 'PRINTER'.
      ls_outp_opts-tddest    = printer.
      ls_outp_opts-tdprinter = printer.    " Specify required printer
      call function gv_func
        exporting
          control_parameters = ls_ctrl_prnt
          output_options = ls_outp_opts
          pk_hdr               = sf_info
          pk_orders            = sf_odrs
          pk_items             = sf_item
          pk_pgbk              = sf_pgbk
        exceptions
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4.
    Am I missing something here?  Any help would be greatly appreciated.
    Thanks,
    Curtis

    I was able to solve my issue. The field TDIMMED (print immediate) in the parameter OUTPUT_OPTION need to be passed with the value 'X'.
    The code is pasted below.
    DATA: l_ssfctrlop TYPE ssfctrlop,
            l_ssfcompop TYPE ssfcompop,
            l_formname  TYPE tdsfname,
            l_fm_name   TYPE rs38l_fnam.
      CLEAR l_formname.
    Get the smartform name based on the output type
      SELECT SINGLE sform FROM tnapr INTO l_formname
        WHERE kschl = ysdt_dynlayout-auart
          AND nacha = '1'
          AND kappl = 'V2'.
      Get the smartform function module name
        CLEAR l_fm_name.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname           = l_formname
          IMPORTING
            fm_name            = l_fm_name
          EXCEPTIONS
            no_form            = 1
            no_function_module = 2
            OTHERS             = 3.
        IF sy-subrc EQ 0.
          l_ssfctrlop-no_dialog = 'X'.                        " print popup dialog box is suppressed
          l_ssfcompop-tddest    = usr01-spld.         " the printer name is passed from screen to this field
          l_ssfcompop-tdimmed   = 'X'.                    " print immediate option is set
          l_ssfcompop-tdcopies  = copies_in.         " number of copies of output required
        Call the smartform
          CALL FUNCTION l_fm_name
            EXPORTING
              control_parameters = l_ssfctrlop
              output_options     = l_ssfcompop
              user_settings      = ' '                            "manual override of user settings            
              i_del_head         = likp
              i_dyn_layout       = ysdt_dynlayout
            TABLES
              t_del_item         = ig_lips
              t_home_address     = ig_home_address
              t_header_text1     = ig_header_text1
              t_footer_text1     = ig_footer_text1
              t_footer_text2     = ig_footer_text2
              t_footer_text3     = ig_footer_text3
              t_text4            = ig_text4
              t_text5            = ig_text5
            EXCEPTIONS
              formatting_error   = 1
              internal_error     = 2
              send_error         = 3
              user_canceled      = 4
              OTHERS             = 5.
        ENDIF.

  • Problem in Printing of mutiple form on single click

    Hi all
    I m wrking on AFS and i had created a page for printing multiple invoice print on single click.
    A range of invoice is given as input and get out in the form of print preivew or print wat v choose .
    I mean a print pop is open for multiple invoice in a single click.
    Problem in printing of multiple form is speed .its going to be slow when click for printing .OR
    v can say that creation of multiple page in printing gets more time .Is ther  any way to solve  this .
    Plz suggest me some solution for that .
    Regards,
    Ravi

    Hi
    Check if Note 353518 - Selection of outputs takes much time and Note 910976 - Selection of output from billing (VF31) are relevants.
    Other suggestion. Do a trace with ST05 and check if you have any bottleneck in the coding that you can have in your Smartform or in your SAPscript, so check in tcode V/40 what form you are using . Also see Note 185530 - Performance: Customer developments in SD.
    I hope this helps you
    Regards
    Eduardo

  • I had a problem with print preview of billing document.

    HI all,
    I had a problem with print preview of billing document which contains two output types ZR1 ZR2..
    For the footer text of billing document I maintained the font size as 7,5 pts, But when i go for print preview from output type ZR1 the font size of footer text is very small and looks good for output type ZR2.
    If i change the print options-->logical destination of output type ZR1 same as Output type ZR2, the footer text looks good.
    I think there is some issue with logical destination in print options for the output type ZR1, how can i resolve  it.

    hi,
    for both the output types , r u using same sapscript or smartform?
    if yes then, u can control it in output options of smartform and also in sapscript , you can control through if condition.
    and if differect sapscript or smartform then you should not get such problem.
    you can check the sapscript or smartfrom in TNAPR table.

  • Problem in Printing

    Hi Experts,
    I have small problem in printing smartforms,my print preview is ok but while taking print it is it is getting cut at right side and bottom of the page.Page size is same(A4) as I have specified in my smart form(DINA4).What might be the problem?
    In printer settings also same page format is selected(A4).
    What might be the problem?
    here are the pics,see the difference in preview and actual print.
    Actual Print :
    http://i35.tinypic.com/wvzx2t.jpg
    Print Preview :
    http://i35.tinypic.com/awx9up.jpg
    Every helpful answer will be rewarded.
    Thanks & Regards,
    Rock.
    (Request for Moderators : Please don't lock this thread,I know this is wrong section I had already posted this in the correct section,i.e 'Form Printing' but could not get the answer)

    Hi
    I hope you should adjust the window according to the print.please convert the form into PDF format and see the print preview.
    I had seen the print preview there is very small gap at the right side corner of the page increase the gap.
    while printing A4 printer will take some default spaces in all the corners may be you are not maintaing that space or  see  the printer if paper is inserted in proper manner.
    Better you correct the layout according to the print.
    Thanks
    Rasheed
    Edited by: Rasheed salman on Nov 21, 2008 7:32 AM

  • Issue with character formats using duplex printing in smartform

    Hi all,
    I am getting a problem with character formats using duplex printing in smartform. I am using a text module with a bold character to display text in a window. The problem is that on the first back page,the text is being printed normally (without bold), but on the next pages, the back pages are being printed with the bold character format.
    Can anyone know where is the problem..please.
    Points to be rewarded..
    Thanks.
    Regards,
    Zaheed.

    Hi Zaheed,
    Normally this should not happen.. and also there is no internal formatting done by SAP.. it will show based on what fomatting option we have specified..
    If you are saying it is happening in ur case then
         1. Recheck whether whether you have same text module getting printed on the
             two page. If they are different then then individual check formatting option for
             each..
          2. If above point does'nt work for you ..then instead of bold char use normal
              format for text element and see if it is printing same on both page..
    Try this out and let us know your findings...
    Enjoy SAP.
    Pankaj Singh

Maybe you are looking for