2007 May 10 4:43 PM
Hi,
I have custom module pool with 5 screens. The fields displayed in the screen are from table MARA.
and also i have custom table with following fields
MATERIAL TYPE
FIELD NAME
FIELD NAME1
while user press SAVE button, then i need to validate screen field from module pool with above mentioned table.
ie in screen i have field MDESC with material type 01, in the custom table i have an entry like this way
01 MDESC
then the screen field MDESC in module pool is mandatory.
How to do this? This validation need to done only on SAVE
aRs
Hi,
I have custom module pool with 5 screens. The fields displayed in the screen are from table MARA.
and also i have custom table with following fields
MATERIAL TYPE
FIELD NAME
FIELD NAME1
while user press SAVE button, then i need to validate screen field from module pool with above mentioned table.
ie in screen i have field MDESC with material type 01, in the custom table i have an entry like this way
01 MDESC
then the screen field MDESC in module pool is mandatory.
How to do this? This validation need to done only on SAVE
aRs
2007 May 10 4:46 PM
HI,
Try this logic..
IN PAI...
If sy-ucomm = 'OSAV'.
Chain.
do ur validation on screen.
check for ur fields.
if mtype = '01'.
if mdesc is initial.
message: 'Field is mandatory'.
endif.
endif.
Endchain.
Endif.
Regards
SAB
2007 May 10 4:48 PM
Hi,
In your custom table you will have the values to make it mandatory or not right??
Thanks,
Naren
2007 May 10 4:49 PM
Hi
LOOP AT SCREEN.
SELECT SINGLE * FROM ZTABLE WHERE MATERIAL_TYPE = <....>
AND FIELDNAME = SCREEN-FIELD.
IF SY-SUBRC = 0.
* --> DO your validation
ENDIF.
ENDLOOP.Max
2007 May 10 4:56 PM
Naren,
In my custom table i have only material type and fieldname. Actually my requirement is if the screen field is not filled then system should check the custom table whether the fieldname is found, then that field in the screen is mandatory.
Thanks
aRs
2007 May 10 5:05 PM
Hi,
Okay...I have assumed that for material type 01 you will have more than one field that requires to be mandatory..
Check this..
Create a module in PAI..
MODULE USER_COMMAND INPUT.
CASE sy-ucomm.
WHEN 'SAVE'. <b>" Function code for save..</b>
<b>* Get the values from the custom table ZTABLE and move it to the internal table
T_ZTABLE</b>
SELECT * FROM ZTABLE
INTO TABLE T_ZTABLE
WHERE MATERIAL_TYPE = '01'. " I am assuming 01
<b>* Process the records.</b>
LOOP AT T_ZTABLE.
<b>* Get the field value dynamically</b>
ASSIGN (T_ZTABLE-FIELDNAME) TO <FS>.
CHECK sy-subrc = 0.
IF <FS> IS INITIAL.
<b>* Error message..the field is mandatory.</b>
MESSAGE E208(00) WITH T_ZTABLE-FIELDNAME ' Is required'.
ENDIF.
ENDLOOP.
ENDMODULE.
Hope this helps.
Thanks,
Naren
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |