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 Error on OBJ_KEY

Former Member
0 Likes
9,327

Dear GURUs,

I am using BAPI_ACC_DOCUMENT_POST for clearing open items ( Actual Transaction F-04).

I am passing DOCUMENTHEADER ACCOUNTGL and CURRENCYAMOUNT tables only.

I am passing AC_DOC_NO in ACCOUNTGL for which the clearing should happen . But I am getting the following errors.

E RW 609 Error in document:

E RW 602 Required field OBJ_TYPE was not transferred in parameter DOCUMENTHEADER

E RW 602 Required field OBJ_KEY was not transferred in parameter DOCUMENTHEADER

E RW 602 Required field OBJ_SYS was not transferred in parameter DOCUMENTHEADER

Please help me to resolve this problem.

Regards,

Sakthivel.N

14 REPLIES 14
Read only

Former Member
0 Likes
4,512

You must fill these fields in structure DOCUMENTHEADER. Look next sentences.

  • look at TTYP table for correct value

DOCUMENTHEADER-OBJ_TYPE = 'BKPFF'.

  • to obtain this value you need to construct a FORM which obtain a document number using FM NUMBER_GET_NEXT according with document type you want to create

DOCUMENTHEADER-OBJ_KEY

  • look at TBDLS table for correct value or construct a FORM which use FM OWN_LOGICAL_SYSTEM_GET to obtain correct value

DOCUMENTHEADER-OBJ_SYS = 'WF2100'.

Regards.

Rafael Rojas.

Read only

0 Likes
4,512

very much Thanks you all rafael, joyjit, santhosh, max

Im getting the following Error

E F5 702 Balance in transaction currency

I unable to find why this error is coming. Can you help over this??

Thanks in advance.

Please find the code below.

  • &---------------------------------------------------------------------*

  • & Report ZTEST_ACC_DOC_POST

  • &

  • &---------------------------------------------------------------------*

  • &

  • &

  • &---------------------------------------------------------------------*

REPORT ztest_acc_doc_post line-size 350.

DATA: w_accheader TYPE bapiache09,

i_accglitem TYPE STANDARD TABLE OF bapiacgl09,

i_acccusitem TYPE STANDARD TABLE OF bapiacar09,

i_accamount TYPE STANDARD TABLE OF bapiaccr09,

i_return type standard table of BAPIRET2,

w_accglitem TYPE bapiacgl09,

w_acccusitem TYPE bapiacar09,

w_accamount TYPE bapiaccr09,

w_return type BAPIRET2.

DATA: l_objtype TYPE awtyp,

l_objkey TYPE awkey,

l_objsys TYPE awsys,

l_objtran TYPE glvor,

l_belnr type belnr_d,

l_qty type INRI-QUANTITY,

l_rtncode type INRI-RETURNCODE.

CLEAR:w_accheader ,

i_accglitem ,

i_acccusitem,

i_accamount ,

w_accglitem ,

w_acccusitem,

w_accamount .

************SETTING OBJECT TYPE

l_objtype = 'IDOC'.

************GETTING NEXT ACCOUNT NUMBER TO FRAME OBJECT KEY

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = '01'

object = 'RF_BELEG'

QUANTITY = '00000000000000000001'

SUBOBJECT = 'TIL'

TOYEAR = '2009'

IGNORE_BUFFER = ' '

IMPORTING

NUMBER = l_belnr

QUANTITY = l_qty

RETURNCODE = l_rtncode

EXCEPTIONS

INTERVAL_NOT_FOUND = 1

NUMBER_RANGE_NOT_INTERN = 2

OBJECT_NOT_FOUND = 3

QUANTITY_IS_0 = 4

QUANTITY_IS_NOT_1 = 5

INTERVAL_OVERFLOW = 6

BUFFER_OVERFLOW = 7

OTHERS = 8

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

concatenate l_belnr 'TIL 2009' into l_objkey.

************GETTING LOGICAL SYSTEM DATA

CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

IMPORTING

OWN_LOGICAL_SYSTEM = l_objsys

EXCEPTIONS

OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

w_accheader-OBJ_TYPE = l_objtype.

w_accheader-OBJ_KEY = l_objkey.

