Tuesday, December 14, 2004

[BPS] Function Exit with self define parameters

FUNCTION Y_BPS_USEREXIT_SYSTEM_LOG.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(I_AREA) TYPE UPC_Y_AREA
*" VALUE(I_PLEVEL) TYPE UPC_Y_PLEVEL
*" VALUE(I_METHOD) TYPE UPC_Y_METHOD
*" VALUE(I_PARAM) TYPE UPC_Y_PARAM
*" VALUE(I_PACKAGE) TYPE UPC_Y_PACKAGE
*" VALUE(IT_EXITP) TYPE UPF_YT_EXITP OPTIONAL
*" VALUE(ITO_CHASEL) TYPE UPC_YTO_CHASEL OPTIONAL
*" VALUE(ITO_CHA) TYPE UPC_YTO_CHA OPTIONAL
*" VALUE(ITO_KYF) TYPE UPC_YTO_KYF OPTIONAL
*" EXPORTING
*" VALUE(ET_MESG) TYPE UPC_YT_MESG
*" CHANGING
*" REFERENCE(XTH_DATA) TYPE HASHED TABLE
*"----------------------------------------------------------------------
DATA:
SEL_AREA TYPE UPC_Y_AREA,
SEL_VAR TYPE UPC_Y_VARIABLE,
SEL_LOG1(60) TYPE C,
SEL_LOG2(60) TYPE C,
W_VAR(60) TYPE C.
data:
"ODS table name
RECORDS type i,
ls_data type /BIC/AODSBPS9000,
lt_data type table of /BIC/AODSBPS9000 with default key.
data: W_IT_EXITP TYPE UPF_YT_EXITP WITH HEADER LINE.
data: ITAB_2 TYPE upc_yto_charsel with header line.
DATA LS_CHARSEL TYPE UPC_YS_CHARSEL.
data i_line type i.
LOOP AT IT_EXITP INTO W_IT_EXITP.
CASE W_IT_EXITP-PARNM.
WHEN 'AREA'.
SEL_AREA = W_IT_EXITP-CHAVL.
WHEN 'VARIABLE'.
SEL_VAR = W_IT_EXITP-CHAVL.
WHEN 'TXT1'.
SEL_LOG1 = W_IT_EXITP-CHAVL.
WHEN 'TXT2'.
SEL_LOG2 = W_IT_EXITP-CHAVL.
ENDCASE.
ENDLOOP.

CALL FUNCTION 'Y_BPS_VAR_GET_DETAIL'
EXPORTING
I_AREA = SEL_AREA
I_VARIABLE = SEL_VAR
* I_BUFFER =
IMPORTING
E_SUBRC = L_SUBRC
ES_RETURN = L_RETURN
E_TYPE = L_TYPE
ETO_VARSEL_ALL = L_VARSEL_ALL " all select value
ETO_VARSEL = L_VARSEL " selected value
ETO_CHANM = L_CHANM.

DESCRIBE TABLE L_VARSEL LINES i_line.
if i_line = 1.
loop at L_VARSEL_ALL into itab_2.
W_VAR = ITAB_2-LOW.
clear ls_data.
ls_data-/BIC/BPSAREA = SEL_AREA.
ls_data-/BIC/BPSLOGD = sy-datum.
ls_data-/BIC/BPSLOGT = sy-uzeit.
ls_data-/BIC/BPSUSER = SY-UNAME.
ls_data-/BIC/BPSLOG1 = SEL_LOG1.
CONCATENATE SEL_LOG2 W_VAR INTO ls_data-/BIC/BPSLOG2.
collect ls_data into lt_data.
CALL FUNCTION 'RSDRI_ODSO_INSERT'
EXPORTING
I_ODSOBJECT = 'ODSBPS90'
I_T_INSERT = lt_data
IMPORTING
E_RECORDS = RECORDS.
endloop.
ENDIF.



* break bwabap01.

ENDFUNCTION.

0 Comments:

Post a Comment

<< Home