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

Former Member
0 Likes
613

I want the Standard ALV buttons as well as my own Customized buttons simultaneouly.

help me.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
571

hih,

do like this

first u need to copy standard toolbar of alv into ur toolbar (z*) for ur report....

for this u need to copy status into SE41.

Go to SE41.

click on copy status button....

now into FROM

Program SAPLKKBL

Status STANDARD_FULLSCREEN

Into TO

Program ZALV_DS (ur program name)

Status ZSTAT ( ur status name)

now go to ur program.....

FORM display_data.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZALV_DS'

i_callback_user_command = 'USER_COMMAND'

i_callback_pf_status_set = 'SET_STAT'

is_layout = st_layout

i_save = 'X'

it_fieldcat = t_fcat

it_events = t_eve

TABLES

t_outtab = itab

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.

ENDFORM. "display_data

FORM set_stat USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZSTAT' EXCLUDING rt_extab.

ENDFORM. "SET_STAT

FORM user_command USING u_comm LIKE sy-ucomm sel_fld TYPE slis_selfield.

CASE u_comm.

WHEN 'TEST'.

CALL TRANSACTION 'MM03'.

ENDCASE.

ENDFORM. "user_command

after copying a status into SE41, open ur Z status, add button u want to add and activate it.

I have added button named TEST...

reward if usefull...

5 REPLIES 5
Read only

Former Member
0 Likes
571

Create an event handler for event TOOLBAR of CL_GUI_ALV_GRID and register this handler with your grid.

In event handler write:

DATA:

zls_toolbar TYPE stb_button.

*-Append an icon for "New Row"

CLEAR:

zls_toolbar.

zls_toolbar-function = 'NEW_ROW'.

zls_toolbar-icon = icon_insert_row.

zls_toolbar-quickinfo = text-f31.

zls_toolbar-text = text-f31.

APPEND zls_toolbar

TO e_object->mt_toolbar.

Regards,

John.

Read only

Former Member
0 Likes
571

How to add button to ALV toolbar using REUSE_ALV_LIST_DISPLAY?

In the program which calls ALV using REUSE_ALV_LIST_DISPLAY,

I have to add a new button.

I saw the demo program BCALV_GRID_08, which is written using ABAP-Controls.

In that example, the button is added using TOOLBAR event of cl_gui_alv_grid.

Could you help me to implement the same logic using REUSE_ALV_LIST_DISPLAY parameters.

you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.

Execute this transaction to get to next screen. select status using checkbox. click on GUI Status --> Copy.

Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.

Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality such as sorting/subtotaling etc...

When you call 'REUSE_ALV_GRID_DISPLAY' make sure you pass it the new status name.

an example of one of mine:

call function 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZSDBOLST_REPORT'

i_callback_pf_status_set = 'STANDARD' <----


i_callback_user_command = 'USER_COMMAND'

i_structure_name = 'I_BOLACT'

i_grid_title = 'BOL Action Report'(031)

is_layout = gs_layout

it_fieldcat = gt_fieldcat[]

i_save = 'A'

is_variant = v_variant

TABLES

t_outtab = i_bolact

EXCEPTIONS

program_error = 1

others = 2.

I just tried the same procedure ,but my entire application toolbar disappeared and a lock icon appears next to the application toolbar in my copied pf-status.

Could you advice what might have gone wrong ?

As identified with the FM's help you can do the following.

1). Using SE80 (I think) you can copy a GUI status from one program to another. It mentions which one in the FM's help.

2). Create a form named like so:

Code:

Form Set_pf_status

Notes: Called by FM REUSE_ALV_GRID_DISPLAY

FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZSTANDARD'.

ENDFORM. "Set_pf_status

In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.

3). Create the following report:

Code:

Form User_command

Notes: Called by FM REUSE_ALV_GRID_DISPLAY

Detects whether the icon/button for

'Return Tag Deletion' has been pressed. If it has then

detect whether any rows have been highlighted and then

set the delete flag.

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

DATA: li_count TYPE I.

IF r_ucomm EQ '%DELETE'.

LOOP AT %g00 WHERE mark EQ 'X'.

ADD 1 TO li_count.

ENDLOOP.

IF li_count GT 0.

gc_delete_flag = 'X'.

r_ucomm = '&F03'. "Back arraow

ELSE.

MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.

ENDIF.

