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

Push Button On ALV

Former Member
0 Likes
580

I have done coding for G/L interface . This report displays an ALV at the end after performnig validations on each record uploaded from a flat file. Once all records are checked , the ALV requires a PUSH BUTTON that when triggered will post the records.

My query is, how shud i add a push button in the ALV in the title bar.

5 REPLIES 5
Read only

Former Member
0 Likes
548

Hi,

You have to copy the standard pf status to a new one.

For this go to the ALV screen and take the menu System -> Status. (I do not access to the system now) then look for the standard pf status. Copy this to Z range and then add your new button.

Even you can do in this method

Create a GUI status.

Go to GUI Status->Application toolbar.

THen add the button by giving

Function text

Icon name

Icon text

Info. text

Fastpath

Then in PBO of the screen,

Just give in a module

set pf_status 'ZSTATUS'.

Here is an example for your question


TYPE-POOLS: slis.

DATA: i_qmel LIKE qmel OCCURS 0.
data v_repid type repid.
SELECT * FROM qmel INTO TABLE i_qmel.

v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = v_repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
i_structure_name = 'QMEL'
TABLES
t_outtab = i_qmel
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 set_pf_status using rt_extab type slis_t_extab.
set pf-status 'TEST'.
endform.

FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
data lv_ucomm type sy-ucomm.
lv_ucomm 
= sy-ucomm. 
CASE lv_ucomm.
WHEN 'BUTTON'. "Double Click line Item
call transaction 'MM01'.
endcase.
endform.

To Click on the you have to do in the following way


i_callback_user_command = 'USER_COMMAND'

form user_command using i_ucomm like sy-ucomm 
is_selfield type slis_selfield.

case i_ucomm. 

when 'XXXX'. "XXXX is the function code for new button
endcase.
endform.

For More info please refer the below links

Please refer the following

https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/t...

http://www.sap-basis-abap.com/abap/add-button-to-alv-toolbar-with-reuse-alv-list-display.htm

Regards,

Chandru

Read only

0 Likes
548

Thanks Chadru..

Read only

Former Member
0 Likes
548

Hi,

Please refer to the link below :

http://www.sapdev.co.uk/reporting/alv/alvgrid_pfstatus.htm

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
548

Hi,

Create a new pf-status. In that copy the required icons from standard pf-status. Add the button you require for the report.

Add this functionality to the program :

set pf-status 'newpf'.

case sy-ucomm.

when 'button'.

perform < action >.

endcase.

reward if helpful.

regards,

cs.

Read only

Former Member
0 Likes
548

Have a look at demo report BCALV_GRID_05, it is the most elegant solution.

Bert