06-03-2005 5:56 PM
Hi Guys
I have a small query...Please suggest
My requirement is in one of the screen field I want to show five different values to the user (E.g 1,2,3,4,5) but user should be able to enter only two values in the screen(E.g 1 or 2).Other values are set by another program.
Please suggest how to achieve this in a best way.
Thanks and Regards
Panda
06-03-2005 6:17 PM
Hi,
For example, for restricting material types, try this:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MTART-LOW.
PERFORM HELP_TIPOS_MATERIAL.
...
&----
&----
*----
FORM HELP_TIPOS_MATERIAL.
Internal table
DATA: H_FIELD_TAB LIKE DFIES OCCURS 0 WITH HEADER LINE.
Material Type
CLEAR H_FIELD_TAB.
H_FIELD_TAB-TABNAME = 'GT_TIPOS_MAT'.
H_FIELD_TAB-FIELDNAME = 'MTART'.
H_FIELD_TAB-POSITION = '0001'.
H_FIELD_TAB-OFFSET = '0'.
H_FIELD_TAB-LENG = '4'.
H_FIELD_TAB-OUTPUTLEN = '4'.
H_FIELD_TAB-INTLEN = '4'.
APPEND H_FIELD_TAB.
Material Type Description
CLEAR H_FIELD_TAB.
H_FIELD_TAB-TABNAME = 'GT_TIPOS_MAT'.
H_FIELD_TAB-FIELDNAME = 'MTBEZ'.
H_FIELD_TAB-POSITION = '0002'.
H_FIELD_TAB-OFFSET = '4'.
H_FIELD_TAB-LENG = '25'.
H_FIELD_TAB-OUTPUTLEN = '25'.
H_FIELD_TAB-INTLEN = '25'.
APPEND H_FIELD_TAB.
Show the values that you choosen in GT_TIPOS_MAT
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MTART' "Campo a recuperar
DYNPPROG = 'ZMM_RPT_DEPURAR_MATERIALES'
DYNPNR = '1000' "Dynpro number
DYNPROFIELD = 'S_MTART' "Target Field
VALUE_ORG = 'S'
TABLES
VALUE_TAB = GT_TIPOS_MAT "Value Table
FIELD_TAB = H_FIELD_TAB
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " HELP_TIPOS_MATERIAL
*********************************************************
Interna Table GT_TIPOS_MAT has the structure
BEGIN OF TIPO_MATERIAL,
MTART LIKE T134-MTART,
MTBEZ LIKE T134T-MTBEZ,
END OF TIPO_MATERIAL.
and you must have filled it before with the values you want.