ENDIF.

ENDFORM. "User_command

As I've added an extra button to indicate which records should be deleted I need to identify a form to be called to process when this button is chosen.

Then when you call the ALV function you to specify the following extra details:

Code:

call function 'REUSE_ALV_GRID_DISPLAY'

exporting i_callback_program = gc_repid

I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

i_grid_title = lc_grid_title

is_layout = lc_layout

it_fieldcat = gt_fieldcat

it_sort = sort

i_save = l_save

is_reprep_id = l_bbs_id

is_variant = l_variant

tables t_outtab = %g00

exceptions program_error = 1

others = 2.

The parameters in capitals are the extra ones that need to be added.

Reward points if useful

Read only

Former Member
0 Likes
572

hih,

do like this

first u need to copy standard toolbar of alv into ur toolbar (z*) for ur report....

for this u need to copy status into SE41.

Go to SE41.

click on copy status button....

now into FROM

Program SAPLKKBL

Status STANDARD_FULLSCREEN

Into TO

Program ZALV_DS (ur program name)

Status ZSTAT ( ur status name)

now go to ur program.....

FORM display_data.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = 'ZALV_DS'

i_callback_user_command = 'USER_COMMAND'

i_callback_pf_status_set = 'SET_STAT'

is_layout = st_layout

i_save = 'X'

it_fieldcat = t_fcat

it_events = t_eve

TABLES

t_outtab = itab

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.

ENDFORM. "display_data

FORM set_stat USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'ZSTAT' EXCLUDING rt_extab.

ENDFORM. "SET_STAT

FORM user_command USING u_comm LIKE sy-ucomm sel_fld TYPE slis_selfield.

CASE u_comm.

WHEN 'TEST'.

CALL TRANSACTION 'MM03'.

ENDCASE.

ENDFORM. "user_command

after copying a status into SE41, open ur Z status, add button u want to add and activate it.

I have added button named TEST...

reward if usefull...

Read only

0 Likes
571

Thank u.....

it is working.

Read only

Former Member
0 Likes
571

hi,

1. Please give me general info on ALV.

http://www.sapfans.com/forums/viewtopic.php?t=58286

http://www.sapfans.com/forums/viewtopic.php?t=76490

http://www.sapfans.com/forums/viewtopic.php?t=20591

http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.

2. How do I program double click in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=11601

http://www.sapfans.com/forums/viewtopic.php?t=23010

3. How do I add subtotals (I have problem to add them)...

http://www.sapfans.com/forums/viewtopic.php?t=20386

http://www.sapfans.com/forums/viewtopic.php?t=85191

http://www.sapfans.com/forums/viewtopic.php?t=88401

http://www.sapfans.com/forums/viewtopic.php?t=17335

4. How to add list heading like top-of-page in ABAP lists?

http://www.sapfans.com/forums/viewtopic.php?t=58775

http://www.sapfans.com/forums/viewtopic.php?t=60550

http://www.sapfans.com/forums/viewtopic.php?t=16629

5. How to print page number / total number of pages X/XX in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)

6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.

http://www.sapfans.com/forums/viewtopic.php?t=64320

http://www.sapfans.com/forums/viewtopic.php?t=44477

7. How can I set the cell color in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=52107

8. How do I print a logo/graphics in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=81149

http://www.sapfans.com/forums/viewtopic.php?t=35498

http://www.sapfans.com/forums/viewtopic.php?t=5013

9. How do I create and use input-enabled fields in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=84933

http://www.sapfans.com/forums/viewtopic.php?t=69878

10. How can I use ALV for reports that are going to be run in background?

http://www.sapfans.com/forums/viewtopic.php?t=83243

http://www.sapfans.com/forums/viewtopic.php?t=19224

11. How can I display an icon in ALV? (Common requirement is traffic light icon).

http://www.sapfans.com/forums/viewtopic.php?t=79424

http://www.sapfans.com/forums/viewtopic.php?t=24512

12. How can I display a checkbox in ALV?

http://www.sapfans.com/forums/viewtopic.php?t=88376

http://www.sapfans.com/forums/viewtopic.php?t=40968

http://www.sapfans.com/forums/viewtopic.php?t=6919

Link containing all the important PDFS. ( There is a PDF for ALV Grid in this link)

http://www.easymarketplace.de/online-pdfs.php

Do reward.