w_accheader-OBJ_SYS = l_objsys.

w_accheader-BUS_ACT = 'RFBU'.

w_accheader-USERNAME = sy-uname.

w_accheader-HEADER_TXT = 'test'.

w_accheader-COMP_CODE = 'TIL'.

w_accheader-DOC_DATE = '20080617'.

w_accheader-PSTNG_DATE = '20080617'.

w_accheader-FISC_YEAR = '2009'.

w_accheader-DOC_TYPE = 'SA'.

w_accglitem-ITEMNO_ACC = '0000000001'.

w_accglitem-GL_ACCOUNT = '0000244557'.

w_accglitem-ITEM_TEXT = 'ITEM CREDIT'.

w_accglitem-ac_doc_no = '0090000031'.

w_accglitem-acct_type = 'S'.

w_accglitem-DOC_TYPE = 'SA'.

w_accglitem-COMP_CODE = 'TIL'.

w_accglitem-fisc_year = '2009'.

w_accglitem-PSTNG_DATE = '20080617'.

w_accglitem-VALUE_DATE ='20080617'.

w_accglitem-ALLOC_NMBR = '124587'.

w_accglitem-DE_CRE_IND = 'H'.

append w_accglitem to i_accglitem.

clear w_accglitem.

w_accglitem-ITEMNO_ACC = '0000000002'.

w_accglitem-GL_ACCOUNT = '0000244215'.

w_accglitem-ITEM_TEXT = 'ITEM DEBIT'.

w_accglitem-ref_key_3 = '0000000128'.

w_accglitem-acct_type = 'S'.

w_accglitem-DOC_TYPE = 'SA'.

w_accglitem-COMP_CODE = 'TIL'.

w_accglitem-fisc_year = '2009'.

w_accglitem-PSTNG_DATE = '20080617'.

w_accglitem-VALUE_DATE ='20080617'.

w_accglitem-ALLOC_NMBR = '124587'.

w_accglitem-DE_CRE_IND = 'S'.

append w_accglitem to i_accglitem.

w_accamount-ITEMNO_ACC = '0000000001'.

w_accamount-CURRENCY = 'INR'.

w_accamount-AMT_DOCCUR = '3000'.

append w_accamount to i_accamount.

clear w_accamount.

w_accamount-ITEMNO_ACC = '0000000002'.

w_accamount-CURRENCY = 'INR'.

w_accamount-AMT_DOCCUR = '3000'.

w_accamount-amt_doccur = w_accamount-amt_doccur * -1.

append w_accamount to i_accamount.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = w_accheader

IMPORTING

OBJ_TYPE = l_objtype

OBJ_KEY = l_objkey

OBJ_SYS = l_objsys

tables

ACCOUNTGL = i_accglitem

currencyamount = i_accamount

return = i_return .

loop at i_return into w_return.

write:/ w_return-TYPE(1),

w_return-ID(2),

w_return-NUMBER(3),

w_return-MESSAGE(50),

w_return-LOG_NO(1),

w_return-LOG_MSG_NO(3),

w_return-MESSAGE_V1(30),

w_return-MESSAGE_V2(30),

w_return-MESSAGE_V3(30),

w_return-MESSAGE_V4(30).

endloop.

Edited by: sakthivel n on Jun 20, 2008 5:06 PM

Read only

0 Likes
4,512

One of the entries in currencyamount has to be negative

Read only

0 Likes
4,512

Hi

U need to transfer the currency type and don't clear the structure w_accamount

w_accamount-ITEMNO_ACC = '0000000001'.
CURRENCYAMOUNT-CURR_TYPE  = '00'. <--------------------------
w_accamount-CURRENCY = 'INR'.
w_accamount-AMT_DOCCUR = '3000'.
append w_accamount to i_accamount.

*clear w_accamount.                                <-------------------------- ERRORR      
w_accamount-ITEMNO_ACC = '0000000002'.
CURRENCYAMOUNT-CURR_TYPE  = '00'. <--------------------------
w_accamount-CURRENCY = 'INR'.
w_accamount-AMT_DOCCUR = '3000'.
w_accamount-amt_doccur = w_accamount-amt_doccur * -1.
append w_accamount to i_accamount.

Anyway you shouldn't get the FI number out of BAPI, u don't need to transfer it, the BAPI should get it automatically.

So u should delete this piece of code (else u risk to loose FI number)

***********GETTING NEXT ACCOUNT NUMBER TO FRAME OBJECT KEY
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '01'
object = 'RF_BELEG'
QUANTITY = '00000000000000000001'
SUBOBJECT = 'TIL'
TOYEAR = '2009'
IGNORE_BUFFER = ' '
IMPORTING
NUMBER = l_belnr
QUANTITY = l_qty
RETURNCODE = l_rtncode
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
BUFFER_OVERFLOW = 7
OTHERS = 8
.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Max

Read only

Former Member
0 Likes
4,512

You need to populate all these fields in structure OCUMENTHEADER

OBJ_TYPE Sender identification

OBJ_KEY Reference number of source document

OBJ_SYS Logical system of source document

Following way u can populate these fields:

call function 'OWN_LOGICAL_SYSTEM_GET'

importing

own_logical_system = gd_documentheader-obj_sys.

  • OBJ_TYPE has to be replaced by customers object key (Y* or Z*)

gd_documentheader-obj_type = <Your prog. name>.

gd_documentheader-obj_key = 'TEST000001BAPICALL'.

Regards,

Joy.

Read only

Former Member
0 Likes
4,512

Hi Saktivel,

You need to pass a value from the Object Types for Accounting Table 'TTYP' for instance you can send 'BKPF' as a value in OBJ_TYPE, or push the data from the Reference Transaction field 'AWTYP' from database table BKPF which you have selected. .

The OBJ_KEY should be provided with the reference key 'AWKEY' field from the database table BKPF which you have selected.

Similarly the OBJ_SYS should be provided with the Logical system field 'AWSYS' from BKPF.

This worked for me .

Please reward if helpful.

Read only

Former Member
0 Likes
4,512

Hi

Don't transfer any value in AC_DOC_NO

Max

Read only

Former Member
0 Likes
4,512

The account balance of i_accamount always must be zero. Values added to this internal table must contain the minus sign ( - ) at the beginning of number.

Regards.

Rafael Rojas.

Read only

Former Member
0 Likes
4,512

I hope I am very near to the solution.

I tried with all your suggesions. But the same error is coming.

E RW 609 Error in document: IDOC 0090000129TIL 2009 CLNT400 000 IDOC 0090000129TIL 200

E F5 702 Balance in transaction currency 000 00 3,000.00

Is there any SD custom setting related to currency? will it be a problem for this error??

Beacuase I used the same BAPI other purpose in IDES server. There I got the same error(Balance in Transaction Currency). But I tried with dev server. It got posted.

Expecting your valuable reply..........

Thanks in advance.........................

Regards,

Sakthi

Read only

0 Likes
4,512

Hi,

Dnt know much abt the first error, but ur second error is coz ur debit values and credit values do not nullify each other. In your excel sheet, add your debit values together and add all the credit values together. The total of both sshud be the same. Its then that the addition turns to zero and the system will then allow you to post the document.

Thanks

Nayan

Reward if useful

Read only

Former Member
0 Likes
4,512

Hi Nayan,

I did the same. But still the same error "Balance in transaction Currency" is coming. I am still hanging on this problem sir......

Regards,

Sakthi

Read only

0 Likes
4,512

Hi,

Its ot possible mate, i have alo faced the same problem and upon making the values of debit and credit same i have managed to remove the error. Check the values again, im dead sure this is the problem.

Read only

Former Member
0 Likes
4,512

Dear Friends,

Thanks to all of you.

I unable to bring the solution over this problem. So I did BDC. its working fine. If anybody have the same problem, please send the mail. I will help you.

Read only

0 Likes
4,512

sakthivel n, I'm having the exact same problem you had. I know you decided to go with BDC, but did you ever figure out a solution for the BAPI?

I don't understand the ramifications of setting the OBJ_TYPE and OBJ_KEY. I ended up setting OBJ_TYPE = 'IDOC' which allowed me to set OBJ_KEY = to whatever I wanted. Not sure what ramifications this will have...

Anyway I'm now getting error:

E F5 702 Balance in transaction currency

Did you ever figure out why?