How to create a document with SRM BAPIS

Dear colleagues,
I have a problem with SRM BAPIs. I need to insert a pdf document into a record using SAP BAPIs, This document is already in a table in a binary format
I am trying with these BAPIs:
    1.
          CALL FUNCTION 'BAPI_SRM_DOC_CREATE'
              EXPORTING
                rms_id                  = rms_id
                sps_id                  = sps_id
                documentid              = documentid
                description             = 'DESCRIPTION'
                do_commit               = 'X'
                documentid_check_unique = 'X'
              IMPORTING
                return                  = return
                objectid                = objectid
                documentclass           = documentclass
              TABLES
                required_properties     = required_properties.
          This BAPI is working as expected. It returns objectid for the new document.
     2. Now I'm using BAPI_RECORD_ADDELEMENT:
             ls_doc_id-objectid = objectid.
            CLEAR: ls_sp_poid. " clear weg und ls_sp_poid clearen
            ls_sp_poid-name  = 'DOC_ID'.
            ls_sp_poid-value = ls_doc_id.
            APPEND ls_sp_poid TO lt_sp_poid.
            CLEAR: ls_doc_id.
            ls_sp_poid-name  = 'VARIANT'.
            ls_sp_poid-value = '0'.
            APPEND ls_sp_poid TO lt_sp_poid.
            CLEAR: ls_doc_id.
            ls_sp_poid-name  = 'VERSION'.
            ls_sp_poid-value = '0'.
            APPEND ls_sp_poid TO lt_sp_poid.
            ls_insertion_by_anchor-anchor = 'DECRET'.
            ls_insertion_by_anchor-parent_node_id = '5'.
            ls_insertion_by_anchor-parent_node_attr_name = 'DECRETAT'.
            ls_insertion_by_anchor-parent_node_attr_value = '40'.
          CALL FUNCTION 'BAPI_RECORD_ADDELEMENT'
              EXPORTING
                objectid                    = zrm_attcab_scr-phio_id
                documentclass               = documentclass
                sps_id                      = 'ZRM_SPS_DOCVAR'
                anchor                      = 'DECRETS'
                description                 = 'Descripcion'
                store_as_new_version        = 'X' "Si X se crea vacio
*               STACKED                     = ''
*               DOC_CONTEXT                 =
                element_type                = 'I'
*                 insertion_by_anchor         = ls_insertion_by_anchor
*                insertion_by_modelid        = insertion_by_modelid
*               INSERTION_BY_REFERENCE_NODE =
*              ALL_SAME_NAME_ANCHOR        = 'X'
*               SET_ELEM_DESCR_HARD         = ' '
*                omit_authority_check        = 'X'
              IMPORTING
                return                      = ls_return
              TABLES
                element_sp_poid             = lt_sp_poid.
*             ELEMENT_PROPERTIES                =
*             ELEMENT_VISIBILITY                =
         This BAPI returns an internal error
Am I following the correct steps or am I skipping anything?
Could anyone help me?
Thanks in advance!!

I have the same problem!!!
Anyone knows?
Thanks!

