BAPI FOR POSTING FBS1 TRANSACTION

Hi,
Can any one help on How/which BAPI to user in posting doc using FBS1 transaction

hai pankaj,
here is the example code using the bapi 'BAPI_ACC_GL_POSTING_POST'
example:
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      = '18000000002002004'.
*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    = '1000'.
*documentheader-ac_doc_no
*documentheader-fisc_year    = '2005'.
documentheader-doc_date     = sy-datum.
documentheader-pstng_date   = sy-datum.
*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 = '0000160100'.
accountgl-comp_code = '1000'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type   = 'SA'.
accountgl-profit_ctr = '0000010000'.
append accountgl.
accountgl-itemno_acc = '2'.
accountgl-gl_account = '0000160100'.
accountgl-comp_code = '1000'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type   = 'SA'.
accountgl-profit_ctr = '0000010000'.
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 = 'GBP'.
currencyamount-amt_doccur = '100.00'.
append currencyamount.
currencyamount-itemno_acc = '2'.
currencyamount-currency = 'GBP'.
currencyamount-amt_doccur = '-100.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.
hope this may be helpful
regards,
praba.

Similar Messages

  • Are there any standard Idocs or Bapis for posting the data into transaction

    Hi,
    Are there any standard Idocs or Bapis for posting the data into transactions ME42N and IK11?
    Thank You.

    Thank you.
    Any idea of the other one?

  • BDC / Bapi For  Post Incoming Payment (F-28)

    Hi
    Im creating BDC for F-28. But it got error coming out.
    >> It says DB05B-PSZAH(02) is not an input field.
    What I do is: First, I search for Line Item then Document Number. Then It return to basic list. Then I loop again for the second Line Item Number and Document Number.
    I can activate the first amount but cannot for the next amount and so on.
    Anybody could help me on this??
    Is there any BAPI for Post Incoming Payment (F-28)?
    Thank you.
    Regards.

    i dont think there is a BAPI for this Transaction...
    i have done a BDC on F-28 myself....pasting the code....hope it helps you....
    *******NOTE********
    the parameter in the subroutine is to see if there is a single document or multiple documents being posted.
    FORM fill_bdc_data_f-28_9005 USING p_i_mult_doc TYPE c.
    **BDC from screen 9005
      DATA : l_amt_bdc(13), l_amt_bdc_remain(13), l_amt_bdc_mult(13),
             l_amt_bdc_mult_remain(13), l_assignment(14), l_period(2),
             l_amount(13).
      CLEAR t_bdcdata.
      REFRESH t_bdcdata.
      PERFORM bdc_dynpro USING 'SAPMF05A' '0103'.
      PERFORM bdc_field USING 'BDC_OKCODE' '=AB'.   "OK CODE - doc overview
    **get user default date format and pass date in that format
      PERFORM convert_date_to_user_format USING bkpf-bldat.
      PERFORM bdc_field USING 'BKPF-BLDAT' w_date.  "cheque date
      CLEAR w_date.
      PERFORM bdc_field USING 'BKPF-BLART' i_blart.  "doc type
      PERFORM bdc_field USING 'BKPF-BUKRS' i_bukrs.  "comp code
    **get user default date format and pass date in that format
      PERFORM convert_date_to_user_format USING bkpf-budat.
      PERFORM bdc_field USING 'BKPF-BUDAT' w_date.  "posting date
      CLEAR w_date.
      l_period = sy-datum+4(2).
      PERFORM bdc_field USING 'BKPF-MONAT' l_period. "period
      PERFORM bdc_field USING 'BKPF-WAERS' 'INR'.    "currency
      PERFORM bdc_field USING 'BKPF-BKTXT' i_bankl.  "doc. hdr. text
      PERFORM bdc_field USING 'BKPF-XBLNR' i_xblnr.  "Ref. Document No.
      PERFORM bdc_field USING 'BSEG-ZUONR' i_zuonr.  "Assignment(Depot Code)
      PERFORM bdc_field USING 'RF05A-KONTO' i_bank_gl. "Bank GL acc
      PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.  "Business Area
      l_amount = bseg-wrbtr.
      PERFORM bdc_field USING 'BSEG-WRBTR' l_amount. "Amount
      PERFORM bdc_field USING 'BSEG-PRCTR' ''.  "Profit Center
    **open items data
      PERFORM bdc_field USING 'RF05A-AGKOA' 'D'.     "Acc type (D=customers)
      PERFORM bdc_field USING 'RF05A-XNOPS' 'X'.     "Std OIs check box
    **end of first screen
    **document overview screen
      PERFORM bdc_dynpro USING 'SAPMF05A' '0700'.    "Overview Screen
      PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-AZEI1(01)'.     "cursor
      PERFORM bdc_field USING 'BDC_OKCODE' '/00'.     "OK CODE
      PERFORM bdc_field USING 'RF05A-NEWBS' '19'.    "posting key
      PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
      PERFORM bdc_field USING 'RF05A-NEWUM' 'B'.     "Spl GL Indicator
    **for single document selected
      CLEAR l_amt_bdc.
      IF p_i_mult_doc = ''.
    ***new screen - next line item
        PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
        PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
    **for single document, use the bouncing amount calculated earlier
        l_amt_bdc = w_amt_ant_bouncing.
        PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc. "amount
    **due date - same as posting date on screen
    **get user default date format and pass date in that format
        PERFORM convert_date_to_user_format USING bkpf-budat.
        PERFORM bdc_field USING 'BSEG-ZFBDT' w_date.  "due date
        CLEAR w_date.
    **assignment
        CLEAR l_assignment.
        CONCATENATE t_seldoc_ant_bouncing-belnr
                    t_seldoc_ant_bouncing-gjahr INTO l_assignment.
        PERFORM bdc_field USING 'BSEG-ZUONR' l_assignment. "assignment
        PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.
    **if there is some remaining amount, then go for another line item
        IF w_rem_amt_ant_bouncing > 0.
          PERFORM bdc_field USING 'RF05A-NEWBS' '15'.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
    **new screen
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-ZTERM'. "CURSOR
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE-ENTER
          l_amt_bdc_remain = w_rem_amt_ant_bouncing.
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'.
    **AGAIN
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'. "CURSOR
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE-SAVE
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'. "pmt term -hardcoded
          PERFORM bdc_field USING 'BSEG-SKFBT' l_amt_bdc_remain.
        ENDIF.
    **multiple documents
      ELSE.
    **initialize remaining amount to amt entered on screen
        l_amt_bdc_mult_remain = bseg-wrbtr.
        LOOP AT t_seldoc_ant_bouncing.
          IF l_amt_bdc_mult_remain > 0.
            IF bseg-wrbtr > t_seldoc_ant_bouncing-rem_amt.
              l_amt_bdc_mult = t_seldoc_ant_bouncing-rem_amt.
            ELSE.
              l_amt_bdc_mult = bseg-wrbtr.
            ENDIF.
    **remaining amt = screen amt - amt calculated above.
            l_amt_bdc_mult_remain = l_amt_bdc_mult_remain - l_amt_bdc_mult.
            PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
            PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
            PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_mult. "amount
            PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.  "Business Area
    **due date - same as posting date on screen
    **get user default date format and pass date in that format
            PERFORM convert_date_to_user_format USING bkpf-budat.
            PERFORM bdc_field USING 'BSEG-ZFBDT' w_date.  "due date
            CLEAR w_date.
    **assignment
            CLEAR l_assignment.
            CONCATENATE t_seldoc_ant_bouncing-belnr
                        t_seldoc_ant_bouncing-gjahr INTO l_assignment.
            PERFORM bdc_field USING 'BSEG-ZUONR' l_assignment. "assignment
    **posting key 19 for all but last document
            PERFORM bdc_field USING 'RF05A-NEWBS' '19'.    "posting key
            PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
            PERFORM bdc_field USING 'RF05A-NEWUM' 'B'.     "Spl GL
          ENDIF.
        ENDLOOP.
      ENDIF.
    **post remaining amount
      IF p_i_mult_doc = 'X'.
    **new screen if there is some amount left
        IF l_amt_bdc_mult_remain > 0.
    **posting key 15 with remaining amount
          PERFORM bdc_field USING 'RF05A-NEWBS' '15'.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
          PERFORM bdc_field USING 'RF05A-NEWUM' ''.     "Spl GL
    **new screen
          PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
          PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.    "OK CODE
          PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_mult_remain.
          PERFORM bdc_field USING 'BSEG-ZTERM' '0001'. "pmt term - hardcoded
        ELSE.
    **if no amount is left, no need for a further line item
          PERFORM bdc_field USING 'RF05A-NEWBS' ''.    "posting key
          PERFORM bdc_field USING 'RF05A-NEWKO' ''. "customer
          PERFORM bdc_field USING 'RF05A-NEWUM' ''.     "Spl GL
        ENDIF.
      ENDIF.
    **clear variables
      CLEAR : l_amount, l_assignment, l_amt_bdc,
              l_amt_bdc_remain,l_amt_bdc_mult, l_amt_bdc_mult_remain.
    ENDFORM.                    " fill_bdc_data_F-28_9005

  • BAPI for post held invoice ?

    Hi,
    Is there a BAPI for posting held invoices?
    I have to post held invoices in background....I hope there is other option, then CALL TRANSACTION.
    I'm on release R/3 4.70x200, but it seems for BUS2081/IncomingInvoice there is no relevant BAPI.
    Method Edit was also implemented via transaction MIR4.
    OSS note 381593 mention that batch input problems with invoice related transactions. MIR4 is only mentioned as keyword, however I might have problems with it later on.
    Any comment?
    Can anyone on higher release check if there is relevant BAPI for this?
    Thanks in advance,
    Peter

    Hi Peter,
    You can use the following addition in the fm MRM_PARKED_INVOICE_POST call..
    CALL FUNCTION 'MRM_PARKED_INVOICE_POST'
    EXCEPTIONS
      error_message = 1.
    IF sy-subrc NE 0.
    ****Use syst message variables here..
    ENDIF.
    This will catch the error messages that terminate the process..
    Hope this helps..
    Sri

  • Function modules or BAPI for posting plan costs for WBS Element

    Hi all,
    Does anyone know, whether there exists a function module or BAPI for posting plan costs to a WBS Element? K_COSTS_PLAN_PS does not work, because RKP1 is not allowed.
    Greetings

    check
    BAPI_COSTACTPLN_POSTACTINPUT   Activity Input Planning: Posting                
    BAPI_COSTACTPLN_POSTACTOUTPUT  Activity/Price Planning: Posting                
    BAPI_COSTACTPLN_POSTKEYFIGURE  Stat. Key Figure Planning: Postings             
    BAPI_COSTACTPLN_POSTPRIMCOST   Primary Cost Planning: Postings                 
    BAPI_PDTRANSCO_POSTPRIMCOST    Transfer of Planning Data: Post Primary Costs   
    K40C                           CO Actual Postings, Manual                      
    BAPI_ACC_PRIMARY_COSTS_POST    Accounting: Post Primary Costs                  
    BAPI_COPAACTUALS_POSTCOSTDATA  BAPI Operating Concern: Post Costing-Based Actua
    BAPI_PRIM_COST_CHECK_AND_POST  Primary Costs: Formal Parameter Check           
    S@meer

  • Bapi for posting IR line item at a time

    Hi....
    Do we have a bapi for posting invoive receipt line item wise instead of posting the PO at a time......this wud be more precise for my requirement.....presently i'm using bapi_acc_document_post but this wud clear the document with single document number.....but i want it to be posted line item wise to see the amount individually item wise instead of combined one....similar to what we have in the IR which shows amount of individual items........

    This is an old bug that keeps popping up:
    https://forums.lenovo.com/t5/T400-T500-and-newer-T-series/Vertical-scrolling-got-reset-everytime-I-use-Ultra-Nav-to-scroll/td-p/343477

  • Bapi for posting Outbound Delivery

    Hi,
    Can anyone please let me know about bapi for posting goods issue of outbound delivery.I have checked bapi like
    BAPI_OUTB_DELIVERY_CONFIRM_DEC
    If i use the with this bapi i can't cancellation the outbound with vl09.
    thanks,

    hi,
    i try to doing posting goods issue for outbound delivery out fo the regular progression.
    the posting is automaticly as part of outside program.
    thanks alot,

  • Function Module/BAPI for posting of Parked Invoice/Documnet

    Dear all,
    Please provide me.
    Function Module/BAPI for posting of Parked Invoice/Documnet
    Regards
    Ricky

    Hi Ricky,
    What about MR_POST_PP_INVOICE?
    In my current project, though, we had to develop a function module for this.
    Regards,
    Eli

  • BAPI for post Tax Amount

    Hi,
    Please tell me BAPI for post Tax Amount.
    Which tcode use for Post tax code, is it FB01 or FB60.
    Regards
    Jana

    Hi,
    Use BAPI_ACC_DOCUMENT_POST
    TCodes
    FB41    Post Tax Payable
    FB05    Post with Clearing
    FB01    Post Document
    Edited by: Neenu Jose on Nov 18, 2008 1:15 PM
    Edited by: Neenu Jose on Nov 18, 2008 1:16 PM
    Edited by: Neenu Jose on Nov 18, 2008 1:17 PM
    Edited by: Neenu Jose on Nov 18, 2008 1:18 PM

  • ECC 5.0 BAPI for posting documents only in non-leading ledger

    Hello,
    for an FI-interface i want to call an BAPI for posting the documents. The document were posted to the leading ledger and to the non-leading ledger by usage of BAPI_ACC_DOCUMENT_POST.
    Now there are cases to post documents only to the non-leading ledger.
    Is there anywhere a possibility to tell the BAPI (e.g. enter the ledger group) only to post to the non-leading ledger or is another BAPI available to do so.
    Thank you for your help.
    Thomas

    Hi Thomas,
    You can use the same BAPI for any type of ledger postings. You can restrict your postings to Type of ledger.
    Cheers
    Srinivas

  • BAPI for posting outbound delivery (VL01n)

    Hi,
    I need some help in finding correct function module or BAPI for posting outbound delivery (VL01n), the requirement is I need delivery created with reference to sales order and must take following input.
    1. Shipping Point
    2. Sales Order
    3. Selection Date
    4. Delivery type
    I tried some existing ones and some do not have delivery type input and some without Shipping Point input.
    Please let me know.
    Regards
    Ram.

    Hi
    Please avoid the duplicate post .It is not as per the Forum rules.
    You have posted the same question with this title in ABAP General Forum:
    Outbound Delivery BAPI/Function module
    Neha

  • BAPI for Posting through FBS1 with reversal reason & reversal Date

    All Experts,
    Can I use BAPI_ACC_DOCUMENT_POST for posting in FBS1 with reversal reason & reversal date? I can't find such option in the BAPI. If not, can you suggest other BAPI that I can use to perform posting with reversal reason & reversal date?
    Thanks in advance.
    Regards,
    Azad.

    You need to use RFBIBL00, create a file to be consumed by it and it will create a session variable that can be run by SM35

  • Bapi for posting HR timesheets

    Hi Guru's,
    I looked with transaction BAPI and could not find it.
    Which bapi can I use for posting HR timesheets?
    Thank you all.
    Best regards,
    Ravi.

    To add entries in timesheet
    BAPI_CATIMESHEETMGR_INSERT
    BAPI_CATIMESHEETMGR_*
    To do the FI Postings:
    WBS, Project, Cost center Posting
    BAPI_ACC_ACTIVITY_ALLOC_POST
    Network Activity Posting
    BAPI_NETWORK_CONF_ADD

  • BAPI for posting a new HR POSITION

    Hi is there any BAPI to post a new position.

    Hey Shiv,
    As far as I know there is no BAPI for that but what you can do is to run a BDC for transaction "PO13" to create a position. To capture the object ID you can query the table "HRP1000" with criteria as the object type = 'S' (this is for position) and the UNAME as the guy who ran the BDC. You can get the latest position that was created by the user.
    Regards,
    Sudhi

  • Bapi for posting FI documents for new General ledger accounting

    Hi,
    We have a requirement for posting FI documents for new General ledger i.e for transaction FB01L. Is there any BAPI for the same so that BDC can be avoided.
    The BAPI "BAPI_ACC_DOCUMENT_POST" is used for FB01. Can we use it for FB01L?? As in this BAPI ledger group field is not there. Please suggest.
    Thanks in advance.
    Regards,
    Gaurav

    Hi Sandra,
    Solved myself using the below options.
    If you are using the BAPI - BAPI_ACC_GL_POSTING_POST, you can pass accounting principle field in importing structure BAPIACHE08. The relation between Legder group & accounting principle has to be configured in SPRO by FICO consultant. Once they configured in the system, get the accounting principles and then pass the accounting principle .
    Code:  s_documentheader-acc_principle  = wa_header-acc_principle.
    Reward me if this will help you.
    Thanks,
    Yerukala Setty

