Sitemap

Amicuk Programming Answers

BAPI FUNCTION MODULE  BAPI_ACC_DOCUMENT_POST : How to give posting keys?

2015-10-11   Views:3

Advertisement

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 pos

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

The replay answer
Advertisement
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

Go to See the other 8 answers

BAPI FUNCTION MODULE  BAPI_ACC_DOCUMENT_POST : How to give posting keys?

Category:DefaultRelease time:2015-10-11Views:130

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 pos[More]

How to define null or empty value in BAPI function modules?

Category:DefaultRelease time:2015-10-11Views:130

Hi, I have problem with BAPI functions, where some parameters are mandatory. For example: when I try to use HR BAPI's(BAPI_PERSDATA_CHANGE, etc.) I have to insert parameters like SUBTYPE,OBJECTID,LOCKINDICATOR. The PA0002 table that is used from this[More]

HOw to find the BAPI function module

Category:DefaultRelease time:2015-10-11Views:130

Hi all, I have a field called IEVER in table EIKP. How to find the related BAPI function module and BAPI structure for this filed. Thanks in advance KPHi KP,    can you tell us the name of the transaction in which you saw this field? If it is in PO C[More]

BAPI function module name and mandatory fields

Category:DefaultRelease time:2015-10-11Views:130

Give the name of BAPI function module for pricing change into the transaction VA05 ? What are the mandatory fields ? Please give a exemple code to do this.Hi, VA05 is for list of sales order. But if you want to change pricing of material stocks go fo[More]

Is there a BAPI function module which reverses the sign of an integer

Category:DefaultRelease time:2015-10-11Views:130

Hi Friends,                  Could u plz tell me  a BAPI function module which can reverse the sign of an integer ? For example:        if i get the integer value in work area as <number> <sign> , i need to change it to <sign><number&[More]

LSMW or ABAP Program:- I need BAPI function module or Direct input program

Category:DefaultRelease time:2015-10-11Views:130

hi experts, I have to develop the program which uploads the transportation pricing data for freight cost management. the transcation code is XK15 for the application A. There is a program called RV14BTCI which will uploads for the application V or M[More]

BAPI function module 'BAPI_PO_CHANGE' is not updating aacural condition

Category:DefaultRelease time:2015-10-11Views:130

Dear All, BAPI function module 'BAPI_PO_CHANGE' is not updating aacural condition in PO pricing. Please give me a right solution on this query. Below I have given my code. Thanks and Regards Makarabd poitem-po_item = '00010'. poitem-net_price = '1060[More]

BAPI Function Module for SCM APO Tcode /SAPAPO/AC42

Category:DefaultRelease time:-0001-11-30Views:130

Hi,   I want to know the BAPI Function Modules for SCM APO Tcode /SAPAPO/AC42.    This BAPI FM should return the column values "Remaining Prod Alloc"  and "Incoming Order Quantity" when we give    below details as inputs for the Tcode[More]

BAPI Function Module for SCM APO Trans code /SAPAPO/AC42

Category:DefaultRelease time:-0001-11-30Views:130

Hi,    Is there any BAPI Function Modules for SCM APO Tcode /SAPAPO/AC42.    This BAPI FM should return the column values "Remaining Prod Alloc"  and "Incoming Order Quantity" when we give    below details as inputs for the Tcode /SAPA[More]

Stuck with Bapi Function module BAPI_STSRVAPS_SAVEMULTI2

Category:DefaultRelease time:-0001-11-30Views:130

Hi all, I have been given the requirement to get the stock quantity using the bapi function module BAPI_STSRVAPS_GETLIST2 from the Livacache and depending upon some stock reservation percent split the stock into two as (NEW STOCK and STOCK RESERVED )[More]

BAPI function module to get condition type and its values based on delivery number?

Category:DefaultRelease time:-0001-11-30Views:130

Hi All, I would like to have the BAPI function module to get condition type value based on delivery number before invoice is created.please provide detail program for as a reference .please reply as soon as possible its urgent. Regards, saaikumar.If[More]

Hot
I have a project in iMovie that I share in Media Browser, goes through the whole process (4 hours) then I get an error message "unable to prepare project for publishing. The project could not be prepared for publishing because an error occurred." [More]
Please read original post first: http://h30434.www3.hp.com/t5/Notebook-Hardware-e-g-Windows-8/Hp-g6-1b60us-apu-upgrade/m-p/2730279 Would it be fine if I installed the apu with f.49 bios? The latest bios for the 1d60us is f.48.JohnB95, I apologize for [More]
I download the update click on the agreement and then it starts to upload but a few seconds later it says that it can't continue and then unpacks itself.  Is anyone else having this problem?ok, not sure if this will help your issue exactly but it mig [More]
Hi All, I have one scenario. Suppose i have created one table control. I have two row initially which is in display mode but I want to add one more blank row which should be only editable. Thanks, Anjaneya.DATA: wa_col TYPE cxtab_column. In PBO LOOP [More]
Hi All, I have this BlazeDS problem I need help with.... I need to get Flex application to "talk to" java on the back-end. For that to work, as you know, I need BlazeDS and, among many, JBoss application server. I was wondering if someone knows [More]
Hi 1. Is there a way I can control the bandwith between 2 sites regarding the distirbution point syncronization Requirement: Pirmary Site --> Send packages to standard distribution point (server DP)  "Link is 3  mb bandwith" and I want to lim [More]
I am trying to put together a Report that has 3 dimension in the "Pages" category. With a single dimension I get results with mutiple dimensions i get all +#MISSING+. I then look to the dropdown box for "Pages" instead of giving me a s [More]
All iWork and iLife apps have shocking font problems... so much so that I need to uninstall Snow Leopard and wait for Apple to sort it out. Does anyone know the best way? And how is it possible that these problems are occurring with Apple's inhouse s [More]
Hello, I want to save an HTML page as cache for a dynamic page in an Access 2003 database. It works OK as long as page length is less then 5000 and some chars, but doesn't register anything if length is for example 6000 chars long. If  copy the same [More]
Hello. Through stubbornness, I bootcamped Windows 7 x64 to a MacBook that I realized (halfway through the process) was a year too old to support it. I don't remember much of what I did, but I have finally lost my ability to ignore the two copies of b [More]