Refernce key in bapi_acc_document_post

hi all,
can ne 1 help me to understand the reference key in bapi 'bapi_acc_document_post'.
it's concatenation of
1.document number
2.company code
3.fiscal year
please suggest me, how to get the document number.
thanx in advance
Manish

Hi,
The one that is concatenation of Doc No, Comp Code, and Fisc Yr is Object Key, not Reference Key.
There are 2 ways to get the document number.
1. Get it from Object Key
DATA l_belnr TYPE bkpf-belnr.
l_belnr = obj_key+0(10).
2. or get it from BAPI return table
DATA lwa_return TYPE bapiret2.
READ TABLE lit_return
INTO lwa_return
WHERE type = 'S'.
IF sy-subrc EQ 0.
l_belnr = lwa_return-message_v1.
ENDIF.
Regards,
Teddy Kurniawan

Similar Messages

  • Posting Key in BAPI_ACC_DOCUMENT_POST

    Hi,
    I am using bapi 'BAPI_ACC_DOCUMENT_POST' to post 'Customer Document'  in FB01. I was able to post the document but Posting Key in the document is not as desired. When I try to Post the document with out any Posting Key by default I am having Posting Key as '01'(Customer document) and '50'(GL account).
    But I want bapi  'BAPI_ACC_DOCUMENT_POST' to post a document with Posting key '15'(Customer Document) and '40'(GL account).
    In bapi I am using these tables along with header.
    ACCOUNTGL- GL Account
    ACCOUNTRECEIVABLE- Customer Document
    I tried passing the posting key in ACCT_TYPE in table ACCOUNTGL and passing the the posting key using EXTENSION2 table but was not successful .  
    Can anyone let me know
    How can I pass the Posting Key to the bapi 'BAPI_ACC_DOCUMENT_POST' for Customer Document and GL account?
    OR
    How can I use EXTENSION2 table to create an appropriate posting key?
    please let me know.
    Vikki,
    In one of your thread you came across the same issue and you solved it. Can you please guide me how to achive appropriate posting key using EXTENSION2 table?
    Thanks,
    Vijay.

    Hi,
    Just follow these steps:
    1. Fill in your EXTENSION table like this
    first 3 character represent item number
    next 2 character represent posting key
      CLEAR: gt_extension.
      gt_extension(3)    = sy-index(3).
      gt_extension+3(2) = 'New Posting Key'.
      APPEND gt_extension.
    2. Create an FM similar to SAMPLE_INTERFACE_RWBAPI01 and put the following codes:
    IF NOT extension IS INITIAL.
      LOOP AT extension.
        READ TABLE it_accit WITH KEY posnr = extension(3).
        IF sy-subrc IS INITIAL.
          it_accit-bschl = extension+3(2).
          MODIFY it_accit INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
    ENDIF.
    3.
    -  Go to TCode "FIBF".
    -  Go to Settings -> Products -> ... of a customer
    -  Create a new entry and check the box to activate the product
    Product = <any name>
    Text = <description>
    RFC = blank
    Check the activation box
    -  Go to Settings -> Process Modules -> ... of a customer
    -  Create a new entry by specifying the name of the function module name and product name created earlier.
    Process = RWBAPI01
    Ctr = blank
    Appl = blank
    FM = <FM created>
    Product = <name of product created earlier>
    Hope this helps,
    Leonard Chomi.

  • Field Posting Key in BAPI_ACC_DOCUMENT_POST ?

    Hi
    I need to post documents like FB01 , i'm already using BAPI_ACC_DOCUMENT_POST  and it works so i can now create documents with the header and itmes positions  , filling the tables header, accountreceivable items and currency items.
    I already found the most of fields for execute the BAPI and create the documents, but i can not find three fields, some of one (BSCHL) the most important:
    Posting Key (BSCHL)
    Special G/L Indicator  (NEWUM)
    Calculate Tax Automatically (XMWST) .
    I think but i'm not sure  the Posting Key (BSCHL) is placed in the EXTENSION2 table, but this table ask for some STRUCTURE name and i don't know what should i place in this field or how fill this parameter table.
    Does somebody can help me  about where can i place these 3 fields in the BAPI or where can i find help documentation for do this ?
    Regards
    Frank

    Frank,
    you should use the Extension2 structure for passing the Posting Keys and you should implement the BADI for posting the documents with the Keys what you have supplied.
    The Enhancement Spots are BADI_ACC_DOCUMENT and IF_EX_ACC_DOCUMENT.
    I've used the BADI_ACC_DOCUMENT and now i'm able to post the documents using the keys which i've supplied to the BAPI.
    Otherwise the BAPI is going to decide the posting keys based on tha amount .
    Hope this will help you.
    Thanks,
    Adi.

  • How to fill the reference key in BAPI_ACC_DOCUMENT_POST

    Hi,
      Currently iam uploading data for FB01 transaction using BAPI_ACC_DOCUMENT_POST. I want to fill the Reference key of header as input. Please let me know the data which we have to fill the input fields.
    Thanks in advance,
    Regards,
    Krishna..

    BAPI_ACC_DOCUMENT_POST having error message RW 609

  • Link to find Accounting document number from Material document number / PO

    Hi
    We are working on a custom report, in which we need to print purchasing details (from EKPO, EKKO & EKBE) as well as accounting details (from BSEG & BKPF). We need to hit BKPF/BSEG with the accounting document number, since it is the only key field (though PO number is there in BKPF, we can not use this because it is not a key field)
    My question from which table we get the accounting document number ? We need to provide a link between purchasing & accounting through accounting document number, but how to find the accounting document number. ?
    Thanks
    Venkat.

    Venkat,
      I guess you are trying to fetch Accouting Documents for goods receipt against PO.
      To do this, you need to look at the PO History table (EKBE) and find out the Corresponding material document (VGABE = 1 for good receipt).
      Get the value of BELNR and GJAHR.
      Concatenate BELNR and GJAHR into your refernce key (like BKPF-AWKEY).
      Then use this key to read table BKPF with the following key
       AWTYP = 'MKPF' for Material document
       AWKEY = reference key generated above.
       AWSYS = the value of the logical system (if used) or blanks
    This will get you quicker access as compared to what you've described below. In this case, the system uses a standard SAP Index "Index by application type and key" to fetch the relevant records.
    Hope this helps.

  • Function module - post new G/L document

    What function module can I use to post a new document in FI?
    BR.

    Hi,
    Please refer to the link below and see if it helps
    Re: Posting Key in BAPI_ACC_DOCUMENT_POST
    Regards
    K.R

  • Problem in using Currency Field in EXTRACTOR

    hello,
            I have a requirement to create Extractor involving some fields from a Ztable.
    While creating extractor (data source) in RSO2 transaction, when i enter the Z table name in "Extraction from DB view - View/Table" and click on SAVE, i get an error msg " Invalid extract structure template ZTABLE of DataSource Zextractor".
    But if i remove the only currency field in the ztable and then try using the ztable for extractor, its working fine. I dunno why? but i need the currency field in the extractor. Kindly let me know how to deal with this issue. Sure points for useful answers.
    thx,
    BaLaJi.......

    hi,
    for currency fields and decimal fields u should provide reference for them. give currency field in fields section -> click on refernce -> give
    currency field name table name refernce key name table name -> save n activate.
    if helpful reward some points.
    with regards,
    Suresh.A

  • Enhance FI_AR_4  BI datasource

    Dear Friends
    i have a doubts on  0fi_AR_4 is only avilable for the ODS it is not there for Cube . do we need to generate the datasource seprately for Cube.
    I would like to enhance the datasourcce 0FI_AR_4 . these  are all the feilds i want to add to the datsource . as below. can you all help  me how to Enhance.  please send me step by step so does not .extraction adding the feilds .look forward
    to your reply.ASAP.forward
    Order no                     VBRP      AUFNR                   
    Profit center      VBRP     PRCTR
    FNR
    Sales document      VBRP     AUBEL
    Local currency      BKPF     HWAER
    Exchnage rate      BKPF     KURSF
    Document no     BKPF     BELNR
    Refernce key      BKPF     AWKEY
    Billing Type     VBRK     FKART
    Payment key      VBRK     ZTERM
    Cancelled     VBRK     FKSTO
    DR/CR factor     TCURF     TFACT
    Refernce no.      PRPS     POSID
    WBS Element     PRPS     PSPNR
    Salesman no.      VBPA     PERNR
    Debit credit indicator      BSEG     SHKZG
    Due days      BSEG     DMBTR
    Gross margin      BSEG     DMBTR

    The procedure for customer exits is described in OSS note 410799

  • Make field MDMA-DISGR (MRP Group, MRP Area) mandatory in material master

    We are using MRP Area (Storage location) and I want to make MRO Group (MDMA-DISGR) mandatory. It is not in the list of fields (IMG > Logistics) to where field selection for material masters is set.
    Am I missing something -- or can this field not be made mandatory?
    Thanks

    Hi
    MRP group(MARC-DISGR) is maintained under selection group 51 (Transaction code - OMSR)
    You can miantain the selection in Tcode OMS9 based on the filed refernce key using for the material type.
    i am not sure is this you are looking for.
    Thanks & Regards
    Kishore

  • FB70: How t o modify the value of BSEG-XREF before posting?

    Hi ABAP Gurus,
    Good day!
    I would like to know the correct way to modify the value of BSEG-XREF1 in FB70 (Prior to posting of document).
    Currently, I have tried using substitution. First, I copied RGGBS000 into ZRGGBS000 AND added form u300, which will modify BSEG-XREF1.  Second, I have added a step to an already existing substitution (COGS), which was set-up in transaction OBBH.  I have assigned u300 to BSEG-XREF1 (Refernce Key 1).
    The said step didn;t seem to work.  I was able to post a document and then I displayed the document.  Unfortuantely, BSEG-XREF1 hasn't been modified. So,  I tried debugging the form U300.  It doesn't stop inside that form, which means the logic that i put there was useless. By the way, the the formname that Im using can be found in two internal tables: (1) exits, and (2) etab.
    Kindly advise on what to do.   Thank you very much!
    <b>Best Regards.
    Brando</b>

    Check this sample code which i've used to substitute the field BSEG-ZUONR
    Also ensure that the callup point in <b>OBBH</b> is 2
    Don't forget to attach ur <b>ZRGGBS000</b> to the application area <b>GBLS</b> in the tcode <b>GCX2</b>
    FORM get_exit_titles TABLES etab.
      DATA: BEGIN OF exits OCCURS 50,
              name(5)   TYPE c,
              param     LIKE c_exit_param_none,
              title(60) TYPE c,
            END OF exits.
      exits-name  = 'U102'.
      exits-param = c_exit_param_field.
      exits-title = text-101.           " Ship-to-Party to Assignment field
      APPEND exits.
      REFRESH etab.
      LOOP AT exits.
        etab = exits.
        APPEND etab.
      ENDLOOP.
    ENDFORM.                    "GET_EXIT_TITLES
    FORM u102 USING zuonr TYPE bseg-zuonr.
      bseg-zuonr = <value>.
    ENDFORM.

  • Country of Origin - MARC HERKL

    Hi Gurus
    I am not able to locate the field country of origin( MARC - HERKL)  in material master
    can you pl let me know which view of Material master it will have....

    Hi
    Thsi field is availble in the Purcahsing view of the material master
    If you donot find it there , if oreign trade is activated the filed is moved to that view
    First check if thsi fiel dis activated for Entry for the material type field refernce Key.
    You can check the same in OMS9.
    Thanks & Regards
    Kishore

  • BAPI FUNCTION MODULE  BAPI_ACC_DOCUMENT_POST : How to give posting keys?

    Hi ,
    i am using BAPI_ACC_DOCUMENT_POST to post accounting document. This accounting document is used to post amount from reconcilation account to bank GL account.the table parameter am using is ACCOUNTGL (in the function module)Now i want to give posting keys to the function module parameter. can anyone please guide me how to give posting keys?
    Edited by: Santhosh Kumar  Cheekoti on Dec 18, 2008 7:48 AM

    Hi,
    As pointed out in one of the previous post, posting key will be decided by the BAPI depending on the sign of the amount. Have a look at bthe following code:-
    DATA: doc_header LIKE BAPIACHE09,
          criteria   LIKE BAPIACKEC9 OCCURS 0 WITH HEADER LINE,
          doc_item   LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
          doc_ar     LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,
          doc_values LIKE BAPIACCR09 OCCURS 0 WITH HEADER LINE,
          return     LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
          extension1 like BAPIACEXTC occurs 0 with header line,
          obj_type   LIKE bapiache08-obj_type,
          obj_key    LIKE bapiache02-obj_key,
          obj_sys    LIKE bapiache02-obj_sys,
          docnum     LIKE bkpf-belnr.
    *DATA:
    *       ITEMNO_ACC     POSNR_ACC
    *       FIELDNAME     FIELDNAME
    *       CHARACTER     ACPI_RKE_CRIGEN
    * Fill Document Header
    doc_header-bus_act = 'RFBU'.
    doc_header-bus_act = 'RMRP'.
    *doc_header-bus_act = 'SD00'.
    doc_header-username = sy-uname.
    doc_header-header_txt = 'TEST BOC BAPI POSTING'.
    doc_header-comp_code = 'IN10'.
    doc_header-compo_acc = 'FICA'.
    doc_header-doc_date = '20060127'.
    doc_header-pstng_date = sy-datlo.
    doc_header-doc_type = 'SA'.
    ** Fill Line 1 of Document Item
    *doc_item-itemno_acc = '1'.
    *doc_item-gl_account = '0000500001'.
    *doc_item-pstng_date = sy-datum.
    *doc_item-item_text = 'TEST POSTING DEBIT ITEM'.
    *doc_item-costcenter = ''.
    *doc_item-quantity = '1'.
    *doc_item-base_uom = 'ST'.
    *APPEND doc_item.
    *CLEAR doc_item.
    ** Fill Line 2 of Document Item
    *doc_item-itemno_acc = '2'.
    *doc_item-customer = '0000000016'.
    *doc_item-gl_account = '0000000016'.
    *doc_item-pstng_date = sy-datlo.
    *doc_item-item_text = 'TEST POSTING CREDIT ITEM'.
    *APPEND doc_item.
    *CLEAR doc_item.
    doc_ar-itemno_acc = '1'.
    doc_ar-gl_account = '0000500001'.
    doc_ar-pstng_date = sy-datum.
    doc_ar-item_text = 'TEST POSTING DEBIT ITEM'.
    doc_ar-costcenter = ''.
    doc_ar-quantity = '1'.
    doc_ar-base_uom = 'ST'.
    APPEND doc_ar.
    CLEAR doc_ar.
    * Fill Line 2 of Document Item
    doc_ar-itemno_acc = '2'.
    doc_ar-customer = '0000000016'.
    doc_ar-gl_account = '0000000016'.
    doc_ar-pstng_date = sy-datlo.
    doc_ar-item_text = 'TEST POSTING CREDIT ITEM'.
    doc_ar-stat_con = ' '.
    doc_ar-costcenter = '0000201681'.
    APPEND doc_ar.
    CLEAR doc_ar.
    * Fill Line 1 of Document Value.
    doc_values-itemno_acc = '1'.
    doc_values-currency_iso = 'INR'.
    doc_values-amt_doccur = '200.00'.
    doc_values-currency = 'INR'.
    doc_values-CURR_TYPE = '00'.  "Doc currency
    APPEND doc_values.
    CLEAR doc_values.
    * Fill Line 2 of Document Value
    doc_values-itemno_acc = '2'.
    doc_values-currency_iso = 'INR'.
    doc_values-amt_doccur = '200.00-'.
    doc_values-currency = 'INR'.
    doc_values-curr_type = '00'.  "Doc currency
    APPEND doc_values.
    CLEAR doc_values.
    * Add tax code in extension1 table.
    extension1-field1 = 'BAPI CALL'.
    APPEND EXTENSION1.
    * Fill CRITERIA for CO-PA
    *refresh criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'ARTNR'.
    *criteria-CHARACTER     = '000000000001312251'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'WERKS'.
    *criteria-CHARACTER     = 'IN91'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'KNDNR'.
    *criteria-CHARACTER     = '0000000016'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'FKART'.
    *criteria-CHARACTER     = 'ZIN2'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'KAUFN'.
    *criteria-CHARACTER     = '0000000633'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'KDPOS'.
    *criteria-CHARACTER     = '000010'.
    *Append criteria.
    *criteria-ITEMNO_ACC = '1'.
    *criteria-FIELDNAME     = 'VKGRP'.
    *criteria-CHARACTER     = '009'.
    **Append criteria.
    * All tables filled - now call BAPI.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
      EXPORTING
        documentheader       = doc_header
      IMPORTING
        OBJ_TYPE             = doc_header-obj_type
        OBJ_KEY              = doc_header-obj_key
        OBJ_SYS              = doc_header-obj_sys
      TABLES
    *    criteria             = criteria
        accountgl            = doc_item
        ACCOUNTRECEIVABLE    = doc_ar
        currencyamount       = doc_values
        return               = return
        EXTENSION1           = EXTENSION1.
    LOOP AT return WHERE type = 'E'.
      EXIT.
    ENDLOOP.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
      EXPORTING
        documentheader       = doc_header
      IMPORTING
        OBJ_TYPE             = doc_header-obj_type
        OBJ_KEY              = doc_header-obj_key
        OBJ_SYS              = doc_header-obj_sys
      TABLES
    *    criteria             = criteria
        accountgl            = doc_item
        currencyamount       = doc_values
        return               = return
        EXTENSION1           = EXTENSION1.
    LOOP AT return WHERE type = 'E'.
      EXIT.
    ENDLOOP.
    IF sy-subrc EQ 0.
      WRITE: / 'BAPI call failed - debug and fix!'.
    ELSE.
      CLEAR return.
      REFRESH return.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    * EXPORTING
    *   WAIT          =
       IMPORTING
         return        = return.
      WRITE: / 'BAPI call worked!!'.
      WRITE: / doc_header-obj_key, ' posted'.
    ENDIF.
    Regards
    Raju Chitale
    Edited by: Raju Chitale on Dec 18, 2008 8:31 AM

  • Error when using BAPI_ACC_DOCUMENT_POST...

    [code]
    Hello Experts,
    Iam using the said BAPI for the first time and I am not sure if I filled up the
    fields correctly. What I want to do is to post multiple debit entries(40) and a
    special G/L entry for vendor(posting key 39). I also need to generate the tax and
    withholding tax. So my entries will be like:
    40 -->amount = 1,120(This value has a VAT included which is 12% or 120)
    39 -->amount = 1,120(Special G/L for vendor)
    For these 2 entries below, they must be generated automatically.
    40 -->amount = 120(Tax)
    50 -->amount = 20(This is the EWT or withholding tax)
    Below is my code:
    wa_documentheader-obj_type = 'BKPFF'.
    CONCATENATE sy-sysid sy-mandt INTO wa_documentheader-obj_sys.
    wa_documentheader-obj_key = '$'.
      wa_documentheader-username = sy-uname.
      wa_documentheader-comp_code = '1000'.
      wa_documentheader-bus_act = 'RFBU'.
      wa_documentheader-header_txt = 'AVH Testing...'.
      wa_documentheader-fisc_year = '2007'.
      wa_documentheader-doc_date = sy-datum.
      wa_documentheader-pstng_date = sy-datum.
      wa_documentheader-fis_period = '11'.
      wa_documentheader-doc_type = 'S3'.
      CLEAR wa_accountpayable.
      wa_accountpayable-itemno_acc = 1.
      wa_accountpayable-vendor_no  = '2000000058'.
      wa_accountpayable-sp_gl_ind  = 'V'.
      wa_accountpayable-tax_code   = 'DI'.
      APPEND wa_accountpayable TO it_accountpayable.
      CLEAR: wa_accountgl.
      wa_accountgl-itemno_acc = 2.
      wa_accountgl-gl_account = '0060000061'.
      wa_accountgl-item_text = 'Aris' .
      wa_accountgl-DE_CRE_IND = 'S'.
      wa_accountgl-tax_code  = 'DI'.
      wa_accountgl-comp_code = '1000'.
      wa_accountgl-fisc_year = '2007'.
      wa_accountgl-fis_period = '11'.
      wa_accountgl-pstng_date = sy-datum.
      wa_accountgl-doc_type = 'S3'.
      INSERT wa_accountgl INTO TABLE it_accountgl.
      CLEAR wa_accounttax.
      wa_accounttax-itemno_acc = 3.
      wa_accounttax-tax_code = 'DI'.
      wa_accounttax-gl_account = '0010018291'.
      wa_accounttax-acct_key = 'VST'.
      APPEND wa_accounttax TO it_accounttax.
      CLEAR: wa_currency.
      wa_currency-itemno_acc = 1.
      wa_currency-currency = 'PHP'.
      wa_currency-curr_type = '00'.
      wa_currency-amt_doccur = 1120.
      wa_currency-amt_base = 1000.
    wa_currency-exch_rate = 1.
      APPEND wa_currency TO it_currency.
      CLEAR: wa_currency.
      wa_currency-itemno_acc = 2.
      wa_currency-currency = 'PHP'.
      wa_currency-curr_type = '00'.
      wa_currency-amt_doccur = 1120.
      wa_currency-amt_base = 1000.
    wa_currency-exch_rate = 1.
      APPEND wa_currency TO it_currency.
      CLEAR: wa_currency.
      wa_currency-itemno_acc = 3.
      wa_currency-currency = 'PHP'.
      wa_currency-curr_type = '00'.
      wa_currency-amt_doccur = 120.
    wa_currency-amt_base = 120.
    wa_currency-exch_rate = 1.
      APPEND wa_currency TO it_currency.
    Post
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
        EXPORTING
          documentheader = wa_documentheader
        IMPORTING
          obj_type       = obj_type
          obj_key        = obj_key
          obj_sys        = obj_sys
        TABLES
          accountgl      = it_accountgl
          currencyamount = it_currency
          return         = it_return.
      LOOP AT it_return INTO wa_return.
        WRITE : /1 wa_return-message.
      ENDLOOP.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait   = 'X'
        IMPORTING
          return = wa_return3.
    When I checked the return table there are 2 problems that says:
    1. Error in document: BKPFF $ ED1CLNT140
    2. Balance in transaction currency
    Hope you can help me guys. Simple examples will be appreciated. Thank you and take care!
    [/code]

    <u>you can check the code.</u>
    IF NOT wa_data-lifnr  IS INITIAL.
          ADD 1 TO g_lino.
          x_vendoritem-itemno_acc        = g_lino.
          x_vendoritem-vendor_no         = wa_data-lifnr.
          IF wa_data-newbk IS INITIAL.
            x_vendoritem-comp_code = wa_data-bukrs.
          ELSE.
            x_vendoritem-comp_code = wa_data-newbk.
          ENDIF.
          x_vendoritem-comp_code         = t001-bukrs.
          x_vendoritem-item_text         = wa_data-csgtxt.
          x_vendoritem-pmnttrms          = wa_data-pyterm.
          x_vendoritem-bline_date        = wa_data-bldate.
          x_vendoritem-pymt_meth         = wa_data-zlsch.
          x_vendoritem-alloc_nmbr        = wa_data-zuonr.
          x_vendoritem-tax_code          = wa_data-mwskz.
          x_vendoritem-taxjurcode        = wa_data-txjcd.
          APPEND x_vendoritem TO it_vendoritem.
          x_currencyamount-itemno_acc    = g_lino.
          x_currencyamount-curr_type     = c_ct1.
          x_currencyamount-currency      = t001-waers.
          x_currencyamount-amt_doccur    = wa_data-cwrbtr.
          APPEND x_currencyamount TO it_currencyamount.
          x_currencyamount-curr_type     = c_ct2.
          APPEND x_currencyamount TO it_currencyamount.
          IF t001-land1 = c_lnd.
            x_currencyamount-curr_type   = c_ct3.
            APPEND x_currencyamount TO it_currencyamount.
          ENDIF.
        ENDIF.
        IF NOT wa_data-dsaknr IS INITIAL.
          CLEAR:
            x_accountgl,
            x_currencyamount,
            x_vendoritem.
          ADD 1 TO g_lino.
          x_accountgl-itemno_acc         = g_lino.
          x_accountgl-doc_type           = x_doc_hdr-doc_type.
          IF wa_data-newbk IS INITIAL.
            x_accountgl-comp_code = wa_data-bukrs.
          ELSE.
            x_accountgl-comp_code = wa_data-newbk.
          ENDIF.
          x_accountgl-gl_account         = wa_data-dsaknr.
          x_accountgl-costcenter         = wa_data-dkostl.
          x_accountgl-item_text          = wa_data-dsgtxt.
          x_accountgl-orderid            = wa_data-daufnr.
          x_accountgl-wbs_element        = wa_data-dwbs.
          x_accountgl-pstng_date         = p_pdate.
          x_accountgl-vendor_no          = wa_data-lifnr .
          x_accountgl-alloc_nmbr         = wa_data-zuonr.
          x_accountgl-tax_code           = wa_data-mwskz.
          x_accountgl-taxjurcode         = wa_data-txjcd.
          APPEND x_accountgl TO it_accountgl.
          x_currencyamount-itemno_acc    = g_lino.
          x_currencyamount-curr_type     = c_ct1.
          x_currencyamount-currency      = t001-waers.
          x_currencyamount-amt_doccur    = - wa_data-dwrbtr.
          APPEND x_currencyamount TO it_currencyamount.
          x_currencyamount-curr_type     = c_ct2.
          APPEND x_currencyamount TO it_currencyamount.
          IF t001-land1 = c_lnd.
            x_currencyamount-curr_type     = c_ct3.
            APPEND x_currencyamount TO it_currencyamount.
          ENDIF.
        ENDIF.
    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'                   
        EXPORTING
          documentheader = x_doc_hdr
        TABLES
          accountgl      = it_accountgl
          accountpayable = it_vendoritem
          currencyamount = it_currencyamount
          return         = it_return.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    Reward if helpful.

  • Problem in G/L posting using BAPI_ACC_DOCUMENT_POST

    Hi all,
    I have one requirement in interface, using BAPI. Uploading the flat file USING BAPI (BAPI_ACC_DOCUMENT_POST)
    my flat file is available given below.
    sl.no
    Document Date
    Document Type
    Company Code
    Posting date
    Period
    Currency
    Reference
    Doc Header Text
    Line Item 1
    Account
    Amount
    Cost Centre
    Profit Centre
    Text
    1
    08/21/2014
    SA
    1000
    08/21/2014
    09
    CUR
    TEST
    TEST
    1
    100
    500.00
    0001
    Test
    1
    CUR
    2
    200
    -500.00
    0001
    Test
    2
    08/21/2014
    SA
    1000
    08/21/2014
    09
    CUR
    TEST
    TEST
    1
    100
    500.00
    0002
    Test
    2
    CUR
    2
    200
    -100.00
    0002
    Test
    2
    CUR
    3
    200
    -100.00
    0002
    Test
    2
    CUR
    4
    200
    -100.00
    0002
    Test
    2
    CUR
    5
    200
    -100.00
    0002
    Test
    2
    CUR
    6
    200
    -100.00
    0002
    Test
    actually my requirement is , first time uploaded my data in ECC using BAPI (BAPI_ACC_DOCUMENT_POST). DOCUMENT no is created in BKPF table. again i've uploaded to same data using bapi.. again document no is created . but i don't need create document no in bkpf( when i'll upload 2nd time or more) in this case, i want to display error message 'this flat file already used'.
    please give the solution fo this requirement. it's very urgent.

    Hi
    The main parameters of BAPI BAPI_ACC_DOCUMENT_POST are:
    - DOCUMENTHEADER (BAPIACHE09) to transfer the header data
    - ACCOUNTGL (BAPIACGL09) to transfer the g/l item data
    - ACCOUNTRECEIVABLE (BAPIACAR09) to transfer the  customer item data
    - ACCOUNTPAYABLE (BAPIACAP09) to transfer the vendor item data
    So u need to use one of parameters above to transfer the header and item data, the amount data for every item have to be transfered by parameters CURRENCYAMOUNT
    U should also considere the posting key is automatically set by BAPI, and it depends on the item type and the sign of amount:
    - 40/50 for G/l
    - 01/11 for customer
    - 21/31 for vendor
    1 40 617300     Mileage              0000310148                            310148               27.20
    2 40 617900     Entertainment Exp.   0000310148                         V1 310148              177.26
    3 40 144000     Input-VAT            20090925                           V4                      34.74
    4 31 1019186    B.E.N. MR SAUVAT                                        V1                     239.20-
    Lines 1/2 data move to ACCOUNTGL and  CURRENCYAMOUNT
    Line   4   data move  to ACCOUNTPAYABLE and CURRENCYAMOUNT
    The line 3 seems to be a TAX line, in this case u need to use ACCOUNTTAX and CURRENCYAMOUNT
    The header data to be transfered to DOCUMENTHEADER
    Max

  • Selection Screen - Text instead of Key in the value help

    Hi ,
    I have implemented selection options for Web dynpro.
    The value help for the selection fields displays the key of the selected value (standard).
    I would like to know if there is an option to display the text (instead of the key) in the field.
    Key Text
    01    AAAA
    02    BBBB
    03   CCCC
    So if I select say - 01 and 03 in the value help, Can I display AAA, CCCC in the field (or next to the field)
    Thanks,
    Sri
    Edited by: Sri on Sep 29, 2010 8:19 AM

    HI,
    You can dispaly it as dropdown and it shown the text:Use the beloe code refernce;
    DATA lt_valueset TYPE wdy_key_value_table.
      DATA ls_valueset LIKE LINE OF lt_valueset.
      ls_valueset-key = '1234'.
      ls_valueset-value = '1234test'.
      APPEND ls_valueset TO lt_valueset.
      ls_valueset-key = '1235'.
      ls_valueset-value = '1235test'.
      APPEND ls_valueset TO lt_valueset.
      ls_valueset-key = '1264'.
      ls_valueset-value = '1236test'.
      APPEND ls_valueset TO lt_valueset.
      CALL METHOD wd_this->lo_select->add_selection_field
        EXPORTING
          i_id = 'CAND_ID'
      it_result                    = lt_range_table
          i_as_dropdown                = abap_true
          it_value_set                 = lt_valueset
    *      i_read_only                  = ABAP_FALSE
    *      i_dont_care_value            =
    *      i_explanation                =
    *      i_tooltip                    =
    Regards,
    madhu

Maybe you are looking for