Using 'BAPI_ACC_GL_POSTING_POST' to simulate FBS1

Hi,
I'm using the 'BAPI_ACC_GL_POSTING_POST' to do the same as tran saction FBS1, having a few problems with the code in terms of values I should be using.
When using FBs1 the values I use are from the following 2 lines:
Po Number, Item, DELv. Date, Descr., Undelvd. Val., GL ACCount, Cost centre, last field being internal order
4500011114     10     23.05.2006     pallet of photo paper     5,000.00     476000     2-1000     
And
4500011114     50     20.05.2006     marketing assistants     500.00     417000                    400157
Not sure what values I should use for the following
documentheader-obj_key =  '000000000100000038'.
documentheader-obj_type = 'BKPFF'.
*documentheader-obj_key = '180000000010002004'.
documentheader-obj_sys = 'RD1CLNT200'.
documentheader-username = sy-uname.
documentheader-header_txt = 'Test using BAPI'.
documentheader-comp_code = '2000'.
The error I get is:
E   |RW                  |609   |Error in document: BKPFF 0000000001000000<
and E   |F5                  |702   |Balance in transaction currency 
The code is below:
DATA:
obj_type LIKE bapiache02-obj_type,
obj_key LIKE bapiache02-obj_key,
obj_sys LIKE bapiache02-obj_sys,
documentheader LIKE bapiache08,
accountgl LIKE bapiacgl08
OCCURS 0 WITH HEADER LINE,
currencyamount LIKE bapiaccr08
OCCURS 0 WITH HEADER LINE,
return LIKE bapiret2
OCCURS 0 WITH HEADER LINE,
extension1 LIKE bapiextc
OCCURS 0 WITH HEADER LINE,
t_edidd LIKE edidd OCCURS 0 WITH HEADER LINE,
bapi_retn_info LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: error_flag.
*documentheader-obj_type = 'BKPFF'.
documentheader-obj_key =  '000000000100000038'.
documentheader-obj_type = 'BKPFF'.
*documentheader-obj_key = '180000000010002004'.
documentheader-obj_sys = 'RD1CLNT200'.
documentheader-username = sy-uname.
documentheader-header_txt = 'Test using BAPI'.
documentheader-comp_code = '2000'.
*documentheader-ac_doc_no
*documentheader-fisc_year = '2005'.
documentheader-doc_date = '20060506'.
documentheader-pstng_date = '20060506'.
*documentheader-trans_date
*documentheader-fis_period
documentheader-doc_type = 'SA'.
*documentheader-ref_doc_no
*documentheader-compo_acc
*documentheader-reason_rev
accountgl-itemno_acc = '1'.
accountgl-gl_account = '0000476000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '2-1000'.
*accountgl-
APPEND accountgl.
accountgl-itemno_acc = '2'.
accountgl-gl_account = '0000476000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '2-1000'.
*accountgl-
APPEND accountgl.
accountgl-itemno_acc = '3'.
accountgl-gl_account = '0000417000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000400157'.
APPEND accountgl.
accountgl-itemno_acc = '4'.
accountgl-gl_account = '0000417000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000400157'.
APPEND accountgl.
*AC_DOC_NO
*FISC_YEAR
*FIS_PERIOD
*accountgl-STAT_CON = 'X'.
*REF_KEY_1
*REF_KEY_2
*REF_KEY_3
*CUSTOMER
*VENDOR_NO
*ALLOC_NMBR
*ITEM_TEXT
*BUS_AREA
*COSTCENTER
*ACTTYPE
*ORDERID
*ORIG_GROUP
*COST_OBJ
*PROFIT_CTR
*PART_PRCTR
*WBS_ELEMENT
*NETWORK
*ROUTING_NO
*ORDER_ITNO
currencyamount-itemno_acc = '1'.
currencyamount-currency = 'EUR'.
currencyamount-amt_doccur = '5000.00'.
APPEND currencyamount.
currencyamount-itemno_acc = '2'.
currencyamount-currency = 'EUR'.
currencyamount-amt_doccur = '-5000.00'.
APPEND currencyamount.
currencyamount-itemno_acc = '3'.
currencyamount-currency = 'EUR'.
currencyamount-amt_doccur = '-500.00'.
APPEND currencyamount.
currencyamount-itemno_acc = '4'.
currencyamount-currency = 'EUR'.
currencyamount-amt_doccur = '-500.00'.
APPEND currencyamount.
call BAPI-function in this system
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = documentheader
importing
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = accountgl
currencyamount = currencyamount
return = return
extension1 = extension1
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
  MESSAGE e999(re) WITH 'Problem occured'.
