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 the data given in the excel file

Former Member
0 Likes
2,664

Hi,

I need to upload the ztable with the data given in the excel file.But before uploading I need to do some validation on the fields given in the file.

For example the first field in the file is plant.I need to check whether the value given for the plant in the file exists in T001W table(check table) or not.Similarly for other fields I need to check with the check tables corresponding to them.If the value doesn't exist in the table then it should give a load error as 'Value &&&& not valid for "field".

Can anyone tell me how can I do this validation?

4 REPLIES 4
Read only

Former Member
0 Likes
1,005

At first upload the excel file to your ABAP program there data will be in the internal table formate.

Validate the data and update the valid records in your custome table.

Regards

Bikas

Read only

Former Member
0 Likes
1,005

Hi,

Fetch the data into internal table using gui_upload.

Then fetch the data from T001W into an internal table.

Then to check for your plants,

LOOP AT itab_t001w.

READ TABLE itab_data INTO wa_data WITH KEY werks = wa_t001w-werks.

ENDLOOP.

Proceed like above, itab_data is the internal table where you uplaod your excel data.

Reward if Helpful.

Regards,

Prosenjit.

Read only

Former Member
0 Likes
1,005

Hi upload data from flat file by using FM GUI_UPLOAD.

LOOP AT itab.

SELECT SINGLE werks FROM t001w INTO t001w-werks

WHERE werks = itab-werks.

IF SY-SUBRC NE 0.

it_error-field = 'value& field description not available.

APPEND it_error.

CONTINUE.

ENDIF.

then 2nd field check with mapping table...

then 3rd field check with mapping table...

...

.

.

.

.

.

ENDLOOP.

Read only

Former Member
0 Likes
1,005

HI,

you need to dowload the data from your flat file to a internal table first. For that you can use FM ' WS_UPLOAD' .

here is a small demo for it,

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'C:\abcd.TXT'

FILETYPE = 'ASC'

TABLES

data_tab = itab

now once you have data in a internal table you can do validations on it in LOOP...........ENDLOOP statement.