You are on page 1of 8

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.

You might also like