File opening error-smartform pdf

dear friends ,
i created a smartform and converted the smart form into pdf file and downloaded the same but when im trying to open the file a pop-up is coming with the msg like the file is corrupted or damaged. can any one help me on this issue. for ur convineince im  putting the code also..
DATA :  I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
        I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
        I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
        I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
        I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
        I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
        I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
        I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
        PDF LIKE TLINE OCCURS 0 WITH HEADER LINE,
Work Area declarations
        WA_OBJHEAD TYPE SOLI_TAB,
        W_CTRLOP TYPE SSFCTRLOP,
        W_COMPOP TYPE SSFCOMPOP,
        W_RETURN TYPE SSFCRESCL,
        WA_DOC_CHNG TYPE SODOCCHGI1,
        W_DATA TYPE SODOCCHGI1,
        WA_BUFFER TYPE STRING,"To convert from 132 to 255
        V_FORM_NAME TYPE RS38L_FNAM,
        V_LEN_IN LIKE SOOD-OBJDBLEN,
        V_LEN_OUT LIKE SOOD-OBJLEN,
        V_LEN_OUTN TYPE I,
        V_LINES_TXT TYPE I,
        V_LINES_BIN TYPE I.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZRD_PINU'"give ur smartform name
IMPORTING
FM_NAME = V_FORM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION V_FORM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I_OTF[] = W_RETURN-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_LEN_IN
TABLES
OTF = W_RETURN-OTFDATA
LINES = I_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
Fehlerhandling
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
  BIN_FILESIZE                  =
    FILENAME                      = 'c:\ktsf.pdf'
   FILETYPE                      = 'ASC'
  APPEND                        = ' '
  WRITE_FIELD_SEPARATOR         = ''
  HEADER                        = '00'
  TRUNC_TRAILING_BLANKS         = ' '
  WRITE_LF                      = 'X'
  COL_SELECT                    = ' '
  COL_SELECT_MASK               = ' '
  DAT_MODE                      = ' '
IMPORTING
  FILELENGTH                    =
  TABLES
    DATA_TAB                      = I_TLINE
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.
Thanks in advance.
Regards..
DurgaPrasad.K

Hi again,
1. I just tried at my end,
   and now it works fine.
2. I have used another FM
   for converting to PDF.
CONVERT_OTF_2_PDF
3. use like this
(u may change the variable name as per ur requirement)
data : myline like table of tline with header line.
data : docs like table of DOCS with header line.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
  USE_OTF_MC_CMD               = 'X'
  ARCHIVE_INDEX                =
IMPORTING
  BIN_FILESIZE                 =
  TABLES
    OTF                          = otf
    DOCTAB_ARCHIVE               = docs
    LINES                        = myline
EXCEPTIONS
  ERR_CONV_NOT_POSSIBLE        = 1
  ERR_OTF_MC_NOENDMARKER       = 2
  OTHERS                       = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
4. Now download internal table
  MYLINE (using gui_download)
  in 'BIN' Format.
5. It will work fine !
regards,
amit m.