ELSE.
  LOOP AT return.
    IF NOT return IS INITIAL.
      CLEAR bapi_retn_info.
      MOVE-CORRESPONDING return TO bapi_retn_info.
      IF return-type = 'A' OR return-type = 'E'.
        error_flag = 'X'.
      ENDIF.
      APPEND bapi_retn_info.
    ENDIF.
  ENDLOOP.
  IF error_flag = 'X'.
    MESSAGE e999(re) WITH 'Problem occured'.
    ROLLBACK WORK.
  ELSE.
   COMMIT WORK.
  ENDIF.
ENDIF.
Many Thanks
Regards Sims

hi,
is there is an example of how to use FM POSTING_INTERFACE_DOCUMENT, I guess, one of my issues is trying to work out the parameters I need to use?
Many Thanks
Regards Sims

Similar Messages

  • Unable to update XBLNR field on BKPF when posting a document using BAPI_ACC_GL_POSTING_POST

    Hi,
    I'm trying to post a clearing document using BAPI_ACC_GL_POSTING_POST, but after posting i'm unable to see the data in the reference field on header (BKPF-XBLNR). I'm passing the data in the header structure of the BAPI  (DOCUMENTHEADER-REF_DOC_NO).
    Thanks in advance.
    Regards,
    Sandeep

    We restricted our entry to five decimals and solved the issue.

  • Not able to post document using BAPI_ACC_GL_POSTING_POST

    Hi all,
    While trying to post documents in FB60 using BAPI_ACC_GL_POSTING_POST we are getting error Account not assigned to company code. But we are able to post documents manually using the same account and company code. Couls any one help me out to resolve this issue.
    Thanks & Regards,
    Neela.

    This is complete procedure to use 'BAPI_ACC_DOCUMENT_POST'. It can be used for GL, AR or AP documents.
    Step 1:
    For Header information, fill u201CDocumentHeaderu201D structure as:
    obj_type = 'BKPFF'
    obj_key  = '$'
    obj_sys = CONCATENATE syst-sysid 'CLNT' syst-mandt
    bus_act = 'RFBU'
    username  = syst-uname .
    comp_code = Company Code
    doc_date  =  Document Date
    pstng_date = Posting Date
    doc_type = Document Type like AB, SA.
    ref_doc_no = Reference Document
    To populate the line item data, fill internal table u201Caccountglu201D or  u201Caccountpayableu201D or u201Caccountreceivableu201D as:
    itemno_acc = Line Number (like 10,20)
    gl_account = GL Account Code (For GL Line Items only)
    vendor_no  = Vendor Number (For AP Line Items only)
    customer   = Customer Number (For AR Line Items only)
    acct_type  = 'S' or u2018Ku2019 or u2018Du2019. (GL = u2018Su2019, AP = u2018Ku2019, AR = u2018Du2019)
    costcenter = Cost Center
    orderid    = Internal Order
    tax_code   = Tax Code
    item_text  = Item Text
    quantity   = Quantity
    base_uom   = Unit for Quantity
    Note:
    u2022 Separate internal tables should be created for GL lines, AP Lines and AR Lines.
    u2022 If posting GL line items then only u201Caccountglu201D internal table should be filled.
    u2022 If posting AP document then GL lines should be filled in table u201Caccountglu201D and Vendor lines should be filled in table u201Caccountpayableu201D.
    u2022 If posting AR document then GL lines should be filled in table u201Caccountglu201D and Customer lines should be filled in table u201Caccountreceivableu201D.
    u2022 Extension of each line of u201Caccountglu201D, u201Caccountpayableu201D and u201Caccountreceivableu201D must be there in u201Ccurrencyamountu201D.
    To populate the amount, fill u201Ccurrencyamountu201D structure as:
    itemno_acc   = Line Number (like 10,20, but pair of u201Caccountglu201D line)
    amt_doccur = Amount {Credit amount should be with sign
    currency  = Currency
    Step 2:
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader = st_documentheader
      IMPORTING
        obj_key        = w_objkey
      TABLES
        accountgl      = i_gl  {GL Line Items}
        accountpayable = i_ap {AP Line Items
        accountreceivable = i_ar {AR Line Items}
        currencyamount = i_amt {Amount of all above}
        return = i_bapiret. {Return messages}

  • Error when using QuestaSim to simulate example design

    Hi:
    I want to use QuestaSim to simulate the example design (PCIe core).
    I've compiled the Xilinx library.
    When I execute the "Run Simulation", there is a error message :
    [USF-ModelSim 51] Path to custom 'vsim.exe' executable program does not exist:C:/questasim64_10.0a/vsim.exe'
    Is there anything wrong with my setting?
    Thanks.

    Hi 
    Instead of C:/questasim64_10.0a use C:/questasim64_10.0a/win64 in simulator executable path.
    Thanks,
    Vinay

  • Can I use SoftMotion to simulate a PID motor control loop using a Solidworks model?

    Hi
    I'm not a labVIEW user yet. But I probably will become one when I can do the following:
    I have a Solidworks model of a complex machine with multiple servo motors. Can I use labVIEW plus SoftMotion to calculate the needed motor forces and aply these forces on the Solidworks model making some parts in the model move and can I get positional feedback from the Solidworks model which I can use in labVIEW to calculate the motor forces again. This way I could use labVIEW to simulate the complete motor control loop including some PID filtering.
    I could find some posts about SoftMotion, but they all seem to handle about SoftMotion in combination with external hardware. But I would like to do a complete software simulation.
    I hope this is possible.

    Hi Melomania
    Solidworks for SoftMotion works in an interesting manner. First SoftMotion runs in labview and plots a trajectory path based off the input from the user. The generated points are controlled by speed, velocity and acceleration. These generated points are sent to SolidWorks where the physics engine takes over. SolidWorks calculates the ammount of force required to move the component the given distance and also if there are any collisions that take place. Basically the whole process is open loop with no PID being implemented. The purpose for the software is to test your motion system for collisions and calculate the required torque for your motors to move and the velocities and accelerations provided. A system prototyped with SoftMotion Solidworks will still need to be tuned when constructed in the real world.
    For your application I would look into Control Design and Simulation Toolkit.
    Thank You
    Eric Reid
    National Instruments
    Motion R&D

  • Error in Using BAPI_ACC_GL_POSTING_POST

    Hi,
    I am using BAPI BAPI_ACC_GL_POSTING_POST for transaction F-02 for uploading salary details.
    here i am using posting key 39 and account no as vendor no and special GL indicator.
    From that system automatically pick the GL attached to that Vendor and posting the document while i am doing that one manually.
    but when i am doing the same using BAPI system is throwing an error saying that GL acnt (Vendor no ) is not defined in chart of
    acnt.But The GL attached to the vendor no is reconcillation acnt,so it is not defined in chart of acnt.
    please help me in this regard.
    Thanks
    Anil D

    Try to fetch the g/l account from company vendor data before calling bapi.
    DATA: l_akont TYPE lfb1-akont.
    SELECT SINGLE akont FROM LFB1 INTO l_akont
    WHERE bukrs = l_bukrs AND lifnr = l_lifnr.
    /BR
    Simo

  • Using RPRPAY00 to simulate Travel Expenses

    I am using this report RPRAY00 to Transfer Travel Expenses and in the development environments I had to direct the RFC Destination using the several systems (from HRD100 to HRD200 and from HRD200 to HRD100).
    This report needs a BADI PayrollTravelExpnses.Post to be in the Distribution Model heading to another SAP system and a Special Method Destination to be created between them.
    In Production I only have one system and client (HRP100).
    How can I do this so the report stills works in Production? I have no machine to head the RFC destination to and I can not head it the same system (HRD100).
    I cannot head it to SAP XI because it is not a Payroll system and it checks some customizing in the other system.
    Can you please help me with this?
    Thanks in advance.

    Hi Marco,
    I don't get it. Why do you need to do so?
    Dokumentation of report says:
    "The transfer program RPRPAY00 imports parts of trip costs accounting results from the logical system of Travel Management to Payroll Accounting's logical system.
    Please note: If Travel Management and Payroll Accounting are both in the same logical system, this program is not needed."
    Herbert

  • How do you simulate an encoder using a virtual channel?

    I am trying to use MAX to simulate hardware so I can create a program before I purchase the hardware. I will be purchasing a USB-6211,  TTL quadrature encoder, and LVDT.
    I want to simulate a quadrature encoder and a LVDT. I have created a virtual channel for each and a virtual USB-6211.
    The LVDT is simulated by creating a virtual analog input channel. This virtual channel works when I test the vi.
    The encoder is simulated by creating a virtual angle counter. This virtual channel does not work when I test the vi.
    How do I get this virtual angle counter to work?

    Kristen,
    I do not get an error. The problem is that I do not get any action from the virtual channel.
     For
    example, when I created the virtual analog input channel, this channel
    provides a simulated varying voltage when I run the vi. The virtual
    angle counter channel does nothing at all when I run the vi.
    Attachments:
    Simulation Problem.vi ‏124 KB

  • Use of FBS1.

    Hello All,
    Can any one explain me the use of the Tcode FBS1? The tcode is used for Accrual, but why does one has give a reversal reason and date...for what does that two fields help? What sorts of posting keys will be used for a transaction with FBS1?
    Please explain,
    Thanks and Regards,
    Tushar

    Hi
    If business requirement, is to make a provisional entry for monthly closing and then reverse the same the fist day of next month, then the reversal data would be used. Since provision entries are done for temporary accounting purposes and the real accounting can happen on receipt of invoices
    Thank You,

  • How do I simulate sine waves up and down several triangular waveforms?

    I need to simulate a number of sine waves at about 10 or 20 Hz and run these up and down a number of triangular waves. I am using the "Simulate Signal" box which generates the sine waves but am not sure what or how to connect to this to "ramp" the sinusoidal waves up and down triangular waves. The triangular waves would run at about 1 Hz.
    thanks
    Martin

    Martin,
    It seems as if you could use a second "Simulate Signal" VI, set it for a triangle pattern at your desired frequency, and then add the resulting waveform to the sine waveform. If I run that in a loop, I get a nice ramping sine wave (see attached image).
    Hope it helps,
    John
    Attachments:
    triangle_sine.png ‏8 KB

  • Bapi for trans code FBS1 - is there any? - FI - Reversal Journal Entries

    Hi Sap Forums,
    I have to post Reversal Journal Entries, I am currently using BAPI_ACC_GL_POSTING_POST for regular entries.
    Anyone else had to do this?
    thanks

    Found this... does this work for anyone?
    I am also trying the same thing can you let me know what parameters you are passing to BAPI BAPI_ACC_GL_POSTING_REV_POST.
    1. I am calling first the BAPI BAPI_ACC_GL_POSTING_POST to create FI Document.
    2. I am passing the document number created from above step to the bapi BAPI_ACC_GL_POSTING_REV_POST .
    3. Till second step it is fine giving no errors but when i do commit i get an update error, document number alreay exist.
    Edited by: keith warnock on Jun 11, 2009 4:58 PM
    Edited by: keith warnock on Jun 11, 2009 4:59 PM

  • Simulate Sales Order and partners function

    Hi,
    I am using the BAPI: BAPI_SALESORDER_SIMULATE to simulate the sales order creation. Everything is working fine, except the partners determination.
    Where should i get all the partners related to that sales order. I want to determine the same that we saw in Partners tab in VA01.
    Can you help please? i already tested with the ORDER_PARTNERS table, but i didn't get the point. Could you please explain?
    Thanks
    Best regards

    Ok,
    I went to transaction WE20, but i am not understanding what this will help to my requirement.
    Can you explain better please?
    What i need is to know if it is possible to know all the partners functions when you are simulating a sales order by using the BAPI simulate. I want to simulate the same that happens in VA01 when we are creating a sales order and we go to tab Partners.
    Thanks
    regards

  • Too much resources use by the iOS6.0.1. How can I downgrade ?

    Good evening,
    I have an Ipod 4 touch. I use Amplitube to simulate amps with my guitar. With Ios5 I had no problem but since upgrade on Ios6 Apps close suddenly. Reason : not enough ram memory.
    How can I fix this ?

    All I can say in this Apple forum is that downgrading the IOS is not supported by Apple.
    For your problems:
    See:
    iOS: Troubleshooting applications purchased from the App Store
    Restore from backup. See:
    iOS: How to back up
    Restore to factory settings/new iPod

  • BAPI for FBS1

    Hi SAP Gurus,
    I am using BAPI_ACC_DOCUMENT_POST
    for transaction FBS1. I am able to get the document No from this bapi.
    when I am pasing this doc no in BKPF table I find an entry against that but
    Reversal posting Date (STODT) and Reversal flag (XSTOV) is coming blank.
    I didn't find where to pass STODT in bapi?
    Or do I need to use any other function mod or BAPI by passing doc no.
    Thanks,
    Krishna

    Hi Krishna,
    hi, there is no BAPI for FBS1 and BAPI_ACC_DOCUMENT_POST does not do it despite having the reversal reason as a header segment field! helpful... I think not.
    The options are either BDC or RFBIBL00..
    I wrapped the standard BAPI and within this either called the standard BAPI or called BDC code if the posting was to be an FBS1.
    Thanks
    Saurabh

  • Bapi for F-02

    i am trying to upload the data for TCODE F-02 using BAPI_ACC_GL_POSTING_POST   &     BAPI_ACC_DOCUMENT_POST in this bapi's all the fields are not available.
    HEADER fields which i have to upload are BLDATA, BUDAT, BUKRS, BLART , XBLNR , BKTXT AND WAERS.
    ITEM fields which i have to upload are
    BSCHL,
    WRBTR,
    MWSKZ,
    ZTERM,
    ZFBDT,
    ZUONR,
    SGTXT,
    NEWKO ,
    KOSTL,
    PRCTR,
    PS_POSID,
    PERNR,
    AUFNR.
    when i try with BAPI_ACC_DOCUMENT_POST  ,  below fields are not available in BAPI .
    ZTERM ( payment term) ,                            
    ZFBDT  (bline date),
    PERNR ( personnel number).
    could you please suggest me , if the above  bapi's will work or not.
    is there any other bapi / function module availbale TCode F-02 with the above fields.including header and item fields.
    Please elaborately explain.

    hi ester,
    check out this weblog
    Re: BAPI FOR POSTING FBS1 TRANSACTION
    hope this will be helpful.
    regards,
    praba.

Maybe you are looking for

  • XML Template error

    Hi All, I am getting a warning on browser control while generating a project in XML Form Builder. The error says "Control must have a title, or a label must be connected to it". We are working on NW 2004s SR1. Can anyone have an idea about this warni

  • Font of text comes out different to my original MS Word fonts? Please Help!!

    When I create (print PDF) the text comes out in a different font to what I used on the MS Word document I PDF'd? My text in the word document was font "Academy" but when I made this a PDF the text is in another standard style font? How can I keep the

  • How to define a dynamic column to count the quarter of each year?

    Lets see the result that now displayed: YEARS MONTHS SUMMONTH SUMYEAR SUMQUARTER 2009 Jan      127994 1766166     449652 2009 Feb      168106 1766166     449652 2009 Mar      153552 1766166     449652 2009 Apr      160329 1766166     438913 2009 May 

  • Drill-down and how to change to the correct value in the dashboard title

    Good Morning, I have a problem on the presentational side, which some of you might have seen as well. My dashboard page looks like this: Dummy Prompt 1: YearFrom Dummy Prompt 2: YearTo Prompt 3: Item All three prompts have a presentation variable to

  • SAP XI in SOA

    HI, We have SAP R/3 4.7, SAP SRM4.0, SAP CRM4.0 and SAP BW-SEM4.0 in system landscape. The implementation is following SOA (Service Oriented Architecture). 1. There is CRM middleware is available to integrate CRM with SAP R/3. 2. SAP BW connector to