11-17-2004 6:27 AM
Does anyone have any documents on the Dos and Don'ts in BADIs, Exits and SD routines from the angle of System performance and how to minimise the load. Iam not talking about the generic Optimisation documents but something specific to SD routines and general BADIs and Exits which fall under the Best practices (coding) of SAP. eg. One guideline from SAP is that Clients should not tamper with the 'x' variables (xvbak, xvbap etc.) in the SD form exits.
Thanks,
Madhavan
11-17-2004 12:34 PM
a) do not rely on/change data which is not passed as (changing) parameters
b) do not use commit work
c) keep in mind that ue is active in every client, once the project has been actiavted.
Christian
11-17-2004 1:31 PM
Hi Madhavan,
I like to add one more suggestion.
Don't use CHECK command.
Venkat
11-18-2004 12:14 PM
Not sure why check is a problem in general however it reminds me on another tricky situation.
For exampele there is a user-exit in CO-PA
call customer-function '001'
exporting
erkrs = i_erkrs
ep_source = <ls_ce1xxxx>
ep_source_bukrs = <gs_ce_bukrs>
exit_nr = i_exit_nr
importing
ep_target = <ls_ce1xxxx>
ep_target_bukrs = <gs_ce_bukrs>
e_bukrs_processed = l_bukrs_processed
et_field = gt_field_user
tables
gt_message_table = gt_message_table
exceptions
others = 1.
as you can see <ls_ce1xxxx> is passed on ep_source and ep_target. If you have several clients but only one in which the user-exit should be active, you usually encapsulate your coding like following.
if sy-mandt = '100'.
ep_target = <changed_values>.
endif.
But in this case you will learn that in every other client the values of ep_source will be cleared if you do not add a statement like ep_target = ep_source.
before the if statement.
Christian
11-19-2004 6:48 AM
I think I can explain why 'check' statement should not be used in certain contexts in Exits. Assume the code in an Exit is as follows.
1st independent condition
check sy-tcode = 'VA01'.
....
2nd independent condition
if sy-tcode = 'VA02'.
....
endif.
Here Block 2 is expected to be executed for va02 but it never happens since the check condition for the transaction fails.
So the following code should be used.
1st independent condition
if sy-tcode = 'VA01'.
....
endif.
2nd independent condition
if sy-tcode = 'VA02'.
....
endif.
bye
Madhavan