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

validating PARAMETERS

Former Member
0 Likes
858

FOLKS..

where n how can we validate a field which is declared by using PARAMETERS??

reg

zid.

6 REPLIES 6
Read only

Former Member
0 Likes
736

if u want to check whether the parameter p_vbeln is initial.

At selection-screen on p_vbeln.

if p_vbeln is initial.

message s000(ZLES) with text-001.

else.

select single vbeln from vbak into l_vbeln

where vbeln = p_vbeln.

if sy-subrc = 0.

else.

exit.

endif.

Read only

Former Member
0 Likes
736

Hi,

U can validate input fields using javascript.Write OnClientClick function for that submit button if ur using htmlb or onClick if u r using html.Refer the follows

http://help.sap.com/saphelp_nw70/helpdata/en/03/900e41a346ef6fe10000000a1550b0/frameset.htm

There are two ways to achieve ur task.

1.By checking for all alphabets.in this u need check all the alphabetic characters one by one.Refer the following

http://www.shiningstar.net/articles/articles/javascript/javascriptvalidations.asp?ID=ROLLA

http://www.shiningstar.net/articles/articles/javascript/checkNumeric.asp?ID=AW

2.By using regular expressions.its very easy and a single line code.here u need to specify single expression for whole alphabets.Refer this

http://aspzone.com/blogs/john/articles/173.aspx

Everything has been given for validating in javascript.i hope u also validating in javascript only.

For more details on "Regular expressions" search google.

(Refer reply from Luis)

<b>Reward points if useful</b>

Regards

Ashu

Read only

Former Member
0 Likes
736

use event

at selection-screen.

if p_matnr ne '123GA'.

message ' wrong entry' type 'E'.

endif.

start-of-selection.

regards

shiba dutta

Read only

Former Member
0 Likes
736

You can validate it normally like any other field. Most often the validation is done in the event AT SELECTION-SCREEN.

Regards,

Manoj

Read only

Former Member
0 Likes
736

Here is the sample code for Validating Select-Options.

You can develop a similar logic for Parameters.....

*"Selection screen elements............................................

SELECT-OPTIONS:

S_EBELN FOR EKKO-EBELN, " Purchasing Document Number

S_LIFNR FOR EKKO-LIFNR, " Vendor's account number

S_EKGRP FOR EKKO-EKGRP, " Purchasing group

S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date

S_UDATE FOR CDHDR-UDATE. " Creation date of the change

" document

"----


  • AT SELECTION-SCREEN EVENT *

"----


AT SELECTION-SCREEN ON S_EBELN.

  • Subroutine to validate Purchase Document Number.

PERFORM VALIDATE_PD_NUM.

AT SELECTION-SCREEN ON S_LIFNR.

  • Subroutine to validate Vendor Number.

PERFORM VALIDATE_VEN_NUM.

AT SELECTION-SCREEN ON S_EKGRP.

  • Subroutine to validate Purchase Group.

PERFORM VALIDATE_PUR_GRP.

&----


*& Form VALIDATE_PD_NUM

&----


  • Subroutine to validate Purchase Document Number

----


  • There are no interface parameters to be passed to this subroutine.

----


FORM VALIDATE_PD_NUM .

IF NOT S_EBELN[] IS INITIAL.

SELECT EBELN " Purchase Document Number

FROM EKKO

INTO W_EBELN

UP TO 1 ROWS

WHERE EBELN IN S_EBELN.

ENDSELECT.

IF SY-SUBRC NE 0.

CLEAR SSCRFIELDS-UCOMM.

MESSAGE E717(M8).

ENDIF. " IF SY-SUBRC NE 0

ENDIF. " IF NOT S_EBELN[]...

ENDFORM. " VALIDATE_PD_NUM

&----


*& Form VALIDATE_VEN_NUM

&----


  • Subroutine to validate Vendor Number

----


  • There are no interface parameters to be passed to this subroutine.

----


FORM VALIDATE_VEN_NUM .

IF NOT S_LIFNR[] IS INITIAL.

SELECT LIFNR " Vendor Number

FROM LFA1

INTO W_LIFNR

UP TO 1 ROWS

WHERE LIFNR IN S_LIFNR.

ENDSELECT.

IF SY-SUBRC NE 0.

CLEAR SSCRFIELDS-UCOMM.

MESSAGE E002(M8) WITH W_SPACE.

ENDIF. " IF SY-SUBRC NE 0

ENDIF. " IF NOT S_LIFNR[]...

ENDFORM. " VALIDATE_VEN_NUM

&----


*& Form VALIDATE_PUR_GRP

&----


  • Subroutine to validate the Purchase Group

----


  • There are no interface parameters to be passed to this subroutine.

----


FORM VALIDATE_PUR_GRP .

IF NOT S_EKGRP[] IS INITIAL.

SELECT EKGRP " Purchase Group

FROM T024

INTO W_EKGRP

UP TO 1 ROWS

WHERE EKGRP IN S_EKGRP.

ENDSELECT.

IF SY-SUBRC NE 0.

CLEAR SSCRFIELDS-UCOMM.

MESSAGE E622(M8) WITH W_SPACE.

ENDIF. " IF SY-SUBRC NE 0

ENDIF. " IF NOT S_EKFRP[]...

ENDFORM. " VALIDATE_PUR_GRP

Regards,

Pavan.

Read only

Former Member
0 Likes
736

Hi,

If you validate all the parameters of selection screen, you can use At Selection-Screen event.

If you validate each parameters, you can go At Selection-Screen on <field> event.

Here <field> is parameter name.

Ex. The parameter p_qty has 'KG' .

At Selection-Screen On p_qty.

if p_qty <> 'KG'.

message e001.

endif.

Regards,

Bhaskar