Similar Messages

  • File opening error

    hello friends,
    i am doing data migration with lsmw withe directinput method so i did everything fine till the end i defined the logicalfiles also correctly and defined everthing perfeclty
    but i am getting below error
    File open error
    belrd110\INPUT\CT.TXT Permission  denied
    can anyone let me know where this is going wrong
    i am having the authorisation at the server level also and in the read and convert steps records and data coming perfectly but when i excute it at the end it is giving such error
    ur help will be appreciated
    Naveen

    Hi Naveen,
    Did you write your statment like this?
    OPEN DATASET P_DOWN FOR OUTPUT IN TEXT MODE.
    If it is not working, try to create a new file and access the same.
    Thanks,
    Sreekanth

  • File open error at ftp even the file is not open.....

    Hi,
    i get the error File open with the fm GUI_UPLOAD while uploading the XML file from FTP server.
    What is interesting is that i did not open the file, furthermore i closed all the windows else that sap window,
    but still i get the file open error.
    We create the xml file when created a new delivery. And this xml file is sent to a bukrs's ftp and they also sent the same xml after some validations done.
    When it arrives to our ftp server i make it post goods issue automatically but from yesterday i got the file open error, it was working fine just before today.
    What could be the problem?
    Hint: Yesterday and previous day files still work fine but files created today are faulty.
    Thanks.

    Thanks for replies.
    My code is that:
    call function 'HTTP_SCRAMBLE'
        EXPORTING
          source      = gv_password
          sourcelen   = slen
          key         = gv_key
        IMPORTING
          destination = gv_password.
      describe field gv_password length gv_pwd_len in character mode.
      call function 'FTP_CONNECT'
        exporting
          user            = 'HHH\GrupMMM'
          password        = gv_password
          host            = '10.10.10.10' "assume that is the host
          rfc_destination = 'SAPFTPA'
        importing
          handle          = gv_handle
        exceptions
          not_connected   = 1
          others          = 2.
      if sy-subrc eq 0.
        "concatenate 'put' ld_full_path '[' ld_full_path ']'
        *gv_com = 'lcd C:\MMM\RETURN_FILES'.*
        clear mtab_data.
        free mtab_data.
        call function 'FTP_COMMAND'
          exporting
            handle        = gv_handle
            command       = gv_com
          tables
            data          = mtab_data
          exceptions
            tcpip_error   = 1
            command_error = 2
            data_error    = 3
            others        = 4.
        if sy-subrc eq 0.
        endif.
    When i get the list of the return files i get data of each file via gui_upload.
    CALL FUNCTION 'GUI_UPLOAD'
            EXPORTING
              filename   = filename
              filetype   = 'BIN'                             
            IMPORTING
              filelength = totalsize
            TABLES
              data_tab   = xml_table[]
            EXCEPTIONS
              FILE_READ_ERROR = 1
              FILE_OPEN_ERROR = 2
              NO_BATCH = 3
              GUI_REFUSE_FILETRANSFER = 4
              INVALID_TYPE = 5
              NO_AUTHORITY = 6
              UNKNOWN_ERROR = 7
              BAD_DATA_FORMAT = 8
              HEADER_NOT_ALLOWED = 9
              SEPARATOR_NOT_ALLOWED = 10
              HEADER_TOO_LONG = 11
              UNKNOWN_DP_ERROR = 12
              ACCESS_DENIED = 13
              DP_OUT_OF_MEMORY = 14
              DISK_FULL = 15
              DP_TIMEOUT = 16.
    However i get the open error for all files created today.
    By the way, how can i use open dataset instead of ftp commands? How can i see the files at apllication server?
    i get the files via IP of the FTP but how can i get files from application server?
    Thanks.

  • DVD-MOV mpegstream clip error: "File open error: unsupported file type"

    I do it all the time this is the only time i've gotten this error, i use mpeg stream clip. I have a dvd I got from a DVR recorder, I open the dvd which shows 2 VOB files in the TS folder. the MENU gives "Warning: the stream may have timecode breaks." I "Fix Now" and it works fine. But i dont want the menu. the other VOB file in the TS folder, which should be the "movie I want" gives this error when opened,
    "File open error: unsupported file type"
    when I open anyway, I get an audio bar which has no sound, and no video.
    ANY IDEAS? I've been on this for hours PLEASE

    Hi,
    Do you have the [MPEG-2 component|http://www.apple.com/quicktime/mpeg2> installed on your computer? If not, you will need it to be able to convert VOB files.

  • Podcasts - File Open Error N97 mini

    I have successfully downloaded podcasts with my N97 mini, but when I go to open/play the podcast I keep getting a "File Open Error" ???

    Podcast Library Refresh - General Error
    1. Connect your 5800 to you PC in Mass Storage Mode OR connect the microSD to your PC via a Memory card reader.
    2. Open Windows Explorer and browse to your memory card drive ..
    - To remove and start fresh start go to E:\Private\10281e17 There you should see 4 files 2 are Mp3 files other are Podcast files. Delete the whole 10281e17 folder, its not harm since our device will automatically create a new structure of the folder.
    TQ
    I'm an Xploit - Please feel free to post your issues, feedbacks in this discussion forum and I'll do my level best to help, otherwise my knowledged friends whom are around willing to help you. Thank you !

  • HT1338 safari pdf file open error

    Dear. Sir
    I have recently downloaded Adobe Reader X, new version. I don't have any problem with this application when I open the stored pdf file in my mac.
    However, it has serious problem with opening a new pdf file on safari.
    When I download pdf files, the pdf document shows as a black....!!! (No respond at all from Safari)
    Please help me out
    Yours faithfully 
    Euna Noh

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • Unwanted external file opening behavior by pdfs

    I am using RoboHelp 8 (TCS 2) on a Windows Vista machine and have done so without issue for quite some time. However, today, after applying the BaseImage.dll fix described for images prepared in PS CS5.1 appearing as a red box (http://kb2.adobe.com/cps/859/cpsid_85901.html) any pdf that I apply to a project, either as a baggage file, by hyperlinking to the file or by embedding it now prompts a dialog box to open the pdf externally in projects exported as browser-based help.
    I don't know if the BaseImage.dll is related but that is the only modification that I have performed on my system. Normally, when I create a topic page in my TOC and link it to a pdf baggage file, the file opens within my main frame or when I link it as a hyperlink and set "Display in frame" to "Page Default (none) etc it will open within the browser. It is now applying this new unwanted behavior on older projects that I have gone back and re-generated which is why I suspect the BaseImage.dll has rewritten some default behavior.
    This is very problematic for me as I need the pdfs to open within the main application. I would sincerely appreciate any assistance!!!

    Hi there
    Perhaps the link below holds an answer?
    Click here to view
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • How to Enable Plugin before File Opened And Load PDF File From memory?

    hello everyone,
    there have two problems,all i want to do is to show a pdf file encrypted by AES algorithm.
    1.one is how to enable plugin before file opened?
    i developed another two plugin,and each enabled after one pdf file was opened,and now i want to replace the file open command and can do some word by meself,such as decrypt the pdf ?
    2.another is how to load pdf file from memory?
    if i can enable plugin before file opened,and than i can read the file and decrypt it,and now i want to do is do load the decrypt file (in memory) into the adobe?
    i tried many method,but all in vain.who can help me or give me some advice?
    thanks.
    merry chrismas to everyone.

    The proper way to handle other file formats (even where it is really a PDF that has been "wrapped") is to create an AVConversionHandler.
    To load a PDF from a source other than the file system, you need to create a custom AVFileSys.

  • Canon 7d mark II raw files open error

    Photoshop elements 12 will not open the canon 7d mark II raw files, from what I read elements are not going to upgrade there camera profiles anymore, so anything new your just out of luck?  The support people have no clue.

    Faq:
    FAQ: Will Photoshop Elements work with my camera, or Why won't my raw files open?
    more specifically:
    Camera Raw plug-in | Supported cameras
    in which you find that your camera requires the ACR 8.7 version
    Camera Raw-compatible Adobe applications
    in which you see that PSE12 can't, and that PS13 can with an update.
    So what solution, since Adobe does not upgrade older versions? It's the free Adobe DNGconverter:
    Use the latest version of the free DNG Converter (for Macintosh or Windows)
    You can convert your files to the universaly compatible DNG format (the files will work with any version of the Camera Raw plug-in). See In depth : Digital Negative (DNG) for more information.
    This standalone utility lets you batch convert whole folders of raw files to the DNG raw format that your PSE12 can read.
    jazyjlb1 a écrit:
    ...  The support people have no clue.

  • PDF file format error - Smartform to e-mail attachment

    Hi All,
    I am trying to convert smartform output to PDF and send as an e-mail/fax attachment. Every thing works fine except when I try to open attachment in e-mail it says ‘Not supported file type or File Damage –> May be not correctly decoded’. I have attached my code for reference, any hints much appreciated. Thanks in advance.
    Regards,
    Tim
    data: t_otf    type  table of itcoo,
            t_tline  type  table of tline,
            g_filesize  TYPE I.
    Internal Table declarations
      DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
      i_tline TYPE TABLE OF tline WITH HEADER LINE,
      i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
      i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
      i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
      i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      i_objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE,
      i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
      w_objhead TYPE soli_tab,
      w_ctrlop TYPE ssfctrlop,
      w_compop TYPE ssfcompop,
      w_return TYPE ssfcrescl,
      w_doc_chng typE sodocchgi1,
      w_data TYPE sodocchgi1,
      w_buffer TYPE string,"To convert from 132 to 255
    Variables declarations
      v_form_name TYPE rs38l_fnam,
      v_len_in LIKE sood-objlen,
      v_len_out LIKE sood-objlen,
      v_len_outn TYPE i,
      v_lines_txt TYPE i,
      v_lines_bin TYPE i.
    <b> CALL FUNCTION FM_NAME</b>. .......
      t_otf[] = wa_outinfo-otfdata[].
      CALL FUNCTION <b>'CONVERT_OTF'</b>
                    EXPORTING
                      FORMAT                      = 'PDF'
                     MAX_LINEWIDTH               = 132
                  ARCHIVE_INDEX               = ' '
                  COPYNUMBER                  = 0
                  ASCII_BIDI_VIS2LOG          = ' '
                  PDF_DELETE_OTFTAB           = ' '
                    IMPORTING
                      BIN_FILESIZE                = g_filesize
                  BIN_FILE                    = g_binfile
                    TABLES
                      OTF                         = t_otf
                      LINES                       = i_tline
                    EXCEPTIONS
                      ERR_MAX_LINEWIDTH           = 1
                      ERR_FORMAT                  = 2
                      ERR_CONV_NOT_POSSIBLE       = 3
                      ERR_BAD_OTF                 = 4
                      OTHERS                      = 5.
    convert PDF 132 to 255
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Convert PDF from 132 to 255.
      LOOP AT i_tline.
    Replacing space by ~
        TRANSLATE i_tline USING ' ~'.
        CONCATENATE w_buffer i_tline INTO w_buffer.
      ENDLOOP.
    Replacing ~ by space
      TRANSLATE w_buffer USING '~ '.
      DO.
        i_record = w_buffer.
    Appending 255 characters as a record
        APPEND i_record.
        SHIFT w_buffer LEFT BY 255 PLACES.
        IF w_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
      Refresh: i_reclist,
      i_objtxt,
      i_objbin,
      i_objpack.
      clear w_objhead.
    Object with PDF.
      loop at i_record.
       i_objbin-line = i_record-line.
       append i_objbin.
      endloop.
    i_objbin[] = i_record[].
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
    Object with main text of the mail.
      i_objtxt = 'Find attached the output of the smart form.'.
      APPEND i_objtxt.
      i_objtxt = 'Regards,'.
      APPEND i_objtxt.
      i_objtxt = 'test'.
      APPEND i_objtxt.
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
    Document information.
      w_doc_chng-obj_name = 'Smartform'.
      w_doc_chng-expiry_dat = sy-datum + 10.
      w_doc_chng-obj_descr = 'Smart form output'.
      w_doc_chng-sensitivty = 'F'. "Functional object
      w_doc_chng-doc_size = v_lines_txt * 255.
    Pack to main body as RAW.
    Obj. to be transported not in binary form
      CLEAR i_objpack-transf_bin.
    *Start line of object header in transport packet
      i_objpack-head_start = 1.
    Number of lines of an object header in object packet
      i_objpack-head_num = 0.
    Start line of object contents in an object packet
      i_objpack-body_start = 1.
    Number of lines of the object contents in an object packet
      i_objpack-body_num = v_lines_txt.
    Code for document class
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
    Packing as PDF.
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'Smartform'.
      CONCATENATE 'Smartform_output' '.pdf'
      INTO i_objpack-obj_descr.
      i_objpack-doc_size = v_lines_bin * 255.
      APPEND i_objpack.
    Document information.
      CLEAR i_reclist.
    e-mail receivers.
      i_reclist-receiver = '[email protected]'.
      i_reclist-express = 'X'.
      i_reclist-rec_type = 'U'. "Internet address
      APPEND i_reclist.
    Sending mail.
      CALL FUNCTION <b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b>
        EXPORTING
          document_data              = w_doc_chng
          put_in_outbox              = 'X'
          COMMIT_WORK                = 'X'
        TABLES
          packing_list               = i_objpack
          object_header              = w_objhead
          contents_hex               = i_objbin
          contents_txt               = i_objtxt
          receivers                  = i_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
      IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

    Hi Tim,
    I used this to send a smartform in pdf format by email.
    Hope it helps
    Cristian
    REPORT  y_cb_test_051                           .
    DATA DECLARATION
    TYPE-POOLS: meein.
    TABLES: toa_dara,
            nast,
            tnapr,
            arc_params.
    DATA: ent_retco  TYPE sy-subrc,
          ent_screen TYPE c,
          l_xkomk LIKE TABLE OF komk WITH HEADER LINE,
          xscreen.                         "Kz. Probeausgabe
    DATA: i_texto_cuerpo LIKE  solisti1 OCCURS 0 WITH HEADER LINE.
    SELECT OPTIONS / PARAMETERS
    PARAMETERS:
    p_kappl  LIKE nast-kappl OBLIGATORY DEFAULT 'EF',
    p_objky  LIKE nast-objky OBLIGATORY DEFAULT '0010001125',
    p_kschl  LIKE nast-kschl OBLIGATORY DEFAULT 'NEU',
    p_spras  LIKE nast-spras OBLIGATORY DEFAULT  'EN',
    p_parnr  LIKE nast-parnr OBLIGATORY DEFAULT  '50009123',
    p_parvw  LIKE nast-parvw OBLIGATORY DEFAULT  'BA',
    p_erdat  LIKE nast-erdat OBLIGATORY DEFAULT '20050908',
    p_eruhr  LIKE nast-eruhr OBLIGATORY DEFAULT '130105',
    p_aende  LIKE nast-aende DEFAULT 'X',
    p_nacha  LIKE nast-nacha DEFAULT '1',
    p_ndialo TYPE tdsfflag   DEFAULT ' ',
    p_telfx  LIKE nast-telfx DEFAULT '1-720-220-4274',
    p_tland   LIKE nast-tland DEFAULT 'US',
    p_sform TYPE tdsfname DEFAULT 'ZMMNABPR3PFMMPO_L3' OBLIGATORY.
    *PDF TABLES
    DATA: tb_pdf LIKE tline OCCURS 0.
    DATA: tb_pdf255 TYPE so_text255 OCCURS 0.
    MAIN PROCESSING SECTION
    START-OF-SELECTION.
    SELECT SINGLE *
    INTO nast
    FROM nast
    WHERE kappl = p_kappl
    AND   objky = p_objky
    AND   kschl = p_kschl
    AND   spras = p_spras
    AND   parnr = p_parnr
    AND   parvw = p_parvw
    AND   erdat = p_erdat
    AND   eruhr = p_eruhr.
    IF sy-subrc <> 0.
      MESSAGE s000(00) WITH 'Record in NAST not found.'.
      nast-kappl = p_kappl.
      nast-objky = p_objky.
      nast-kschl = p_kschl.
      nast-spras = p_spras.
      nast-parnr = p_parnr.
      nast-parvw = p_parvw.
      nast-erdat = p_erdat.
      nast-eruhr = p_eruhr.
      nast-nacha = p_nacha.
      nast-telfx = p_telfx.
      nast-tland = p_tland.
    ENDIF.
      nast-aende  = p_aende.
      tnapr-sform = p_sform.
      PERFORM entry_neu
                      USING
                                ent_retco
                                ent_screen.
    FORMS
    *&      Form  entry_neu
          text
         -->ENT_RETCO  text
         -->ENT_SCREEN text
    FORM entry_neu
                    USING
                              ent_retco
                              ent_screen.
      DATA: l_druvo LIKE t166k-druvo,
            l_nast  LIKE nast,
            l_from_memory,
            l_doc   TYPE meein_purchase_doc_print.
      DATA: ls_print_data_to_read TYPE lbbil_print_data_to_read.
      DATA: ls_bil_invoice TYPE lbbil_invoice.
      DATA: lf_fm_name            TYPE rs38l_fnam.
      DATA: ls_control_param      TYPE ssfctrlop.
      DATA: ls_composer_param     TYPE ssfcompop.
      DATA: ls_recipient          TYPE swotobjid.
      DATA: ls_sender             TYPE swotobjid.
      DATA: lf_formname           TYPE tdsfname.
      DATA: ls_addr_key           LIKE addr_key.
    xscreen = ent_screen.
    clear ent_retco.
      IF nast-aende EQ space.
        l_druvo = '1'.
      ELSE.
        l_druvo = '2'.
      ENDIF.
      CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
        EXPORTING
          ix_nast        = nast
          ix_screen      = ent_screen
        IMPORTING
          ex_retco       = ent_retco
          ex_nast        = l_nast
          doc            = l_doc
        CHANGING
          cx_druvo       = l_druvo
          cx_from_memory = l_from_memory.
      CHECK ent_retco EQ 0.
      IF nast-adrnr IS INITIAL.
        PERFORM get_addr_key
                             CHANGING ls_addr_key.
      ELSE.
        ls_addr_key = nast-adrnr.
      ENDIF.
    *Set the print Parameters
      PERFORM set_print_param USING      ls_addr_key
                                CHANGING ls_control_param
                                         ls_composer_param
                                         ls_recipient
                                         ls_sender
                                         ent_retco.
    *Get the Smart Form name.
      IF NOT tnapr-sform IS INITIAL.
        lf_formname = tnapr-sform.
      ELSE.
        lf_formname = tnapr-fonam.
      ENDIF.
    determine smartform function module for invoice
      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.
      perform protocol_update_i.
      ENDIF.
      ls_control_param-getotf = 'X'.
      DATA: l_document_output_info TYPE  ssfcrespd,
            l_job_output_info      TYPE  ssfcrescl,
            l_job_output_options   TYPE  ssfcresop.
      CALL FUNCTION lf_fm_name
           EXPORTING
                archive_index      = toa_dara
                archive_parameters = arc_params
                control_parameters = ls_control_param
                mail_recipient     = ls_recipient
                mail_sender        = ls_sender
                output_options     = ls_composer_param
                user_settings      = ' '
                zxekko             = l_doc-xekko
                zxpekko            = l_doc-xpekko
               zxaend             = l_doc-xaend
          IMPORTING
                document_output_info = l_document_output_info
                job_output_info      = l_job_output_info
                job_output_options   = l_job_output_options
          TABLES
                l_xekpo            = l_doc-xekpo[]
                l_xekpa            = l_doc-xekpa[]
                l_xpekpo           = l_doc-xpekpo[]
                l_xeket            = l_doc-xeket[]
                l_xtkomv           = l_doc-xtkomv[]
                l_xekkn            = l_doc-xekkn[]
                l_xekek            = l_doc-xekek[]
                l_xaend            = l_doc-xaend[]
                l_xkomk            = 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.
        BREAK-POINT.
      ENDIF.
    Converts OTF to PDF
      DATA: v_len_in TYPE i.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
        IMPORTING
          bin_filesize          = v_len_in
        TABLES
          otf                   = l_job_output_info-otfdata
          lines                 = tb_pdf
        EXCEPTIONS
          err_max_linewidth     = 0
          err_format            = 1
          err_conv_not_possible = 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.
    Change the PDF format from 132 to 255.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
       EXPORTING
       line_width_src                    =
       line_width_dst                    =
         transfer_bin                      = 'X'
        TABLES
          content_in                        = tb_pdf
          content_out                       = tb_pdf255
       EXCEPTIONS
         err_line_width_src_too_long       = 1
         err_line_width_dst_too_long       = 2
         err_conv_failed                   = 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.
      DATA: lw_subject TYPE so_obj_des.
      DATA: lwa_body  TYPE solisti1.
      DATA: ltb_body  TYPE TABLE OF solisti1.
      DATA: lw_filename TYPE char100.
      DATA: ltb_recipients TYPE TABLE OF somlreci1.
      DATA: lwa_recipients TYPE somlreci1.
      lw_subject = 'This is the email subject'.
      lwa_body-line = 'This is the email body - Line1'.
      APPEND lwa_body TO ltb_body.
      lwa_body-line = 'This is the email body - Line2'.
      APPEND lwa_body TO ltb_body.
      lwa_body-line = 'This is the email body - Line3'.
      APPEND lwa_body TO ltb_body.
      lwa_body-line = 'This is the email body - Line4'.
      APPEND lwa_body TO ltb_body.
      lw_filename = 'Contract'.
    *RECIPIENTS
      lwa_recipients-rec_type = 'U'.
      lwa_recipients-express  = 'X'.
      lwa_recipients-receiver = sy-uname.
      lwa_recipients-copy     = ''.
      APPEND lwa_recipients TO ltb_recipients.
    RECIPIENTS
      lwa_recipients-rec_type = 'U'.
      lwa_recipients-express  = 'X'.
      lwa_recipients-receiver = '[email protected]'.
      lwa_recipients-copy     = ''.
      APPEND lwa_recipients TO ltb_recipients.
    RECIPIENTS
      lwa_recipients-rec_type = 'U'.
      lwa_recipients-express  = 'X'.
      lwa_recipients-receiver = '[email protected]'.
      lwa_recipients-copy     = ''.
      APPEND lwa_recipients TO ltb_recipients.
    Sends the PDF by email.
      PERFORM f_send_pdf_by_email
                          TABLES
                                 tb_pdf255
                                 ltb_body
                                 ltb_recipients
                          USING
                                 lw_subject
                                 lw_filename.
    ENDFORM.                    "entry_neu
    *&      Form  ZCA_MAIL_BIN
          text
    FORM f_send_pdf_by_email
                        TABLES
                                ptb_pdf255      STRUCTURE solisti1
                                ptb_body        STRUCTURE solisti1
                                ptb_recipients  STRUCTURE somlreci1
                        USING
                                pw_subject TYPE so_obj_des
                                pw_filename TYPE char100.
    *-DATA DECLARATION----
    Variables y tablas internas.
      DATA: BEGIN OF ltb_objbin OCCURS 0.
              INCLUDE STRUCTURE solisti1.
      DATA: END OF ltb_objbin.
      DATA:  lwa_doc_chng LIKE sodocchgi1,
             lw_tab_lines LIKE sy-tabix,
             ltb_objtxt  LIKE solisti1 OCCURS 10 WITH HEADER LINE,
             ltb_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    *-MAIN PROCESSING SECTION----
      clear:   ltb_objbin, ltb_objtxt, ltb_objpack, lwa_doc_chng.
      refresh: ltb_objbin, ltb_objtxt, ltb_objpack.
    Control Data
      lwa_doc_chng-obj_name   = 'URGENT'.
      lwa_doc_chng-sensitivty = 'P'.
      lwa_doc_chng-no_change  = 'X'.
      lwa_doc_chng-priority   = '1'.
      lwa_doc_chng-obj_prio   = '1'.
      lwa_doc_chng-obj_langu  = sy-langu.
      lwa_doc_chng-no_change  = 'X'.
    Email Subject
      lwa_doc_chng-obj_descr = pw_subject.
    Email Body
      ltb_objtxt[] = ptb_body[].
      CLEAR ltb_objtxt.
      DESCRIBE TABLE ltb_objtxt LINES lw_tab_lines.
      IF lw_tab_lines GT 0.
        READ TABLE ltb_objtxt INDEX lw_tab_lines.
        lwa_doc_chng-doc_size =
            ( lw_tab_lines - 1 ) * 255 + STRLEN( ltb_objtxt ).
        CLEAR ltb_objpack-transf_bin.
        ltb_objpack-body_start = 1.
        ltb_objpack-body_num   = lw_tab_lines.
        ltb_objpack-doc_type   = 'RAW'.
        APPEND ltb_objpack.
      ENDIF.
    Attachment
    Move the binary attachment to other internal table.
      ltb_objbin[] = ptb_pdf255[].
      ltb_objpack-transf_bin = 'X'.
      ltb_objpack-body_start = 1.
    Get the number of lines in the Attachment (PDF FILE)
      DESCRIBE TABLE ltb_objbin LINES lw_tab_lines.
      ltb_objpack-body_num  = lw_tab_lines.
      ltb_objpack-doc_type  = 'PDF'.
      ltb_objpack-obj_descr = pw_filename.
      ltb_objpack-obj_name  = pw_filename.
      ltb_objpack-doc_size  = lw_tab_lines * 255.
      APPEND ltb_objpack.
    Call the function to send the PDF file by email
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = lwa_doc_chng
          put_in_outbox              = 'X'
        TABLES
          packing_list               = ltb_objpack
          contents_bin               = ltb_objbin
          contents_txt               = ltb_objtxt
          receivers                  = ptb_recipients
        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.
      CASE sy-subrc.
        WHEN 0.
        WHEN 1. RAISE too_many_receivers.
        WHEN 2. RAISE document_not_sent  .
        WHEN 3. RAISE document_type_not_exist.
        WHEN 4. RAISE operation_no_authorization.
        WHEN 5. RAISE parameter_error.
        WHEN 7. RAISE enqueue_error .
        WHEN OTHERS. RAISE x_error.
      ENDCASE.
      COMMIT WORK.
    ENDFORM.                    "ZCA_MAIL_BIN
    *&      Form  get_addr_key
          text
         -->P_CS_BIL_INVOICE_HD_ADR  text
         <--P_CS_ADDR_KEY  text
    FORM get_addr_key
                      CHANGING l_addr_key LIKE addr_key.
      DATA: l_lfa1 LIKE lfa1.
      SELECT SINGLE * FROM lfa1 INTO l_lfa1
      WHERE lifnr = nast-parnr.
      IF sy-subrc = 0.
        MOVE l_lfa1-adrnr TO l_addr_key.
      ENDIF.
    ENDFORM.                               " get_addr_key
    *&      Form  set_print_param
          text
         -->P_LS_ADDR_KEY  text
         <--P_LS_CONTROL_PARAM  text
         <--P_LS_COMPOSER_PARAM  text
         <--P_LS_RECIPIENT  text
         <--P_LS_SENDER  text
         <--P_CF_RETCODE  text
    FORM set_print_param USING    is_addr_key LIKE addr_key
                         CHANGING cs_control_param TYPE ssfctrlop
                                  cs_composer_param TYPE ssfcompop
                                  cs_recipient TYPE  swotobjid
                                  cs_sender TYPE  swotobjid
                                  cf_retcode TYPE sy-subrc.
      DATA: ls_itcpo     TYPE itcpo.
      DATA: lf_repid     TYPE sy-repid.
      DATA: lf_device    TYPE tddevice.
      DATA: ls_recipient TYPE swotobjid.
      DATA: ls_sender    TYPE swotobjid.
      lf_repid = sy-repid.
    CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
      CALL FUNCTION 'Z_MMNA_WFMC_PREPARE_SMART_FORM'
        EXPORTING
          pi_nast       = nast
          pi_addr_key   = is_addr_key
          pi_repid      = lf_repid
        IMPORTING
          pe_returncode = cf_retcode
          pe_itcpo      = ls_itcpo
          pe_device     = lf_device
          pe_recipient  = cs_recipient
          pe_sender     = cs_sender.
      IF cf_retcode = 0.
        MOVE-CORRESPONDING ls_itcpo TO cs_composer_param.
        cs_composer_param-tdimmed = ' '.
        cs_control_param-device      = lf_device.
        cs_control_param-no_dialog   = 'X'.
      cs_control_param-no_dialog   = p_ndialo.
        cs_control_param-preview     = xscreen.
        cs_control_param-getotf      = ls_itcpo-tdgetotf.
        cs_control_param-langu       = nast-spras.
      ENDIF.
    ENDFORM.                    "set_print_param
    Message was edited by: Cristian Berri

  • PDF File opening error

    Hi,
    I have an BSP application in which I am fetching the pdf file data from an oracle table to a variable of data type xstring.
    Now I have to display this xstring again in pdf format in this BSP. The pdf file is generated but while opening it is giving error "There is an error in opening this document.The file is damaged and could not be repaired".
    What could be the reason.
    My On initialisation code is as:
    data: outputx type xstring.
    (The pdf file data is fetched from oracle table to outputx.)
    CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg
    = 1.
        cached_response->set_header_field( name  =
              if_http_header_fields=>content_type
                                      value = 'application/pdf' ).
        cached_response->set_status( code = 200 reason = 'OK' ).
        cached_response->server_cache_expire_rel( expires_rel = 180 ).
        l_pdf_len = xstrlen( outputx ).
        response->set_data( data = outputx
                                 length = l_pdf_len ).
         response->set_header_field(
                            name  = 'content-disposition'
                            value = 'attachment; filename=attach_pdf.pdf' ).
    CALL FUNCTION 'GUID_CREATE'
          IMPORTING
            ev_guid_32 = guid.
        CONCATENATE runtime->application_url '/' guid '.pdf' INTO
    display_url.
        cl_http_server=>server_cache_upload( url      = display_url
                                             response = cached_response ).
      navigation->response_complete( ).

    Still the pdf file is not opening.
    My On Initilisation code is as below:
    EXEC SQL.
      OPEN CUR FOR SELECT ORDER_NO,ORDER_DESC,DOC_TYPE
                 FROM SAPIBM.T_ORDER
                 where ORDER_NO = :orderno
    ENDEXEC.
    refresh : t_order.
    do.
      clear : wk_order.
      EXEC SQL.
        FETCH NEXT CUR INTO
                         :wk_order-ORDER_NO,
                         :wk_order-ORDER_DESC,
                         :WK_ORDER-DOC_TYPE
      ENDEXEC.
      if sy-subrc = 0.
        append wk_order   to t_order.
      else.
        exit.
      endif.
    enddo.
    EXEC SQL.
      CLOSE CUR
    ENDEXEC.
    if not t_order[] is initial.
      read table t_order into wk_order index 1.
      w_doctype = wk_order-doc_type.
      case w_doctype.
        when 'P'.
    outputx = wk_order-order_desc.
    CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg
    = 1.
    IF XSTRLEN( OUTPUTX ) > 0.
    response->delete_header_field(
    name = if_http_header_fields=>cache_control ).
    response->delete_header_field(
    name = if_http_header_fields=>expires ).
    response->delete_header_field(
    name = if_http_header_fields=>pragma ).
    response->set_header_field(
    name = if_http_header_fields=>content_type
    value = 'application/pdf' ).
       response->set_status( code = 200 reason = 'OK' ).
       response->server_cache_expire_rel( expires_rel = 180 ).
        response->set_header_field(
                          name  = 'content-disposition'
                           value = 'attachment; filename=attach_pdf.pdf' )
        response->set_header_field(
                       name  = 'cache-control'
                       value = 'max-age=0' ).
        l_pdf_len = xstrlen( wk_order-order_desc ).
        response->set_data( data = wk_order-order_desc
                                 length = l_pdf_len ).
        CALL FUNCTION 'GUID_CREATE'
          IMPORTING
            ev_guid_32 = guid.
        CONCATENATE runtime->application_url '/' guid '.pdf' INTO
    display_url.
        cl_http_server=>server_cache_upload( url      = display_url
                                             response = cached_response ).
      navigation->response_complete( ).
    endif.
      endcase.
    endif.

  • Encrypted PDF file open error

    Hi All,
    problem is when i open to outlook to check mail at that time i got mail but attached file is not open which is encrypted file
    so please help how to open attached file following process i do .
    1: convert otf to pdf file
    2: download pdf file into application server
    3:encrypt pdf file with password protect
    4:upload pdf file from application server
    5:send mail
    1. OTR 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                = gv_bin_filesize
    *   BIN_FILE                    =
        TABLES
          otf                         = gt_otf
          lines                       = gt_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.
    then download pdf file into application server using following code
    OPEN DATASET l_file FOR OUTPUT IN BINARY MODE  .
      IF  sy-subrc = 0 .
        LOOP AT gt_pdf_tab.
          TRANSFER gt_pdf_tab TO l_file .
        ENDLOOP.
        CLOSE DATASET l_file  .
      ELSE.
        WRITE : / 'operating system could not open file' .
      ENDIF.
    *Then i use command line mode Encryptpdf, from verypdf.com, *
    so successfuly file encrypted and password protected.*
    Then upload pdf filw which is encrypted form application server
    OPEN DATASET to_file FOR INPUT IN BINARY MODE.
      IF sy-subrc = 0.
        DO .
          READ DATASET to_file INTO gs_objbin. "GS_PDF_TAB.
          IF sy-subrc = 0.
            APPEND gs_objbin TO gt_objbin .  "GS_PDF_TAB TO GT_PDF_TAB.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
        CLOSE DATASET to_file.
      ENDIF.
    then i use use FM SO_NEW_DOCUMENT_ATT_SEND_API1
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                    = gs_docdata
         put_in_outbox                    = 'X'
         commit_work                      = 'X'
    * IMPORTING
    *   SENT_TO_ALL                      =
    *   NEW_OBJECT_ID                    =
        TABLES
          packing_list                     = gt_objpack
    *   OBJECT_HEADER                    =  I_OBJTXT
         contents_bin                     = gt_objbin
         contents_txt                     = i_objtxt
    *   CONTENTS_HEX                     =
    *   OBJECT_PARA                      =
    *   OBJECT_PARB                      =
          receivers                        = gt_reclist
       EXCEPTIONS
         too_many_receivers               = 1
         document_not_sent                = 2
         document_type_not_exist          = 3
         operation_no_authorization       = 4
         parameter_error                  = 5
         x_error                          = 6
         enqueue_error                    = 7
         OTHERS                           = 8
    Edited by: Krupaji on Oct 27, 2010 11:31 AM

    Related FM SO_NEW_DOCUMENT_ATT_SEND_API1 you can check following example:
    clear : gs_docdata,gt_objbin. "
        refresh : gt_objbin . "
    *   gs_docdata-obj_name = 'ord_accept'.
        gs_docdata-obj_name = 'Invoice'.
        gs_docdata-expiry_dat = sy-datum + 10.
    *   gs_docdata-obj_descr = 'Your Invoice No : '.
        gs_docdata-obj_descr = detail1.
        gs_docdata-sensitivty = 'F'. "Functional object
        gs_docdata-doc_size = gv_desc_lines * 255.
        clear gs_objpack-transf_bin.
    * Start line of object header in transport packet
    *    GS_OBJPACK-TRANSF_BIN = 'X'.
        gs_objpack-doc_size = gv_desc_lines * 255.
        gs_objpack-head_start = 1.
        gs_objpack-head_num = 0.
        gs_objpack-body_start = 1.
        gs_objpack-body_num = gv_desc_lines.
        gs_objpack-doc_type = 'RAW'.
    *    GS_OBJPACK-OBJ_NAME = 'ORDER_ACCEPTANCE'.
    *    GS_OBJPACK-OBJ_DESCR = 'ORDER_ACCEPTANCE.PDF'.
        append gs_objpack to gt_objpack.
      endif.
    *• Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
      clear : gs_objbin, gs_pdf_tab.
    *&      Encrypted file
      filename = name.
      if name is initial.
        concatenate   'd:\pdf\' main_dtl-vbeln '.PDF' into name.
      filename = name.
    endif.
    data: pdf type ref to cl_hrasr00_pdf_generation.
      data : lt_data            type solix_tab.
      open dataset filename for input in binary mode.
      if sy-subrc eq 0.
        read dataset filename into filex.
      endif.
      if filex is not initial.
        call function 'SCMS_XSTRING_TO_BINARY'
          exporting
            buffer        = filex
          importing
            output_length = file_length
          tables
            binary_tab    = gt_objbin.
      endif.
      close dataset filename.
    describe table gt_objbin lines gv_tab_lines.
      clear gs_objbin.
      read table gt_objbin into gs_objbin index gv_tab_lines.
      if sy-subrc = 0.
        gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + strlen( gs_objbin ).
        gs_objpack-transf_bin = 'X'.
        gs_objpack-head_start = 1.
        gs_objpack-head_num = 0.
        gs_objpack-body_start = 1.
        gs_objpack-body_num = gv_tab_lines.
        gs_objpack-doc_type = 'PDF'.
        gs_objpack-obj_name = 'INVOICE'.
        gs_objpack-obj_descr = 'Invoice Order'.
        append gs_objpack to gt_objpack.
      endif.
    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        exporting
          document_data                    = gs_docdata
         put_in_outbox                    = 'X'
         commit_work                      = 'X'
    * IMPORTING
    *   SENT_TO_ALL                      =
    *   NEW_OBJECT_ID                    =
        tables
          packing_list                     = gt_objpack
    *   OBJECT_HEADER                    =  I_OBJTXT
         contents_bin                     = gt_objbin
         contents_txt                     = i_objtxt
    *   CONTENTS_HEX                     =
    *   OBJECT_PARA                      =
    *   OBJECT_PARB                      =
          receivers                        = gt_reclist
       exceptions
         too_many_receivers               = 1
         document_not_sent                = 2
         document_type_not_exist          = 3
         operation_no_authorization       = 4
         parameter_error                  = 5
         x_error                          = 6
         enqueue_error                    = 7
         others                           = 8
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
        open dataset name for input in binary mode.
        if sy-subrc eq 0.
          delete dataset filename.
        endif.

  • File open error under document tab in tcode BP

    Hi expert
    In a report, I am reading path ,file type ,name from a text file from the presentation server. The file gives all the information related to the file uploaded on application server. File can be of any type like cfg ,doc txt, bmp .
    I have to read and link the file under document tab in BP code I am able to link but not able to open the file from the link another text format is giving dump error saying format not supporting.
    I am reading and linking in binary mode because i do not have another option as we can read the file in text and binary mode only.
    Please suggest any solution for this .
    Point will be rewarded for this.
    Prem.
    Edited by: Prem Kumar on Jan 12, 2009 2:39 PM
    Edited by: Prem Kumar on Jan 12, 2009 2:40 PM

    HI,
      Just try it simply as below.
    the possible reasons could be.
    1) file with that name is not existing in that path
    2) path name is wrong (u gave it as c:/ give it as c:\)
    3) file may be open..
    how ever just try with giving the file path and the output table and see how it works
    *-- Read the File From PC
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME = V_FILENAME
        TABLES
          DATA_TAB = I_FILE
        EXCEPTIONS
          OTHERS   = 17.
    Thanks
    mahesh

  • File open error

    I am getting errors when I try to open up previously created projects in iDVD '08. When I try to open a project I get a File Not Writeable window that tells me "An error occurred while loading the project. This project seems to be write-protected and can't be opened." This is an iDVD message (not a Finder message). I have tried removing the "lock" file in package contents, locking/unlocking the file in the Get Info window, changing permissions to allow everyone to read/write, repaired disk permissions, capped-off by waving a dead chicken foot around the MacBook. Nothing seem to help so far. Thoughts?

    Others have reported in the FCP forum that a re-install of Motion (or FCS) did the trick for them.
    I asked about the frame rate because, an odd frame rate can make a normal file that is recognized be labeled "unknown".
    Patrick

  • HTTP 500 - Internal Server Error - Smartforms pdf

    Hi, all
    I'm trying to print a pdf (made with Smartforms) in Consolidation environment from a BSP form and occurs the error:
    Exception condition "SINGLE_EXIT_MULTIPLY_ACTIVE" raised.
    RABAX_STATE
    Method: GET_INSTANCE of program CL_EXITHANDLER================CP
    Function: HR_GET_BUSINESS_ADD_IN of program SAPLHRBAS00UTILITIES
    Function: HRHAP_C_GET_BUSINESS_ADD_IN of program SAPLHRHAP_C_A_GLOBAL
    Method: ONINITIALIZATION of program CLO249Z8ZDCO03QHBX8B23G1B5QGTCP
    Method: %_ONINITIALIZATION of program CL_O249Z8ZDCO03QHBX8B23G1B5QGTCP
    Method: DO_REQUEST of program CL_BSP_PAGE===================CP
    Method: ON_REQUEST of program CL_BSP_RUNTIME================CP
    Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_HTTP_EXT_BSP===============CP
    Method: EXECUTE_REQUEST of program CL_HTTP_SERVER================CP
    Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
    HTTP 500 - Internal Server Error
    Somebory knows the solucion? In the Development environment works succesfully.
    ps.: The error occurs in the call of HRHAP_C_GET_BUSINESS_ADD_IN.
    Best regards,
    Ana.
    Edited by: Ana Carolina dos Santos on May 24, 2011 3:26 PM

    Hi,
    somehow you´re calling a BADI in your code, so make sure that the implementation has been transported into th test system:
    * If Business Add-In is implemented, get instance
    Line 56 of function HR_GET_BUSINESS_ADD_IN

