Error Base64-decoding binary attachment with ContentId: ''

I am encountering this siebel soap response whenever I send an Insert request (Activity Result - CustomObject1Insert):
<siebelf:error>
<siebelf:errorcode>(SBL-EAI-04316)</siebelf:errorcode>
<siebelf:errorsymbol/>
<siebelf:errormsg>Error while processing argument urn:/crmondemand/xml/CustomObject1/Data:ListOfCustomObject1 for operation CustomObject1Insert(SBL-EAI-04316)</siebelf:errormsg>
</siebelf:error>
<siebelf:error>
<siebelf:errorcode>(SBL-EAI-04120)</siebelf:errorcode>
<siebelf:errorsymbol>IDS_EAI_ERR_INTOBJHIER_ATTACH_DECODE</siebelf:errorsymbol>
<siebelf:errormsg>Error Base64-decoding binary attachment with ContentId: ''(SBL-EAI-04120)</siebelf:errormsg>
</siebelf:error>
With regard to session, the service returns a JSESSIONID as cookie together with this error message.
Please feel free to provide any insight on this. Thank you.

I also faced the same issue when I tried to attach file through soap UI.
resolution: In my request there was one parameter <ins:ActivityFileBuffer>
Which also be there for you so just encode your file using base 64 encoding and paste the content as below.
<ins:ActivityFileBuffer>VGhpcyBpcyBhIHNhbXBsZSByZXF1ZXN0IHRvIGF0dGFjaCBhIGZpbGUgd2l0aCB0aGlzIGNvbnRl
bnQu</ins:ActivityFileBuffer>
By doing so my file got attached with the content I wanted in my file.
Cheers,
Saket

Similar Messages

  • Error while invoking webservice attached with custom policy

    I created a webservice in SOA 11g and attached a custom policy which is doing encryption(message protection) to its exposed service endpoint .This web service runs fine if i run it independently. Then i created a simple SOA process and call this web service.Then i am getting Fabric Invocation Exception.Can anyone tell me what can be the problem?

    I want to do the encyrpton only in secured webservice. I just want to invoke that web service from another process. In this case which policy can i attach in the reference of the SOA process which is calling secured web service?

  • Sending a SOAP request with binary attachment

    hi all,
    I am sending a SOAP request from a SOAP client SOAP UI  with a binary attachment ( image file as an attachment )  and creating a file on the receiver side with attachment.
    But how do i see this attachment in XI and do i have to specify some additional configuration in my receiver or sender adapter modules.
    Regards ,
    Loveena.

    creating a file on the receiver side with attachment.
    Is this working? Receiver file adapter does not support attachment.
    But how do i see this attachment in XI
    In the pipeline steps, under payload, you will find two entries, one for payload and other for attachment.
    Regards,
    Prateek

  • ERROR ITMS-9000:"Redundant Binary Upload. There already exists a binary upload with build version '1.1' for ipa '1.1'".

    ERROR ITMS-9000:"Redundant Binary Upload. There already exists a binary upload with build version '1.1' for ipa '1.1'".
    I need to change the build number, but not the version number. So I can upload a new build for same version to ITC. What step should I do in FB4.7?

    Hi mobisa,
    Can you try the solution in this post? ios - ERROR ITMS-9000: "Redundant Binary Upload. There already exists a binary upload with build version '1.0' for train…
    Thanks,
    Preran

  • Base64 decode with user defined function called from xslt

    I have an xml document which has a segment containing a b64 encoded attachment.
    I would like to decode the attachment as i map it.
    I would think this could be done by using a java function of some kind being called from the xslt however i have very limited experience in this and none in how to code the decoding.
    Anyone have an example ?
    Cheers
    Jon

    >
    Jon Vaugan wrote:
    > I have an xml document which has a segment containing a b64 encoded attachment.
    > I would like to decode the attachment as i map it.
    >
    > I would think this could be done by using a java function of some kind being called from the xslt however i have very limited experience in this and none in how to code the decoding.
    >
    > Anyone have an example ?
    >
    > Cheers
    > Jon
    yes SDN seems to have an example for you....it may not exactly solve your problem...but yes it not irrelevant.....you just need to do some R&D
    /people/farooq.farooqui3/blog/2008/05/22/decode-base64-incoming-encoded-information-in-sap-xipi-using-java-mapping
    Regards,
    Abhishek

  • Base64-decoding with XI?

    Hi all,
    I have a Webservice which returns a base64-encoded binary stream. This stream contains an UTF-8 encoded XML-Document.
    I want to do a "normal" mapping on this binary-represented XML stream.
    Is it possible with XI 3.0 to:
    1. un-wrap the base64 binary block into the XML that it represents
    2. do a receiver determination based on a part of the XML content that was "rescued" from the binary form
    3. import a schema agains which the unpacked XML stream is checked
    4. map the XML to a different format
    5. wrap the mapped XML in base64-encoding again
    6. stick the base64 block into a SOAP-Parameter and fire it back to SAP
    I know that XI3.0 can do all of the mentioned operations in some contexts. But is it possible to do it in the abovementioned sequence?
    Any answer (including partial ones) would be muchly appreciated.
    Thank you
    Christian

    See: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/bs64demo8i_sql.txt
    For an example usage see: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/mailexample8i_sql.txt
    Hope this helps,
    Michiel

  • Iphone 4 when am attach with itune oxe8000065 error comein

    iphone 4 when am attach with itune oxe8000065 error comein

    Hello jatinder singh7,
    Thank you for using Apple Support Communities.
    For more information, take a look at:
    iOS: Unknown error containing '0xE' when connecting to a Windows PC
    http://support.apple.com/kb/ts3221
    iTunes could not connect to this [device] because an unknown error occurred (0xE8000065)
    Have a nice day,
    Mario

  • J1i2 report error ? if the vendor is attached with alternative payee

    Dear MM experts,
    I  am having an  issue with regard to J1i2 report. I have raised PO with JVCS tax condition on vendor (this vendor master has been attached with alterntive payee) .
    J1I2 report is not able get the data  of POs/MIROs detaile for such vendors (alternative payee attached). J1I2 is considering and pulling report for only Vendors (who are not having alternative payee code in vendor master data)
    Can i get help from experts, how I can get details of Vendors (attached with alternative payee vendor code).
    Thanks in advance,
    Thanks & regards
    Srihari
    Edited by: Ediga Srihari on Dec 24, 2009 11:37 AM

    problem/issued solved by sap service market place by suggesting us to go for Zreport.
    thanx
    Srihari

  • Error #1034 Type Coercion fail with registerClassAlias and nested Vectors

    I'm attempting to use flash.net.registerClassAlias and ByteArray.writeObject in order to serialize/deserialize data with static type information.  It works as you'd expect in the general case but I've run into problems with some nested Vectors that I don't understand.  Hopefully someone can point out if I'm just missing something.
    For what I understand, we must register both the scalar types and a one-deep specification of a Vector for that scalar type in order to use nested Vectors.  For example:
                flash.net.registerClassAlias("TestStructureInner", TestStructureInner);
                flash.net.registerClassAlias("VectorTestInner", Vector.<TestStructureInner> as Class);
    This should allow us to read/write objects of type TestStructureInner, Vector.<TestStructureInner>, and Vector.<Vector.<TestStructureInner>> into ByteArrays.  And in general it seems to work.
    Attached though is a simplified test case that fails, however.  The first time we deserialize the data it works.  The subsequent time, however, we encounter the following runtime error #1034.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fcb9 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fbc9 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fdd1 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fce1 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fbf1 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fec1 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fad9 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fa61 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304f9e9 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
        TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304f971 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
    Re-registering the class aliases again via flash.net.registerClassAlias works in this test case but isn't 100% for our actual application (I'm reticent to even mention it but it seems relevant).  Is there a step I'm missing here?  Any light shed would be appreciated.
    // mxmlc -debug Test0.as
    package
        import Base64; // http://code.google.com/p/jpauclair-blog/source/browse/trunk/Experiment/Base64/src/Base64.a s
        import flash.net.registerClassAlias;
        import flash.events.Event;
        import flash.utils.ByteArray;
        import flash.display.Sprite;
        import flash.display.Stage;
        import flash.system.System;
        public class Test0 extends Sprite
            static private const OPERATION_SERIALIZE:uint = 0;
            static private const OPERATION_DESERIALIZE_AND_FAIL:uint = 1;
            static private const OPERATION_DESERIALIZE_AND_SUCCEED:uint = 2;
            static private var staticStage:Stage;
            private var bar:Vector.<TestStructure>;
    * common functions
            static private function registerClassAliases():void
                flash.net.registerClassAlias("TestStructureInner", TestStructureInner);
                flash.net.registerClassAlias("VectorTestInner", Vector.<TestStructureInner> as Class);
                flash.net.registerClassAlias("TestStructure", TestStructure);
            static public function staticDeserialize():Object
                var byteArray:ByteArray = Base64.decode("EBUAG1Rlc3RTdHJ1Y3R1cmUKEwAHZm9vEAEAH1ZlY3RvclRlc3RJbm5lcgoBEAEABAoBEAEABA oBEAEABAoBEAEABAoBEAEABAoBEAEABAoBEAEABAoBEAEABAoBEAEABA==");
                byteArray.position = 0;
                return byteArray.readObject();
            public function Test0():void
                registerClassAliases();
                // Switching operation between the constants demonstrates failure/success in a couple of different ways.
                // SERIALIZE is just used to prepare the base64 string for subsequent tests.
                var operation:int = OPERATION_SERIALIZE_AND_FAIL;
                if (operation == OPERATION_SERIALIZE)
                    trace("Serializing");
                    // outputs base64 string for subsequent tests
                    serialize();
                else if (operation == OPERATION_DESERIALIZE_AND_FAIL)
                    trace("Fail case");
                    // perform successful one deserialization, then one failing one.
                    deserializeOnceThenFail();
                else if (operation == OPERATION_DESERIALIZE_AND_SUCCEED)
                    trace("Success via re-registration");
                    // perform successful one deserialization, then another successful one.
                    deserializeOnceThenSucceed();
    * serialize
            // outputs base64 string we use for subsequent tests.
            private function serialize():void
                var baz:Vector.<TestStructure> = new Vector.<TestStructure>;
                for (var i:int=0; i<10; ++i)
                    baz.push(new TestStructure);
                var byteArray:ByteArray = new ByteArray;
                byteArray.writeObject(baz);
                trace(Base64.encode(byteArray));
    * deserializeOnceThenFail
            // perform successful one deserialization, then one failing one.
            public function deserializeOnceThenFail():void
                // save stage
                staticStage = stage;
                // the first deserialize will proceed without error.
                staticDeserialize();
                trace("Successful deserialize");
                // add an event listener in order to invoke error on subsequent frame
                stage.addEventListener(Event.ENTER_FRAME, doEnterFrameOnceThenFail);
            // remove event listener and invoke again.
            static private function doEnterFrameOnceThenFail(e:Event):void
                staticStage.removeEventListener(Event.ENTER_FRAME, doEnterFrameOnceThenFail);
                staticDeserialize();
                trace("unsuccessful deserialize2");
    * deserializeOnceThenSucceed
    * Here, we re-call flash.net.registerClassAlias on all our class types when running.
            // perform successful one deserialization, then one failing one.
            public function deserializeOnceThenSucceed():void
                // save stage
                staticStage = stage;
                // the first deserialize will proceed without error.
                staticDeserialize();
                trace("Successful deserialize");
                // add an event listener in order to invoke error on subsequent frame
                stage.addEventListener(Event.ENTER_FRAME, doEnterFrameOnceThenSucceed);
            // remove event listener and invoke again.
            static private function doEnterFrameOnceThenSucceed(e:Event):void
                staticStage.removeEventListener(Event.ENTER_FRAME, doEnterFrameOnceThenSucceed);
                registerClassAliases();
                staticDeserialize();
                trace("successful deserialize2");
    internal class TestStructureInner
              public var value:int;
    internal class TestStructure
              public var foo:Vector.<Vector.<TestStructureInner>> = new Vector.<Vector.<TestStructureInner>>;

    The error would imply that ImageAssetEvent does not inherit
    DisplayEvent. Either modify the inheritance chain or listen for a
    basic Event object (flash.events.Event) and cast inside the
    function.

  • Want to Send smartform as pdf attachment with a Email to some mail id

    Hi ,
    I want to send a smartform as a PDF attachment with a mail to a mail id. And I can send a mail with the PDF attachment.
    But I am not able to open the PDF. It is throwing some error (Adobe reader could not open u2018fileu2019 because it is either not a supported file type or because the file has been damaged (for example , it was sent as an email attachment and was not correctly decoded)).
    By debugging I come to know that the file which is generating is in some encoding format.
    Please help me regard this. This is very urgent.
    here is the code,
    Main Program :
    REPORT Ztest_report.
    *--Top Include for Global Data Declarations.
    INCLUDE ztest_report_top.
    *--Form Include for Form Routines.
    INCLUDE ztest_report_form.
    START-OF-SELECTION.
    START-OF-SELECTION.
    *--Display data
      Perform display_data.
    END-OF-SELECTION.
    Top declaration :
    Internal table
    DATA :  i_otfdata TYPE tsfotf,          " Smart Forms: Table OTF
            i_tline TYPE TABLE OF tline WITH HEADER LINE,
            i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
            i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
            i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
            w_mailaddr TYPE ppfdmailad,
            w_mailtype TYPE so_escape,
            w_mailrecipient TYPE swotobjid,
            w_control 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
            wa_objhead TYPE soli_tab,
    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.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-009.
    PARAMETER:      p_bukrs TYPE bukrs OBLIGATORY,            "Company Code
                    p_belnr TYPE belnr_d OBLIGATORY,          "Document No
                    p_gjahr TYPE gjahr OBLIGATORY,            "document type
                    p_mailid(50) TYPE c OBLIGATORY.
    "Mail Id
    SELECTION-SCREEN END OF BLOCK blk1.
    Form Logic :
    FORM display_data.
    *Local Variable declaration
      DATA: lc_fm TYPE rs38l_fnam,       "local variable to store the
            l_i_document_output_info TYPE ssfcrespd,
            l_i_struc_job_output_info TYPE ssfcrescl,
            l_i_struc_job_output_options TYPE ssfcrescl,
            i_lines TYPE TABLE OF tline WITH HEADER LINE,
            lv_job_output_info      TYPE ssfcrescl,
            lv_document_output_info TYPE ssfcrespd,
            lv_job_output_options   TYPE ssfcresop,
            lv_bin_filesize         LIKE sood-objlen.
    Determine the smartform name
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                formname           = 'ZTEST_SMARTFORM'
           IMPORTING
                fm_name            = lc_fm
           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_control-getotf = 'X'.
      w_control-no_dialog = 'X'.
      w_control-preview = space.
    w_control-device = 'MAIL'.
    Call the smartform and pass the selection screen parameter
      CALL FUNCTION lc_fm
           EXPORTING
                control_parameters = w_control
                output_options     = w_compop
                user_settings      = 'X'
                t_bukrs            = p_bukrs
                t_belnr            = p_belnr
                t_gjahr            = p_gjahr
           IMPORTING
                job_output_info    = l_i_struc_job_output_info
           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.
    Moving the Smart Forms: Table OTF into an internal table
      i_otfdata[] = l_i_struc_job_output_info-otfdata[].
    CONVERT TO OTF TO PDF.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = lv_bin_filesize
           TABLES
                otf                   = i_otfdata
                lines                 = i_lines
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                err_bad_otf           = 4
                OTHERS                = 5.
    IF sy-batch EQ l_c_no.
    To directly view the print-preview in PDF format
      CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
           EXPORTING
                i_otf                    = i_otfdata
           EXCEPTIONS
                convert_otf_to_pdf_error = 1
                cntl_error               = 2
                OTHERS                   = 3.
    For Sending the PDF file to a Mail ID.
    LOOP AT i_lines.
       TRANSLATE i_lines USING '~'.
       CONCATENATE wa_buffer i_lines INTO wa_buffer.
    ENDLOOP.
    TRANSLATE wa_buffer USING '~'.
    DO.
       i_record = wa_buffer.
       APPEND i_record.
       SHIFT wa_buffer LEFT BY 255 PLACES.
       IF wa_buffer IS INITIAL.
         EXIT.
       ENDIF.
    ENDDO.
      DATA: BEGIN OF zlines OCCURS 0,
      tline TYPE char255,
      END OF zlines.
    *Change the PDF format from 132 to 255.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
           EXPORTING
                transfer_bin                = 'X'
           TABLES
                content_in                  = i_lines
                content_out                 = zlines
           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.
    Attachment
      REFRESH: i_reclist,
      i_objtxt,
      i_objbin,
      i_objpack.
      CLEAR wa_objhead.
      i_objbin[] = zlines[].
    Create Message Body Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      APPEND i_objtxt.
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
    Attachment (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
    I_OBJPACK-DOC_TYPE = 'RAW'.
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-doc_size = v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      APPEND i_objpack.
      CLEAR i_reclist.
      i_reclist-receiver = p_mailid.
      i_reclist-rec_type = 'U'.
      APPEND i_reclist.
    Send new document with attachments via RFC
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = wa_doc_chng
                put_in_outbox              = 'X'
                commit_work                = 'X'
           TABLES
                packing_list               = i_objpack
                object_header              = wa_objhead
                contents_bin               = 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.
        WRITE:/ 'Error When Sending the File', sy-subrc.
      ELSE.
        WRITE:/ 'Mail sent'.
      ENDIF.
    ENDFORM.                    " display_data

    hi,
    i wrote a programm.for me it is working.i think it will help for u.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = form_name
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 4
       OTHERS                      = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    APPEND T_OBJTXT.
    DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
    READ TABLE T_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR T_OBJPACK-TRANSF_BIN.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    T_OBJPACK-BODY_NUM = V_LINES_TXT.
    T_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND T_OBJPACK.
    Attachment (pdf-Attachment)
    T_OBJPACK-TRANSF_BIN = 'X'.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
    READ TABLE T_OBJBIN INDEX V_LINES_BIN.
    T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    T_OBJPACK-BODY_NUM = V_LINES_BIN.
    T_OBJPACK-DOC_TYPE = 'PDF'.
    T_OBJPACK-OBJ_NAME = 'smart'.
    T_OBJPACK-OBJ_DESCR = 'test'.
    APPEND T_OBJPACK.
    CLEAR T_RECLIST.
    T_RECLIST-RECEIVER = 'mail id'.
    T_RECLIST-REC_TYPE = 'U'.
    APPEND T_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = WA_DOC_CHNG
        PUT_IN_OUTBOX              = 'X'
        COMMIT_WORK                = 'X'
      TABLES
        PACKING_LIST               = T_OBJPACK
        OBJECT_HEADER              = WA_OBJHEAD
        CONTENTS_BIN               = T_OBJBIN
        CONTENTS_TXT               = T_OBJTXT
        RECEIVERS                  = T_RECLIST
      EXCEPTIONS
        TOO_MANY_RECEIVERS         = 1
        DOCUMENT_NOT_SENT          = 2
        DOCUMENT_TYPE_NOT_EXIST    = 3
        OPERATION_NO_AUTHORIZATION = 4
        PARAMETER_ERROR            = 5
        X_ERROR                    = 6
        ENQUEUE_ERROR              = 7
        OTHERS                     = 8.
    IF SY-SUBRC <> 0.
      WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
      WRITE:/ 'Mail sent'.
    ENDIF.
    please reward me if helpful.

  • Sending a binary attachment via email, looking for a more clean way

    Hi experts.
    I finally managed to send a binary attachment via email. Why "finally"? Never done before!
    Also I got to manage the "not standard" .SAP file extension, because the attachment is a transaction link.
    So let me explain how i did it:
    take SO_NEW_DOCUMENT_ATT_SEND_API1, filling following input data:
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = st_docdata
          commit_work                = 'X'
        TABLES
          packing_list               = lt_packlist
          contents_hex               = lt_hex
          contents_txt               = lt_content
          receivers                  = lt_recv
        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.
    But how to fill lt_hex? Well I did not found a way to transfer text data into raw data structure (lt_hex is type SOLIX).
    So, here is the trick:
    fill another table, lt_bin type SOLISTI1, with attachment content (text data);
    dump lt_bin content to a file on application server, having care to specify TEXT MODE and UTF-8 encoding;
    now reopen the same file in BINARY MODE and transfer content to lt_hex.
    Why I did not use parameter
    content_bin
    ? Because SAP ECC 6 is unicode enabled (I think UTF-16) and file has got to be UTF-8 or ASCII. Also, packing_list for attachment must specify binary tranfer mode. And doing so each UTF-16 character (2 bytes) is split into 2 characters (1 char + 1 NUL byte). Attachment is now unusable.
    What is the question? Here it is: how to fill lt_hex data directly from text (UTF-16) data, avoiding conversion errors?
    Thank you in advance.

    Hi Chhayank,
    the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
    Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
    ~Florian

  • ABAP WebDynpro - ArchiveLink - PDF Error: "File does not start with..."

    Hey community,
    I have a WebDynpro application in which I want to show a Archive document.
    I'm using FM 'ARCHIV_GET_TABLE' and then FM 'SCMS_BINARY_TO_XSTRING'.
    But I only get the error message: (see also attached)
    File does not open with "%PDF-".
    Local\EWH...
    Attachment two shows, how the data is stored in TOA03.
    Document type is FAX .
    I tried several FM and nothing worked.
    Does anyone have an idea?
    Thank you very much in advance.
    Florian

    Hi Florian,
    I don't think you need to use FM SCMS_BINARY_TO_XSTRING.
    Just try to make of your binary output table from ARCHIV_GET_TABLE an xstring by concatenating all lines into one xstring.
    Regards,
    Julien

  • Binary file with File adapter

    Hi gurus,
    I am getting binary file as base64binary (not a text/xml file) in a request XML tag. I need to write this file to a file directory with the file adapter after retrieving it from the request message by a message/java mapping and use another field in XML as the file name.
    I followed the blog `how to send binary data through PI` but in that case, the request message is also the same. Mine requires a mapping to be executed and in this case I cannot use dummy names for message types/interfaces as Enterprise Repository development is required.
    How can I achieve this?
    Thanks
    Gokhan

    Just solved the problem actually
    As I was trying to write a binary file directly with the receiver file adapter, I wasn't sure how to define a data type / message type for it. I developed a java mapping that decodes the base64 to binary data and writes it to the output stream, and used a dummy message type / data type for the service interface as the target in Operation Mapping
    And it worked!
    Regards,
    Gökhan

  • Base64 decoding - perl & openssl vs. html embedded image

    I am having a strange problem. I have a TIFF image stored in a SQLite database encoded as Base64. When I retrieve the Base64 characters, save them to a file using an applescript writing a utf-8 text file to disk (or just saving it in TextWrangler), and then try to feed that file into openSSL using the Base64 decoding option, I get an empty file or just a small (not nearly large enough) file that will not open. BUT! When I put that same string into a img tag using base64 decoding in an HTML document, it displays properly in a browser window. Anyone have an idea why this might happen? It does not work using perl either.
    The html code is here: http://web.me.com/danaleighton/base64.html
    The file I am feeding into openSSL is here: http://web.me.com/danaleighton/base64sm.txt
    I am using the following command: openssl enc -base64 -d -in base64sm.txt -out testscript.tiff
    This perl command also does not work: perl -i.txt -MMIME::Base64 -e 'undef $/;while(){print decode_base64($_);}' base64sm
    Thanks in advance for any help!!!

    it's most likely the text you're extracting from the database is either corrupted or wasn't encoded as you expect. Note that your success with the img tag decoding may be misleading. I can't give you details that apply to this case, but browsers typically use smarter decoding tools which are more robust ...
    1) Was the text in the database produced by an internal encoder or was it obtained either from a standard e-mail attachment or produced by this command or its equivalent?:
    Thanks Ray - I was afraid of that. I am extracting the image from a database written by a commercial application. I checked with the developers, and they said it was base64, so that's all I have to go on. I reported this anomaly to them but haven't heard back in over a week.
    2) Are you sure you're retrieving exactly the same bytes that were stored in the database?
    As sure as I can be. For testing, I invoke sqlite from a shell to do the select statement and dump the result to the terminal. Then copy and paste from terminal to a TextWrangler document. I have done the same with an Applescript.
    One complicating factor: the text stored in the database has these weird markup tags that I can't find any documentation. They look like this: <iimg><preferredFilename>Embedded image</preferredFilename><segment>TU0AK...=
    </segment><segment>UdSVL...=
    </segment></iimg>
    I strip these out of the field coming from the database.
    To isolate the problem...
    Unfortunately, since I am not creating the database, I am loath to write to it. I could, but since the problem is likely in the way the developers are encoding or storing the data, it wouldn't do much to solve my problem...
    Thanks so much for your suggestions!! Very helpful.

  • Re: Base64 Decoder in TOOL requested

    Brendan Duddridge wrote:
    >
    Does anyone have a Base64 decoder written in TOOL? I'm looking for one
    for a project I'm
    working ong.I've enclosed a zip archive with an encoder/decoder class I wrote. This
    is not completely Base64 compliant, but it uses the same algorithm for
    encoding binary data as text. In the Encode and Decode methods, it uses
    the underscore character "_" for padding. Base64 actually uses "=" (the
    equal sign) for this purpose, so you'll need to change this. You'll also
    want to change the last two characters in the ENCODE_ALPHABET constant
    from "$" and "-" to "+" and "/". (Note the comment at the start of the
    Encode method regarding this.) If you need to parse files in MIME
    format, you'll need to do additional work, as well, but that shouldn't
    be too hard. This code, with minor changes, should be able to handle the
    Base64 decoding/encoding for you.
    One major caveat, though. For my purposes, I just wanted to be able to
    serialize a graph of Forte objects into a textual format that could be
    safely embedded into an HTML form field for later retrieval. I wrote
    this class for that purpose, and based it on the Base64 algorithm for
    that. But I haven't really tested it to ensure it really complies with
    Base64. I'm pretty sure it does (with the exception of the 3 characters
    I've changed to avoid using characters that have special meaning on the
    web), but you'll need to test it to make sure. I also don't deal with
    line breaks; it just creates, or decodes, a character stream without
    line breaks, so you'll need to add line break logic if you need to deal
    with MIME format files, or Base64 files with line breaks in them.
    If you have any questions, feel free to ask me.
    Michael Brennan
    Programmer/Analyst
    Amgen Inc.

    Brendan Duddridge wrote:
    >
    Does anyone have a Base64 decoder written in TOOL? I'm looking for one
    for a project I'm
    working ong.I've enclosed a zip archive with an encoder/decoder class I wrote. This
    is not completely Base64 compliant, but it uses the same algorithm for
    encoding binary data as text. In the Encode and Decode methods, it uses
    the underscore character "_" for padding. Base64 actually uses "=" (the
    equal sign) for this purpose, so you'll need to change this. You'll also
    want to change the last two characters in the ENCODE_ALPHABET constant
    from "$" and "-" to "+" and "/". (Note the comment at the start of the
    Encode method regarding this.) If you need to parse files in MIME
    format, you'll need to do additional work, as well, but that shouldn't
    be too hard. This code, with minor changes, should be able to handle the
    Base64 decoding/encoding for you.
    One major caveat, though. For my purposes, I just wanted to be able to
    serialize a graph of Forte objects into a textual format that could be
    safely embedded into an HTML form field for later retrieval. I wrote
    this class for that purpose, and based it on the Base64 algorithm for
    that. But I haven't really tested it to ensure it really complies with
    Base64. I'm pretty sure it does (with the exception of the 3 characters
    I've changed to avoid using characters that have special meaning on the
    web), but you'll need to test it to make sure. I also don't deal with
    line breaks; it just creates, or decodes, a character stream without
    line breaks, so you'll need to add line break logic if you need to deal
    with MIME format files, or Base64 files with line breaks in them.
    If you have any questions, feel free to ask me.
    Michael Brennan
    Programmer/Analyst
    Amgen Inc.

Maybe you are looking for