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

dynamically retreiving fields of a table

Former Member
0 Likes
521

Hi,

I have a text file in the application server containing data corresponding to the fields of table EPROVAL15.I have declared an internal table and work area of the table type .While I am trying to split the file into respective fields it's throwing an error which is "field should be declared of character type".since fields such as 'VAL0000' or 'VAL0015' are of decimal format,so split statement doesnot work for such data type.Can any1 suggest how to split the file so that data from the text file get appended to the internal table?

I thought of declaring a structure containing the same number fields as the table EPROFVAL15 with data type as char,but then that would be time consuming process as the table contains many fields.Can any one provide a solution to it?

I would like to know ,if there is a table containing more than 100 fields and we want to append values from text file to it through an internal table ,then in the split statement do we need to provide every field name (the usual process that we do) ?i feel it's a time consuming process to mention all the field name manually.is there any way out by which the fields can be called dynamically for appending the data from the text file into it?

Hi,

I have a text file in the application server containing data corresponding to the fields of table EPROVAL15.I have declared an internal table and work area of the table type .While I am trying to split the file into respective fields it's throwing an error which is "field should be declared of character type".since fields such as 'VAL0000' or 'VAL0015' are of decimal format,so split statement doesnot work for such data type.Can any1 suggest how to split the file so that data from the text file get appended to the internal table?

I thought of declaring a structure containing the same number fields as the table EPROFVAL15 with data type as char,but then that would be time consuming process as the table contains many fields.Can any one provide a solution to it?

I would like to know ,if there is a table containing more than 100 fields and we want to append values from text file to it through an internal table ,then in the split statement do we need to provide every field name (the usual process that we do) ?i feel it's a time consuming process to mention all the field name manually.is there any way out by which the fields can be called dynamically for appending the data from the text file into it?

2 REPLIES 2
Read only

brad_bohn
Active Contributor
0 Likes
491

Yes, there are several ways you can do it dynamically but you didn't mention how your file is delimited or whether it's fixed-length. Also, what type of structure are you initially reading the file into? Post some code - although I understand the SPLIT error, it's not clear why SPLIT is being used with a numeric data type.

Read only

Former Member
0 Likes
491

Hi Brad,

The text file is delimited by' | '.

following is the sample code .

data: gt_IEPROFVAL15 type IEPROFVAL15,

gwa_IEPROFVAL15 type EPROFVAL15.

split g_temp1 at '|' into gwa_IEPROFVAL15-PROFILE gwa_IEPROFVAL15-VALUEDAY gwa_IEPROFVAL15-VAL0000

gwa_IEPROFVAL15-VAL0015 gwa_IEPROFVAL15-VAL0030 gwa_IEPROFVAL15-VAL0045.

The above split statement contains fields up till VAL2345(presently i have shown fields up till VAL0045).The syntactical error is

' gwa_IEPROFVAL15-VAL0000 must be a character type data object'.

Is there any way by which data conversion can take place explictly ?

If i declare a structure containing the same fields as that of table EPROVAL15(with the data type being char instead of integer) to be used in the split statement then again it's a tedious process.

Hope the problem stated is clear to you.