Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding downloading file dynamically

Former Member
0 Likes
1,141

Hi Experts,

We have following requirement.

we are supposed to dsiplay one report which will have avg 150 columns where 3 column will be constant and the rest of the 147 column will be dynamically

populated with n no of columns.Now  as per the ALV display , there are a limit of around 82 column display so requirement is being made as following..

we are supposed to write the data in application server, though the application server will not show (AL11) more than 1024 char avg, it will be shown

perfect after dwonloading, i guess i am correct regarding this context.

Ques 1 ).can we increase this limit (1024) somehow in ECC6.0 with any solution (AL11)?

Another thing is that how are we going to populate and download the dynamic table,as per the alv we pass the fieldcatalogue in

class CL_ALV_TABLE_CREATE and the method CREATE_DYNAMIC_TABLE.....we do not need to pass the fieldcatalogue as we are not  going to display any report, how can we create a dynamic table without passing the fieldcatalogue?

i went through a post but did not get the part without using fieldcatalogue

Ques 2) Can anyone help me regarding the same please?

Ques 3 )If we want to do the same thing while downloading , we are  bit confused, will it be possible to transfer the content properly from a dynamically created file?

will it be possible to create the file structure dynamically and tranferring the data?

Please provide your valuable feedbacks regarding the same.

Thanks a Advance.

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
565

Hi Rinki,

as an alternative, you could create tab-delimited .CSV file which can be opened using Excel. It allows for older excel versions 255 columns with a max. width of 255 for each column and 64k rows.

Office2007 and later has bigger limits.

You can create dynamic tables using RTTS run time type services. This source may give you required hints

  METHOD create_dispodata.

    DATA:

      lo_structdescr         TYPE REF TO cl_abap_structdescr,

      lo_typedescr           TYPE REF TO cl_abap_typedescr,

      lo_tabledescr          TYPE REF TO cl_abap_tabledescr,

      lr_data                TYPE REF TO data,

      lt_lvc_scol            TYPE lvc_t_scol,

      lt_lvc_styl            TYPE lvc_t_styl,

      lt_comp_all            TYPE cl_abap_structdescr=>component_table,

      lv_count_day_block     TYPE int4,

      lv_index               TYPE numc2.

    FIELD-SYMBOLS:

      <any>                  TYPE ANY,

      <component>            TYPE LINE OF abap_component_tab.

M

*$*$*...............Dynamic Internal Table........................*$*$*

* Prefix block

    lo_typedescr   = cl_abap_typedescr=>describe_by_name( lc_tabname_dispoliste_prefix ).

    APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

    <component>-type ?= lo_typedescr.

    <component>-name = lc_tabname_prefix."'PREFIX'

    <component>-as_include  = abap_true.

* first day

    lo_typedescr   =  cl_abap_typedescr=>describe_by_name( lc_tabname_dispoliste_tag_1 ).

    APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

    <component>-type ?= lo_typedescr.

    <component>-name = lc_tabname_tag_1.                    "'TAG_1'

    <component>-as_include  = abap_true.

* day blocks as includes

    lv_count_day_block = get_count_day_block( ).

    DO lv_count_day_block TIMES.

      lv_index = sy-index.

      lo_typedescr   =  cl_abap_typedescr=>describe_by_name( lc_tabname_dispoliste_tag ).

      APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

      <component>-type ?= lo_typedescr.

* build Include-name  'TAG' <underscore> and nn, e.g. TAG_01, TAG_02...

      CONCATENATE lc_tabname_tag lc_underscore lv_index INTO <component>-name.

      <component>-as_include  = abap_true.

      CONCATENATE lc_underscore lv_index INTO <component>-suffix.

    ENDDO.

* add style

    APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

    <component>-type ?= cl_abap_datadescr=>describe_by_data( lt_lvc_styl ).

    <component>-name = lc_fieldname_t_styl.

** add color     APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

    <component>-type ?= cl_abap_datadescr=>describe_by_data( lt_lvc_scol ).

    <component>-name = lc_fieldname_t_color.

* create new descriptive type for dynamic structure

    lo_structdescr = cl_abap_structdescr=>create( lt_comp_all ).

*  create table description

    lo_tabledescr = cl_abap_tabledescr=>create(

                    p_line_type  = lo_structdescr

                    p_table_kind = cl_abap_tabledescr=>tablekind_std

                    p_unique     = abap_false ).

* create date object returning reference

    CREATE DATA rr_dispodata TYPE HANDLE lo_tabledescr.

  ENDMETHOD.

Regards,

Clemens

3 REPLIES 3
Read only

