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

ALV layout problem

Former Member
0 Likes
766

Hi,

I have an custom ALV report runs successfully. However when I output the report is displaying in a different sequence of data elements.

ZABC is the report. OUT is the internal table. The sequence of data elements need to be as below.

data: begin of out occurs 0,

nachn like pa0002-nachn,

vorna like pa0002-vorna,

pernr like pa0002-pernr,

endda like pa0002-endda,

pgylevel like zdiff-zpgylevel,

agencyfeecode like zdiff-zagencycode,

diff like zdiff-zdiff,

end of out.

Here is the piece of code.

LV_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

LV_IS_LAYOUT TYPE SLIS_LAYOUT_ALV.

LV_IS_LAYOUT-GROUP_CHANGE_EDIT = 'X'.

  • LV_IS_LAYOUT-GROUP_CHANGE_EDIT = ' '.

LV_IS_LAYOUT-GET_SELINFOS = ' '.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = 'ZABC'

I_INTERNAL_TABNAME = 'OUT'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = 'ZABC'

I_BYPASSING_BUFFER = 'X'

CHANGING

CT_FIELDCAT = LV_FIELDCAT[]

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

        • LV_FIELDCAT[] picks the field layout as defined in the 'OUT' table. While executing 'REUSE_ALV_LIST_DISPLAY' it changes to 'pernr,endda,nachn,vorna pglevel,agencycode,zdiff'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'ZABC'

IT_FIELDCAT = LV_FIELDCAT[]

  • I_DEFAULT = 'X'

  • I_SAVE = 'X'

  • IS_VARIANT = LV_TEMPLATE

  • IS_LAYOUT = LV_IS_LAYOUT

TABLES

T_OUTTAB = OUT

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

The data looks fine but the sequence of data elements displayed is different. How can I fix this?

Thanks in advance,

VG

6 REPLIES 6
Read only

Sandra_Rossi
Active Contributor
0 Likes
705

it sometimes changes it the default sequence (date, key, I don't remember exactly the rules).

Just force the position of columns in the catalog.

Read only

0 Likes
705

Thanks. I figured out the problem. I changed the use of FM 'REUSE_ALV_GRID_DISPLAY'. It worked with the changed layout. However when i run the report in the foreground how can I display the menu bar that gives the option to download and chnage layout?

VG

Read only

0 Likes
705

Use this parameters in ur FM..

I_DEFAULT = 'X'
 I_SAVE = 'A'

Read only

0 Likes
705

Hi,

you also ne to pass parameter


data:
 lS_VARIANT type disvariant.

lS_VARIANT-program = sy-repid.
lS_VARIANT-user = sy-uname.
...

 IS_VARIANT = ls_variant

Regards,

Clemens

Read only

0 Likes
705

Thanks for the response.

Santhosh.

Read only

Former Member
0 Likes
705

Hi Vinu Gotti,

Checks if there is another routine where you are building the catalog manually or remove the FM 'REUSE_ALV_FIELDCATALOG_MERGE' and builds the catalog manually.

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

L_POS TYPE I,

LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

L_POS = L_POS + 1.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = L_POS.

LS_FIELDCAT-TABNAME = 'OUT'.

LS_FIELDCAT-FIELDNAME = 'NACHN'.

LS_FIELDCAT-SELTEXT_L = TEXT-C14.

LS_FIELDCAT-JUST = 'L'.

LS_FIELDCAT-OUTPUTLEN = '20'.

APPEND LS_FIELDCAT TO LT_FIELDCAT.

L_POS = L_POS + 1.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = L_POS.

LS_FIELDCAT-TABNAME = 'OUT'.

LS_FIELDCAT-FIELDNAME = 'VORNA'.

LS_FIELDCAT-SELTEXT_L = TEXT-C14.

LS_FIELDCAT-JUST = 'L'.

LS_FIELDCAT-OUTPUTLEN = '20'.

APPEND LS_FIELDCAT TO LT_FIELDCAT.

Hope this information is help to you.

Regards,

José