Vendor code addition in FBL3N report using Business Transaction Events (BTE)
Vendor code addition in FBL3N report using Business Transaction Events (BTE)
Requirement – Business requirement is to display vendor code in FBL3N report for GR-IR clearing a/c on each line item.
You can add additional field to FBL3N reports with using BTE exit.
To find a BTE, Go to transaction FIBF and follow the below path.
Use the Documentation button to see the documentation for the BTE.
Click on sample function module to see the function module for BET.
Copy the function module and create new with Z.
Implementing the BTE
Go back to transaction FIBF
Create a new product for BET active the same
Then go to below path to attached the product to Z function module which is created.
Now edit existing structure RFPOS and add the new fields as shown in screen shot.
Then add the same fields in structure RFPOSX.
After that run the program RFPOSXEXTEND from SE38.
After this you can see vendor code and names column in FBL3N.
Then write the code as per your requirement.
FUNCTION ZSAMPLE_INTERFACE_00001650.
*”———————————————————————-
*”*”Local Interface:
*” IMPORTING
*” VALUE(I_POSTAB) LIKE RFPOS STRUCTURE RFPOS
*” EXPORTING
*” VALUE(E_POSTAB) LIKE RFPOS STRUCTURE RFPOS
*”———————————————————————-
*————– Initialize Output by using the following line ———-
e_postab = i_postab.
TABLES : BSEG, LFA1.
DATA: w_name1 TYPE lfa1-name1,
w_lifnr TYPE lfa1-lifnr,
w_ebeln TYPE ekko-ebeln.
IF e_postab-blart EQ ‘WE’. “For MIGO documents
SELECT SINGLE ebeln
INTO w_ebeln
FROM bseg
WHERE belnr = e_postab-belnr
AND bukrs = e_postab-bukrs
AND gjahr = e_postab-gjahr
AND hkont = e_postab-hkont.
IF sy-subrc = 0.
SELECT SINGLE lfa1~name1
lfa1~lifnr
INTO (w_name1, w_lifnr)
FROM ekko INNER JOIN lfa1 ON ekko~lifnr = lfa1~lifnr
WHERE ekko~ebeln = w_ebeln.
IF sy-subrc = 0.
e_postab-zname = w_name1.
e_postab-zlifnr = w_lifnr.
CLEAR:w_name1,w_lifnr.
ENDIF.
ENDIF.
ELSE. “For other than MIGO doc i.e. Vendor Invoice
SELECT SINGLE lifnr
FROM bseg
INTO (e_postab-zlifnr,
e_postab-zaugbl)
WHERE bukrs = i_postab-bukrs
AND gjahr = i_postab-gjahr
AND belnr = i_postab-belnr
AND bschl IN (’31’,’21’)
AND koart = ‘K’.
* Fetching Vendor Name
SELECT SINGLE name1
FROM lfa1
INTO e_postab-zname
WHERE lifnr = e_postab-zlifnr.
ENDIF.
ENDFUNCTION.
Result : Vendor code and name is appearing in FBL3N.
Same way you can add more fields base on your requirement.
Regards,
Rohidas Shinde.
Dear Rohidas,
Thanks for the excellent documentation.
We have one issue. We are not able to create Event 00001650. We have 00001649 & 00001651 in our system. How to create or activate this event.
Thanks in advance
Regards
ACR.Ruben
Hi,
Go to transaction FIBF & follow the below path.
Then click on new entries.
In F4 help you will find the 00001650 event. Select the entry and save the record.
Other wise check the entry in table TBE01.
Regards,
Rohidas Shinde
Dear Rohidas Shinde,
Great,
Thanks a ton for the swift reply.
Yes it is working.
Thanks again for sharing the knowledge.
Regards
ACR.Ruben
Hi,
Thanks for Sharing, Good Document.
Hi Rohidas,
Thanks a lot this is very useful document.
Thanks Rohidas for sharing the details...
Regards,
Narin Kamuni
Also kindly go through Raymond's reply in the below thread which is suggesting to use BADi instead of an BTE from performance point of view which is more preferred.
http://scn.sap.com/thread/3582770
K.Kiran.
Thanks for sharing the doc...it is very helpful.
Regards,
Ruhul
Hi Rohidas,
I implemented 1650 BTE for FBL3N to add vendor code, name and user id in output. I appended fields in RFPOS ans RFPOSX structure as well.
All my process is running fine in foreground and get my required columns with value in output. But when I run the same FBL3N in background then it gives me appended columns without value.
I debug backgroung job ans value is coming in backend till REUSE_ALV_GRID_DISPLAY. I am not able to find any solution regarding this.
Please help me.
Thanks
Shubhanshu
Dear Rohidas,
Excellent doc!!! keep doing the good work 🙂
Thanks,
Anand
Thanks. Very helpful indeed but I had to make slight change in the code to make it work