Application Development 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: 

How to validate parameters on selection-screen

Former Member

Dear All,

In my selection-screen I have Material Document No. and Material Number as parameters and I wish to validate Material No. on the basis of Material Document i.e the user should be able to input only those material nos. that belong to the material document no. to be inputted by the user. The code of my selection-screen looks like following:

PARAMETERS: P_MBLNR LIKE MSEG-MBLNR,

P_MATNR LIKE MSEG-MATNR,

P_GJAHR LIKE MSEG-GJAHR,

P_MENGE LIKE MSEG-MENGE,

Q_MENGE LIKE MSEG-MENGE,

P_SGTXT LIKE MSEG-SGTXT.

Please suggest a solution.

Regards,

Alok.

1 ACCEPTED SOLUTION

Simha_
Employee
Employee
0 Kudos

Hi,

Use <b>At selection-screen</b> event.

In this u can validate the details u want to..

Write a select query to validate the entries entered in the document number and after that validate the material number whether it is the valid one or not in the above event....

cheers,

SImha.

<b>Reward all the helpful answers.</b>

3 REPLIES 3

Simha_
Employee
Employee
0 Kudos

Hi,

Use <b>At selection-screen</b> event.

In this u can validate the details u want to..

Write a select query to validate the entries entered in the document number and after that validate the material number whether it is the valid one or not in the above event....

cheers,

SImha.

<b>Reward all the helpful answers.</b>

Former Member
0 Kudos

Alok,

With respect to your requirement, you can use a match code object in the parameter. You can attach a match code object to a parameter only if you don`t have a searchhelp attached to the material no. Hence declare your parameters as below :

Parameters : MATNR(18) type c matchcode object 'HELP'.

****Now you have to use the selection-screen event
**** declare an internal table for holding values of matnr

at selection-screen on field matnr.

select * matnr from mblnr into table it_matnr
where mblnr = p_mblnr.

*** now call function module F4IF_INT_TABLE_VALUE_REQUEST
** and this will supply values for the match code object 
*** MATNR.
Eg :

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
            RETFIELD         = 'CONNID'
            DYNPPROG         = PROGNAME
            DYNPNR           = DYNNUM
            DYNPROFIELD      = 'CONNECTION'
            VALUE_ORG        = 'S'
       TABLES
            VALUE_TAB        = VALUES_TAB.

This would solve your problem. Reward points if you`re convinced.

Regards

Former Member
0 Kudos

Hi,

As much as I understand u want a validation for the data for field2 from the values in field1.

If So,Please go throuhg the code below.

REPORT ZSM_TEST.

TABLES : MARA.

SELECTION-SCREEN BEGIN OF BLOCK B1.

PARAMETERS : S_MTART LIKE MARA-MTART OBLIGATORY.

PARAMETERS : S_MATNR LIKE MARA-MATNR OBLIGATORY MODIF ID M1.

SELECTION-SCREEN END OF BLOCK B1.

To Disable the field2(Material Code) in case the Material Type is not entered

-


AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'M1'.

IF S_MTART IS INITIAL.

SCREEN-INPUT = '0'.

ELSE.

SCREEN-INPUT = '1'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Check the data for combibation of field1 and field2

-


AT SELECTION-SCREEN.

CHECK S_MTART IS NOT INITIAL AND

S_MATNR IS NOT INITIAL.

SELECT SINGLE * FROM MARA

WHERE MTART EQ S_MTART

AND MATNR EQ S_MATNR.

IF SY-SUBRC NE 0.

MESSAGE E002(SY) WITH 'Invalid Material & Type Combination!!'.

ENDIF.

START-OF-SELECTION.

WRITE : 'BINGO'.