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: 

BAPI_ACC_DOCUMENT_POST Giving problem.

former_member214878
Active Participant
0 Kudos

Hi Guys,

I am using BAPI_ACC_DOCUMENT_POST for Transaction F-28.

When I am executing this bapi using SE37 I am able to execute it successfully.

But with the same values when I am trying to execute it in a program, I am getting the below errors -

-


> E RW 609 Error in document : BKPFF $

When I traced it further I got to know that there OBJ_KEY in a header level which needs to be incremented while subsequent call via program. I am not sure whether thats what I am missing.

As while SE37 I am only passing "$" for OBJ_KEY.

Please let me know if anyone has clue for this.

Thanking u in advance.

regards,

Ravi

10 REPLIES 10

Former Member
0 Kudos

Are you getting error during the first call via BAPI or during subsequent calls to BAPI via your program? Is this the only error? And when you execute from SE37, did you successfully post the document (or did it just give a success message?)

Compare your SE37 test data to the data passed to BAPI via your program and make sure it is the exact same ...

check in SDN /google with your error message and see if it is applicable to you.

0 Kudos

Hi Kris,

That was damn perfect direction.----

I checked just - Findings as below -

Now I am executing BAPI only once in the program, but for one time also its giving me the same error.

Actually you are abs. right, I am just able to see the success message but actually the document is not being posted.

I was thinking that my document is just getting posted, but its not. Only success message wont help me. I want to actually post the document.

i am comparing my SE37 data with the program data, its 100% exactly same.

I trust your judgement, mean while I am searching on Google/SDN as well, if u have any other way of thinking please share.

Thanking u in advance.

Regards,

Ravi

0 Kudos

Hi Kris,

That was damn perfect direction.----

I checked just - Findings as below -

Now I am executing BAPI only once in the program, but for one time also its giving me the same error.

Actually you are abs. right, I am just able to see the success message but actually the document is not being posted.

I was thinking that my document is just getting posted, but its not. Only success message wont help me. I want to actually post the document.

i am comparing my SE37 data with the program data, its 100% exactly same.

I trust your judgement, mean while I am searching on Google/SDN as well, if u have any other way of thinking please share.

Thanking u in advance.

Regards,

Ravi

Heading 2: Sorry for the same post ,,,,, got sent without intention

Edited by: ravisonar01 on Feb 4, 2011 12:01 AM

0 Kudos

Hi Ravi,

Most likely the difference between your program and SE37 is that in your program you commit your data to the DB by invoking the BAPI commit function. In SE37 this commit is not done, unless you include the commit BAPI in the other function popup while testing which not very often is done. In case you have not done this, try this and see if you get the same results as your program.

Regards,

Robert

Ps. Forgot to add that the additional function can be added in the SE37 test mode by FUNTION MODULES->OTHER. Just add the subsequent function in the popup and save. Then execute the BAPI_ACC_DOCUMENT_POST.

Edited by: RJ. Schamhart on Feb 3, 2011 10:42 AM

0 Kudos

Ravi, You have to execute both BAPI_ACC_DOCUMENT_POST and BAPI_TRANSACTION_COMMIT from SE37 to commit your data... As RJ had indicated, in SE37 Use the Function Module -> Test - > Test sequences to enter both the function modules and test to see if you are getting the same behaviour like Program... Let us know once you are able to test from SE37...

0 Kudos

Thanks for correcting this Kris.

I was incorrect in the directions I mentioned on how to test both functions thru SE37.

Kind regards,

Robert

0 Kudos

Kris/Robert,

Problem is something different, when I am posting it via SE37 and calling BAPI_TRANSACTION_COMMIT through Test sequences, I am able to see the document is getting successfully posted.

But when I see whether the specific document for the Customer got cleared or not, then I see that there are another line created with the Document Type DZ with overdue amount.

This is for SE37 ---

For my program -

I am still on the error side, I am not able to figure out the OBJ_KEY which the BAPI document says,

The object key consists of a reference document number and a reference organizational unit.

Example: 1000007899 00011996

Reference Reference organizational unit

document no. client and fiscal year

I am not able to understand how to solve this E RW 609 Error in document : BKPFF $ .

Please suggest.

0 Kudos

It is very unusual for BAPI to work from SE37, but not from your program... Did you compare the interface parameters to your BAPI from SE37 AND your program in debug mode (in parallel sessions) and see if it is the same ? Please compare field by field in debug mode (all the parameters).

