‎2008 Sep 20 6:56 AM
Hi all,
i want to disply a field for PERIOD which will have months value 1 to 12. i want to restrict the user for those values 1 to 12 in the event AT SELECTION-SCREEN on VAR.
plz help me for that....
thanx...
‎2008 Sep 20 7:12 AM
Hi,
DATA : BEGIN OF values OCCURS 10,
period(6),
END OF values.
DATA:values_tab LIKE values OCCURS 10 WITH HEADER LINE.
data : period1(2) type c default c.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR matnr.
REFRESH values_tab.
Do 12 times.
period1 = period1 + 1.
concatenate period1 sy-datum+0(4) into values_tab-period. "this for "012008"
append values_tab.
ENDO.
note : im just giving u idea do it urself must me above code is not correctbut u try like this and append that values in values_tab table using DO.ENDDO. loop.
this is for F4 help.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'PERIOD'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'PERIOD'
value_org = 'S'
TABLES
value_tab = values_tab .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
then here u can restrict that filed aslo by
READ TABLE values_tab WITH KEY period = var. " this var is ur parameter on selction screen.
if sy-subrc <> '0'.
message 'Error' type 'E'.
endif.
by this u can restrict the user to enter correct value.
Regards,
Sanket.
‎2008 Sep 20 7:17 AM
just make it simple c i just want to restrict the user for entering the value which ic, val>=1 and val <=12.
i.e. 1 to 12. in that variable which is there in the selection-screen and its length is 2.
thanx...
‎2008 Sep 20 7:21 AM
try somthing like this.
AT SELECTION-SCREEN on VAR
if value gt 12.
error message.
endif.
‎2008 Sep 20 7:52 AM
Hi Nilesh,
Better you can create a new Domain with Values 1 to 12 (even you can enter January to December) and include that Domain in a new Data Element and then create the screen parameter/select-options using that data element.
The advantage here is you will be provided with a search help automatically without coding.
For validation. in PAI/ At Selection Screen write the following code;
IF Period LT 1 Or Period GT 12.
Message 'Error in Period Input !' Type 'E'.
ENDIF.Regards
Karthik D
‎2008 Oct 16 12:38 PM