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

Display list when pushbutton is pressed.

Former Member
0 Likes
2,018

Hi Experts,

I have a requirement, when a pushbutton is pressed in the selection screen I would like to display a list based on the user's selection inputs.

Right now I cannot display the list using the pushbutton press but the list is displayed when i click on the execute button.

I don't want to use the execute button to show the list, but instead I want to used the pushbutton to execute the list. Can anyone help me how to achieve this.

Thanks,

Prabhu.

Message was edited by: Prabhakaran Paramasivan

1 ACCEPTED SOLUTION
Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,342

Hi Prabhu

You can control pushbutton actions at the event block <b>"AT SELECTION-SCREEN"</b> regarding the value sy-ucomm.

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

8 REPLIES 8
Read only

ssimsekler
Product and Topic Expert
Product and Topic Expert
0 Likes
1,343

Hi Prabhu

You can control pushbutton actions at the event block <b>"AT SELECTION-SCREEN"</b> regarding the value sy-ucomm.

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

Read only

0 Likes
1,342

Thanks, I doing the same. But in the event block "AT SELECTION-SCREEN" and for the sy-ucomm value if I have some list printed out( write statement). I'm not able the see that on the screen. I have made sure that the control comes there when the button is clicked.

Should I hide the selection screen in order to show the List values.

AT SELECTION-SCREEN.

CASE sscrfields-ucomm.

WHEN 'GEN_PB'.

  • PERFORM SAM_RUN.

MESSAGE i000 with 'Execute SAM Run.'.

WHEN 'DREP_PB'.

PERFORM SAM_REPORT.

ENDCASE.

In the above code I'm calling the form SAM_REPORT when the Push button has the value 'DREP_PB'.

In the form SAM_REPORT, I have displaying a list which is not shown when the button is pressed. If I give a message there, a message window is shown but the list is not shown. Could you please tell me if i'm doing it wrong.

Regards,

Prabhu.

Message was edited by: Prabhakaran Paramasivan

Read only

0 Likes
1,342

Hi,

I created one program with following code:

SELECTION-SCREEN PUSHBUTTON /10(20) TEXT-001 USER-COMMAND GO.

AT SELECTION-SCREEN.
 CASE SY-UCOMM.
  WHEN 'GO'.
    SUBMIT TEST2 AND RETURN.
 ENDCASE.

and second one which is called from the first one after button click:

 REPORT TEST2 .
  WRITE:/ 'Line 1'.
  WRITE:/ 'Line 2'.

and it works...

Krzys

Read only

0 Likes
1,342

Hi Krzys,

Thank you for your suggestion, but I don't want to create a new program to display the report. I have the list in the form, is there a way to do the same by calling the form.

Thanks,

Prabhu.

Read only

Read only

0 Likes
1,342

Hi,

Check this sample code.

data : itab type standard table of mara.

select-options : s_matnr for mara-matnr.

SELECTION-SCREEN PUSHBUTTON /10(20) TEXT-001 USER-COMMAND GO.

AT SELECTION-SCREEN .

CASE SY-UCOMM.

WHEN 'GO'.

select * from mara into table itab where matnr = s_matnr.

set screen 9000.

ENDCASE.

module STATUS_9000 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

...Make your ALV

  • Write statement won't work here.But you can use ALV by building fieldcatalog

endmodule. " STATUS_9000 OUTPUT

Hope it helps.If so,reward points.Otherwise,get back.

Read only

0 Likes
1,342

Hi Prabhakaran,

Please refer the standard program: RPLICO10.

Otherwise: See this sample code:

SELECTION-SCREEN BEGIN OF BLOCK b_2 WITH FRAME TITLE text-001.

SELECT-OPTIONS s_fields FOR qpmk-mkmnr NO-DISPLAY.

SELECTION-SCREEN PUSHBUTTON /1(24) name USER-COMMAND <b>flds</b>.

SELECTION-SCREEN END OF BLOCK b_2.

AT SELECTION-SCREEN.

IF sscrfields-ucomm = '<b>FLDS</b>'.

PERFORM display_fields.

ENDIF.

******************

In the form:

DATA: v_rc LIKE sy-subrc.

DATA: BEGIN OF i_sort_tab OCCURS 0,

fieldtext LIKE dntab-fieldtext,

fieldname LIKE dynpread-fieldname,

tabname LIKE dntab-tabname,

field LIKE dntab-fieldname,

END OF i_sort_tab.

DATA: i_selecttab LIKE i_sort_tab OCCURS 3 WITH HEADER LINE.

i_sort_tab-fieldtext = 'AAAA'.

i_sort_tab-fieldname = 'C303'.

i_sort_tab-tabname = 'ZZZZ'.

APPEND i_sort_tab.

i_sort_tab-fieldtext = 'BBBB'.

i_sort_tab-fieldname = 'C304'.

i_sort_tab-tabname = 'QPMK'.

APPEND i_sort_tab.

CALL FUNCTION 'FIELD_CHOICE'

EXPORTING

maxfields = c_max

titel1 = text-002

titel2 = text-003

popuptitel = text-004

  • NOTDELETEABLE =

  • INFO_TEXT =

  • DYN_PUSHBUTTON_TEXT1 =

  • DYN_PUSHBUTTON_TEXT2 =

  • DYN_PUSHBUTTON_TEXT3 =

  • NOSORT = ' '

nomove = ' '

  • INITIAL_SORT = 0

IMPORTING

return_code = v_rc

TABLES

fieldtabin = i_sort_tab

selfields = i_selecttab

  • EXCEPT_TAB =

EXCEPTIONS

no_tab_field_input = 1

to_many_selfields_entries = 2

OTHERS = 3 .

IF NOT i_selecttab[] IS INITIAL.

REFRESH s_fields.

LOOP AT i_selecttab INTO w_selecttab.

s_fields-sign = 'I'.

s_fields-option = 'EQ'.

s_fields-low = w_selecttab-fieldname.

APPEND s_fields.

ENDLOOP.

ENDIF.

Hope this helps you.

Regards,

Anjali

Message was edited by: Anjali Devi

Read only

Former Member
0 Likes
1,342

Hi Prabhu,

The solution to your question is quite simple. Look at the following code snippet.

parameters: p_test type i.

at selection-screen output.
  set pf-status 'TEST'.

start-of-selection.
  write p_test.

Just make sure that you create a PF-STATUS in the menu painter. there should be one button on the application toolbar and the Function code for that has to be <b>ONLI</b>.

Regards,

Anand Mandalika.