Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: can anyone plz help me finding a badi for FB01

Former Member
0 Kudos

hi..,

My requirement is to capture the profit center & change it w.r.to the profit center available in purchase order while posting a documet in FB01. iam trying to find a badi for this.. can anyone plz suggest me, how to proceed??? this is the first time iam dealing with badi's...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

There is a BADI: FI_HEADER_SUB_1300 available. This affects transactions FB01, FB50 (G/L account posting), FBD1, FBD5 (recurring entry of G/L account documents).

You can change the posting date (BKPF-BUDAT).

P.S. Mark points for all helpful answers.

JLN

8 REPLIES 8

Former Member
0 Kudos

just run this program u find badi related to transaction.

*&---------------------------------------------------------------------*
*& Report  ZNEGI16                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZNEGI16                                 .
TABLES : TSTC,
TADIR,
MODSAPT,
MODACT,
TRDIR,
TFDIR,
ENLFDIR,
SXS_ATTRT ,
TSTCT.

DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
DATA : FIELD1(30).
DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.

PARAMETERS : P_TCODE LIKE TSTC-TCODE,
P_PGMNA LIKE TSTC-PGMNA .




DATA wa_tadir type tadir.

START-OF-SELECTION.

IF NOT P_TCODE IS INITIAL.
SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.

ELSEIF NOT P_PGMNA IS INITIAL.
TSTC-PGMNA = P_PGMNA.
ENDIF.

IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'PROG'
AND OBJ_NAME = TSTC-PGMNA.

MOVE : TADIR-DEVCLASS TO V_DEVCLASS.

IF SY-SUBRC NE 0.
SELECT SINGLE * FROM TRDIR
WHERE NAME = TSTC-PGMNA.
IF TRDIR-SUBC EQ 'F'.
SELECT SINGLE * FROM TFDIR
WHERE PNAME = TSTC-PGMNA.

SELECT SINGLE * FROM ENLFDIR
WHERE FUNCNAME = TFDIR-FUNCNAME.

SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'FUGR'
AND OBJ_NAME EQ ENLFDIR-AREA.

MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
ENDIF.
ENDIF.

SELECT * FROM TADIR INTO TABLE JTAB
WHERE PGMID = 'R3TR'
AND OBJECT in ('SMOD', 'SXSD')
AND DEVCLASS = V_DEVCLASS.


SELECT SINGLE * FROM TSTCT
WHERE SPRSL EQ SY-LANGU
AND TCODE EQ P_TCODE.

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) P_TCODE,
45(50) TSTCT-TTEXT.
SKIP.
IF NOT JTAB[] IS INITIAL.
WRITE:/(105) SY-ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.

* Sorting the internal Table
sort jtab by OBJECT.
data : wf_txt(60) type c,
wf_smod type i ,
wf_badi type i ,
wf_object2(30) type C.
clear : wf_smod, wf_badi , wf_object2.
* Get the total SMOD.




LOOP AT JTAB into wa_tadir.
at first.
FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE:/1 SY-VLINE,
2 'Enhancement/ Business Add-in',
41 SY-VLINE ,
42 'Description',
105 SY-VLINE.
WRITE:/(105) SY-ULINE.
endat.
clear wf_txt.
at new object.
if wa_tadir-object = 'SMOD'.
wf_object2 = 'Enhancement' .
elseif wa_tadir-object = 'SXSD'.
wf_object2 = ' Business Add-in'.

endif.
FORMAT COLOR COL_GROUP INTENSIFIED ON.

WRITE:/1 SY-VLINE,

2 wf_object2,
105 SY-VLINE.
endat.

case wa_tadir-object.
when 'SMOD'.
wf_smod = wf_smod + 1.
SELECT SINGLE MODTEXT into wf_txt
FROM MODSAPT
WHERE SPRSL = SY-LANGU
AND NAME = wa_tadir-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

