We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

Re: [sap-dev] Expand and Collapse Buttons On ALV Grid (for Classic ALV, not OOP)

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from Kabiru1 on Apr 10 at 11:01 AM
Hi Laurie,

I guess it's your lucky day. I just finished up with the
same issue. Hopefully, got it resolved....

Below is the sample program which I just created for ya. Just declare
your client's requirement into em and do lemme if you got it resolved. Have
a good one.

DATA: BEGIN OF IT_MARD OCCURS 0,
MATNR TYPE MARD-MATNR,
WERKS TYPE MARD-WERKS,
LGORT TYPE MARD-LGORT,
LABST TYPE MARD-LABST,
END OF IT_MARD.

DATA: BEGIN OF IT_MAKT OCCURS 0,
MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF IT_MAKT.

DATA IT_OUT TYPE ZCK10 OCCURS 0 WITH HEADER LINE.

*--
TYPE-POOLS SLIS.

DATA IT_FIELDS TYPE SLIS_T_FIELDCAT_ALV.

DATA WA_FIELDS TYPE SLIS_FIELDCAT_ALV.

DATA IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA WA_SORT TYPE SLIS_SORTINFO_ALV.

SELECT-OPTIONS S_MATNR FOR IT_MARD-MATNR.

START-OF-SELECTION.

SELECT MATNR
WERKS
LGORT
LABST INTO TABLE IT_MARD
FROM MARD
WHERE MATNR IN S_MATNR.

IF NOT IT_MARD[] IS INITIAL.

SORT IT_MARD BY MATNR.

SELECT MATNR
MAKTX INTO TABLE IT_MAKT
FROM MAKT
FOR ALL ENTRIES IN IT_MARD
WHERE MATNR = IT_MARD-MATNR
AND SPRAS = SY-LANGU.
ENDIF.

END-OF-SELECTION.

LOOP AT IT_MARD.

READ TABLE IT_MAKT WITH KEY MATNR = IT_MARD-MATNR.
IF SY-SUBRC = 0.
MOVE IT_MAKT-MAKTX TO IT_OUT-MAKTX.
ENDIF.

MOVE: IT_MARD-MATNR TO IT_OUT-MATNR,
IT_MARD-WERKS TO IT_OUT-WERKS,
IT_MARD-LGORT TO IT_OUT-LGORT,
IT_MARD-LABST TO IT_OUT-LABST.

APPEND IT_OUT.
CLEAR IT_OUT.
ENDLOOP.

*--Output

PERFORM BUILD_FIELDS USING 'MATNR' 'Material Number' ' ' '25' 'X'.

PERFORM BUILD_FIELDS USING 'MAKTX' 'Material Desc' ' ' '35' ' '.

PERFORM BUILD_FIELDS USING 'WERKS' 'Plant' ' ' '10' ' '.

PERFORM BUILD_FIELDS USING 'LGORT' 'Str Loc' ' ' '10' ' '.

PERFORM BUILD_FIELDS USING 'LABST' 'Price' 'X' '25' ' '.

*--SORT
WA_SORT-FIELDNAME = 'MATNR'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.

APPEND WA_SORT TO IT_SORT.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = I_BYPASSING_BUFFER
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-CPROG
* I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'SECOND_LIST'
* I_STRUCTURE_NAME = I_STRUCTURE_NAME
* IS_LAYOUT = IS_LAYOUT
IT_FIELDCAT = IT_FIELDS
* IT_EXCLUDING = IT_EXCLUDING
* IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
IT_SORT = IT_SORT
* IT_FILTER = IT_FILTER
* IS_SEL_HIDE = IS_SEL_HIDE
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT = IS_VARIANT
* IT_EVENTS = IT_EVENTS
* IT_EVENT_EXIT = IT_EVENT_EXIT
* IS_PRINT = IS_PRINT
* IS_REPREP_ID = IS_REPREP_ID
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IR_SALV_LIST_ADAPTER = IR_SALV_LIST_ADAPTER
* IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
* ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = IT_OUT
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&-----------*
*& Form BUILD_FIELDS
*&-----------*
FORM BUILD_FIELDS USING VALUE(P_0161)
VALUE(P_0162)
VALUE(P_0163)
VALUE(P_0164)
VALUE(P_0165).

WA_FIELDS-FIELDNAME = P_0161.
WA_FIELDS-SELTEXT_L = P_0162.
WA_FIELDS-DO_SUM = P_0163.
WA_FIELDS-OUTPUTLEN = P_0164.
WA_FIELDS-KEY = P_0165.

APPEND WA_FIELDS TO IT_FIELDS.
CLEAR WA_FIELDS.
ENDFORM. " BUILD_FIELDS

*&----------*
*& Form SECOND_LIST
*&----------*
* text
*------------*
FORM SECOND_LIST USING L_UCOM TYPE SY-UCOMM
L_FIELD TYPE SLIS_SELFIELD.

DATA IT_MARA TYPE MARA OCCURS 0 WITH HEADER LINE.

DATA L_MATNR TYPE MARA-MATNR.

IF L_UCOM EQ '&IC1' AND L_FIELD-FIELDNAME EQ 'MATNR'.

L_MATNR = L_FIELD-VALUE.

SELECT * FROM MARA INTO TABLE IT_MARA WHERE MATNR = L_MATNR.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = 'MARA'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE = I_GRID_TITLE
* I_GRID_SETTINGS = I_GRID_SETTINGS
* IS_LAYOUT = IS_LAYOUT
* IT_FIELDCAT = IT_FIELDCAT
* IT_EXCLUDING = IT_EXCLUDING
* IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
* IT_SORT = IT_SORT
* IT_FILTER = IT_FILTER
* IS_SEL_HIDE = IS_SEL_HIDE
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT = IS_VARIANT
* IT_EVENTS = IT_EVENTS
* IT_EVENT_EXIT = IT_EVENT_EXIT
* IS_PRINT = IS_PRINT
* IS_REPREP_ID = IS_REPREP_ID
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
* IT_HYPERLINK = IT_HYPERLINK
* IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
* IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
* IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
* ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = IT_MARA
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.




ENDIF.

ENDFORM. "SECOND_LIST

---------------Original Message---------------
From: Laurie Severt
Sent: Wednesday, April 10, 2013 10:51 AM
Subject: Expand and Collapse Buttons On ALV Grid (for Classic ALV, not OOP)

Expand and collapse buttons on ALV grid (for classic ALV, not OOP) - I have created an ALV grid program that has subtotals and I want to be able to expand or collapse detail. I cannot find (and I have searched extensively) the code I need to have these buttons (or icons) show up and be used in my grid.
I am using the FM REUSE_ALV_GRID_DISPLAY.
We are on ECC 6.I am using classic ALV (as opposed to OOP) because I do not have a complete grasp of OO programming yet.

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2013 Ziff Davis, Inc. and message author.
Ziff Davis, Inc. 28 E 28th Street New York, NY 10016
Kabiru1  
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Have an SAP Question? Ask Your Peers at Toolbox for IT

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language