cancel
Showing results for 
Search instead for 
Did you mean: 

Flat File Upload from WebDynpro ABAP

Former Member
0 Kudos

Hi,

I am struggling to find a solution for this requirement and I hope I get some help from the Gurus here.

I have to upload a ".csv" file from the WebDynpro application, and then store the data in the flat file in a Z# table.

Can some one explain me how to go ahead with this requirement??

Regards,

Nadh

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hi Nadh,

you can store binary data in a database table in a field of type XSTRING. The field

has to be a non-key field. For the key field, choose something appropriate for your

business scenario - or a guid.

Best regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

Thankyou for the reply,

I binded the data to a context attribute and tried to display it. But the data in the text file is not read, instead I see some string charecters and numbers when i upload the text file with some string data.

I know I am missing some thing while trying to display the data on the layout, but could not find out a way get the data in the text file.

Any suggestion??

Regards,

Nrisimhanadh

Former Member
0 Kudos

Hi Nrisimhanadh Yandamuri ,

.

After reading the csv file using file up load you can use the following code to tranfer the same to an itab of your required format

DATA : loc_conv TYPE REF TO cl_abap_conv_in_ce,

var_string TYPE string.

  • Convert XString to String

CALL METHOD cl_abap_conv_in_ce=>create

EXPORTING

input = item_content

encoding = 'UTF-8'

replacement = '?'

ignore_cerr = abap_true

RECEIVING

conv = loc_conv.

*Read the file contents

TRY.

CALL METHOD loc_conv->read

IMPORTING

data = var_string.

CATCH cx_sy_conversion_codepage.

*-- Should ignore errors in code conversions

CATCH cx_sy_codepage_converter_init.

*-- Should ignore errors in code conversions

CATCH cx_parameter_invalid_type.

CATCH cx_parameter_invalid_range.

ENDTRY.

SPLIT var_string AT crlf INTO TABLE it_string_tab.

Regards

Sarath

thomas_szcs
Active Contributor
0 Kudos

Hi Nrisimhanadh,

as Sarath wrote you need to convert the binary representation inside of the xstring typed attribute to a string.

Best regards,

Thomas

Former Member
0 Kudos

Hi Sarath and Thomas,

Thankyou for the help. Sarath's code helped me with what I want.

Thank you very much.

Best Regards,

Nrisimhanadh

Answers (0)