I think if you can get your program and SE37 to work in the same way, then it is easy to fix other issues.

Are you referring to OBJKEY in document header structure? Look at some of the links,

And you can also indicate how your interface fields are filled.

0 Kudos

thanks kris,

I will try for the same..... I got what i am missing. Let me try out this one first, will write u ...

mean while I thought of assigning it as a useful answer for ur help....


wa_docheader-obj_type = 'BKPFF'.
wa_docheader-obj_key = '$'.
wa_docheader-obj_sys = 'ECCCLNT771'.      "Logical System
wa_docheader-bus_act = 'RFBU'.

thanks Kris.

0 Kudos

Hey thanks for replying Kris.

I could able to solve my problem.

BAPI is working properly now.

*&---------------------------------------------------------------------*
*& Report  ZBAPI_ACC_DOCUMENT_POST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
PROGRAM zbapi_acc_document_post.

DATA:
gv_obj_type  LIKE  bapiache09-obj_type,
gv_obj_key LIKE  bapiache09-obj_key,
gv_obj_sys LIKE  bapiache09-obj_sys,


gs_documentheader LIKE bapiache09,

gs_accountgl LIKE bapiacgl09," OCCURS 0 WITH HEADER LINE,
gt_accountgl LIKE bapiacgl09 OCCURS 0," WITH HEADER LINE,

gs_currencyamount LIKE bapiaccr09," OCCURS 0 WITH HEADER LINE,
gt_currencyamount LIKE bapiaccr09 OCCURS 0," WITH HEADER LINE,

gs_accountreceivable LIKE bapiacar09,
gt_accountreceivable LIKE bapiacar09 OCCURS 0,


gt_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,

t_edidd LIKE edidd OCCURS 0 WITH HEADER LINE,
bapi_retn_info LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: error_flag.


BREAK-POINT.

gs_documentheader-obj_type        =     'BKPFF'.
gs_documentheader-obj_key         =     '$'.
gs_documentheader-obj_sys         =     'DECCLNT311'.
gs_documentheader-bus_act         =     'RFBU'.
gs_documentheader-username        =     'WI_MVENKAT'.
gs_documentheader-header_txt      =     'TEST'.
gs_documentheader-comp_code       =     '1000'.
gs_documentheader-doc_date        =     '20110203'.
gs_documentheader-pstng_date      =     '20110203'.
gs_documentheader-fisc_year       =     '2010'.
gs_documentheader-fis_period      =     '11'.
gs_documentheader-doc_type        =     'DZ'.



gs_accountgl-itemno_acc           =     '0000000001'.
gs_accountgl-gl_account           =     '0000251000'.
APPEND gs_accountgl TO gt_accountgl.


gs_accountreceivable-itemno_acc   =     '0000000002'.
gs_accountreceivable-customer     =     '0009000176'.
gs_accountreceivable-gl_account   =     '0000240010'.
APPEND gs_accountreceivable TO gt_accountreceivable.


gs_currencyamount-itemno_acc      =     '0000000002'.
gs_currencyamount-currency        =     'INR'.
gs_currencyamount-amt_doccur      =     '-10000'.
APPEND gs_currencyamount TO gt_currencyamount.

gs_currencyamount-itemno_acc      =     '0000000001'.
gs_currencyamount-currency        =     'INR'.
gs_currencyamount-amt_doccur      =     '10000'.
APPEND gs_currencyamount TO gt_currencyamount.


CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
  EXPORTING
    documentheader          =     gs_documentheader
*   CUSTOMERCPD             =
*   CONTRACTHEADER          =
* IMPORTING
*   OBJ_TYPE                =
*   OBJ_KEY                 =
*   OBJ_SYS                 =
  TABLES
    accountgl               =     gt_accountgl
    accountreceivable       =     gt_accountreceivable
*   ACCOUNTPAYABLE          =
*   ACCOUNTTAX              =
    currencyamount          =     gt_currencyamount
*   CRITERIA                =
*   VALUEFIELD              =
*   EXTENSION1              =
    return                  =     gt_return.


IF gt_return[] IS NOT INITIAL.
  LOOP AT gt_return.
    WRITE: / gt_return-message.
  ENDLOOP.
ENDIF.