How create documents with "Open" Status

Hello!
I create purchase orders in SAP using SDK:
Set oOPOR = oCompany.GetBusinessObject(SAPbobsCOM.oPurchaseOrders)
lRetCode = oOPOR.Add
But all my docs have "close"-status, that is why I can't create following invoices in my system.
DocumentStatus property of doc-object iis read only.
Can you help me? What should I do to create "open" docs?
Thank you!

Hi Andrey,
Try This.....
By using this code creating a purchase order with docstatus=open in my system
  Dim RetVal As Long
        Dim ErrCode As Long
        Dim ErrMsg As String
        Dim oPurchaseOrder As SAPbobsCOM.Documents
        oPurchaseOrder = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders)
        oPurchaseOrder.CardCode = "V1010"
        oPurchaseOrder.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO
        oPurchaseOrder.DocDate = DateTime.Today
        oPurchaseOrder.Lines.ItemCode = "A00002"
        oPurchaseOrder.Lines.UnitPrice = 2.36
        oPurchaseOrder.Lines.Quantity = 50
        oPurchaseOrder.Lines.DiscountPercent = 10
        oPurchaseOrder.Lines.Add()
        oPurchaseOrder.Lines.ItemCode = "A00002"
        oPurchaseOrder.Lines.Quantity = 8
        oPurchaseOrder.Lines.UnitPrice = 5
        oPurchaseOrder.Lines.DiscountPercent = 10
        RetVal = oPurchaseOrder.Add
        If RetVal <> 0 Then
            MsgBox(ErrCode & " " & ErrMsg)
        End If
Thanks
Shafi

