Application Development 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: 

Want to Simulate Payment Document

0 Kudos
120

Hi All,

We have a requirement before Posting we should validate the whether document can be posted or not. For checking the Invoice we are using the function module BAPI_ACC_DOCUMENT_CHECK. For checking the payment document can we use the same funciton module whether my paymnet document will be posted or not.

Thanks and best regards,

Niteesh Rai

3 REPLIES 3

former_member200345
Contributor
0 Kudos
81

YES. You can use it. I have checked it and it is working for me.

0 Kudos
81

Dear Vijaymadhur,

Could you please send me the sample code how did you do that, I was facing issues in passing all parameter to this function module. We have our development end on tuesday and we have to resolve this issue before that.

It will be gr8 if you mail me the same on toniteeshrai@gmail.com.

Thanks and best regards,

Niteesh Rai

0 Kudos
81

Hi, find the below sample code.

DATA: HEADER TYPE BAPIACHE09,
      WA_VENDOR TYPE BAPIACAP09,
      IT_VENDOR TYPE STANDARD TABLE OF BAPIACAP09,
      WA_GL TYPE BAPIACGL09,
      IT_GL TYPE STANDARD TABLE OF BAPIACGL09,
      WA_CURR TYPE BAPIACCR09,
      IT_CURR TYPE STANDARD TABLE OF BAPIACCR09,
      IT_RETURN TYPE STANDARD TABLE OF BAPIRET2.

DATA: W_ITEM TYPE POSNR_ACC.

HEADER-OBJ_TYPE = 'RMBE'.
HEADER-OBJ_KEY = '100010000000152011'.
HEADER-OBJ_SYS = 'LOGSYS100'.
HEADER-COMP_CODE = '1000'.
HEADER-DOC_DATE = SY-DATUM.
HEADER-PSTNG_DATE = SY-DATUM.
HEADER-DOC_TYPE = 'KZ'.
HEADER-REF_DOC_NO = '4500000000'.
HEADER-USERNAME = SY-UNAME.
HEADER-BUS_ACT = 'RFBU'.

CLEAR WA_VENDOR.
ADD 1 TO W_ITEM.
WA_VENDOR-ITEMNO_ACC = W_ITEM.
WA_VENDOR-VENDOR_NO = 'VENDOR1'.
APPEND WA_VENDOR TO IT_VENDOR.

CLEAR WA_CURR.
WA_CURR-ITEMNO_ACC = W_ITEM.
WA_CURR-CURRENCY = 'EUR'.
WA_CURR-AMT_DOCCUR = 100.
APPEND WA_CURR TO IT_CURR.

CLEAR WA_GL.
ADD 1 TO W_ITEM.
WA_GL-ITEMNO_ACC = W_ITEM.
WA_GL-GL_ACCOUNT = '0000111111'.
WA_GL-ACCT_TYPE = 'S'.
APPEND WA_GL TO IT_GL.

CLEAR WA_CURR.
WA_CURR-ITEMNO_ACC = W_ITEM.
WA_CURR-CURRENCY = 'EUR'.
WA_CURR-AMT_DOCCUR = 100 * -1.
APPEND WA_CURR TO IT_CURR.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
  EXPORTING
    DOCUMENTHEADER          = HEADER
*   CUSTOMERCPD             =
*   CONTRACTHEADER          =
  TABLES
   ACCOUNTGL               = IT_GL
*   ACCOUNTRECEIVABLE       =
   ACCOUNTPAYABLE          = IT_VENDOR
*   ACCOUNTTAX              =
   CURRENCYAMOUNT          = IT_CURR
*   CRITERIA                =
*   VALUEFIELD              =
*   EXTENSION1              =
    RETURN                  = IT_RETURN
*   PAYMENTCARD             =
*   CONTRACTITEM            =
*   EXTENSION2              =
*   REALESTATE              =
*   ACCOUNTWT               =
          .

IF SY-SUBRC IS INITIAL.

ENDIF.