Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with bapi BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
428

We are trying to post a customer invoice like transaction FB70

We are filling tables accountgl, and accountreceivable, for some reason the bapi returns a succes message with a document number, but bkpf and bseg tables are never updated.

What could be wrong?

Should I need to fill another table?

Here is the code


data: head type BAPIACHE09,
      gl type table of BAPIACGL09 with header line,
      rv type table of BAPIACAR09 with header line,
      ret type table of BAPIRET2 with header line,
      CU TYPE TABLE OF BAPIACCR09 WITH HEADER LINE,
      TY TYPE BAPIACHE09-OBJ_TYPE,
      KY TYPE BAPIACHE09-OBJ_KEY,
      SI TYPE BAPIACHE09-OBJ_SYS.

DATA L.

 head-bus_act = 'RFBU'.
 head-username = SY-UNAME.
 head-HEADER_TXT = 'RFBeee'.
 head-COMP_CODE = '083'.
 head-DOC_dATE = '20080507'.
 head-PSTNG_DATE = '20080507'.
head-DOC_TYPE = 'DZ'.
head-REF_DOC_NO = 'FFFF'.



 GL-ITEMNO_aCC = '2'.
 GL-GL_ACCOUNT = '0003606004'.
 GL-ITEM_TEXT = 'EEE'.
 GL-BUS_AREA = '2373'.
 APPEND GL.

 RV-ITEMNO_aCC = '1'.
 RV-CUSTOMER = '0000000800'.
 RV-ITEM_TEXT = 'EEE'.
 RV-BUS_AREA = '2373'.
 RV-BLINE_DATE = '20080507'.
 APPEND RV.

 CU-ITEMNO_aCC = '1'.
 CU-CURRENCY = 'MXN'.
 CU-CURR_TYPE = '00'.
 CU-AMT_BASE = '1'.
 APPEND CU.
  CU-ITEMNO_aCC = '2'.
  CU-CURR_TYPE = '00'.
 CU-CURRENCY = 'MXN'.
 CU-AMT_BASE = '1'.
 APPEND CU.


 CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
   EXPORTING
     documentheader          = HEAD
*    CUSTOMERCPD             =
*    CONTRACTHEADER          =
  IMPORTING
    OBJ_TYPE                = TY
    OBJ_KEY                 = KY
    OBJ_SYS                 = SI
   tables
    ACCOUNTGL               = GL
    ACCOUNTRECEIVABLE       = RV
*    ACCOUNTPAYABLE          =
*    ACCOUNTTAX              =
     currencyamount          = CU
*    CRITERIA                =
*    VALUEFIELD              =
*    EXTENSION1              =
     return                  = RET
*    PAYMENTCARD             =
*    CONTRACTITEM            =
           .

 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    WAIT          = 'X'
  IMPORTING
    RETURN        = RET.

1 REPLY 1
Read only

Former Member
0 Likes
283

Solved, changed amt_base to amt_doccur in currencyamount table and the document is being posted