cancel
Showing results for 
Search instead for 
Did you mean: 

BADI vs Script logic

former_member200880
Participant
0 Kudos

Dear All

When do we prefer to use BADI from Script logic.

We got to know that every calculation can be done by script logic. Then why BADI/Store procedures being used.

i have read that script logic gets compiled and queries back to DB server and hence time taking and resource utilization making more time.

While BADI/Stored procedures stay in DB itself and hence round time gets reduced with less utilization.

is that the above justification correct? if so, is there any technical preferences to BADI from using SCript logic?

Also I belive that stored procedures, BADI would stay in DB server itself.

While Script logic file stays in Application server on in DB.. [correct me if it the above statement is wrong]

Please let me know.

thanks

Prasad

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi Prasad,

You have to use badi in case performance of script logic is not acceptable or in some cases where the limitations of script logic will not allow you to implement business logic.

But don't mix badi and stored procedure, the last is another story (for BPC MS). Badi is also executed in the same place as script (not on the DB level). Script logic is spending time for code interpretation and generation of abap equivalent. BADI is written on ABAP.

Vadim

former_member200880
Participant
0 Kudos


hi Vadim

thanks for explaination.

yeah I dont mix badi with store procedures as stored procedures related to BPC MS.

so do you mean BADI/Script both execute in application layer?? but the difference only is script logic is needs to be interprested and converted to BADI and hence time taking.. [am i right?]

physically where do BADI stay? is it in applicatino server/ or DB? i belive script logic stay in application server->webfolders.

thanks

Prasad

former_member186338
Active Contributor
0 Kudos

Hi Prasad,

I doesn't matter where the script file is stored, the question is how it's executed:

Example of script:

//All statements here have to be interpreted and ABAP code will be generated for REC

*XDIM_MEMBERSET ACCOUNT=AC1

*WHEN ACCOUNT

*IS *

*REC(EXPRESSION=%VALUE%*1.07)

*ENWHEN

//Then we have BADI call - badi ABAP will be executed with parameter passed

*START_BADI SOMEBADI

QUERY = ON

WRITE = ON

PERCENTAGE = 0.07

*END_BADI

But at the end final ABAP code will be executed in the same place.

Vadim

former_member186338
Active Contributor
0 Kudos

P.S. Just look on the code of the function: UJK_SCRIPT_LOGIC_EXECUTE ...

Answers (1)

Answers (1)

former_member210696
Active Contributor
0 Kudos

Prasad,

There are several existing threads on BADI Vs Script Logic. Have you gone through them already?

We got to know that every calculation can be done by script logic. - Not true, there could be some requirements who simply can't be met by the use of script logic.


Script Logic calculation executes in application layer and performance may be impacted.


In general, BADIs are faster than script logic. Please search on SDN forums and you will get numerous threads.


Regards,

Ashish