when 'SXSD'.
* For BADis
wf_badi = wf_badi + 1 .
select single TEXT into wf_txt
from SXS_ATTRT
where sprsl = sy-langu
and EXIT_NAME = wa_tadir-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.

endcase.



WRITE:/1 SY-VLINE,
2 wa_tadir-OBJ_NAME hotspot on,
41 SY-VLINE ,
42 wf_txt,
105 SY-VLINE.
AT END OF object.
write : /(105) sy-ULINE.
ENDAT.


ENDLOOP.

WRITE:/(105) SY-ULINE.



SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No.of Exits:' , wf_smod.
WRITE:/ 'No.of BADis:' , wf_badi.

ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.

AT LINE-SELECTION.

data : wf_object type tadir-object.
clear wf_object.


GET CURSOR FIELD FIELD1.
CHECK FIELD1(8) EQ 'WA_TADIR'.
read table jtab with key obj_name = sy-lisel+1(20).
move jtab-object to wf_object.

case wf_object.
when 'SMOD'.
SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).

CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
when 'SXSD'.
SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
endcase.

0 Kudos

thnx for ur reply... i found a list of badi's. can u plz tell me how to find out the exact badi for my requirement?? do i have to put a break point in each & every method & run the transaction to know the right method????

0 Kudos

hi kishen,

thnx for the code. i got a list of badi's. to find out the exact badi, do i have to put a break-point in each & every method & test??

Former Member
0 Kudos

There are multiple ways of searching for BADI.

• Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE

• Finding BADI Using SQL Trace (TCODE-ST05).

• Finding BADI Using Repository Information System (TCODE- SE84).

1. <b>Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE</b>

Go to the Transaction, for which u want to find the BADI, Click on System->Status, Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’. Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.

The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code. Definition of Instance would give you the Interface name.

2. <b>Finding BADI Using SQL Trace (TCODE-ST05).</b>Start transaction ST05 (Performance Analysis).

Set flag field "Buffer trace". We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT). Push the button "Activate Trace".

Start transaction FB01 in a new GUI session. Do the changes and Save. Go back to the Performance trace session. Push the button "Deactivate Trace". Push the button "Display Trace".

The popup screen "Set Restrictions for Displaying Trace" appears.

Now, filter the trace on Objects:

• V_EXT_IMP

• V_EXT_ACT

Push button "Multiple selections" button behind field Objects. Fill: V_EXT_IMP and V_EXT_ACT.

All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.

So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA.

3. <b>Finding BADI Using Repository Information System (TCODE- SE84)</b>

Go to “Maintain Transaction” (TCODE- SE93).

Enter the Transaction FB01 for which you want to find BADI. Click on the Display push buttons.

Get the Package Name.

Go to TCode: SE84->Enhancements->Business Add-inns->Definition

Enter the Package Name and Execute.

Here you get a list of all the Enhancement BADI’s for the given package.

Best Regards,

Vibha

  • Reward points if it helps

Former Member
0 Kudos

use this method to find BADI

enter se24

enter cl_exithandler

click the GET_INSTANCE.

set a break point at Line number 25

Execute SAP transaction FB01

Press the button , execution would stop at break point you set.

find the value stored in variable exit_name in the debug mode

regards

vivek

<b>reward points if this helps</b>

Former Member
0 Kudos

For FI u dont have any User exits, but u have

1. Validations - GGB0 Tcode

2.Substitutions -GGB1,

3.BTEs ---FFBF.

more info , check in help.sap.com, search terms are VALIDATIONS.

also check my posting on this and have to LOOK In <b>GSBB000</b> program

regards

Prabhu

Former Member
0 Kudos

Hi,

There is a BADI: FI_HEADER_SUB_1300 available. This affects transactions FB01, FB50 (G/L account posting), FBD1, FBD5 (recurring entry of G/L account documents).

You can change the posting date (BKPF-BUDAT).

P.S. Mark points for all helpful answers.

JLN

Former Member
0 Kudos

Is there any update about this?

I have the same question about substitution...

Any one can help to answer this question?