09-02-2007 6:31 PM
Hi,
I have a requirement to update 2 custom tables. Each table have more 230 field each.
and have 90 check tables assigned to the fields.
I need a common code to validate before updating into this table,
i need to validate the fields against the check tables assigned to that field.
I know i how to validate field with each check table.
But i need a common function module. class or some code that i can use commonly passing field value, check table and i need return value
Anybody having code please paste it here.
Your help appreciated.
a®
09-02-2007 6:43 PM
Hi,
Happy to see that you ask questions too.. i had an impression that you only solve them
Why dont you create a subroutine in you program?
FORM f_validate USING field TYPE c
value TYPE any
tabname TYPE c
CHANGING return TYPE c.
FIELD-SYMBOLS : w_field TYPE any.
SELECT SINGLE ( field )
FROM ( tabname )
INTO w_field
WHERE ( field ) EQ value.
If sy-subrc NE 0.
retrurn = 'X'.
ENDIF.
ENDFORM.
Thanks and Best Regards,
Vikas Bittera.
09-02-2007 6:43 PM
Hi,
Happy to see that you ask questions too.. i had an impression that you only solve them
Why dont you create a subroutine in you program?
FORM f_validate USING field TYPE c
value TYPE any
tabname TYPE c
CHANGING return TYPE c.
FIELD-SYMBOLS : w_field TYPE any.
SELECT SINGLE ( field )
FROM ( tabname )
INTO w_field
WHERE ( field ) EQ value.
If sy-subrc NE 0.
retrurn = 'X'.
ENDIF.
ENDFORM.
Thanks and Best Regards,
Vikas Bittera.
09-02-2007 6:53 PM
Vikas,
Thanks for your reply. My brain not upto the mark due to long hours working
Your reply will solve my issue.
Points awarded
a®
09-02-2007 6:46 PM
I have verified AT SE37 and Found many ( Search term would be CHECKTABL*
Check the below FM :
CALL FUNCTION 'CHECKTABLE_GET'
EXPORTING
VALUECHECKFIELDNAME = SPACE
VALUECHECKTABLE = SPACE
VALUECHECKVALUE = SPACE
VALUEFIELDNAME = FIELD_DFIES-FIELDNAME
VALUELANGUAGE = SY-LANGU
VALUETABNAME = FIELD_DFIES-TABNAME
MAXENTRIES = MAXENTRIES
SHOW_LIST = SPACE
IMPORTING
RETCODE = RC
TABLES
DYNPSELECT = DYNPSELECT
VALUES = VALUES
VALUESSTRUCTURE = VALUESSTRUCTURE
EXCEPTIONS
OTHERS = 1.
Look at report RDD00DOC.
Otherwise create one perform routine ,pass the table and fields dynamically'
Thanks
Seshu
09-03-2007 4:54 AM
Hello a®s
The code samples already given solve the problem to verify the existence of single values in check tables. However, this may not be sufficient.
Assuming that one ore more foreign-key relations in your custom tables have more than one foreign-key fields then this logic is insufficient.
The classical example is table SFLIGHT. Look at the foreign-key relation for field CONNID:
SPFLI MANDT SFLIGHT MANDT
SPFLI CARRID SFLIGHT CARRID
SPFLI CONNID SFLIGHT CONNID
While field MANDT can be neglected you may find a foreign-key value for CARRID in table S_CARR and the corresponding value for CONNID in SPFLI but not the combination of both in table SFLIGHT.
Thus, for any foreign-key relation having multiple check-table fields you have to use a more elaborate logic.
Regards
Uwe