‎2009 Dec 08 9:09 PM
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
‎2009 Dec 10 5:21 AM
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
‎2009 Dec 09 6:14 AM
‎2009 Dec 10 5:21 AM
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
‎2009 Dec 10 10:46 AM
‎2009 Dec 10 10:56 AM
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
‎2009 Dec 13 10:24 AM
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.
‎2009 Dec 14 7:16 AM
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
‎2009 Dec 23 6:11 AM
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.