Similar Messages

  • Creating Idocs With 64 Status.

    Hai Friends,
    My requirement is like this...
    Scenario:- my client says...They Get some idocs from a external system and then a program runs in the background to read these idocs and post Inbound delivery and IR documents.
    And Now As These IDOCs are not coming ...We have to read this data from a excel sheet and Create exactly the same type of IDOCs so that They can RUN the same Program to post Documents.....
    Now my doubt is ...How do i create IDOCs with status 64 and that too in the same same..as here there wont be any target system..
    Please help me with ur solution....How should i Approach...I know how to fetch data from excel and all..I need Help specially in
    Creating IDOCs with 64 status and what should be in the Control Records..
    Waiting for your insight.
    Thanks,
    Jeevan...

    Hi,
    You can use below FM for your requirement.
    CALL FUNCTION 'IDOC_INBOUND_SINGLE'
        EXPORTING
          pi_idoc_control_rec_40  = w_control_rec
        IMPORTING
          pe_idoc_number          = g_idoc_number
        TABLES
          pt_idoc_data_records_40 = i_idoc_recposting
        EXCEPTIONS
          idoc_not_saved          = 1
          OTHERS                  = 2.
      IF sy-subrc = 0.
    Idoc created if sy-subrc = 0
      Endif.
    The Control records should be like this  ( You need to check the partner profile)
      w_control_rec-mandt   = sy-mandt.
      w_control_rec-docrel  = <sap_release>
      w_control_rec-direct  = '2'.
      w_control_rec-idoctyp = < Idoc type >.
      w_control_rec-mestyp  = < message type>.
      w_control_rec-sndpor  = <sender port>
      w_control_rec-sndprt  =  < Sender partner type>
      w_control_rec-sndprn  = < sender partner>.
      w_control_rec-rcvpor  = < recv port>
      w_control_rec-rcvprt  = < recv partnertype >
      w_control_rec-rcvprn  =  < recv partner>
    Let us know if it helps you. Thanks.
    Edited by: Atul Mohanty on Jun 23, 2011 10:59 PM

  • How create header with user id time date to VC-report's output as display ?

    How create header with user id time date to VC-report's output as display ?
    This info should come from the VC - not all the way from R3-side via FunctionModule/BABI. So only userid, date, time to output as normal text (which is not editable of course). Thanks =)

    Hi ann-mari
    Go through following link may it help u
    Form Item disabled based on portal role
    /people/community.user/blog/2007/01/17/visual-composer-explorations-using-portal-roles-to-influence-ui-element-behavior
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/usingrolestoinfluenceapplication&
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/passingvaluesvia+URL&
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ad182ac7-0a01-0010-4fb8-8a4d217b19c1
    Best Regards
    ````Satish````

  • Create Documents with any Currency

    Hi,
    it´s possible create documents with SDK objects in any currency?
    I need create a invoice in Local Currency or System Currency depending the source.

    Hi Victor,
    Yes, you can create marketing documents through the DI API and set any currency code (...well, any currency code that already exists in the company setup). The Documents object has a DocCurrency and DocRate property for defining the currency.
    Kind Regards,
    Owen

  • Error while creating document with attachment.

    Hi,
    I am getting an error "An error occured while creating the original attribute for PDF"
    I tried with out file attachment, it works as you know it is simple....
    I tried with various types of attachments like .TXT and .WRD (changed both wsapplication and docfile parameters), however i get the same error. I tried both from presentation and application server (by providing   pf_ftp_dest                = 'SAPFTPA'    pf_http_dest               = 'SAPHTTPA' )
    Any idea on how to solve this?
    All i need is create a DMS document with a PDF attachment from application server. Are there any other ways to solve this issue?
    ws_docdata-documenttype = 'ARE'.
    ws_docdata-description = 'BAPI DMS'.
    ws_docdata-statusextern = 'CR'.
    ws_file-storagecategory = 'DMS_C1_ST'.
    ws_file-wsapplication   = 'PDF'.
    ws_file-description = 'Job output'.
    ws_file-docfile = 'C:\CAD Integ BAPIS_46.pdf'.
    append ws_file to it_files.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
         documentdata               = ws_docdata
    IMPORTING
         return                     = v_ret
    TABLES
         documentfiles              = it_files   .
    BREAK-POINT.
    IF v_ret-type CA 'EA'.
      ROLLBACK WORK.
      WRITE : v_Ret-message.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = '5'.
    ENDIF.
    Thanks
    Pavan

    Hi,
    I found that it is due to document type = 'ARE'. I changed hte document type to one of hte standard type 'TST'. It works for presentation server, but does not work for application server. Any ideas? Any help is appreciated with points.
    ws_docdata-documenttype = 'TST'.
    ws_docdata-description = 'BAPI DMS'.
    ws_docdata-statusextern = 'CT'.
    ws_docdata-documentnumber = 'ZNG-10000000017'.
    ws_file-storagecategory = 'DMS_C1_ST'.
    ws_file-wsapplication   = 'PDF'.
    ws_file-description = 'Job output'.
    ws_file-docfile = p_file.
    append ws_file to it_files.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
        documentdata               = ws_docdata
       pf_ftp_dest                = 'SAPFTPA'
       pf_http_dest               = 'SAPHTTPA'
    IMPORTING
       documentnumber             = v_docnum
       documentpart               = v_docpart
       documentversion            = v_docver
       return                     = v_ret
    TABLES
       documentfiles              = it_files   .
    IF v_ret-type CA 'EA'.
      ROLLBACK WORK.
      WRITE : v_Ret-message.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = '5'.
    ENDIF.
    Thanks
    Pavan

  • Create document with PL/SQL xml parser

    Hello,
    I'm trying to create a document with PL/SQL package xmldom on 8.1.7 and write to a file.
    The problem is that my file is empty when it's created.
    Can anyone send me an example of this simple problem or fullfill my example so it's works.
    As you understand I'm new in using XML. :)
    My example is:
    declare
    doc xmldom.DOMDocument;
    n xmldom.DOMNode;
    e xmldom.domelement;
    t xmldom.domtext;
    begin
    doc := xmldom.newdomdocument;
    t := xmldom.createtextnode(doc, 'ROOT');
    n := xmldom.makenode(t);
    doc := xmldom.makedocument(n);
    xmldom.writetofile(doc, 'd:\orant\xdk\plsql\demo\test.xml');
    end;
    Regards
    Hekan

    Your problem may be memory for the JavaVM. Remember, the PL/SQL
    parser uses the Java XML Parser APIs which run in a VM instance.
    Are you running Oracle 8i? If you are you can access our Java
    XML parser loaded in 8i's VM directly from your PL/SQL code.
    That is in fact how our PL/SQL Parser does it.
    Finally, we have no experience loading other XML Parsers into
    Oracle.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Premal Mehta (guest) wrote:
    : Hi,
    : I asked about his a few days back. Pl/SQL parser does not
    work
    : for XML files of size greater then 500Kb. You replied saying
    : that there were no such problem.
    : However whenever I try, either I get some exception or
    Pl/SQL
    : crashes due to memory error. I am clueless. Is there some
    : setting that I can do to get away with the problem? Please
    : guide...
    : Also, tell me about the alternatives.
    : Can I write code in Java and load these class filesin Oracle
    : and then reference these classes from Pl/SQL code. Can I load
    : any other parser for Java in Oracle.
    : Looking forward for help...
    : Premal.
    null

  • Create document with refrence + update some fields by passing some  values

    Hello Experts,
    I have a small problem . I have to create the sales order from BAPI ...but the scenario is
          have to create with refreence to another document
          some fields like condition types or material or order quantity etc are passed from an excel sheet
    hence some information which is populated in excel sheet should be picked up rest everything should be picked up
    from the refrence document
    How can use both information (from the refrence document and externally passed from the excel)  and create a new document
    please suggest!!!!
    regards,
    Khushy

    Hi,
    I am  not sure whether I really understand your request. Let me try to help.
    > Example: <FT_TAB> TYPE STANDARD TABLE,
    >                 <FS_TAB> TYPE ANY,            
    >
    > DATA: INT_TAB  is my dynamic table values.
    >
    >
    > LOOP AT INT_TAB.
    >  ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    > <F_VALUE> = INT_TAB-MATNR.
    >  APPEND <FS_TAB> TO <FT_TAB>
    Here <FT_TAB> must already be assigned to some internal table with a given (dynamic) structure. Did this happen before this piece of code?
    What I would do is to create a dynamic table (see documentation to CREATE DATA) with MATNR and the STYLE field (LVC_T_STYL). See the documentation for CREATE DATA - creation of internal tables. When collection the field descriptions for that internal table I would also build the field catalogue for the ALV.
    Then assign <FT_TAB> to that newly created internal table, <FS_TAB> to a newly created structure (same as a table line).
    Move the MATNR to component 1 (or component 'MATNR') of the table and fill the style table according to your needs. Then insert the <FS_TAB> into <FT_TAB>.
    Finally call the ALV SET_TABLE... method with your dynamic table and your field catalogue.
    Regards,
    Gerd Rother

  • Reg Creating Document with predefined content and it should be send by mail

    Hello Friends,
    I created one report containg Customer Realted Info.
    Requirement:
    now when user click or select one customer no then that time one document will be generated with predifined format having that selected customer no and address
    and that document will be sent by mail to 4 persons. ( like automailers ).
    so plz tell how to create that document with predefined letter content and how can i send that document via mail ????
    Thanks in advance.
    Marmik

    Hi
    <b>Here is custom sample code for E-mail purpose</b>
    *& Report  ZSEND
    report zsend .
    tables: kna1.
    data for send function
    data doc_data  like sodocchgi1.
    data object_id like soodk.
    data objcont   like soli occurs 10 with header line.
    data receiver  like somlreci1 occurs 1 with header line.
    select * from kna1 where anred like 'C%'.
      write:/ kna1-kunnr, kna1-anred.
    send data internal table
      concatenate kna1-kunnr kna1-anred
                             into objcont-line separated by space.
      append objcont.
    endselect.
    insert receiver (sap name)
      refresh receiver.
      clear receiver.
      move: sy-uname to  receiver-receiver,
            'X'      to receiver-express,
            'B'      to receiver-rec_type.
      append receiver.
    insert mail description
      write 'Sending a mail through abap'
                     to doc_data-obj_descr.
    call function 'SO_NEW_DOCUMENT_SEND_API1'
         exporting
              document_data              = doc_data
         importing
              new_object_id              = object_id
         tables
              object_content             = objcont
              receivers                  = receiver
         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.
    Hope this will help.
    Please rewards suitable points.
    Regards
    - Atul

  • Problem creating document with function ISH_N2_MEDICAL_DOCUMENT

    Hello,
    first of all, creating a document with correct data works. But our customer wants the documents also to be created if the name of the responsible employee is wrong or not existing.
    Can this be done in some way? Because when i try to use the function "ISH_N2_MEDICAL_DOCUMENT" i get the message "message employee NAME is not employee responsible" and the document is not created.
    regards
    Daniel

    Dear Daniel,
    basically you cannot create a medical document without an existing employee responsible (business partner). Depending on your system configuration the EmR may to be assigned to the documenting ou.
    So how you can deal with that restriction?
    a) use a dummy bp for these onces which doesn't exists. You can check BP by the IS-H BAPI for Business partners.
    b) create the BP on the fly before creating the document.
    Regards,
    Axel

  • Creating document with content from a remote system

    Any sample code that I have seen for creating a new document requires that the file (the content) of the document resides on the Server machine.
    What is the best way to create a document with content that comes from a remote file?

    The Java code which is trying to load a file into IFS must have access to the file to load it.
    If the file you are trying to load is in a remote location from the Java code, then you would need to use some remote access protocol, such as NFS, to ensure the file was accessible to the Java code.

  • Am creating document with Pages. pages are in "portrait" orientation, but two charts at end need to be "landscape". changing the orientation for one section changes it for entire doc. can i have different orientations in Pages for different sections?

    am creating a document with Pages.  all pages using "portrait" orientation, except 2 appendices need to be in "landscape".  in Word for Windows it is possible to have different page orientations for different sections of a document.  is that possible with Pages.  Even when i put the appendices in a different section, changing the page orientation changes it for the entire doc.

    Make a separate document the size and orientation you want.
    Turn that into a pdf and add it back into the original Pages document or into the pdf from from that document.
    Peter

  • Report on Deleted Parked AR Documents with 'Z' status

    Hello Experts,
    Any suggestion to obtain the list of deleted parked AR documents which did not get posted in the past.  We created AR documents and were not sure about VAT treatment and were parked but later managed to invoice the customer separately.  Subsequent to this, we have deleted the parked AR document and I know when these parked document gets deleted, document numbers are marked by a letter 'Z' and you can get a report BY DOCUMENT NUMBER.  Is there any standard SAP report that can be run BY CUSTOMER to see all deleted parked documents for that customer only.
    Appreciate valuable suggestions to achieve the above.
    Rgds
    CONMJI

    Hi,
    use S_ALR_87012293 - Display of Changed Documents  to check the deleted parked docuements or any status regarding parked document.
    Here if you select park doc radio button and give input document type and posting key, then you will get the customer/vendor/GL related docuements . Take that dump and put in the table and give input of your customer code.it will shows those documents if any.
    Thanks
    ANJI

  • How create report with data from table and some columns results function ?

    Hi,
    How can i create on apex report region with some columns (of the report) as returned from a table and the other columns as results of plsql functions ?
    for example , I want to create a report like that:
    device last_date error_msg stop/start
    kodak1 06/04/08 null >>
    kodak2 08/03/08 good msg --^--
    kodak3 08/04/08 err msg >>
    3 rows returned
    where the 3 first columns are data returned from the table and the forth column is the result of plsql function (returned for example false) and on that i want to display a button of start ( >> in this example ) or stop ( --^-- in this example)

    Thomas,
    There is no problem here -- this is fully suported scenario.
    1. Bind Table dataSource to Customers node.
    2. Bind individual cell editors to any attribute of customer or any nested node like Address, say create column with InputField as editor, then for "value" property select Customer.Address.Street.
    Your nested nodes (like Address) must be non-singleton, set singleton=false on context designer tab.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • TextEdit: how save document with new name?

    I tryed in many ways to save modified document with new name with TextEdit but no one works for me.

    Use TextEdit > File > Duplicate.
    For this example, my original document is named Lorem.rtf. I open it with TextEdit, and then Duplicate it. A new TextEdit document window appears. Its default name is Untitled (Lorem copy). If you pass your pointer near the right parenthesis, a downward pointing triangle appears. Click that and the Name field has Lorem Copy preselected. Press the delete key to erase this name, and enter the new name — followed by a return to set it.

  • How create page with two frame (google geocoding BSP)

    Hi all,
    can someone suggest me how create an BSP application with the main page composed by two frae?
    I've create a page with tags <htmlb> gridLayout for ape the frame structure and the result is fine.
    here the screenshot of what i've done:  http://img17.imageshack.us/img17/3558/bspgeolocalization.jpg
    But now i've to call the right page frame ( obviously in his frame) from the left page controller after pressing the 'search button'
    and passing to it a table.
    someone has an idea?
    Thanks in advance,
    Davide

    checkt his thread
    Web template keep loading/refreshing in BSP
    though the question is for different purpose, you can find the code for framed pages there

