2016 Jan 25 7:20 AM
Hi all,
My requirement is to create a functional module to check the remaining no.of days when UD is accepted.... Is there any FM for reference so that I can create my required FM.
Regards...
Hi all,
My requirement is to create a functional module to check the remaining no.of days when UD is accepted.... Is there any FM for reference so that I can create my required FM.
Regards...
2016 Jan 25 7:30 AM
2016 Jan 27 6:55 AM
Hi Elzkie,
Thanks for your inputs,
am completely unaware of how to use user exit and BADI ,I have never worked on it, Could you explain me in detail how to use this for checking shelf life expiration in a FM.
Thanks& Regards,
Sanjay
2016 Jan 25 7:58 AM
A simple select on batch master will give you date and subtract from your current date? Why do you need FM etc?
Thanks
Nabheet
2016 Jan 25 9:47 AM
Hi nabheet,
Thanks for your time...
When UD is saved with Accepted status in qa32 I should check the shelf remaining days is < 30 or not,if it is < 30,I should display an error message already there is a function module to check Inspection lot , in same way I need to create FM to check the remaining shelf days
Regards.
Sanjay.
2016 Jan 25 12:37 PM
Hi
This is the FM source code for checking Inspection lot, now I need to check for remaining shelf days less than 30 or not and to throw an error message am confused with the tables and fields for shelf days .
TYPES : BEGIN OF ty_mch1,
matnr TYPE mch1-matnr,
charg TYPE mch1-charg,
vfdat TYPE mch1-vfdat,
cuobj_bm TYPE mch1-cuobj_bm,
END OF ty_mch1.
DATA : lt_mch1 TYPE STANDARD TABLE OF ty_mch1,
lwa_mch1 LIKE LINE OF lt_mch1,
CONSTANTS : a_code TYPE qave-vcode VALUE 'A',
batch_char TYPE i VALUE 30,
* char_name(30) TYPE c VALUE 'LOBM_RLZ'.
char_name(30) TYPE c VALUE 'BATCH_SHELF_LIFE_DAYS'.
check sy-batch is initial.
SELECT matnr
charg
vfdat
cuobj_bm
FROM mch1 INTO TABLE lt_mch1
WHERE matnr EQ i_qals-matnr
AND charg EQ i_qals-charg.
IF NOT lt_mch1 IS INITIAL.
SORT lt_mch1 BY matnr charg.
LOOP AT lt_mch1 INTO lwa_mch1.
CALL FUNCTION 'VB_BATCH_VALUES_FOR_OUTPUT'
EXPORTING
material = lwa_mch1-matnr
* PLANT =
batch = lwa_mch1-charg
batch_cuobj = lwa_mch1-cuobj_bm
language = sy-langu
TABLES
* OBJECTS = objects
classification = classification
EXCEPTIONS
no_classification_data = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDLOOP.
*CHECK THE CONDITION USAGE CODE IS EQUAL TO 'A' OR NOT
IF i_qave-vcode EQ a_code.
READ TABLE classification INTO lwa_class WITH KEY atnam = char_name.
SHIFT lwa_class-atwrt RIGHT.
batch_value = lwa_class-atwrt(4).
IF NOT lwa_mch1-vfdat IS INITIAL.
IF batch_value GT batch_char.
* IF NOT lwa_mch1-vfdat IS INITIAL.
MESSAGE 'USER DECISION SAVED' TYPE 'I'.
ELSE.
2016 Jan 27 12:33 PM
Hi all,
Any suggestions ?? Am still struggling with this...
Regards,
Sanjay
2016 Jan 27 2:07 PM
Hi Sai,
Have you tried looking at RM07MMHD (tcode mb5m) and see if there is something there that you can leverage to create your FM?
Just looking through that program i picked up on a couple of database views that may come in handy like V_MMIM_LC
Geoffery
2016 Jan 28 9:16 AM
Hi Geoffrey..
Thanks for your time ....
i just coded like below for my requirement, I found no.of shelf days in LOBM_RLZ
TYPES : BEGIN OF ty_mch1,
matnr TYPE mch1-matnr,
charg TYPE mch1-charg,
vfdat TYPE mch1-vfdat,
cuobj_bm TYPE mch1-cuobj_bm,
END OF ty_mch1.
*INTERNAL TABLE TO BATCH TABLE
DATA : lt_mch1 TYPE STANDARD TABLE OF ty_mch1,
lwa_mch1 LIKE LINE OF lt_mch1,
*CLASSIFICATION DECLARATIONS
classification TYPE TABLE OF conf_out,
lwa_class TYPE conf_out,
batch_value TYPE i.
"characteristic TYPE TABLE OF cabnt,
"lwa_char TYPE cabnt.
*CONSTANTS TO CHECK THE USAGE CODE AND BATCH CLASSIFICATION VALUE
CONSTANTS : a_code TYPE qave-vcode VALUE 'A',
b_code TYPE qals-vfdat VALUE 'SY-DATUM',
batch_char TYPE i VALUE 30,
char_name1(30) TYPE c VALUE 'LOBM_RLZ',
char_name(30) TYPE c VALUE 'BATCH_SHELF_LIFE_DAYS'.
DATA: l_w_answer TYPE c.
* Restrict this only for foreground process
CHECK sy-batch IS INITIAL.
*if not i_qals is initial.
SELECT matnr
charg
vfdat
cuobj_bm
FROM mch1 INTO TABLE lt_mch1
WHERE matnr EQ i_qals-matnr
AND charg EQ i_qals-charg.
" AND vfdat EQ i_qals-vfdat.
IF NOT lt_mch1 IS INITIAL.
SORT lt_mch1 BY matnr charg vfdat.
LOOP AT lt_mch1 INTO lwa_mch1.
*THIS FUNCTION MODULE IS TO GET THE CLASSIFICATION DETAILS WITH THE VALUES MATERIAL,BATCH AND BATCH OBJECT
CALL FUNCTION 'VB_BATCH_VALUES_FOR_OUTPUT'
EXPORTING
material = lwa_mch1-matnr
* PLANT =
batch = lwa_mch1-charg
batch_cuobj = lwa_mch1-cuobj_bm
language = sy-langu
TABLES
* OBJECTS = objects
classification = classification
EXCEPTIONS
no_classification_data = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDLOOP.
*CHECK THE CONDITION USAGE CODE IS EQUAL TO 'A' OR NOT
IF i_qave-vcode EQ a_code.
READ TABLE classification INTO lwa_class WITH KEY atnam = char_name.
SHIFT lwa_class-atwrt RIGHT.
batch_value = lwa_class-atwrt(4).
IF NOT lwa_mch1-vfdat IS INITIAL.
IF batch_value GT batch_char.
* IF NOT lwa_mch1-vfdat IS INITIAL.
MESSAGE 'USER DECISION SAVED' TYPE 'I'.
ELSE.
* to raise a popup to display batch characterstic value is less than 30
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = text-003
* DIAGNOSE_OBJECT = ' '
text_question = text-001
text_button_1 = 'Ok'
* ICON_BUTTON_1 = ' '
* TEXT_BUTTON_2 = ''
* ICON_BUTTON_2 = ' '
default_button = '1'
display_cancel_button = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
popup_type = 'E'
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
answer = l_w_answer
* TABLES
* PARAMETER =
* EXCEPTIONS
* TEXT_NOT_FOUND = 1
* OTHERS = 2
.
IF l_w_answer IS NOT INITIAL.
LEAVE TO SCREEN '0'.
ENDIF.
ENDIF.
"TO CHECK NO. DAYS < 30 OR NOT.
* IF i_qals-vfdat EQ b_code.
READ TABLE classification INTO lwa_class WITH KEY atnam = char_name1.
SHIFT lwa_class-atwrt RIGHT.
batch_value = lwa_class-atwrt(4).
* IF NOT lwa_mch1-vfdat IS INITIAL.
IF batch_value LT '30'.
* IF NOT lwa_mch1-vfdat IS INITIAL.
MESSAGE 'The remaining shelf days is less than 30' TYPE 'E'.
* ELSE.
** TO DISPLAY POPUP MESSAGE 'SLED IS NOT THERE' TYPE 'I'.
* CALL FUNCTION 'POPUP_TO_CONFIRM'
* EXPORTING
* titlebar = text-003
** DIAGNOSE_OBJECT = ' '
* text_question = text-005
* text_button_1 = 'Ok'
** ICON_BUTTON_1 = ' '
** TEXT_BUTTON_2 = ''
** ICON_BUTTON_2 = ' '
* default_button = '1'
* display_cancel_button = 'X'
** USERDEFINED_F1_HELP = ' '
** START_COLUMN = 25
** START_ROW = 6
* popup_type = 'E'
** IV_QUICKINFO_BUTTON_1 = ' '
** IV_QUICKINFO_BUTTON_2 = ' '
* IMPORTING
* answer = l_w_answer
** TABLES
** PARAMETER =
** EXCEPTIONS
** TEXT_NOT_FOUND = 1
** OTHERS = 2
* .
*
* IF l_w_answer IS NOT INITIAL.
* LEAVE TO SCREEN '0'.
* ENDIF.
* CALL FUNCTION 'POPUP_FOR_INTERACTION'
* EXPORTING
* headline = text-003
* text1 = text-005
* ticon = 'E'
* button_1 = text-004.
** MESSAGE I001(00) WITH text-001 DISPLAY LIKE 'E'.
** MESSAGE 'batch characterstics is less than 30' TYPE 'W' ."DISPLAY LIKE 'W'.
* LEAVE TO SCREEN '0'.
ENDIF.
* ELSE.
* MESSAGE i001(00) WITH text-002 DISPLAY LIKE 'E'.
*IF USAGE CODE IS <> A AND BATCH CLASSIFICATION VALUE IS <30 AND VFDAT IS INITIAL THEN RAISE A MESSAGE
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = text-003
* DIAGNOSE_OBJECT = ' '
text_question = text-002
text_button_1 = 'Ok'
* ICON_BUTTON_1 = ' '
* TEXT_BUTTON_2 = ''
* ICON_BUTTON_2 = ' '
default_button = '1'
display_cancel_button = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
popup_type = 'E'
* IV_QUICKINFO_BUTTON_1 = ' '
* IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
answer = l_w_answer
* TABLES
* PARAMETER =
* EXCEPTIONS
* TEXT_NOT_FOUND = 1
* OTHERS = 2
.
IF l_w_answer IS NOT INITIAL.
LEAVE TO SCREEN '0'.
ENDIF.
* CALL FUNCTION 'POPUP_FOR_INTERACTION'
* EXPORTING
* headline = text-003
* text1 = text-002
* ticon = 'E'
* button_1 = text-004.
* LEAVE TO SCREEN '0'.
ENDIF.
ENDIF.
ENDIF.
* ENDIF.
* ENDIF.
now in SPRO for quality management when I give this FM name i got this strange error....
"Function module does not have E_SUBRC parameter "
any idea what went wrong and how to solve this??
2016 Jan 29 5:16 AM
Hi,
If the FM is to be inserted into a SPRO step, then it probably has to have a predefined signature (= inputs, outputs and exceptions). I'm guessing one of those outputs is E_SUBRC.
You need to find a sample FM and copy it, then add your code to it. Check the help text in the SPRO step.
cheers
Paul
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |