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

BAPI_ACC_DOCUMENT_POST: to post to multiple one-time customer

Former Member
0 Likes
4,331

Hi Expert,

I am able to use function BAPI_ACC_DOCUMENT_POST to post the accounting document. In the business scenarios, we received a sum of incoming payment from various one-time customer. As long as one-time customer is concern, we have to input the customer name, city etc. However, noticed that input parameters CUSTOMERCPD in BAPI_ACC_DOCUMENT_POST can only accept one customer.

Can expert please share with me how do you address on above? Or, any available BAPI that can be used instead of BAPI_ACC_DOCUMENT_POST?

Regards

Kang Ring

4 REPLIES 4
Read only

andreas_mann3
Active Contributor
0 Likes
2,160

use report rfbibl00 - it's much more simple than unhandy BAPIs

grx

Andreas

Read only

0 Likes
2,160

Hi Andreas

May I know how can I test on the program rfbibl00? Reason, system prompt to enter 'File path name'. May I know what do I need to enter with the data content and its format.

Regards

Kang Ring

Read only

Former Member
0 Likes
2,160

Hi.

Chek out my code

REPORT  ztn_test_bapi_f02.


DATA: gs_documentheader LIKE bapiache09.
DATA: BEGIN OF gt_documentheader OCCURS 0.
        INCLUDE STRUCTURE bapiache09.
DATA: END OF gt_documentheader.

DATA: gs_accountgl LIKE bapiacgl09.
DATA: BEGIN OF gt_accountgl OCCURS 0.
        INCLUDE STRUCTURE bapiacgl09.
DATA: END OF gt_accountgl.

DATA: gs_rec LIKE bapiacar09.
DATA: BEGIN OF gt_rec OCCURS 0.
        INCLUDE STRUCTURE bapiacar09.
DATA: END OF gt_rec.

DATA: gs_accountpayable LIKE bapiacap09.
DATA: BEGIN OF gt_accountpayable OCCURS 0.
        INCLUDE STRUCTURE bapiacap09.
DATA: END OF gt_accountpayable.

DATA: gs_currencyamount LIKE bapiaccr09.
DATA: BEGIN OF gt_currencyamount OCCURS 0.
        INCLUDE STRUCTURE bapiaccr09.
DATA: END OF gt_currencyamount.

DATA: BEGIN OF return OCCURS 0.
        INCLUDE STRUCTURE bapiret2.
DATA: END OF return.

*DATA: gv_obj_type LIKE bapiache09-obj_type VALUE 'BKPFF',
*gv_obj_key LIKE bapiache09-obj_key VALUE '3400000216',
**gv_obj_sys LIKE bapiache09-obj_sys VALUE 'DEVCLNT200'.
*
*gs_documentheader-obj_type = 'BKPFF'.
*gs_documentheader-obj_key =  '3400000216'.
*gs_documentheader-obj_sys =  'DEVCLNT200'.
*"gs_documentheader-bus_act = 'BKPFF'.
gs_documentheader-username = sy-uname.
gs_documentheader-header_txt = 'test'.
gs_documentheader-comp_code = '1500'.
gs_documentheader-doc_date = sy-datum.
gs_documentheader-pstng_date = sy-datum.
gs_documentheader-doc_type = 'SA'.
APPEND gs_documentheader TO gt_documentheader.

*gs_accountpayable-itemno_acc = '2'.
*gs_accountpayable-vendor_no = '0060001439'.
*APPEND gs_accountpayable TO gt_accountpayable.

gs_accountgl-itemno_acc = '0000000001'.
gs_accountgl-gl_account = '0004690360'.
gs_accountgl-comp_code = '1500'.
gs_accountgl-pstng_date = sy-datum.
gs_accountgl-costcenter = '4150000000'.
APPEND gs_accountgl TO gt_accountgl.


gs_rec-itemno_acc = '0000000002'.
gs_rec-gl_account = '0004120250'.
gs_rec-COMP_CODE = '1500'.
gs_rec-customer = '0001000001'.

APPEND gs_rec TO gt_rec.


*gs_accountgl-itemno_acc = '0000000002'.
*gs_accountgl-gl_account = '0004690360'.
*gs_accountgl-customer = '0001000001'.
*gs_accountgl-vendor_no = '0001000001'.
*gs_accountgl-comp_code = '1500'.
*gs_accountgl-pstng_date = sy-datum.
*gs_accountgl-costcenter = '4150000000'.
*APPEND gs_accountgl TO gt_accountgl.

*gs_accountgl-itemno_acc = '0000000002'.
*gs_accountgl-gl_account = '0001000001'.
*gs_accountgl-comp_code = '1500'.
*gs_accountgl-pstng_date = sy-datum.
*gs_accountgl-costcenter = '4150000000'.
*APPEND gs_accountgl TO gt_accountgl.

gs_currencyamount-itemno_acc = '0000000001'.
gs_currencyamount-currency = 'PKR'.
gs_currencyamount-amt_doccur = '20080'. "i_tab-repval.
APPEND gs_currencyamount TO gt_currencyamount.

gs_currencyamount-itemno_acc = '0000000002'.
gs_currencyamount-currency = 'PKR'.
gs_currencyamount-amt_doccur = '20080-'. "i_tab-repval.
APPEND gs_currencyamount TO gt_currencyamount.

DATA: extension2 LIKE STANDARD TABLE OF bapiparex WITH HEADER LINE.

extension2-bschl = '15'.
APPEND extension2.
*
*extension2-bschl = '15'.
*APPEND extension2.

BREAK-POINT.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
  EXPORTING
    documentheader    = gs_documentheader
*  IMPORTING
*    obj_type          = gv_obj_type
*    obj_key           = gv_obj_key
*    obj_sys           = gv_obj_sys
  TABLES
    accountgl         = gt_accountgl
    accountreceivable = gt_rec
    accountpayable    = gt_accountpayable
    currencyamount    = gt_currencyamount
    extension2        = extension2
    return            = return.

BREAK-POINT.
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: / obj_key, ' posted'.
ENDIF.

Read only

0 Likes
2,160

HI tahir

Thanks for your code. But, problem persists to handle one time customer via BAPI. Input parameter CUSTOMERCPD not a table, it only accept one record.

Regards

Kang Ring