Skip to Content
Author's profile photo Rohidas Shinde

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.

 

Untitled.jpg

 

Untitled.jpg

 

Use the Documentation button to see the documentation for the BTE.
Untitled.jpg

 

Click on sample function module to see the function module for BET.

Untitled.jpg

 

Copy the function module and create new with Z.

Untitled.jpg

 

Implementing the BTE

Go back to transaction FIBF

Create a new product for BET active the same

Untitled.jpg

 

Untitled.jpg

 

Then go to below path to attached the product to Z function module which is created.

 

Untitled.jpg

 

Untitled.jpg

Now edit existing structure RFPOS and add the new fields as shown in screen shot.

Untitled.jpg

 

Then add the same fields in structure RFPOSX.

 

Untitled.jpg

 

 

After that run the program RFPOSXEXTEND from SE38.

After this you can see vendor code and names column in FBL3N.

 

Untitled.jpg

 

 

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.

 

Untitled.jpg

 

Same way you can add more fields base on your requirement.

 

Regards,

Rohidas Shinde.

Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      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

      Author's profile photo Rohidas Shinde
      Rohidas Shinde
      Blog Post Author

      Hi,

      Go to transaction FIBF & follow the below path.

      Untitled.jpg

      Then click on new entries.

      Untitled.jpg

      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

      Author's profile photo Former Member
      Former Member

      Dear Rohidas Shinde,

      Great,

      Thanks a ton for the swift reply.

      Yes it is working.

      Thanks again for sharing the knowledge.

      Regards

      ACR.Ruben

      Author's profile photo Former Member
      Former Member

      Hi,

      Thanks for Sharing, Good Document.

      Author's profile photo rajendhar gadipelly
      rajendhar gadipelly

      Hi Rohidas,

      Thanks a lot this is very useful document.

      Author's profile photo narin kamuni
      narin kamuni

      Thanks Rohidas for sharing the details...

      Regards,

      Narin Kamuni

      Author's profile photo Kiran K
      Kiran K

      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.

      Author's profile photo Md Ruhul Amin
      Md Ruhul Amin

      Thanks for sharing the doc...it is very helpful.

      Regards,

      Ruhul

      Author's profile photo shubhanshu Agrawal
      shubhanshu Agrawal

      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

      Author's profile photo Anand Babu V
      Anand Babu V

      Dear Rohidas,

      Excellent doc!!! keep doing the good work 🙂

      Thanks,

      Anand

      Author's profile photo Mohammed Misbahuddin
      Mohammed Misbahuddin

      Thanks. Very helpful indeed but I had to make slight change in the code to make it work

      FUNCTION ZSAMPLE_INTERFACE_00001650.
      *"----------------------------------------------------------------------
      *"*"Local Interface:
      *"  IMPORTING
      *"     VALUE(I_POSTAB) TYPE  RFPOS
      *"  EXPORTING
      *"     VALUE(E_POSTAB) LIKE  RFPOS STRUCTURE  RFPOS
      *"----------------------------------------------------------------------
        e_postab = i_postab.
      
        TABLES : BSEG, LFA1.
      
        "BREAK GMC.
      
        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)
           WHERE  bukrs = i_postab-bukrs
              AND gjahr = i_postab-gjahr
              AND belnr = i_postab-belnr
              AND bschl IN ('31', '21')           "Posting key 21 - Credit Memo, 31 - Invoice
              AND koart = 'K'.                    "Acc Type - Vendors
      
      * Fetching Vendor Name
      
          SELECT SINGLE name1
                 FROM lfa1
                 INTO e_postab-zname
                 WHERE lifnr = e_postab-zlifnr.
      
        ENDIF.
      
      ENDFUNCTION.