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 BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
2,975

Hi,

I am tring to upload customer invoices using BAPI BAPI_ACC_DOCUMENT_POST.

I am not able to find field for contract number and contract type.

Usually when iam using f-02 i can enter this fields (contract number and contract type)

These fields corresponds to BSID-VERTT and BSID-VERTN.

Can anyone help in getting this fields.

Regards

Kuna.

Moderator message - Moved to the correct forum

Edited by: Rob Burbank on Dec 10, 2009 9:32 AM

1 ACCEPTED SOLUTION
Read only

tobiaskugelmann
Explorer
0 Likes
1,990

Hi,

which SAP Realse are you using?

Following search method I wuold recommend: Find the data element for the fields and search within the BAPI structures for that data element.

If you do not find it, then you probably can't set this information with the BAPI.

BR

Tobias Kugelmann

7 REPLIES 7
Read only

Former Member
0 Likes
1,990

Can anyone give me some information about contract number.

Read only

tobiaskugelmann
Explorer
0 Likes
1,991

Hi,

which SAP Realse are you using?

Following search method I wuold recommend: Find the data element for the fields and search within the BAPI structures for that data element.

If you do not find it, then you probably can't set this information with the BAPI.

BR

Tobias Kugelmann

Read only

0 Likes
1,990

Hi,

Thanks for your reply.

Iam using ERP ECC 6.0

Thanks

Kuna

Read only

0 Likes
1,990

Hi

Not all fields of BKPF and BSEG are available for that BAPI, if you can't see a field in the BAPI structure u need to use the extension in order to transfer the value of that field.

In ECC 6.00 there are two chances for extension:

- The "old" BTE RWBAPI01: here u need to use the table parameter EXTENSION1

- The "new" BADI ACC_DOCUMENT: here u need to use the table parameter EXTENSION2

Max

Read only

0 Likes
1,990

Hi,

Thanks for your valuable information. I am trying to use extension2 . But its still not updateing the required field.

I have created a structure ZKUNA_ACCIT. The structure contains three fields.

POSNR

VERTT

VERTN

Below is my coding.

******************************************************************************

DATA : i_ext2 TYPE STANDARD TABLE OF bapiparex WITH HEADER LINE.

DATA: ls_zzz type ZKUNA_ACCIT.

CLEAR i_ext2.

CLEAR LS_ZZZ.

LS_ZZZ-POSNR = '20'.

LS_ZZZ-VERTT = 'A'.

LS_ZZZ-VERTN = ITAB_XS010-COD_REF.

I_EXT2-STRUCTURE = 'ZKUNA_ACCIT'.

MOVE ls_zzz TO i_ext2-valuepart1.

APPEND i_ext2.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

DOCUMENTHEADER = ITAB_DOCUMENTHEADER

  • CONTRACTHEADER = ITAB_CONTRACTS

IMPORTING

OBJ_TYPE = OBJ_TYPE

OBJ_KEY = OBJ_KEY

OBJ_SYS = OBJ_SYS

TABLES ACCOUNTGL = ITAB_GLACCOUNT

ACCOUNTRECEIVABLE = ITAB_CUSTOMER

CURRENCYAMOUNT = ITAB_CURRENCY

RETURN = ITAB_RETURN

EXTENSION2 = I_EXT2.

****************************************************************

The result is that the document is generated by the extension2 is not updating the required field.

Can you pls tell me what might be the problem

Thanks

Regards

Kuna.

Read only

Former Member
0 Likes
1,990

Hi,

If you are using ECC 6.0 then you can find CONTRACTITEM structure. using ITEMNO_ACC field you can connect ACCOUNTRECEIVABLE and CONTRACTITEM.

No need to use any extension.

Thanks

Arun

Read only

0 Likes
1,990

Hi,

Finally i got a solution and finally worked !!!!!!

See the below solution :

**************************************************************************************

Write this code in the program which is using the Bapi.

DATA : I_EXT2 TYPE STANDARD TABLE OF bapiparex WITH HEADER LINE.

I_EXT2-STRUCTURE = 'CONTRACT_10'.

I_EXT2-VALUEPART1 = 'A'.

I_EXT2-VALUEPART2 = ITAB_XS010-COD_REF.

APPEND I_EXT2.

CLEAR I_EXT2.

I_EXT2-STRUCTURE = 'CONTRACT_20'.

I_EXT2-VALUEPART1 = 'A'.

I_EXT2-VALUEPART2 = ITAB_XS010-COD_REF.

APPEND I_EXT2.

CLEAR I_EXT2.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

DOCUMENTHEADER = ITAB_DOCUMENTHEADER

  • CONTRACTHEADER = ITAB_CONTRACTS

IMPORTING

OBJ_TYPE = OBJ_TYPE

OBJ_KEY = OBJ_KEY

OBJ_SYS = OBJ_SYS

TABLES ACCOUNTGL = ITAB_GLACCOUNT

ACCOUNTRECEIVABLE = ITAB_CUSTOMER

CURRENCYAMOUNT = ITAB_CURRENCY

RETURN = ITAB_RETURN

EXTENSION2 = I_EXT2.

*************************************************************************************

Enhance the BADI ACC_Document - Method - Change

method IF_EX_ACC_DOCUMENT~CHANGE.

DATA: wa_extension TYPE bapiparex,

wa_accit TYPE accit.

LOOP AT c_extension2 INTO wa_extension.

IF wa_extension-structure = 'CONTRACT_10'.

CLEAR wa_accit.

READ TABLE c_accit INTO wa_accit WITH KEY posnr = 10.

IF sy-subrc = 0.

wa_accit-VERTT = wa_extension-valuepart1.

wa_accit-VERTN = wa_extension-valuepart2.

MODIFY c_accit FROM wa_accit INDEX sy-tabix TRANSPORTING VERTT VERTN.

ENDIF.

ENDIF.

IF wa_extension-structure = 'CONTRACT_20'.

CLEAR wa_accit.

READ TABLE c_accit INTO wa_accit WITH KEY posnr = 20.

IF sy-subrc = 0.

wa_accit-VERTT = wa_extension-valuepart1.

wa_accit-VERTN = wa_extension-valuepart2.

MODIFY c_accit FROM wa_accit INDEX sy-tabix TRANSPORTING VERTT VERTN.

ENDIF.

ENDIF.

ENDLOOP.

endmethod.