cancel
Showing results for 
Search instead for 
Did you mean: 

Upload Files to Cluster Table

Former Member
0 Kudos

Hi all,

I need to upload a file via the UI element: FILEUPLOAD from local PC to a cluster table: ZLIB.

Since I have get the XSTRING data from WD now, how could I convert its format and save it to ZLIB?

remark: ZLIB is a custom-created Cluster Table, with standard fields: RELID/SRTFD/SRTF2/.../CLUSTR/CLUSTD.

Thanks.

XiaoHong

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You could also just write the XSTRING into the Cluster table. Why convert to a string? True binary files shouldn't be converted to STRING or you risk corruption of the data they contain.

Former Member
0 Kudos

Hi Jung,

Thanks for your reply, but I still need your further help to solve the problem.

In R/3, I can use FM 'GUI_UPLOAD' to upload a file source to an internal table, and then EXPORT to the cluster table. Now in Web Dynpro, that FM cannot be used. I need to write an XSTRING to the Cluster Table directly, but I wonder how I could do so. Since a standard cluster table has the structure as followed:

field data element data type length

RELID INDX_RELID CHAR 2

SRTFD INDX_SRTFD CHAR 22

SRTF2 INDX_SRTF2 INT4 10

... ...

CLUSTR INDX_CLSTR INT2 5

CLUSTD INDX_CLUST LRAW 2886

Thank you.

XiaoHong

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm not sure what exactly your question is about writting the data into the cluster. XSTRINGs go into clusters just fine. Just use the EXPORT <object> TO DATABASE ... syntax. The contents of the binary string will get spread across the proper number of cluster table records.

Former Member
0 Kudos

Hi Jung,

It works. Thanks a lot.

Regards,

Xiaohong.Z

Edited by: Zhao Xiao Hong on May 4, 2009 10:00 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can convert xstring data to string data in the following way.

  • Convert XString to String

data: loc_conv type ref to CL_ABAP_CONV_IN_CE,

loc_xstring type xstring,

loc_string type string.

CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE

EXPORTING

INPUT = loc_xstring

ENCODING = 'UTF-8'

REPLACEMENT = '?'

IGNORE_CERR = ABAP_TRUE

RECEIVING

CONV = loc_CONV.

CALL METHOD loc_CONV->READ

IMPORTING

DATA = loc_string.

Regards,

Mallika