Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

value entry in parameters

Former Member
0 Likes
1,638

hi

I have a statement like

Parameters : material type mara-matnr which actually gives me all the values that can be entered when i press F4

however i can also enter any other value....Is their a way i can force the user to enter from only those values coming in F4

9 REPLIES 9
Read only

former_member209120
Active Contributor
0 Likes
1,337

Hi Hema,

Validate using

At selection-screen on p_matnr.

example

DATA : wa_matnr TYPE mara-matnr.

PARAMETERS : p_matnr TYPE mara-matnr.

AT SELECTION-SCREEN ON  p_matnr.
   SELECT matnr FROM mara
   INTO wa_matnr
   WHERE matnr = p_matnr.
   ENDSELECT.

   IF sy-subrc NE 0.
     MESSAGE 'Wrong Material' TYPE 'E'.
   ENDIF.


Read only

Former Member
0 Likes
1,337

Hi

Only by validations

Max

Read only

Former Member
0 Likes
1,337

Hi Hema,

You should do a validation check. While execution, you can check if the value entered in the field matches an entry in MARA table with Select MATNR from MARA into LMatnr where

matnr = P_matnr ( your Parameter ).

If sy-subrc NE 0.

Message ..Not valid.

Read only

Former Member
0 Likes
1,337

Hi,

Try this below code.

At Selection screen on p_matr.

IF p_matr IS NOT INITIAL.

SELECT SINGLE matnr

                 FROM mara

                 INTO lv_matnr

                 WHERE matnr EQ p_matr.

IF sy-subrc NE 0.

"Display your error message.

ENDIF.

ENDIF.

Best Regards,

Abirami

Read only

Former Member
0 Likes
1,337

Hi,

you can do validation  for the material number(matnr)

or

Using foreign keys, you can easily create value checks for input fields

Read only

Former Member
0 Likes
1,337

Hi,

your parameters is material type?

if so, field is mara-mtart and not mara-matnr.

For Validate You can try use

AT SELECTION SCREEN on p_mtart.

Regards

Ivan

Read only

former_member220538
Active Participant
0 Likes
1,337
Hi,
Try this ,it will work.


TYPES: BEGIN OF ty_field,
       matnr TYPE matnr,
       END OF ty_field.


DATA :t_rtn TYPE STANDARD TABLE OF ddshretval,
      x_rtn TYPE  ddshretval,
      t_field TYPE STANDARD TABLE OF ty_field,
      dynpfields TYPE TABLE OF dynpread WITH HEADER LINE.

PARAMETERS: p_id(20) TYPE c MODIF ID grp.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-group1 = 'GRP'.
      screen-input   = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_id.
  SELECT DISTINCT matnr
    FROM mara
    INTO TABLE t_field
    UP TO 10 ROWS.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'P_ID'
      value_org       = 'S'
    TABLES
      value_tab       = t_field
      return_tab      = t_rtn
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
  IF sy-subrc <> 0.
  ENDIF.

  READ TABLE t_rtn INTO x_rtn INDEX 1.
  IF sy-subrc EQ 0.
    dynpfields-fieldname = 'P_ID'.
    MOVE x_rtn-fieldval TO dynpfields-fieldvalue.
    APPEND dynpfields.

    CALL FUNCTION 'DYNP_VALUES_UPDATE'
      EXPORTING
        dyname     = sy-cprog
        dynumb     = sy-dynnr
      TABLES
        dynpfields = dynpfields.

  ENDIF.

Regards,
Jeffin
Read only

Former Member
0 Likes
1,337

Hi,

Validate the parameter on AT SELECTION SCREEN ON event.

Read only

Former Member
0 Likes
1,337

Hi,

You can modify SCREEN, dynamically,in your ABAP program during the PBO event of a screen. Its contents override the static attributes of the screen fields for a single screen call.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbab6f35c111d1829f0000e829fbfe/content.htm

For this you need to write the below code in one of the MODULEs in PBO event (1000 screen of your program ).

LOOP AT SCREEN.

* you can specify IF conditions here according to your screen elements

  screen-input = 0.  " 0 will disable accepting input ; 1 will enable accepting input
MODIFY SCREEN.
ENDLOOP.

This link will be helpful to you:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbab6f35c111d1829f0000e829fbfe/content.htm