Comments (3)
I'll have a look.
from abap2xlsx.
Internal table lt_test has to be accessible in scope when calling lo_excel_writer->write_file.
In your demo lt_test is freed by the system when leaving method get_it_excel and cannot be accessed during xlsx creation.
I used the same pattern as for example standard ALV classes - just the reference is stored not the copy of internal table. The reference to internal table is needed to perform some calculations during file creation.
With standard ALV you are also getting short dump when internal table is not in scope - you can try this demo:
REPORT zdemo_excel1_ref.
----------------------------------------------------------------------
-
----------------------------------------------------------------------
CLASS lcl_alv DEFINITION
*
----------------------------------------------------------------------
CLASS lcl_alv DEFINITION.
PUBLIC SECTION.
METHODS get_alv
EXPORTING
e_alv TYPE REF TO cl_salv_table.
ENDCLASS. "lcl_alv DEFINITION
----------------------------------------------------------------------
-
CLASS lcl_alv IMPLEMENTATION
----------------------------------------------------------------------
*
----------------------------------------------------------------------
CLASS lcl_alv IMPLEMENTATION.
METHOD get_alv.
DATA lt_test TYPE TABLE OF sflight.
SELECT * FROM sflight INTO TABLE lt_test.TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = e_alv
CHANGING
t_table = lt_test ).
CATCH cx_salv_msg. "#EC NO_HANDLER
ENDTRY.
ENDMETHOD. "get_alv
ENDCLASS. "lcl_alv IMPLEMENTATION
START-OF-SELECTION.
DATA: lr_alv TYPE REF TO lcl_alv,
lr_table TYPE REF TO cl_salv_table.
CREATE OBJECT lr_alv.
lr_alv->get_alv( IMPORTING e_alv = lr_table ).
lr_table->display( ).
To make it work change declaration of lt_test - it can be global or returned from the class method.
If there is a strong requirement to use it like in your demo with lt test declared locally please reopen the issue and I'll try to workaround it by doing the calculations early in the bind_table() method without storing the reference.
from abap2xlsx.
[[file:cAazaYdcKr473dacwqjQYw]]
ZDEMO_EXCEL1_REF.slnk
from abap2xlsx.
Related Issues (20)
- Sometimes values of referenced Filed are empty HOT 1
- CX_SY_CONVERSION_NO_NUMBER because of conversion exit EXCRT HOT 6
- ZCL_EXCEL_WORKSHEET -> CONVERT_TO_TABLE drops initial excel lines HOT 8
- CX_SY_CONVERSION_NO_NUMBER exception in ZCL_EXCEL_READER_2007 method LOAD_WORKSHEET for multiple row spans HOT 1
- Use of Column Formula (zdemo_excel47) generates corrupted Excel HOT 10
- ZCL_EXCEL_WORKSHEET -> CONVERT_TO_TABLE wrong results if empty lines HOT 2
- Incorrect cell value when generating Excel using write_file and digits with data type "s" HOT 4
- CONVT_NO_NUMBER in ZCL_EXCEL_READER_2007=>LOAD_WORKSHEET HOT 4
- convert_to_table may produce zcx_excel/invalid time with some time values
- Reorganize zcl_excel_common unit tests, one method per test and define several test classes instead of one
- -
- Encrypt with Password HOT 1
- Position drawing in middle of a cell HOT 2
- Reading Smart Tables HOT 8
- Header/footer images and comments together make corrupted Excel file HOT 1
- Corrupted XLSX with BIND_TABLE and numeric column in TOP_LEFT_COLUMN
- Using abap2xlsx to read Excel with Excel open HOT 5
- Writer_xlsm and Writer_2007 not fully aligned again HOT 5
- Size of comments HOT 1
- Set column width via the field catalog of method BIND_TABLE
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abap2xlsx.