Example : Enhance to check the production version if it's suject to the name rule.
run TX C223, to get the main program name:SAPLCMFV
type this program name in SE80 under program, it'll automatic turn to function group: CMFV
in the function module(FM), find a suitable function to implement the enhancement.
I choose CM_FV_PROD_VERS_SAVE_ALL.
double click on it to enter the FM, and click "enhance"(shift+f4).
goto the main menu : EDIT- enhancement operations--show implicit enhancement options
put on your cursor to the desired possition. (only the black right arrow possition can be implemented.)
here, insert your codes.
Example code:
* Check the PV number if between 0001 TO 0099
Data:
lc_flag type CHAR1 ,
wa_BAPIRET2 type BAPIRET2 .
LOOP AT GT_MKAL_Y WHERE VERID NE SPACE .
CALL FUNCTION 'Z_CA85DETERMINE_A5_E5_LOGIC'
Exporting
IV_PLANT = GT_MKAL_Y-werks
importing
ev_a5_flag = lc_flag .
IF lc_flag = 'X' and ( GT_MKAL_Y-werks ne '1600' or GT_MKAL_Y-werks NE '1700') .
call FUNCTION 'Z_FV_PROD_VERS_CHECK'
Exporting
P_VERID = GT_MKAL_Y-VERID
Importing
BAPIRET2 = wa_BAPIRET2 .
IF wa_BAPIRET2-TYPE = 'E' .
MESSAGE wa_BAPIRET2-MESSAGE type 'E'.
ENDIF .
ENDIF .
ENDLOOP .
* Check the PV number if between 0001 TO 0099
Data:
lc_flag type CHAR1 ,
wa_BAPIRET2 type BAPIRET2 .
LOOP AT GT_MKAL_Y WHERE VERID NE SPACE .
CALL FUNCTION 'Z_CA85DETERMINE_A5_E5_LOGIC'
Exporting
IV_PLANT = GT_MKAL_Y-werks
importing
ev_a5_flag = lc_flag .
IF lc_flag = 'X' and ( GT_MKAL_Y-werks ne '1600' or GT_MKAL_Y-werks NE '1700') .
call FUNCTION 'Z_FV_PROD_VERS_CHECK'
Exporting
P_VERID = GT_MKAL_Y-VERID
Importing
BAPIRET2 = wa_BAPIRET2 .
IF wa_BAPIRET2-TYPE = 'E' .
MESSAGE wa_BAPIRET2-MESSAGE type 'E'.
ENDIF .
ENDIF .
ENDLOOP .
Function module Z_FV_PROD_VERS_CHECK source code:
DATA :
lr_number type range of char4,
ls_number like line of lr_number.
ls_number-sign = 'I' .
ls_number-option = 'BT' .
ls_number-low = '0001' .
ls_number-high = '0099' .
append ls_number to lr_number.
IF P_VERID in lr_number .
BAPIRET2-TYPE = 'S' .
ELSE.
BAPIRET2-TYPE = 'E' .
BAPIRET2-MESSAGE = 'For all A5 BGs except India, the production version should between 0001 to 0099, please check your input'.
endif.
DATA :
lr_number type range of char4,
ls_number like line of lr_number.
ls_number-sign = 'I' .
ls_number-option = 'BT' .
ls_number-low = '0001' .
ls_number-high = '0099' .
append ls_number to lr_number.
IF P_VERID in lr_number .
BAPIRET2-TYPE = 'S' .
ELSE.
BAPIRET2-TYPE = 'E' .
BAPIRET2-MESSAGE = 'For all A5 BGs except India, the production version should between 0001 to 0099, please check your input'.
endif.
stucture BAPIRET2 should put in "export" as a parameter.
--
The end.
No comments:
Post a Comment