cancel
Showing results for 
Search instead for 
Did you mean: 

Download to excel problem

Former Member
0 Kudos

Hi Friends,

DATA lo_nd_hr_update TYPE REF TO if_wd_context_node.

DATA lt_hr_update TYPE wd_this->elements_hr_update.

DATA ls_hr_update TYPE wd_this->element_hr_update.

  • navigate from <CONTEXT> to <HR_UPDATE> via lead selection

lo_nd_hr_update = wd_context->get_child_node( name = wd_this->wdctx_hr_update ).

  • @TODO handle non existant child

  • IF lo_nd_hr_update IS INITIAL.

  • ENDIF.

lo_nd_hr_update->get_static_attributes_table( IMPORTING table = lt_hr_update ).

DATA text TYPE string.

DATA xtext TYPE xstring.

LOOP AT lt_hr_update INTO ls_hr_update.

CONCATENATE text ls_hr_update-mandt

ls_hr_update-pernr

ls_hr_update-effdt

ls_hr_update-upddt

ls_hr_update-ename

ls_hr_update-aedat

ls_hr_update-aenam

ls_hr_update-sigempno

ls_hr_update-signame

ls_hr_update-emailid

ls_hr_update-rejuvem

ls_hr_update-rejuvey

ls_hr_update-enrich1

ls_hr_update-enrich2

ls_hr_update-offdt

ls_hr_update-status

ls_hr_update-accdt

ls_hr_update-tedempno

ls_hr_update-tedname

ls_hr_update-skill1

ls_hr_update-skill2

ls_hr_update-skill3

ls_hr_update-skill4

ls_hr_update-comments

ls_hr_update-letter_rel

ls_hr_update-reldt

ls_hr_update-practice

ls_hr_update-practext

ls_hr_update-location

ls_hr_update-email

ls_hr_update-bill_date

cl_abap_char_utilities=>newline INTO text SEPARATED BY

cl_abap_char_utilities=>horizontal_tab.

ENDLOOP.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = text

IMPORTING

buffer = xtext.

wdr_task=>client_window->client->attach_file_to_response(

**path to the word file

i_filename = 'WDP.xls'

  • String Variable

i_content = xtext

  • File Type

i_mime_type = 'EXCEL' ).

The problem is i'm facing is i'm unable to download all the contents.

Is there any restriction on string size.....whether i need to increase string size....

Is it the problem with table size it has more than 25 fields & around 150 reocrds but every time when i use above code getting arnd 11 rows of data.

Kindly reply.

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Have you tried setting break points to see where you are loosing data? Is the complete data present in the string or xstring? Track back to see where you are losing the data.

Former Member
0 Kudos

Hi,

Data type string has length restriction upto some 288 characters...

So instead use string_table.

data : lt_table type string_table,

ls_table type string.

loop at ur table.

concatenate ls_table <ur fields>

append ls_table to lt_table.

clear ls_table.

endloop.

This will solve ur problem.

Thanks,

Divya.S

Former Member
0 Kudos

Hi,

I did as folllow changes in my code .....

DATA text TYPE string.

DATA text_s TYPE string_table.

DATA xtext TYPE xstring.

LOOP AT lt_hr_update INTO ls_hr_update.

CONCATENATE text ls_hr_update-mandt

ls_hr_update-pernr

ls_hr_update-effdt

ls_hr_update-upddt

ls_hr_update-ename

ls_hr_update-aedat

ls_hr_update-aenam

ls_hr_update-sigempno

ls_hr_update-signame

ls_hr_update-emailid

ls_hr_update-rejuvem

ls_hr_update-rejuvey

ls_hr_update-enrich1

ls_hr_update-enrich2

ls_hr_update-offdt

ls_hr_update-status

ls_hr_update-accdt

ls_hr_update-tedempno

ls_hr_update-tedname

ls_hr_update-skill1

ls_hr_update-skill2

ls_hr_update-skill3

ls_hr_update-skill4

ls_hr_update-comments

ls_hr_update-letter_rel

ls_hr_update-reldt

ls_hr_update-practice

ls_hr_update-practext

ls_hr_update-location

ls_hr_update-email

ls_hr_update-bill_date

cl_abap_char_utilities=>newline INTO text SEPARATED BY

cl_abap_char_utilities=>horizontal_tab.

APPEND text TO text_s.

CLEAR text.

ENDLOOP.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = text_s

IMPORTING

buffer = xtext.

wdr_task=>client_window->client->attach_file_to_response(

**path to the word file

i_filename = 'WDP.xls'

  • String Variable

i_content = xtext

  • File Type

i_mime_type = 'EXCEL' ).

but it wil through type conflict error in fm 'SCMS_STRING_TO_XSTRING'

pls suggest.......

Former Member
0 Kudos

Hi,

Pl reply on this......................

Former Member
0 Kudos

Hi,

This FM SCMS_STRING_TO_XSTRING is used to convert the

string format.But now data type has changed to string_table.

Thats why u get this error.

use,

loop at stringtable into ls_struct.

"call FM passing ls_struct.

"concatenate the converted xstring format

to xstring field.

endloop.

Thanks,

Divya.S

Former Member
0 Kudos

Hi,

Use FM ISM_TRANSFORM_TAB_TO_XSTRING.

This converets the String_table format to xtsring format directly.

Thanks,

Divya.S

while concatenate the fields to the string_table table format.

Dont forget to append the string to table and

clear the struture.

data : lt_stringtable. type string_table,

text type string.

LOOP AT lt_hr_update INTO ls_hr_update.

CONCATENATE text ls_hr_update-mandt

ls_hr_update-pernr

ls_hr_update-effdt

ls_hr_update-upddt

ls_hr_update-ename

ls_hr_update-aedat

ls_hr_update-aenam

ls_hr_update-sigempno

ls_hr_update-signame

ls_hr_update-emailid

ls_hr_update-rejuvem

ls_hr_update-rejuvey

ls_hr_update-enrich1

ls_hr_update-enrich2

ls_hr_update-offdt

ls_hr_update-status

ls_hr_update-accdt

ls_hr_update-tedempno

ls_hr_update-tedname

ls_hr_update-skill1

ls_hr_update-skill2

ls_hr_update-skill3

ls_hr_update-skill4

ls_hr_update-comments

ls_hr_update-letter_rel

ls_hr_update-reldt

ls_hr_update-practice

ls_hr_update-practext

ls_hr_update-location

ls_hr_update-email

ls_hr_update-bill_date

cl_abap_char_utilities=>newline INTO text SEPARATED BY

cl_abap_char_utilities=>horizontal_tab.

append text to lt_stringtable.

clear text.

ENDLOOP.

Thanks,

Divya.S

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi,

>

> Data type string has length restriction upto some 288 characters...

>

> Thanks,

> Divya.S

Absolutely and totally incorrect! String is not limited in length to 288 characters. It is only limited by the amount of memory that can be allocated and assigned to the internal session. On 32-bit based systems this would 2Gb. Both the stirng and string_table would have the same maximum memory allocation. Whatever your problem, it is not because of some size limitation on the STRING data type as you have been told by Divya.S. This person has mislead you.