Maybe you are looking for

  • Ripping a DVD that was recorded in VR format

    I've made dozens of DVDs on a Phillips set-top DVD recorder, using DVD+R media. Now, I want to rip them (using Handbrake) so I can watch them on my Apple TV through iTunes. Problem is, Mac won't read the disk. Simply says "You've inserted a blank dis

  • Problem: apex_collection.create_collection_from_query

    Hi; I've the following procedure:declare     p_collection_name varchar2(1000) := 'EDIT_CAT'; begin         IF (apex_collection.collection_exists(p_collection_name))         THEN             apex_collection.delete_collection(p_collection_name);       

  • Manually dispatching a keyboard tab event on a form does not work

    Hi, I am trying to solve the following issue: I have a form that is sitting on a TitleWindow. This is a popup window. I have a TextInput field. After clicking on the TextInput field when I try to paste something on it, nothing happens the first time

  • Script editor ICM 6 - "...don't own the script lock"

    I'm running UCCE 6 (ICM 6.0) and I just installed the ICM Internet Script Editor on my computer. When I try to save changes to a script I get the following error: "You can not update the script because you don't own the script lock" When I open the s

  • I realize I don't understand LR like I should, so...

    help me understand LR's "reaction" to this... Images = approx 17,000. I plan to move the bulk to an external HDD and keep "current" ones locally (I have a laptop, so I won't always have my external HDD with me but will still want to do editing). I wa