Hi,
I had a requirement for file upload and using the contents of the file for updating article master.
So I thought I would make it a little interesting by creating an abstract class which would take the file path and file type (along with the delimeter) and create a factory pattern by creating child classes(each of which would be for a specific location. Eg 1 subclass for handling files from AL11 and another subclass for files from local desktop).
As a part of this, I wanted to use RTTS, so that the application can return the contents of the file in the i/p format required by the application. So I started by doing the following.
1. Create a DDIC structure for the i/p file. This way every application that wants to use the reusable class, will first create a DDIC structure and pass the name of the structure to the main class.
2. The main class will determine which subclass to instantiate and get back the contents in the form of a string table.
3. The main class would then use RTTI using the name of the structure to create an internal table dynamically.
After all the necessary steps for ITAB creation is done, I have a data reference variable, go_tab.
Now, I want to loop thru the string table where the contents are comma separated( let's assume 3 columns a. MATNR b. COLOR c. VALUE eg: 12345,10,ABCD) and add them to my go_tab using a simple SPLIT statement.
data : go_data typre ref to data.
field-symbols: <fs_tab> type standard table.
ASSIGN : go_tab->* TO <fs_tab>.
DATA ref_wa TYPE REF TO data.
CREATE DATA ref_wa LIKE LINE OF <FS_TAB>.
LOOP AT string_tab INTO lv_string.
SPLIT lv_string AT gv_delimeter INTO
ref_wa->satnr ref_wa->color
ref_wa->value.
append ref_wa->* to <fs_tab>.
ENDLOOP.
But the above split statement returns the error "You cannot dereference (->) a generic reference in the current statement". How do I move the contents from the lv_string into my dynamic internal table?Any help would be much appreciated.
Thanks,
Vikram.M
Add comment