07-11-2006 4:10 PM
Hello!
I need to find a place, exit or BADI, where any transaction that creates or changes the classification of a batch passes by.
The goal is to have the classification of the batch, in order to copy it to Z table where the values will be available directly by batch number. Like this the performance will increase, because there's no need to use SAP functions that read it, using IBIN, AUSP, INOB...
I'm working with version 470.
Thanks!
07-11-2006 4:30 PM
I think this access don´t have performances issues:
CLEAR: cuobj, klart.
klart = '023'.
SELECT SINGLE cuobj_bm FROM mch1 INTO cuobj
WHERE matnr = matnr
AND charg = charg.
CHECK NOT cuobj IS INITIAL.
SELECT * FROM ausp INTO TABLE t_ausp
WHERE objek = cuobj
AND klart = klart
AND datuv LE sy-datum
AND lkenz = space.
07-11-2006 4:30 PM
I think this access don´t have performances issues:
CLEAR: cuobj, klart.
klart = '023'.
SELECT SINGLE cuobj_bm FROM mch1 INTO cuobj
WHERE matnr = matnr
AND charg = charg.
CHECK NOT cuobj IS INITIAL.
SELECT * FROM ausp INTO TABLE t_ausp
WHERE objek = cuobj
AND klart = klart
AND datuv LE sy-datum
AND lkenz = space.
07-11-2006 5:41 PM
Hi Peluka,
You are right this access is not very bad when performed for a batch. But we have millions of batches, each one with more then 30 characteristics, that's why we want to kept some of the characteristics in a Z table and make a select only by batch number!
07-25-2006 10:47 AM
Found the soluction!
Using BADI MB_DOCUMENT_BADI and method MB_DOCUMENT_BEFORE_UPDATE I can get the classifiction used on a material document.
METHOD IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_BEFORE_UPDATE .
CONSTANTS: c_ausp(25) VALUE '(SAPLCLFM)ALLAUSP[]'.
DATA: l_ausp TYPE rmclausp,
lt_ausp TYPE TABLE OF rmclausp,
l_zmmmcha TYPE zmmmcha,
l_mseg TYPE mseg.
DATA: BEGIN OF l_batch_class,
atnam TYPE atnam,
atwrt TYPE atwrt,
atflv TYPE atflv,
END OF l_batch_class.
DATA: lt_batch_class LIKE TABLE OF l_batch_class.
FIELD-SYMBOLS: <ausp> LIKE lt_ausp.
LOOP AT xmseg INTO l_mseg.
get batch classification
ASSIGN (c_ausp) TO <ausp>.
pass the information to temporary internal table
LOOP AT <ausp> INTO l_ausp.
CALL FUNCTION 'CONVERSION_EXIT_ATINN_OUTPUT'
EXPORTING
input = l_ausp-atinn
IMPORTING
output = l_batch_class-atnam.
l_batch_class-atwrt = l_ausp-atwrt.
l_batch_class-atflv = l_ausp-atflv.
APPEND l_batch_class TO lt_batch_class.
CLEAR: l_batch_class.
ENDLOOP.
l_zmmmcha-matnr = l_mseg-matnr.
l_zmmmcha-werks = l_mseg-werks.
l_zmmmcha-charg = l_mseg-charg.
LOOP AT lt_batch_class INTO l_batch_class.
CASE l_batch_class-atnam.
...
ENDCASE.
INSERT zmmmcha VALUES l_zmmmcha.
ENDLOOP.
ENDMETHOD.
04-23-2007 5:51 AM
U CAN USE FUNCTIONAL MODULE
QC01_BATCH_VALUES_READ
IMPORTING
*" VALUE(I_VAL_MATNR) LIKE MARA-MATNR
*" VALUE(I_VAL_WERKS) LIKE VBDPL-WERKS OPTIONAL
*" VALUE(I_VAL_CHARGE) LIKE VBDPL-CHARG
*" VALUE(I_LANGUAGE) LIKE SY-LANGU DEFAULT SY-LANGU
*" VALUE(I_DATE) LIKE SY-DATUM DEFAULT SY-DATUM
*" EXPORTING
*" VALUE(E_CLASS) LIKE KLAH-CLASS
*" VALUE(E_CLASS_TYPE) LIKE KLAH-KLART
*" TABLES
*" T_VAL_TAB STRUCTURE API_VALI OPTIONAL
*" T_CHAR_TAB STRUCTURE API_CHAR OPTIONAL
*" T_ATT_TAB STRUCTURE API_CH_ATT OPTIONAL
*" EXCEPTIONS
*" NO_CLASS
*" INTERNAL_ERROR
*" NO_VALUES
*" NO_CHARS
04-23-2007 5:54 AM