Application Development 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: 

problem creating an excel with ALV GRID

Former Member
0 Kudos

Hi all,

this is my problem:

i have an ALV GRID in which I display several columns in a proper order, es : A B C D E F G

when i create an excel from this display i obtain a different order of the columns!

in particular the 3 columns which represent numeric values (es C D E) are the last 3 colums in the excel, instead in the alv grid this 3 comuns stay in the middle!

so in the excel i obtain : A B F G C D E!!!!

please can anyone help me to fix this problem?

6 REPLIES 6

Former Member
0 Kudos

While creating the field catalog..

use

For A

fieldcat-colpos = 1.

For B

fieldcat-colpos = 2.

for each field as 1,2,3 in the order which u want

Regards,

Prashant

0 Kudos

sure i'm already doing this!

in fact in the alv i display correctly the order of the columns

the problem is that the order change only when i create the file excel

the order of the columns is different in my excel!!!!

the colpos u say affect the position in the alv!

here it seems that there isn't a corrispondence between the alv i diplay and the file i'm going to create!!!!

how is it possible?

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

hi,

if you do a debugging it will go into the function module alv_xxl_call.

in this we can find the code as below.

catch system-exceptions import_mismatch_errors = 1.

import l_xxl_toggle_date from database ltdx(XL) id

'bcalv_xxl_toggle_date'.

endcatch.

here place a break point and check what value is it coming for this variable l_xxl_toggle_date.

if it is coming as X. then this problem will arrive.

here manually change the variable to space and check , the output will be coming perfectly.

if value is coming as X.

THEN WE CAN DO ONE THING.

HERE we are having a report bcalv_toggle_date which MUST EXECUTED ONCE ONLY.

WHEN IT IS EXECUTED IT DOES NOT DISPLAY ANYTHING.

after executing once the variable will be changed from X TO SPACE.

but we must run this report as other program excel sheet download order might get disturbed.

my might suggestion copy thwe standard gui to custom one and right a code for that excel icon in your code as shown below.

we need to copy the function module alv_xxl_call and comment the code

catch system-exceptions import_mismatch_errors = 1.

import l_xxl_toggle_date from database ltdx(XL) id

'bcalv_xxl_toggle_date'.

endcatch.

if l_xxl_toggle_date is initial.

and endif of the above if.

WHEN 'XXL'.

DATA : v_fieldcat TYPE STANDARD TABLE OF kkblo_fieldcat.

DATA : wa_fieldcat TYPE kkblo_fieldcat.

DATA : w_fieldcat LIKE LINE OF gt_fieldcat.

DATA : g_sort TYPE slis_t_sortinfo_alv.

DATA : g_filter TYPE slis_t_filter_alv.

DATA : a_fieldcat TYPE slis_t_fieldcat_alv.

CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'

IMPORTING

es_layout = gs_layout

et_fieldcat = a_fieldcat[]

et_sort = g_sort

et_filter = g_filter

es_variant = gs_variant.

DELETE a_fieldcat WHERE no_out = 'X'.

LOOP AT a_fieldcat INTO w_fieldcat.

MOVE-CORRESPONDING w_fieldcat TO wa_fieldcat.

APPEND wa_fieldcat TO v_fieldcat.

ENDLOOP.

CALL FUNCTION 'ZALV_XXL_CALL'

EXPORTING

i_tabname = 'IT_FINAL'

  • IS_LAYOUT =

it_fieldcat = v_fieldcat[]

  • I_CALLBACK_TOP_OF_PAGE =

  • I_TITLE =

  • I_MODE =

TABLES

it_outtab = it_final

EXCEPTIONS

FATAL_ERROR = 1

NO_DISPLAY_POSSIBLE = 2

OTHERS = 3.

Former Member
0 Kudos

all the above which i had given is if you are using

list-export-spreadsheet

Former Member
0 Kudos

Hi,

Kindly go through this link below:

Hope it helps

Regrds

Mansi