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: 

field validation using field symbol !!

Former Member
0 Kudos
577

hi,

in my dialog i have 3 fields which needs the port number to be validated against a custom table.

so I want to write a single module for validation which can be called during validation of all these 3 fields. But inside this module i must differentiate the fields so that the field's current value is read and validated.

so in my PAI i say

FIELD ZXXXPORT1 MODULE PORT_VAL.

FIELD ZXXXPORT2 MODULE PORT_VAL.

FIELD ZXXXPORT3 MODULE PORT_VAL.

and the module code is as follows:

FIELD-SYMBOLS: <FS> TYPE ANY.

DATA: L_CNT TYPE I.

GET CURSOR FIELD FIELDNAME.

ASSIGN FIELDNAME TO <FS>.

SELECT COUNT(*) INTO L_CNT FROM ZXXX WHERE PORTCODE = <FS>.

IF L_CNT IS INITIAL.

MESSAGE E899(F2) WITH 'Enter a valid Port code '.

ENDIF.

This fails even when the correct port number is entered and I know why. In the select's where class I need the field's value to be substituted, but when i use FIELDNAME or a field symbol like <FS>, the fieldname is what is substituted rather thaan the field's value. How to get the field's value here ??

thks

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos
198

You are almost there, just change the assign statement.


ASSIGN (FIELDNAME) TO <FS>.

By this way, it will assign the value of the FIELDNAME to the <FS>.

Regards,

Naimesh Patel

2 REPLIES 2

naimesh_patel
Active Contributor
0 Kudos
199

You are almost there, just change the assign statement.


ASSIGN (FIELDNAME) TO <FS>.

By this way, it will assign the value of the FIELDNAME to the <FS>.

Regards,

Naimesh Patel

0 Kudos
198

Excellente...thank u very much...