2010 Dec 15 9:28 AM
hi experts,
i have a blocked alv list and the blocks are displayed with respect to the department...i want to display the block alv but i dont know the number of departments so the number of blocks would be dynamic that i will get from the internal table..
i tried to use append block in loop with respect to the department but could not display it..can any one guide me..
with thanks in advance,
syed
2010 Dec 15 10:40 AM
hi,
this is my code
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = SY-REPID
i_callback_user_command = 'USER_COMMAND'.
LOOP AT IPUT INTO WPUT.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE WPUT TO <OUTTAB>.
APPEND <OUTTAB> TO OUTTABLE.
ON CHANGE OF WPUT-DEPARTMENT.
PERFORM APPEND_BLOCK.
REFRESH OUTTABLE.CLEAR OUTTABLE.
ENDON.
CLEAR WPUT.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
EXCEPTIONS
program_error = 1
OTHERS = 2.
"perform append _block
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = gt_fieldcatcH[]
is_layout = t_layout
i_tabname = 'OUTTABLE'
it_events = t_event
TABLES
t_outtab = OUTTABLE
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
with thanks in advance,
syed
Edited by: SYED_ibbu on Dec 16, 2010 4:28 AM
Edited by: SYED_ibbu on Dec 17, 2010 11:18 AM
Edited by: SYED_ibbu on Dec 31, 2010 6:45 AM
2010 Dec 31 5:57 AM
Try using FM CALL FUNCTION REUSE_ALV_BLOCK_LIST_DISPLAY after REUSE_ALV_BLOCK_LIST_APPEND
Use :
data : print_layout TYPE slis_print_alv
call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
exporting
is_print = print_layout
Edited by: K.Manas on Dec 31, 2010 6:59 AM
2010 Dec 31 6:49 AM
hi manas,
thanks for the reply.
i have actually used list display after block append .I have Called the Block append through subroutine...
Any way Around..
thanks in advance,
syed
2010 Dec 31 7:48 AM
Try passing I_INTERFACE_CHECK = 'X'. If you read the FM documentation it says not to use that. IF this fails comment the EXPORTING.
Edited by: K.Manas on Dec 31, 2010 8:49 AM
2010 Dec 31 8:14 AM
thanks again,
i tried it but no luck..any other way?
thanks in advance,
syed
2010 Dec 31 8:21 AM
Syed,
May be you can check if you are clearing or refreshing your internal table before display. Debug and see if that would be happening.
This is a sample code of using blocks in ALV. Hope this would help you in any way.
[Using Block ALV|http://www.sap-img.com/abap/reuse-alv-block-list-display.htm]
2010 Dec 31 8:34 AM
thanks again,
My problem is not displaying the Block ALV but to Display it dynamically.. that is i will not know how many blocks i will need until runtime..so i cannot predefine my no of blocks as in the Code you provide..
for example...if i have 4 departments i need to have four blocks for 4 departments and if 5 means 5 departments
below is my code.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = SY-REPID
i_callback_user_command = 'USER_COMMAND'.
LOOP AT IPUT INTO WPUT.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE WPUT TO <OUTTAB>.
APPEND <OUTTAB> TO OUTTABLE.
ON CHANGE OF WPUT-DEPARTMENT."i need to find the no. of blocks with respect to the number of department
PERFORM APPEND_BLOCK."when there is a change in department a block has to be added..
REFRESH OUTTABLE.CLEAR OUTTABLE."here the value is getting refreshed as it should but if i call reuse alv block list alv before refreshing the the first block appeara then when i click back the 2nd block apperas twice. and 3rd and 4th as such..
ENDON.
CLEAR WPUT.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
EXCEPTIONS
program_error = 1
OTHERS = 2.
"perform append _block
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
it_fieldcat = gt_fieldcatcH[]
is_layout = t_layout
i_tabname = 'OUTTABLE'
it_events = t_event
TABLES
t_outtab = OUTTABLE
EXCEPTIONS
program_error = 1
maximum_of_appends_reached = 2
OTHERS = 3.
thanks in advance,
syed
2011 Jan 07 1:32 PM
Hi Syed, I have run into the same problem. Have you found a solution to it?
Thanks,
2011 Jan 07 2:18 PM
hi hinlai,
no, i have not found a solution ..do post the solution if you found one.
regards,
syed