Former Member
0 Likes
565

Hi,

Ques 1) don't know, maybe a ZAL11

Ques 2) You can use RTTS class instead of CL_ALV_CREATE_TABLE... Look around for dynamic table creation, there are already a lot of threads about it on SDN.

Ques 3) What do you mean by "transfer from a file"? If you want to get your data back into a dynamic table, then you could use a separator in your file along with a header line. This way it will be possible to create dynamically the internal table based on the header line (again with RTTS) and fill the table by splitting rows data at your separator value.

There are other possiblities like storing your layout structure (with a key) in a DDIC object and get it back when needed to re-build your internal table.

Or use statement like EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key when creating the internal table the first time and get the layout back with th related IMPORT statement...

Kr,

Manu.

Read only

0 Likes
565

Hi Manu,

Thanks for the reply.

By data transfer, i mean to say that,

Generally  we download file in application server with defined column numbers, we declare our type

with those known structure and write the data to file, now here if we do not know the number of column in output file then we will not be able to declarae specific type declaration, so will it work?

If we declare the type as dynamic and write them in the file...actually i went through one post

without CL_ALV_CREATE_TABLE but did not get it as the content was in detail in case of cl*alv* part,

i will again serach, can you provide any dump which can help me ?

Thanks In Advance.

Read only

Clemenss
Active Contributor
0 Likes
566

Hi Rinki,

as an alternative, you could create tab-delimited .CSV file which can be opened using Excel. It allows for older excel versions 255 columns with a max. width of 255 for each column and 64k rows.

Office2007 and later has bigger limits.

You can create dynamic tables using RTTS run time type services. This source may give you required hints

  METHOD create_dispodata.

    DATA:

      lo_structdescr         TYPE REF TO cl_abap_structdescr,

      lo_typedescr           TYPE REF TO cl_abap_typedescr,

      lo_tabledescr          TYPE REF TO cl_abap_tabledescr,

      lr_data                TYPE REF TO data,

      lt_lvc_scol            TYPE lvc_t_scol,

      lt_lvc_styl            TYPE lvc_t_styl,

      lt_comp_all            TYPE cl_abap_structdescr=>component_table,

      lv_count_day_block     TYPE int4,

      lv_index               TYPE numc2.

    FIELD-SYMBOLS:

      <any>                  TYPE ANY,

      <component>            TYPE LINE OF abap_component_tab.

M

*$*$*...............Dynamic Internal Table........................*$*$*

* Prefix block

    lo_typedescr   = cl_abap_typedescr=>describe_by_name( lc_tabname_dispoliste_prefix ).

    APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

    <component>-type ?= lo_typedescr.

    <component>-name = lc_tabname_prefix."'PREFIX'

    <component>-as_include  = abap_true.

* first day

    lo_typedescr   =  cl_abap_typedescr=>describe_by_name( lc_tabname_dispoliste_tag_1 ).

    APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

    <component>-type ?= lo_typedescr.

    <component>-name = lc_tabname_tag_1.                    "'TAG_1'

    <component>-as_include  = abap_true.

* day blocks as includes

    lv_count_day_block = get_count_day_block( ).

    DO lv_count_day_block TIMES.

      lv_index = sy-index.

      lo_typedescr   =  cl_abap_typedescr=>describe_by_name( lc_tabname_dispoliste_tag ).

      APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

      <component>-type ?= lo_typedescr.

* build Include-name  'TAG' <underscore> and nn, e.g. TAG_01, TAG_02...

      CONCATENATE lc_tabname_tag lc_underscore lv_index INTO <component>-name.

      <component>-as_include  = abap_true.

      CONCATENATE lc_underscore lv_index INTO <component>-suffix.

    ENDDO.

* add style

    APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

    <component>-type ?= cl_abap_datadescr=>describe_by_data( lt_lvc_styl ).

    <component>-name = lc_fieldname_t_styl.

** add color     APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.

    <component>-type ?= cl_abap_datadescr=>describe_by_data( lt_lvc_scol ).

    <component>-name = lc_fieldname_t_color.

* create new descriptive type for dynamic structure

    lo_structdescr = cl_abap_structdescr=>create( lt_comp_all ).

*  create table description

    lo_tabledescr = cl_abap_tabledescr=>create(

                    p_line_type  = lo_structdescr

                    p_table_kind = cl_abap_tabledescr=>tablekind_std

                    p_unique     = abap_false ).

* create date object returning reference

    CREATE DATA rr_dispodata TYPE HANDLE lo_tabledescr.

  ENDMETHOD.

Regards,

Clemens