Similar Messages

  • How to create shipment document with out inbound delivery document

    Dear Friends
    How to create shipment document with out outbound/inbound delivery document.
    In my client scenario, there is no inbound delivery for normal purchases.
    Just there are raising the PO to vendor, then they are doing MIGO for goods receipt.
    Can we do shipment creation with reference to PO?
    If it is possible, how it will be?
    Please let it solve
    With regards
    Lakshmikanth

    Dear Sameer,
    Please go to transaction VT01N here you enter Transportation planning point and shipment type then press enter.
    Now system will take you to the shipment document creation screen here you click on Select deliveries or press F6 now system will take you to the select outbound deliveries screen in this screen you enter selection data then execute, now deliveries will get assigned to that shipment.
    After assigning the deliveries enter the remaining data then complete the shipment finally save the shipment document.
    For more information please go through this SAP help link
    Note:- Shipment process need to be carry out for the deliveries before PGI.
    http://help.sap.com/saphelp_47x200/helpdata/en/f5/04898047bd11d2bf750000e8a7386f/frameset.htm
    I hope this will help you,
    Regards,
    Murali.

  • How to create the document with originals and checkin that document

    I am using this 2 bapi for creating DMS ,
    BAPI_DOCUMENT_CREATE2
    BAPI_TRANSACTION_COMMIT
    BAPI_DOCUMENT_CHECKIN2
    BAPI_TRANSACTION_COMMIT
    at last we want to c in DRAO table the created doc no should be updated here.
    But it not updating.how can i update in the table..
    Please tell via code..

    How do you call BAPI_DOCUMENT_CREATE2?
    I just tried with the example given in the documentation and with a little adjustment I created a document with an original which appears in the DMS_DOC_FILES table.
      DATA: ls_doc    LIKE bapi_doc_draw2,
            ls_return LIKE bapiret2.
      DATA: lf_doctype    LIKE bapi_doc_draw2-documenttype,
            lf_docnumber  LIKE bapi_doc_draw2-documentnumber,
            lf_docpart    LIKE bapi_doc_draw2-documentpart,
            lf_docversion LIKE bapi_doc_draw2-documentversion.
      DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,
            lt_drat  LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE.
      ls_doc-documenttype    = 'Z01'.
      ls_doc-documentversion = '01'.
      ls_doc-documentpart    = '000'.
      ls_doc-statusextern   = 'DR'.
      ls_doc-laboratory     = '001'.
      REFRESH lt_files.
      CLEAR lt_files.
      lt_files-docfile      = 'c:\BP\test.docx'.
      APPEND lt_files.
      CLEAR lt_drat.
      REFRESH lt_drat.
      lt_drat-language    = 'EN'.
      lt_drat-description = 'Info Rec Description'.
      APPEND lt_drat.
      CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
            EXPORTING: documentdata         = ls_doc
            IMPORTING: documenttype         = lf_doctype
                       documentnumber       = lf_docnumber
                       documentpart         = lf_docpart
                       documentversion      = lf_docversion
                       return               = ls_return
           TABLES: documentdescriptions = lt_drat
                   documentfiles        = lt_files.
      IF ls_return-type CA 'EA'.
        ROLLBACK WORK.
        MESSAGE ID '26' TYPE 'I' NUMBER '000'
                WITH ls_return-message.
      ELSE.
        COMMIT WORK.
      ENDIF.
    Best Regards,
    Martin

  • How to create an uwl with a BAPI

    Hi Experts!!!
    I need someone that say me, how to create a task in the uwl with a bapi or program.
    Thanks in advanced,
    Regards,

    Hi Carlos,
    Do you have the javadocs?  It contains information in regards to the UWL API.
    http://help.sap.com/javadocs/NW04S/current/uw/overview-summary.html#Service Component Collaboration
    What is the necessity to create a task from a BAPI or from a program?  If the task is in the backend inbox (SBWP) once UWL is configured properly it will also be created in the worklist. 
    We use SWK_LOCAL_INBOX_GET to pull back the list of tasks
    We use the following wapis for the following purposes:
    SAP_WAPI_GET_HEADER to retrieve the from value
    SAP_WAPI_GET_OBJECTS to retrieve the attachment information
    SAP_WAPI_WORKITEM_DESCRIPTION to retrieve the task description text
    Have a look at the page that I sent you above.  This gives great information on the UWL structure and how it works.
    Please let me know if you require any additional documentation.
    Beth Maben
    EP - Senior Support Consultant
    AGS Primary Support, Business Suite & Technology
    Please see the UWL Wiki @
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/bpx/uwl+faq  ***

  • How to creat a document with a file

    i'm coding a texteditor-like programme.
    I did use a Jtable instead of a JtextComponent's subclass to display & edit text.
    however, i want to realize some function just like a texteditor such as undo & redo.
    Shoud i must creat a document to realize function i mentioned above?
    if yes, i searched in the google to find that always use method jtextComponent.setDocument () to automatically creat a document by files loaded in the jtextComponent.
    if i just creat a jtextarea for creating document & did not make it visible, whether it will waste too much resouces
    or i should make a subclass of AbstractDocument to transformer file to document?

    Hi Gilo,
       Check these docs...
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb">How to… Download a Hierarchy to a Flat File</a>
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/fa/e92637c2cbf357e10000009b38f936/content.htm">Uploading Hierarchies from Flat Files</a>
    <a href="http://sapbwneelam.blogspot.com">More Docs...</a>
    Hope it Helps
    Srini

  • How to creat pdf documents with printing restrictions in Aperture

    Hi,
    I wondered if it is possible to create a pdf document made up of 9-12 image per page contact sheets, to send to clients that restricts the client to open and view only i.e no printing allowed.
    Photoshop allows this, however i would like to create /correct versions in aperture and then create a pdf [with the above printing restrictions applied, simply to save time.
    the way i work in photoshop is to export approx a 500 to 1000 jpegs [ per client] in aperture to a folder which I then open with Bridge- create the contact sheets and then create the pdf document with printing restrictions applied.
    is there any way for me to make this simpler, especially just using Aperture?

    just been reading about terminal on another thread.... Spinning beach ball,,[page 2 of Aperture discussions].Apparently there is a command line explained there that can help speed up Aperture. I tried it but Had a problem when trying to type in my Password... It would not let me type anything....So I canceled the proceedure. [ knowing my luck I would cause some irrepairable damage to the machine].
    Think I need to do a lot of reading up to get up to scratch with folk using this discussion Board!!!
    With regards to the pdfauxinfo- is it complicated to get running, or does it run straiaght away in automator?

  • How to create a document with sections that differ in margin and layout

    I'm trying to add a pages document 'B' into my new pages document 'A'.
    A and B have two entirely different layouts and different document margins. So whenever i copy B into A, B's margins become A's margins and thus B's layout turns into a mess.
    I tried adding a section break, column break, layout break.. None resolves the issues.
    All ideas on this are appreciated.
    Thank you.

    A document has the same size, orientation and margins throughout.
    You can however set the minimum margins and use Layout breaks to position text and images within that.
    In practice it is best to keep the two separate and combine the finished sets as .pdfs.
    Peter

  • How to create matreial document for ten line items (10 documents) by BAPI

    Hi
    how to create matreial document for ten line items (10 documents) by BAPI_goodsmvt_create
    i created but it gives error as "no ites were transferre
    and i need code also.
    thanks in advance

    Prabhu Peram wrote:>
    > >
    Gareth @ Atos Origin UK wrote:
    > > Prabhu,
    > >
    > > You have been on SDN a long time and have a decent amount of points - why do you feel the need to simply cut and paste standard SAP documentation? _-----> I least bother abt the Points, and i never ask somebody to give points to me , if u have any doubt on it , u can check all my postings ? All it does is fill up the SDN servers with replicated data which the original poster could quite easily access themselves via SE37----> Sorry I have seen ur Posting/Reply,dont assume that i do copy & paste for sake of Points.Njoy SAP.>
    > > Gareth.
    >
    >
    >
    > regards
    > Prabhu
    Prabhu.
    I didn't question you about points at all - I was making the point that you have been on SDN a long time and have a lot of points.  Therefore you should know better than to simply cut and paste standard SAP help.  If you don't copy and paste for sake of points, what do you do it for?  It serves no purpose other than to fill up the servers here on SDN.  The original poster appears to have access to a SAP system and SE37 and wants to know how to call a BAPI - they can easily go to SE37 and read the documentation themselves.  Posting it here just adds noise and makes searching harder, as well as taking up more and more space on SDN servers.
    Gareth.

  • How to create a complaint with pre-decessor document Inovice?

    Hello experts,
    I need create a complaint with reference to a pre-decessor document type Invoice (apart from other types such as sales order and service order). Can someone enlighten me
    1) how to create an invoice in IC Web Client and backend?
    2) how to create a complaint with reference to this created invoice in IC Web client and backend?
    Thanks a lot!!!

    Hi Easwar
    Thanks  a lot for answering the question.
    Yes I do have CRM Billing documents. But the problem is
    a) either the billing document doesn't have Transfer to Accounting status Transferred or
    b) a transferred billing document, but all items have error "Unable to offset billing item 90003458 0000000060" etc.
    Do you know
    1) how I can make a billing document have "Transferred" status? Pressing "Transfer to Accounting" button in the billing document overview page will only set the status to "Being transferred". And it's always being tranfered.
    2) What does the error "Unable to offset billing item ... "mean? How to get rid of them?
    Thanks a lot!

  • Help! How do I create a document with an imported PDF in 300dpi using a FOGRA27 colour profile?

    I am a new Indesign user and I have been working with GIMP for the last year creating single colour print-ready PDFs. But now I need to create a document with a FOGRA27 CMYK colour profile and a resolution of at least
    How do I create a document with an imported PDF in 300dpi using a FOGRA27 colour profile?
    I can import the PDF by creating a new document and finding the PDF in places, but it's bad quality.
    The only colour profile I can find under View - Proof Setup is FOGRA39, but I need FOGRA27!
    Help help help, I need to get these files printed in two days!
    Thanks so much..
    xx

    Proof Colors doesn't change the file's color management, it just lets you see what the color values would look like if they are printed unchanged on different output devices. If you want to actually convert the color from one CMYK space to another, it's probably better to do that in Acrobat—Tools>Print Production>Convert Colors.
    There's very little difference between Fogra27 and Fogra39—Fogra27 allows more total ink 350 vs. 330.
    There's nothing you can do to improve the quality of low res images

  • Create reversal document with BAPI: BAPI_ACC_DOCUMENT_POST.

    Hi Guys,
    I am Create reversal document with BAPI: BAPI_ACC_DOCUMENT_POST.First I am post financial document with BAPI BAPI_ACC_DOCUMENT_POST and Same Document. i am Reversal  with same BAPI 'BAPI_ACC_DOCUMENT_POST'.
    New reversal docment is created. but posting key are not changingin reversal docment.whatever posting key created in posting same posting key are created while reversal also.Please help me

    check
    Mapping of POSTING KEY in BAPI_ACC_DOCUMENT_POST

  • CREATE SD document with characteristics - BAPICUVAL / E1CUVAL problem

    Hello there,
    I am trying to create SD document with material characteristic. I can create single value characteristic, but when I am trying to post interval characteristic, just lower interval is saved and upper one is ignored.
    I use BAPI_SALESORDER_CREATEFROMDAT2. For example:
    DATA: tab_order_value TYPE TABLE OF bapicuval,
          wa_order_value LIKE LINE OF tab_order_value.
    wa_order_value-config_id = '000001'.
    wa_order_value-inst_id = '00000001'.
    wa_order_value-charc = 'OUTER_DIAMETER'.
    wa_order_value-value = '510'.
    wa_order_value-valcode = '3'.
    wa_order_value-value_to = '2100'.
    wa_order_value-author = '8'.
    INSERT wa_order_value INTO TABLE tab_order_value.
    Characteristic is not set properly (510-2100mm), just 510mm is set. How should I call it properly? Should I fill also some another tables? Is there some documentation? Can be there some bug in SAP standard?
    Any response is highly appricieted.

    Hi Maggie,
    my values are definitely ok. When you post 100 its same as 100,00 :).
    When I want to post just one value, for example 100 it works well. When you want to post interval values, for example 100 u2013 500, its just post the first one.
    I debug standard code behind this and its look like, that there is no way to write interval and this "bug" is standard feature - the upper level of interval is cut by ABAP code.
    In past I also checked how is system filling BAPICUVAL structure. When I fill this structure with same values and run it in my BAPI its doesnu2019t work, because its processed like iDoc.
    So the conclusion is, that it is not possible to write intervals right now from external source, just from the inside of SAP standard transactions.
    So, I decided to close this thread.

  • How to create a document folder using ListData.svc

    Hi All,
    I've recently been put on a project where I need to use the REST services (ListData.svc) to retrieve and add documents to the document library. It all has been smooth sailing until I hit the point where I want to save a document in a path that doesn't exist.
    I get an error if I try to save a file where the folder structure doesn't exist. I then went about it a different way trying to create the folder structure first. This also didn't work and I get an error message saying that the entity type is marked with the
    MediaEntry attribute but no save stream was set for the entity. Not too sure what set for the save stream if I'm just adding a folder.
    So my question is can a file be added to a folder structure that doesn't exist where it automatically creates the folders. If not can the service create folders?
    Some sample code I've been using:
    var folder = new SampleDocumentLibraryItem();
    folder.Name = "Sample";
    folder.Title = "Sample";
    folder.ContentType = "Folder";
    folder.Path = "/sample/folder1/folder2";
    spContext.AddToSampleDocumentLibrary(folder);
    spContext.SaveChanges();
    Thanks in advance,
    Damo

    Hi All,
    Finally managed to figure this one out. For anyone who needs source on how to create a document folder. Some sample source is below...
    var folder = new DocumentLibraryItem();
    folder.Name = "Folder Name";
    folder.Title = "Folder Name";
    folder.ContentType = "Folder";
    folder.Path = path;
    spContext.AddtoDocumentLibrary(folder);
    spContext.SetSaveStream(folder, stream, false, folder.ContentType, folder.Path + folder.Name + "|0x0120009BCC19899CEBC6468FF4EEAC7B8CF4F5"
    spContext.SaveChanges();
    So the important differences in the code above. The content type of the object and stream MUST be set to "Folder". I'm not sure why but you still need to set the save stream to be a valid stream even though you're only adding a folder. So just keep the stream
    open and then pass "true" to close it when you actually save the file. The other important element as noted from the URL's in the previous comments is you need to add a "|" + Content Type ID of a folder. You'll be able to get this ID by visiting the rest service
    for an existing document library and view source to see the actual content type id for a folder.
    Thanks everyone for your help,
    Damo

  • How to create a Document Set in SharePoint 2013 using JavaScript Client Side Object Model (JSOM)?

    Hi,
    The requirement is to create ""Document Sets in Bulk" using JSOM. I am using the following posts:-
    http://blogs.msdn.com/b/mittals/archive/2013/04/03/how-to-create-a-document-set-in-sharepoint-2013-using-javascript-client-side-object-model-jsom.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/1904cddb-850c-4425-8205-998bfaad07d7/create-document-set-using-ecma-script
    But, when I am executing the code, I am getting error "Cannot read property 'DocumentSet' of undefined "..Please find
    below my code. I am using Content editor web part and attached my JS file with that :-
    <div>
    <label>Enter the DocumentSet Name <input type="text" id="txtGetDocumentSetName" name="DocumentSetname"/> </label> </br>
    <input type="button" id="btncreate" name="bcreateDocumentSet" value="Create Document Set" onclick="javascript:CreateDocumentSet()"/>
    </div>
    <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"> </script>
    <script type="text/javascript">
       SP.SOD.executeFunc('sp.js','SP.ClientContext','SP.DocumentSet','SP.DocumentManagement.js',CreateDocumentSet);
    // This function is called on click of the “Create Document Set” button. 
    var ctx;
    var parentFolder;
    var newDocSetName;
    var docsetContentType;
    function CreateDocumentSet() {
        alert("In ClientContext");
        var ctx = SP.ClientContext.get_current(); 
        newDocSetName = $('#txtGetDocumentSetName').val(); 
        var docSetContentTypeID = "0x0120D520";
        alert("docSetContentTypeID:=" + docSetContentTypeID);
        var web = ctx.get_web(); 
        var list = web.get_lists().getByTitle('Current Documents'); 
        ctx.load(list);
        alert("List Loaded !!");
        parentFolder = list.get_rootFolder(); 
        ctx.load(parentFolder);
        docsetContentType = web.get_contentTypes().getById(docSetContentTypeID); 
        ctx.load(docsetContentType);
        alert("docsetContentType Loaded !!");
        ctx.executeQueryAsync(onRequestSuccess, onRequestFail);
    function onRequestSuccess() {       
        alert("In Success");
        SP.DocumentSet.DocumentSet.create(ctx, parentFolder, newDocSetName, docsetContentType.get_id());
        alert('Document Set creation successful');
    // This function runs if the executeQueryAsync call fails.
    function onRequestFail(sender, args) {
        alert("Document Set creation failed" + + args.get_message());
    Please help !!
    Vipul Jain

    Hello,
    I have already tried your solution, however in that case I get the error - "UncaughtSys.ArgumentNullException: Sys.ArgumentNullException:
    Value cannot be null.Parameter name: context"...
    Also, I tried removing SP.SOD.executeFunc
    from my code, but no success :(
    Kindly suggest !!!
    Vipul Jain

  • Intercompany stock transfer: IV billing documents creates FI document with

    Hi,
    Intercompany stock transfer: IV billing documents creates FI document with wrong vendor.
    How can I make sure that the correct vendor is posted in the selling company code?
    Best regards,
    Eric.

    Hi Jürgen,
    I also tried this option but then the following error appeared:
    "Message no. F5598: Posting keys for account determination for transaction BUV do not exist".
    Some point is forcing the PGI to ask for BUV operation (Tx. OBYA).
    Thank you for your contribution.

Maybe you are looking for

  • How to reassign a budget type which has been assigned

    hi, i wanted to know how to reassign the budget type assigned for psoting period ending 30.09.2008. i want to change the key figure assigned to the budget type so i am trying to delete the budget type for that purpose. i cannot delete key figure for

  • TS3694 how to fix 1015 error in iphone 3g

    Hello, Can anyone tell me how to fix 1015 error? I'm using an Iphone 3g thank you

  • Why use cfinclude

    why use cfincludes for headers and footers instead of using templates?

  • Push e-mail from Videotron

    Hi, I want to setup my Ipad to get messages from Videotron; it does, but only if the Mail is opened on Ipad. How and what should I setup to get the e-mails from Videotron as soon as they arrive in the Videotron server? Thanks.

  • Safari 4 Progress Bar??

    Does anyone know how to bring the blue progress indicator that we saw in Safari 3 back? There was a way to in the Safari 4 beta however terminal doesn't seem to be able to modify Safari now.