cancel
Showing results for 
Search instead for 
Did you mean: 

conversion from xstring to string

Former Member
0 Kudos

Hi all

when i m converting xstring to string,the string is comming

饉#胥#################>#################################

how can i solve this problem.i m using 'HR_KR_XSTRING_TO_STRING' RFC.

Pls help me.

Regards

Susheel Joshi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks All

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I don't see that this question is directly related to Web Dynpro ABAP. It seems to be more of a general ABAP question.

I take it that your XSTRING is of a different code page than your server (or it is Unicode and your server is not) or that it is truely binary data and therefore is comprised of non-printable characters. What is the source of the XSTRING?

Former Member
0 Kudos

Hi Thomas,

i m getting that xstring from ABAP Webdynpro FILEUPLOAD UI Element.

there i m selecting path of the file.

So it seems webdynpro problem.

Regards,

Susheel

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Just because you are uploading via WDA doesn't make this a WDA question. You could uplaod the file many different ways - like via CL_GUI_FRONTEND_SERVICES. Once the file is in memory on the application server, the options to process it in ABAP are the same.

You say you got the file from the frontend, but you haven't said what type of file it is? That information is critical to know how to help you to process the binary data - assuming it is even possible to do so.

saket_abhyankar
Active Participant
0 Kudos

Hi Susheel

Try following code:

z_convt = cl_abap_conv_in_ce=>create( input = lv_ca_filecontent ). " lv_ca_filecontent IS EXTRING DATA

z_convt->read( IMPORTING data = z_string ). " Z_STRING IS STRING VARIABLE

"Column headers

SPLIT z_string AT cl_abap_char_utilities=>cr_lf INTO TABLE t_stable.

READ TABLE t_stable INTO z_table INDEX 1.

"Delete column header

DELETE t_stable INDEX 1.

SPLIT z_table AT cl_abap_char_utilities=>horizontal_tab INTO TABLE t_fields.

z_num_cols = LINES( t_fields ).

REFRESH t_fields.

LOOP AT t_stable ASSIGNING <fs_table>.

SPLIT <fs_table> AT cl_abap_char_utilities=>horizontal_tab INTO :

z_wreg-" FIELDS OF INTERNAL TABLE

z_wreg-" FIELDS OF INTERNAL TABLE

z_wreg-" FIELDS OF INTERNAL TABLE

z_wreg-" FIELDS OF INTERNAL TABLE

APPEND z_wreg TO t_reg.

CLEAR z_wreg.

ENDLOOP.

Hope this will hepl.

Regards,

Saket.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Saket, this conversion would work assuming the file being uploaded is a text, tab delimited file from something like Excel. However Susheel hasn't told us what the source of the file is yet. These instructions might not be helpful at all if the file turns out to be Native Excel format, Word Document, or even an image file.

Former Member
0 Kudos

Hi Thomas,

I have just started to work on Webdynpro.

i m uploading excel sheet ,but THE RFC is Properly working ,

one of the import parameter of that RFC is file Path,

so i want to just pass that string(path string) to that RFC which comes in FILEUPLOAD ui Element.

Any other way to solve this problem.

Regards,

Susheel

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You can't process native Excel files in ABAP. The native, binary Excel format is Microsoft specific and there is no server side library to process it. The file must be saved in a neutral format like XML or Text Tab Delimited and then processed on the ABAP side. Sorry there is no RFC that will process the binary file. The old SAPGUI specific ones did this via a connection to the client machine and OLE automation to Excel. That isn't possible within a browser.

Former Member
0 Kudos

hi Thomas

i want only to store the string which comes in FILE UPLOAD UI Element after the selection of path of that excel sheet.

like E:\MyDocument\susheel\book1.xls

in a string.

but the string comes from FILE UPLOAD UI in xstring format.

Regards

Susheel

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I think you need to take a closer look at those parameters. FileUpload only has one XSTRING parameter and that is DATA. It will receive the actual contents of the uploaded file - not a path to the file. I think you want the fileName parameter - but it STRING, so you don't have to do any conversions on it.

Former Member
0 Kudos

Hi Thomas,

My RFC has an import parameter that is path of the string.

So ho can i get the path of that excel file.

Regards,

Susheel

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Look at the properties on the FileUpload UI element. That will show you what you have to work with:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b3/be7941601b1d09e10000000a155106/frameset.htm

FileName is your only choice here. I don't believe it gives you the whole path. Even if it did - what RFC are you calling. I hope you don't expect the RFC to process that file. From Web Dynpro you have no direct connection to the SAPGUI or the Client Desktop - so Function Modules that do such things won't work.