‎2009 Sep 03 6:40 PM
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
‎2009 Sep 03 7:55 PM
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.
‎2009 Sep 03 8:35 PM
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
‎2009 Sep 03 10:37 PM
‎2009 Sep 03 11:10 PM
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_variantRegards,
Clemens
‎2009 Sep 24 8:40 PM
‎2009 Sep 03 8:27 PM
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é