‎2007 Apr 26 1:17 PM
Is the only way to update the reason code (BSEG-RSTGR) using the above bapi is by using the extension1 .
Tnks
‎2007 Apr 26 1:22 PM
Hi
Yes, I think so...or you can try to transfer it by FI substitution.
Max
‎2007 Apr 26 1:27 PM
I am little bit confused looking at the sample CL_EXM_IM_ACC_DOCUMENT.
Do I use structure accit ?
‎2007 Apr 26 1:43 PM
Sorry but there isn't that class in my system (4.6C)
If you need to use the extension of BADI BAPI_ACC_DOCUMENT_POST you need active the BTE RWBAPI01 (trx FIBF), so you have to create a copy of fm SAMPLE_INTERFACE_RWBAPI01 and in your new function insert the code you need to transfer the data.
This a my code to transfer the data from extension:
TABLES: ZSDFI_BAPI_EXTENSION.
LOOP AT EXTENSION.
MOVE EXTENSION TO ZSDFI_BAPI_EXTENSION.
LOOP AT IT_ACCIT WHERE POSNR = ZSDFI_BAPI_EXTENSION-ITEMNO_ACC.
IT_ACCIT-KIDNO = ZSDFI_BAPI_EXTENSION-ESENZIONE.
IT_ACCIT-ZLIFNR = ZSDFI_BAPI_EXTENSION-ZLIFNR.
IT_ACCIT-ZJ_3AKVGR6 = ZSDFI_BAPI_EXTENSION-CANALE.
MODIFY IT_ACCIT.
ENDLOOP.
ENDLOOP.ZSDFI_BAPI_EXTENSION is a dictionary structure where I insert all fields I need to use in the extension, in your case it should have the fields:
- ITEMNO_ACC (type POSNR_ACC)
- RSTGR (type RSTGR)
In the report where you used the BAPI while filling the item table you fill the extensions:
ZSDFI_BAPI_EXTENSION-ITEMNO_ACC = ITEMNO_ACC.
ZSDFI_BAPI_EXTENSION-RSTGR = <.....>.
MOVE ZSDFI_BAPI_EXTENSION TO EXTENSIONS.
APPEND EXTENSIONS.
In your BTE insert the code to pick up the values:
TABLES: ZSDFI_BAPI_EXTENSION.
LOOP AT EXTENSION.
MOVE EXTENSION TO ZSDFI_BAPI_EXTENSION.
LOOP AT IT_ACCIT WHERE POSNR = ZSDFI_BAPI_EXTENSION-ITEMNO_ACC.
IT_ACCIT-RSTGR = ZSDFI_BAPI_EXTENSION-RSTGR.
MODIFY IT_ACCIT.
ENDLOOP.
ENDLOOP.Max
‎2007 Apr 26 1:57 PM
Tnks but i probably should use the class.
anyone know what filter i should use ?
‎2007 Apr 26 2:04 PM
Hi
I believe the concept is the same: before calling the BAPi you fill the extension and in class (I suppose It's a BADI(?)) get the data from extension and transfer them to the ACCIT structure.
There isn't that BADI in my system son I don't know which filter it uses, anyaway the FI BADI often use the code country in the filter, so u should use it only if that BADI should be triggered only for the company code of certain countries.
Can u say me which field is used for the filter?
Max
‎2007 Apr 26 3:11 PM
I cannot get the extension to be executed.
it seems to not want 'multiple use' but this is derived from an implentation which is mutliple use.
‎2008 Apr 22 3:31 AM
I spent the last two days getting this working. It is really difficult but I got there in the end.
In the function module BAPI_ACC_DOCUMENT_POST in routine INIT_GLOBALS the program searches for an implementation of ACC_DOCUMENT. The filter is the document type which for this BAPI is BKPFF (two letter F's).
Later in routine CALL_BADI the methdo CHANGE is called of the implementation.
I copied the sample code from CL_EXM_IM_ACC+DOCUMENT into my Z BADI which I wittily called ZCL_IM_ACC_DOCUMENT. As I am changing the value of a field already in ACCIT I can leave the code exactly as is.
I then created my own structure (has to be all character fields regardless of the target field type in ACCIT), and filled up the extension table as follows just before calling the BAPI.
DATA: lt_extension2 TYPE STANDARD TABLE OF bapiparex
WITH HEADER LINE,
ls_extension2 TYPE zzbank_bapi_structure.
CLEAR ls_extension2.
ls_extension2-posnr = 2. "Second Item
ls_extension2-rebzg = gt_details-vbeln_vf."Invoice
ls_extension2-rebzt = 'Z'. "It's an invoice
ls_extension2-rebzz = 1. "Item
SELECT SINGLE gjahr FROM bkpf
INTO ls_extension2-rebzj
WHERE bukrs = gt_header-bukrs
AND belnr = gt_details-vbeln_vf.
The BAPI chooses ir's own posting keys, which we do not like
IF gt_details-shkzg = 'S'."Normal
ls_extension2-bschl = '15'."Incoming Customer Payment
ELSE.
ls_extension2-bschl = '05'."Outgoing Customer Payment
ENDIF.
lt_extension2-structure = 'ZZBANK_BAPI_STRUCTURE'.
lt_extension2-valuepart1 = ls_extension2.
APPEND lt_extension2.
The trick with BADIS is not just to activate the class but also the implemenation. I forget the second part every time.
Hope this helps.
Cheersy Cheers
Paul
‎2009 Oct 26 10:30 AM
Hi Paul Hardy and Dear Experties,
I am new with BAPI and BADIs thingi.....I am using BAPI_ACC_DOCUMENT_POST, I need to pass an additional value SESSION NAME in BSEG.
Please guide me step by step on how I can pass entered value in table EXTENSION2 into BSEG.
Appreciate if anyone can give complete coding sample in BAPI and how to get into BADI for the code changes.
kibam
‎2007 May 16 9:22 AM
Hello Mr. Morrissey,
I habe read your blog and I want to offer you a project. I am looking for a ABAP developer (freelancer), if you are interested in, please contact me. Thank you.
With kind regards,
Andrea Kuschereitz
Resourcer
GFT Resource Management GmbH
Elisabethstraße 44-46
D-40217 Düsseldorf
T +49-211 863266-10
F +49-211 863266-11
Andrea.Kuschereitz@gft.com