cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while dowloading the contends to CSV file in webdynpro

harish2
Explorer
0 Kudos


Hi Frnds ,

In my scenario iam uploading CSV file trough file upload Ui elemenrt in sap webdynpro

FYI,

cotents in the file are

PlantSales OrganizationDistribution Channelcolor
2000100010red,yellow,green
1000100010

and i am using the below code to read the contends in the file

*data source is attribute  the trough which i have binded my data to file uplod ui element

  wd_context->get_attribute(    EXPORTING      name `DATASOURCE`    IMPORTING      value = l_xstring ).


  CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
    EXPORTING
      in_xstring = l_xstring
    IMPORTING
      out_string = l_string.

in debugging i found the data in the below format in i_string.

Plant,Sales Organization,Distribution Channel,color##2000,1000,10,"red,yellow,green"##1000,1000,10,##

my concern is if in case in debugging if i chnage the conted to

werks,Sales Organization,Distribution Channel,color##2000,1000,10,"red,yellow,green"##1000,1000,10,##

i have just chnaged plant to werks in debugging

     CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
      text   = l_string

    IMPORTING
      buffer = xstr.

   CALL METHOD cl_wd_runtime_services=>attach_file_to_response
    EXPORTING
      i_filename      = 'Dashboard.csv'
      i_content       = xstr
      i_mime_type     = 'TEXT/CSV'
      i_in_new_window = abap_false
      i_inplace       = abap_false.

when i am dowloding it is showing output as

werksSales OrganizationDistribution Channelcolor##2000100010red,yellow,green##1000100010##

if i am not chnaging any thingh in debugging on the field l_string

then it is giving out as \

PlantSales OrganizationDistribution Channelcolor
2000100010red,yellow,green
1000100010

kindly let me know what was the reason

Is that we should not edit any thingh

Thanks,

Harish.

Accepted Solutions (0)

Answers (1)

Answers (1)

denniss_
Explorer
0 Kudos

Hi Harish,

## represents the linebreak ( cl_abap_char_utilities=>cr_lf ). I never had problems with textfiles so far. But maybe when you change the text in the debugger ## (linebreak) is converted to ## (real hashes) and so it's lost when you export again.

Can you try to change Plant to werks by ABAP command (REPLACE) instead of doing it in the debugger?

Regards,

Dennis