2014 Oct 05 4:10 PM
Hi,
I have to make a report that have to upload tab delimited file from presentation server and perform operation then.
Now, can anyone tell me:
1. how to validate if file is tab delimited at all or not?
2.how to check if file has correct data i.e. say in the incoming file there should be 18 column, all of them can be filled or not at a time. how to check if file has data for required column only?
Regards
Ajit C
Hi,
I have to make a report that have to upload tab delimited file from presentation server and perform operation then.
Now, can anyone tell me:
1. how to validate if file is tab delimited at all or not?
2.how to check if file has correct data i.e. say in the incoming file there should be 18 column, all of them can be filled or not at a time. how to check if file has data for required column only?
Regards
Ajit C
2014 Oct 05 4:24 PM
Hi Ajeet,
For the first question, use SPLIT statement and use separator as cl_abap_char_utilities=>horizontal_tab. Check the sy-subrc value for validation.
Secondly, if your split statement works, then the values will be in respective columns of the structure u will be using in ABAP. Then you can place the validation based on the values in fields of structure.
For further clarification go through F1 help on split statement.
Thanks,
Sumit
2014 Oct 05 5:10 PM
Hi Ajeet,
first do the GUI_UPLOAD into an internal table of text lines with sufficient length (i.e. text200 or so).
Declare a internal table of strings, i.e. lt_col type table of string.
Loop at the table just uploaded. For each line, SPLIT <line> BY cl_abap_char_utilities=>horizontal_tab INTO TABLE lt_col.
IF lines( lt_col ) = 0.
* NOT tab-delimited
EXIT. "the loop
ELSE.
* Use the data
LOOP AT lt_string ASSIGNING <string>.
CASE sy-tabix.
WHEN 1.
* columns 1
* ...
WHEN 8.
IF <string> IS INITIAL.
* Expected value not present...
ENDIF
ENDCASE.
ENDLOOP.
ENDIF.
This is just to give you an idea.
Regards,
Clemens
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |