How to send Sales Document Number and Item to BAPI_ACC_DOCUMENT_POST?

Hello SAPients,
We are using BAPI_ACC_DOCUMENT_POST to create an accounting document similar to what FB01 does, in FB01 you can type the number and position of a Sales Document even if you are using an Account Receivable account number. But in the BAPI, the  ACCOUNTRECEIVABLE table doesn't have a field to include those numbers. How should I pass the sales order number and item to the BAPI? I have tried several things but every time I receive more complicated error messages.
Thank you in advance for your kind help.

Let me know if you have any questions:
Loop through your records and fill in the appropriate structure based on record type (GL, Vendor or Customer)
IF NOT pcard_post_rec-zlsapac IS INITIAL.
    gt_gl_item-itemno_acc   = ls_posnr.
    gt_gl_item-gl_account = pcard_post_rec-zlsapac.
    gt_gl_item-comp_code = pcard_post_rec-zlsapco.
    "gt_gl_item-pstng_date = pcard_post_rec-zlgpsdt.
    gt_gl_item-pstng_date = gv_posting_date.
    gt_gl_item-doc_type = doctype.
    gt_gl_item-alloc_nmbr = ls_assignment.
    gt_gl_item-ref_key_3 = pcard_post_rec-zlgvend.
    IF pcard_post_rec-zlsapac < 500000.
      gt_gl_item-item_text    = ''.
    ELSE.
      gt_gl_item-item_text    = pcard_post_rec-zlguser.
    ENDIF.
    gt_gl_item-costcenter = pcard_post_rec-zlsapcc.
    gt_gl_item-orderid = lv_ordnum.
    APPEND gt_gl_item.
  ELSEIF NOT pcard_post_rec-zlsapven IS INITIAL.
    gt_ap_item-itemno_acc = ls_posnr.
    gt_ap_item-vendor_no = pcard_post_rec-zlsapven.
    gt_ap_item-comp_code = pcard_post_rec-zlsapco.
    gt_ap_item-alloc_nmbr = ls_assignment.
    gt_ap_item-ref_key_3 = pcard_post_rec-zlgvend.
    IF pcard_post_rec-zlsapac < 500000.
      gt_ap_item-item_text = ''.
    ELSE.
      gt_ap_item-item_text    = pcard_post_rec-zlguser.
    ENDIF.
    APPEND gt_ap_item.
  ELSEIF NOT pcard_post_rec-zlsapcus IS INITIAL.
    gt_ar_item-itemno_acc = ls_posnr.
    gt_ar_item-customer = pcard_post_rec-zlsapcus.
    gt_ar_item-comp_code = pcard_post_rec-zlsapco.
    gt_ar_item-alloc_nmbr = ls_assignment.
    gt_ar_item-ref_key_3 = pcard_post_rec-zlgvend.
    IF pcard_post_rec-zlsapac < 500000.
      gt_ar_item-item_text = ''.
    ELSE.
      gt_ar_item-item_text    = pcard_post_rec-zlguser.
    ENDIF.
    APPEND gt_ar_item.
  ENDIF.

Similar Messages

  • Free form partner function field in Sales document header and item..

    Hello Experts,
    Is there anyway we can use the partner functions functionality in Sales document header and item level, so that we can enter a free form number in the Partner field? I mean is it possible to be able to enter a free form number WITHOUT getting validated against corresponding master data like Customer or Vendor master, Contact person, Personnel or User master records?

    Hi,
    It is not possible.
    Because partner function will be determined in the sales document header and item as per the configuration you have done in the partner determination.
    It is not possible to enter a number wihich is not created and assigned.
    Regards,
    Mullairaja

  • How to catch accounting Document Number in SE37 for  BAPI_ACC_DOCUMENT_POST

    HI Frds,
    My ReQ is i have to post Customer Invoice from Legacy to ECC through PI interface. So i am using one BAPI , ' BAPI_ACC_DOCUMENT_POST''. I had customized this BAPI by adding 2 fields (1.zstatus, 2.zsaprefno) as i have to send the status(1. Success/Fail, 2.Account Document Number) back to Legacy.
    For PI i have to give the BAPI structure. So when i am executing in SE37 zstatus field is catching the value as 'Success'. But the ZSAPREFNO is not catching the account document number. Bez we have to execute BAPI_TRANSACTION_COMMIT after this BAPI(in test sequence from Menu bar). So directly updating in Database tables.
    when i was excuting in SE38 the Accounting Document Number is returned in RETURN parameter of MESSAGE_V2 as we are checking the return parameter after BAPI_TRANSACTION_COMMIT.
    when i am trying in SE37 its not catching the value in MESSAGE_V2(catching as $).  After COMMITing we have no option to check the RETURN parameter.
    So, any idea how to get the Account Document Number  in SE37.......Or any other way to do..........
    Edited by: priya tavanam on Sep 3, 2010 7:02 AM

    Hi,
    if standard BAPI did not return the Acc. document number before BAPI_COMMIT then create wrapper FM
    1) call actual BAPI and BAPI_COMMIT with in that.
    2) retrun the account document back.
    otherwise you can try sync proxy as well.
    Regds,
    Suresh

  • To get service order from sales order number and item number

    The select on AUFK takes much longer time than the transaction which is used to get the sevice order number starting from VA03. ( select one line item. goto repairs, then select the repairs column and goto SM Order). Is there any other table than AUFK from which i can get service order number.

    Hi!
    Check, if you have an entry in table VBFA for your sales order (sales order in VBELV, POSNV, AUFK in VBELN and POSNN, VBTYP_N might be 'C').
    If so, your select will be much faster by using VBFA.
    Regards,
    Christian

  • How to send a document link and track and receive analytics?

    I was under the impression that if I subscribed I would be able to do this - post a link to an uploaded document and track it as it is viewed.
    I don't have the email addresses of strangers that will be clicking the link, so the email option is moot.

    Hi BJRCollins,
    You may use Forms Central then, you may pose link on your website or on social networking website. Collect form responses with FormsCentral | Adobe Acrobat XI
    But if you need people to review some documents and comment on it that can be done using Adobe Acrobat and with the people of whom you will send the link share that document.: http://wwwimages.adobe.com/content/dam/Adobe/en/feature-details/acrobatpro/pdfs/initiating -a-shared-review.pdf
    Regards,
    Ajlan Huda.

  • Remodeling the cube and adding sales document number

    HI guys
    I have a requirement of sales order number in the sales over view cube ( 0sd_c03 ) so i am planing to remodel the cube to add sales order number and item
    as i can not create a new dimension i have to add these two charecteritics to a old dimension
    so whether it will give any perfomance issues later on as the sales document number will increase the
    records in that dimesion or can i go ahead to do it or i have to delete the data in cube and change the cube adding a new diemension ( line item dimension)
    please suggest..
    Regards
    Amiya

    Hi Amiya,
    Regarding ur case ..
    In my opinion, it should be separated into different dimension ..
    Because it will make that old table dimension become have huge data,
    it will make slow in fetching the data.
    To make it.
    1. Edit Info-Cube using t-code RSA1
    2. Create new dimension, and insert dummy characteristic, then save, and activate it.
    3. In the remodeling, t-code: RSMRT, you can add those 2 characteristics there, you also can initilize the value for those characteristic.
    4. Then, in the remodeling, you delete the dummy characteristic.
    Hopefully it can help you a lot.
    Best regards,
    Niel.

  • Sales Document number in FBL5N

    Hi Friends,
    In FBL5N (customer line item report) there is a field "Sales Document" Field Name "VBEL2". But the accounting document which is generated in FBL5N for billing document from SD in not populating the sales order number in this field, this field is blank.
    this field is getting populated for down payments with relevant sales document number and not for invoice document.
    Our client wants the sales order number to be reported in customer line item report for their tracking.
    Can any one please suggest how this can be achieved.
    Thanks & Regards

    You can map Sales Order number to either 'Assignment' or 'Reference' fields in accounting document using Copy control function in SD. Please use transaction VTFA, this needs to be maintained for combinations of billing type and sales document type. Please ensure these fields are not currently used in your system for other information.
    Following fields can be mapped to 'Assignment' or 'Reference'.
    A Purchase order number
    B Sales order number
    C Delivery number
    D External delivery number
    E Current billing document number
    F External delivery no. if available, otherwise delivery no.
    If you currently use 'Assignment' or 'Reference' fields for other details, you can use user exit EXIT_SAPLV60B_008.
    Thanks
    Venkata Ganesh Perumalla
    Edited by: Venkata Ganesh Perumalla on Oct 4, 2010 11:52 AM

  • Add Sales Document Number in FBL5N

    How can we add the Sales Order Number in FBL5N. Although we have fields Sales Document Number and Order field but they are not populating.

    I write the following code to get the sales order in function module .
    Firt Try
    FUNCTION ZSAMPLE_INTERFACE_00001650.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_POSTAB) LIKE  RFPOS STRUCTURE  RFPOS
    *"  EXPORTING
    *"     VALUE(E_POSTAB) LIKE  RFPOS STRUCTURE  RFPOS
    TABLES : VBRP.
    SELECT SINGLE VBRP~AUBEL INTO E_POSTAB-ZSORDER* FROM VBRP WHERE VBRP~VBELN = I_POSTAB-VBELN.*
    Initialize Output by using the following line -
    E_POSTAB = I_POSTAB.
    I addZORDER field in RFPOSX structure and first I use the RFPOSX in into clause but it gives me the error component ZSORDER does not have component ZSORDER although I followed the instruction. (Is append is same thing like I did)
    Second Try
    I change ZSORDER with AUFNR which is RFPOSX FIELD  then ift gives me error report/program statement missing.
    SELECT SINGLE VBRP~AUBEL INTO E_POSTAB-AUFNR* FROM VBRP WHERE VBRP~VBELN = I_POSTAB-VBELN.*
    ENDFUNCTION.

  • How to find sales document and billing document number of a accounting doc

    Hi,
    I have opened a accounting doc. using fb03. Now how to find the corresponding sales doc. and billing doc. no. of this accounting doc. no.

    Dear satyam
    Go to SE16 / BKPF, give the accounting document number reference in "Document number" and execute, so that you will get the respective billing document number.  Make a note of it.
    Now go to again SE16 and give table VBFA and give all the billing document references in "Follow-on doc" and maintain "C" in "Prec.doc.categ." and execute.
    Alternatively, you can try with table joining BKPF and VBFA in SQVI.
    thanks
    G. Lakshmipathi

  • How to populate the sales document number in FD10N or FBL5N report

    Hi Gurus,
    In the reports FBL5N and FD10N i am able to see the Billing document field(VBELN) populated with the number but The sales document number (AUBEL) is not populated with the number.
    How to get this number updated to the FBL5N or FD10N report.
    Thanks in advance.

    Hai
    Goto Settings Special Fields and add the required fields and save and come back and exceute again.
    Regards
    Raghavendra.M
    SAP-Practice

  • How to unlock sales order number after changing its line item statuses.

    hi all,
            my requirement is i am changing the status of the double
           clicked sales order which is showing in ALV grid display
           before that i am locking that sales order using FM
           CALL FUNCTION 'ENQUEUE_EVVBAKE' and for
           changing the status i am using FM
            CALL FUNCTION 'STATUS_CHANGE_EXTERN'
            which doesnt have commit statement inside this FM so
           i have explictly written this commit statement if this FM
           gives SY-SUBRC = 0 but with this statement it unlock my
           sales order because of the commit functionality.
    also this FM is in loop for all line items for that sales order
    please help me with that!!!!

    Hi,
    I have created delivery against sales order.
    While picking (during delivery PGI), I selected two batches to suffice the delivery qty. Please refer the example quoted below.
    Sales order (SO1) - Material (Mat1) - qty (15 ea)
    Delivery against sales order (Del1) - batch split: batch1 - 10 ea
                                                                         batch2 - 5 ea
    In table LIPS: when I enter delivery number as "Del1" and execute, I get 2 records:
       del no.     Item No.      Material   Qty       Batch no       Sales Order no     Sales Order Item no
    1. DEL1       10              Mat1        10 ea    batch1          SO1                    10
    2. DEL1       20              Mat1         5 ea     batch2         ______                 ____
    Thus in the 2nd record, the Sales order no.(LIPS-VGBEL) and sales order item no. (LIPS-VGPOS) does not get updated.
    I have to develop a report to display the Sales Order number and sales order line item number for each batch of the Delivery for the same item number. Please guide me to know how I can get the same.
    Hope this clarifies the issue faced.
    Regards,
    Ankush

  • Sales document number not appearing in Work Item.

    Hello gurus,
         I have created a WorkFlow for approval of Sales order. My problem is, the sales document number is not appearing in the WorkItem for user decision task. I am passing container variable the sales document number in the Parameter1 of the User Decision task of the work flow. Value is populated correctly in the container variable for sales document number, but fails to appear in the work item content in SBWP.
         Please suggest a solution.
    Regards,
    Dnyanesh.

    Hello All,
         Thanks for your reply.
    I am passing the value of sales document number in parameter 1 of the standard task for approval as below.
    But in my Business Workplace I do not get the Sales document number. Below is the screenshot.
    Regards,
    Dnyanesh.

  • Table to link FI document number, line item and pricing condition type

    Hi,
      I am looking for tables to link the FI document number, line item and PO pricing condition type.
      Appreciate any help on this.
    Thanks.

    For any PO in ME23n in which Goods receipt has happened, you can check in the itemdetails->Po history tab in ME23n.
    Here you will find the material document number. Just click on the material document, it will take you to anpther screen here you will find a button for FI document.
    Click that button for FI document. In PO history istelf you can see the Condition types.
    Hope this helps.

  • MIGO-sales order number and line item not validated for 501E mvt in MIGO.

    Hi All,
    In MIGO i am trying to post for 501E(specisl stock=order on hand) movement type, here i am entering the material and in the where TAb even if I enter wrong sales order number or wrong sales order line item number. the system allows to post .
    its not validating the material against the sales order number and line item number that is entered to check whether that material really exists in that particular sales order or not.
    is there a way to fix this?
    Thanks
    Mahendra

    hi
    i dont think vvalidation is possibel
    as the system dont know whaich material is assigned to which SO
    as we r takeing the stock without PO
    if u want to validate then system can validate the quantity that is also with use of some user exit
    correct me if i am wrong

  • How do I prevent a Sales Document number to be generated

    Hi Experts,
    I'm going to be using bapi_salesorder_create_fromdat1 to simulate a sales order create, but I will not commit it.
    The BAPI has a flag that I can set to prevent a sales order from being created.
    Problem is that: 
    It still generates a Sales Document Number, which I don't want to have happen.
    Has anyone done something similar or at the very least prevent a number from being taken from the number ranges from config?
    Regards,
    Orlando

    Hi Orlando,
    as per your last thread i understand no sales order generated but number rage is taken.
    so for your test purpose you can assign new dummy number range to order type and after your simaltion you can reassign the original.
    I know this is not what you want but still this could be one of soultion to your problem.
    hope this solves your purpose.
    regards/ashu

Maybe you are looking for

  • How can I transfer songs from my ipod to my new computer (my old one is dead)?

    My old computer died this past summer.  Luckily, all of my music was saved to my ipod (nano 4th generation?.  How can I transfer my songs to my new computer without deleting them?

  • Micro USB cable

    Would someone give me a link or model number for the "micro USB cable" that specifically goes from the Apple TV 2/3 gen to a MacBook Pro 13 2012? Thanks!

  • Performing E2ETrace Analysis unuseable in Citrix-Server-Environment?

    Hallo, Since SAP CLient Plug-In 1.11 for E2E Trace Analysis, we get the error "ERROR: Found running application instance(s): please close the open application instance" if IE8 sessions are startet before launching the plugin. so, executing the E2E -T

  • Urgent need lsmw with directinput

    hi folks, i am in urgent need i am using the program RSADRLSM02 for the uploading of the bisiness address services/regionla structure with lsmw using directinput method i finished all the steps but at the end i am getting struck it is asking for the

  • Suddenly there's no sound while i use QT to play avi

    i once could play most avi files in QT, but suddenly, i can't anymore, i haven't made any changes recently in Mac OS X, but have installed the Windows XP using BootCamp( some of the drivers which contained in the CD burned using BootCamp can't instal