2008 Aug 08 4:58 PM
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
2008 Aug 08 5:00 PM
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
2008 Aug 08 5:00 PM
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
2008 Aug 08 5:13 PM