‎2005 Jul 08 3:46 PM
I'm working on an ABAP that will upload a CSV file into SAP and create Activity Group Authorisations based on the contents of the CSV. One of the requirements is that the CSV is validated before processing.
How can I validate a value against a Data Element specification?
For info, I'm trying to validate Activity Group Org Level values. For example, is the value read from the CSV a valid BUKRS value? I need to confirm to the user that all the data is good the actual creating of the auth's starts.
Thanks,
Malc
‎2005 Jul 08 5:22 PM
Thanks for the answers but they don't quite answer my question. My CSV input file will have something like this:
Company Code, BUKRS, 800
Business Area, GSBER, 400
Account Type, KOART, 5
For BUKRS and GSBER I now see that I can check the Data Elements "Value table" and validate against it but some of my fields don't have a value table, eg KOART.
When I read the CSV I need to check that "5" is a valid value for KOART. For example, if the CSV contained:
Account Type, KOART, wumpus
I need to detect that "wumpus" is not a valid value for KOART. Is there a SAP function I can call to check if a value is a valid value for any given Data Element?
Thanks,
Malc
‎2005 Jul 08 3:52 PM
Hi Malc,
You need to find out the corresponding database table and validate against that. One way to find out the table is to go to the domain and look for the value table.
Thanks
Vinod
‎2005 Jul 08 4:04 PM
‎2005 Jul 08 5:22 PM
Thanks for the answers but they don't quite answer my question. My CSV input file will have something like this:
Company Code, BUKRS, 800
Business Area, GSBER, 400
Account Type, KOART, 5
For BUKRS and GSBER I now see that I can check the Data Elements "Value table" and validate against it but some of my fields don't have a value table, eg KOART.
When I read the CSV I need to check that "5" is a valid value for KOART. For example, if the CSV contained:
Account Type, KOART, wumpus
I need to detect that "wumpus" is not a valid value for KOART. Is there a SAP function I can call to check if a value is a valid value for any given Data Element?
Thanks,
Malc
‎2005 Jul 08 5:27 PM
Try the function module DDIF_FIELDINFO_GET which will return the possible values of a field. Then you can check the value from the file.
‎2005 Jul 08 6:16 PM
Here is a sample.....
data: dbdiff_values type ddfixvalues, "Festwerttexte zu dbdiffkind
dbdiff_val type ddfixvalue.
parameters: p_koart type koart.
at selection-screen.
call function 'DDIF_FIELDINFO_GET'
exporting
tabname = 'BSEG'
fieldname = 'KOART'
lfieldname = 'KOART'
tables
fixed_values = dbdiff_values.
read table dbdiff_values into dbdiff_val
with key low = p_koart.
if sy-subrc <> 0.
message e001(00) with 'Entry not found'.
endif.
Regards,
Rich Heilman