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

Re: Output fields need to validate

Former Member
0 Likes
662

Hi Expert,

I have developed a report .In my report I have 6 fields to be display and which is currently displaying.In the selection screen i have taken three field i.e

Material number            xyz

Material category          Food

plant                             1000

o/p is with below fields

Material number      base unit of measure             division           grossweight           country                 city

                                        

                                       L                                    01                                          

my output is comming  but i have to do the validation  for fields base unit of measure and division i.e

if user enter any material in the selection screen and if he enter material type FOOD and plant 1000 then base unit of measure should be 'L'

AND division should be 01 if it is not for this two field it should throw error message like wrong values is maintain for paricular material catgory and plant in the selection screen

Any one can throw some light on this

Regards,

Am                           

Hi Expert,

I have developed a report .In my report I have 6 fields to be display and which is currently displaying.In the selection screen i have taken three field i.e

Material number            xyz

Material category          Food

plant                             1000

o/p is with below fields

Material number      base unit of measure             division           grossweight           country                 city

                                        

                                       L                                    01                                          

my output is comming  but i have to do the validation  for fields base unit of measure and division i.e

if user enter any material in the selection screen and if he enter material type FOOD and plant 1000 then base unit of measure should be 'L'

AND division should be 01 if it is not for this two field it should throw error message like wrong values is maintain for paricular material catgory and plant in the selection screen

Any one can throw some light on this

Regards,

Am                           

4 REPLIES 4
Read only

iftah_peretz
Active Contributor
0 Likes
630

Hi,

You need to do something like this:

parameters:  mat              type MATNR,
                     matcat(255) type c ,
                     plant            type werks_d.


at selection-screen.
  if matcat NE 'FOOD' AND plant  NE '1000'.
    MESSAGE ' wrong values is maintain for paricular material catgory and plant in the selection                               screen' TYPE 'E'.
  endif.

END-OF-SELECTION.

**********YOUR PROGRAM****************************************

Let me know how is this working for you,

Best,

Iftah

Read only

0 Likes
630

Hi Iftah,

It is working fine.for this report i have used the alv but my clint want to display the fields one after the another lke

Material number 276547

Plant                     1001

storage location          8765

.

.

.etc like this they want can suggest me

   Loop at it_output into wa_output.

* if ( ( wa_output-werks NE '1001' ) or ( wa_output-meins NE 'L' ) or ( wa_output-spart NE '01' ) ).
  if wa_output-werks NE '1001' or wa_output-meins NE 'L' or wa_output-spart NE '01'.
*   CONTINUE.
*   else .
* if sy-subrc ne '0'.
    message ' No Entry for field Plantc Base unit of measure division ' TYPE 'I'.
*    ENDIF.
  endif.
  stop.
ENDLOOP.




wa_fcat-col_pos = '1'.
wa_fcat-fieldname = 'MATNR '.
wa_fcat-tabname = WA_OUTPUT.
wa_fcat-seltext_m = 'Material Number'.
append wa_fcat to it_fcat.


wa_fcat-col_pos = '2'.
wa_fcat-fieldname = 'MTART '.
wa_fcat-tabname = WA_OUTPUT.
wa_fcat-seltext_m = 'Material Type'.
append wa_fcat to it_fcat.



wa_fcat-col_pos = '3'.
wa_fcat-fieldname = 'MATKL '.
wa_fcat-tabname = WA_OUTPUT.
wa_fcat-seltext_m = 'Material Group'.
append wa_fcat to it_fcat.

wa_fcat-col_pos = '4'.
wa_fcat-fieldname = 'BISMT '.
wa_fcat-tabname = WA_OUTPUT.
wa_fcat-seltext_m = 'Old Material Number'.
append wa_fcat to it_fcat.

wa_fcat-col_pos = '5'.
wa_fcat-fieldname = 'MEINS '.
wa_fcat-tabname = WA_OUTPUT.
wa_fcat-seltext_m = 'Base unit of Measure'.
append wa_fcat to it_fcat.

Regards,

Am

Read only

Former Member
0 Likes
630

Hi Antha,

Validation want to be done in the AT SELECTION-SCREEN Event.Sample code for your validation given below.

Ex:

parameters:   pa_matnr              type mara-matnr,
                         pa_mcat          type mara-attyp
,

                         pa_plant               type marc-werks.


at selection-screen.

* Fetch the Data Record From the Table using input data

select * from Table Name

                         into itab

                          where matnr = pa_matnr

                          and     attyp   = pa_mcat

                          and     werks = pa_plant.

                         

* Checking Data Record available for user input

if itab is not initial.

* In the Internal Table, reading the Unit of Measure Data to check.
  read table itab into wa

                                    with key attyp = pa_mcat "'FOOD' 

                                                   werks  = pa_plant "'1000'.

if sy-subrc.

* Checking the Unit Of Measure.

if wa-unit ne 'L'.

    MESSAGE ' wrong values is maintain for paricular material catgory and plant in the selection                                                 screen' TYPE 'E'.
  endif.

endif.

else.

* Error Message No Records Found.

MESSAGE "No Records" Type 'E'.

endif.

Kind Regards,

Balaji

Read only

RaymondGiuseppi
Active Contributor
0 Likes
630

You have to perform the select and raise message error in AT SELECTION-SCREEN (PAI events).

If you want that all fields are input allowed after display of message error, put them in a SELECTION-SCREEN BEGIN/END OF BLOCK and use the event AT SELECTION-SCREEN ON BLOCK.

If you want the check to be performed only when user has clicked on run icon, put the test in a IF SSCRFIELDS-UCOMM = 'ONLI'/ENDIF block.

Regards,

Raymond