Maybe you are looking for

  • How to allow application access to particular User while running payroll

    Guys, We are using Oracle Co-Hrms and payroll application and running fine,but one majore problem we face in every payroll,while running the payroll if any employee profile opened by any user ,which is inculde in assignment set of running payroll the

  • Process chain errors

    Hi all, I have a question regarding the 'process chain'. Here is my business scenario: --<b>I loaded data into ODS and then loaded from ODS to the Cube.</b> I created the infopackage for ODS with the 'full load' and 'immediately load' one month ago.

  • XML Report Bursting and distribution

    I want to send PDF report as an attachment to more than 200 suppliers using XML Report Bursting In XML Report Bursting and distribution, do we need to configure the "Mail Server" on apps. (I mean any configuration is required on apps server)? Thanks,

  • Create Item Category in PeopleSoft 9.1

    Hello, We are using PeopleSoft 9.1 and we have to create a large number of item categories. Is there any way to automate this process in stead of creating them one by one? regards, Stijn

  • WLST/start AdminServer - problems with trusted cert key store

    Hello, I have clustered environment. Machine1: AdminServer and odi_server1. Machine2: odi_server2. There is NodeManager running on each machine. This is my nodemanager.properties for NodeManager on Machine1: #Thu Dec 19 13:18:30 CET 2013 #Thu Dec 19