Maybe you are looking for

  • Upgrading to 1.1.4 and iTouch error (6)

    I tried to upgrade from 1.1.3 to 1.1.4 and I received an error "An unknown error occured (6). Clicking "OK" and I got a 2nd message indicating that "iTunes has detecting an iPod in recovery mode. You must Restore..." The display shows a connector wit

  • Issue with the fan and laptop gets heated up

    Hi  can someone help me with the issue, my laptop gets heated up and after sometime it makes sound and it shuts down after half an hour of use. when i went to service center they said fan needs to b replaced. when i checked it online there are many f

  • What scenarios Multiproviders don't work fine

    In what scenarios the multiprovider will not work fine from the modeling perspective? Sourav

  • Mouse right-click doesn't work while clicking on files in folders

    Hi there, I have an iMac 8,1 with 10.6.8 OS. Mouse is a Logitech M-BZ105A connected via USB. About a week ago, I've noticed weird problem with my mouse: nothing happens when I right-click on files in folders. Nothing shows up. - left-click works (it'

  • Importing tracks from non-I Tune libraries into I Tunes

    I am a recent convert to the world of Ipod, having previously used other mp3 players like Zen Creative and an old Panasonic that operated off Real Player & Real Jukebox software. I would now like to import my old music collection into I-Tunes, but am