Application Development 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: 

button added in screen 1000 doesn't work

former_member397321
Participant
0 Kudos

hello experts,

I added a button in the screen 1000 of a report, following the instructions below of one of the member:

Hi,

Please follow These steps,

First execute Your report, after that click on System -> status

copy the Program(GUi) and GUI status

Go to Se41

Click on Copy Status button

Provide the From program and status as as copied above and provide To Program (your program name) ans status (zstat).

Active it.

In your Report Provide the name for  I_CALLBACK_PF_STATUS_SET.

form STATUS USING i_extab TYPE slis_t_extab.

   set PF-STATUS 'ZSTAT'.

ENDFORM.

Write the code for Back Button in usercommand.

form user USING V1 TYPE sy-ucomm

                 V2 TYPE slis_selfield.

CASE V1.

WHEN 'BACK'.

       leave TO SCREEN 1000.

endcase.

endform.

So When I click on that button called DCLI, I hope to find that value on sy-ucomm but it doesn't appear.

I want to add some code after click in DCLI.

I haven't done  the last instruction about creating a form user......

I'm looking forward to hearing from you.

Thanks.

17 REPLIES 17

omer_sakar
Participant
0 Kudos

Hi Elina,

Please share your code and I can check.

0 Kudos

YES OF COURSE:

As I said I copied the standard status to my report z and implemented the code on bold below.

REPORT zpfontraneef

        MESSAGE-ID e4

        NO STANDARD PAGE HEADING LINE-SIZE 255.


* DATA DECLARATION SECTION

DATAv_zintb(6), ws_banco LIKE it_movs_bc1-banco,

***      Dados do DCLI- assinaturas


u TYPE sy-ucomm, """icon sy-ucomm

itab TYPE slis_t_extab,

it type slis_selfield .

. . .


AT SELECTION-SCREEN OUTPUT.

   LOOP AT SCREEN.

     IF screen-group1 = '901'.

       screen-input = 0.

       MODIFY SCREEN.

     ENDIF.

   ENDLOOP.

*

  PERFORM status USING itab. " THIS PERFORM RETURNS THE BUTTON I HAVE ADDED


START-OF-SELECTION.

   break nur.

* Ler o ficheiro

   PERFORM ler_ficheiro.

* Processar o ficheiro

   PERFORM valida_dados.

*****  Visualizar Assinaturas-

  PERFORM ucomm_dcli USING u it. "itab- I haven't codded this perform yet

END-OF-SELECTION.

FORM ucomm_dcli USING V1 TYPE sy-ucomm

                       v2 TYPE slis_selfield  . "

*how to fill this form

ENDFORM.                    " UCOMM_DCLI

0 Kudos

Assign 'UCOMM_DCLI' your I_CALLBACK_USER_COMMAND parameter of REUSE_ALV_GRID_DISPLAY like this :

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

   EXPORTING

     I_CALLBACK_USER_COMMAND  = 'UCOMM_DCLI'


EDIT :

FORM ucomm_dcli USING V1 TYPE sy-ucomm

                       v2 TYPE slis_selfield  .


   CASE V1.

     WHEN 'DCLI'.

      "write what do you want to do when click the button

ENDCASE.

ENDFORM.                    " UCOMM_DCLI


0 Kudos

OK, BUT

IN WHICH EVENT?

0 Kudos

HI Omer, thank you for your replay,

does it means that there is no perform? I mean no directly call of FORM ucomm_dcli

kind regards

0 Kudos

yes,

it performs your form 'UCOMM_DCLI' by doing this :


I_CALLBACK_USER_COMMAND  = 'UCOMM_DCLI'

0 Kudos

OK. DO YOU MEAN  CALL THE FUNCTION END IMPLEMENT FORM IN START_OF_SELECTION EVENT...

0 Kudos

I'M DOING SOMETHING WRONG THE PROGRAM DOESN'T STOP IN CALL FUNCTION, LOOK:

START-OF-SELECTION.

   break nur.

* Ler o ficheiro

   PERFORM ler_ficheiro.

* Processar o ficheiro

   PERFORM valida_dados.

  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           = 'UCOMM_DCLI'

*     I_CALLBACK_TOP_OF_PAGE            = ' '

*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '

*     I_CALLBACK_HTML_END_OF_LIST       = ' '

*     I_STRUCTURE_NAME                  =

*     I_BACKGROUND_ID                   = ' '

*     I_GRID_TITLE                      =

*     I_GRID_SETTINGS                   =

*     IS_LAYOUT                         =

*     IT_FIELDCAT                       =

*     IT_EXCLUDING                      =

*     IT_SPECIAL_GROUPS                 =

*     IT_SORT                           =

*     IT_FILTER                         =

*     IS_SEL_HIDE                       =

*     I_DEFAULT                         = 'X'

*     I_SAVE                            = ' '

*     IS_VARIANT                        =

*     IT_EVENTS                         =

*     IT_EVENT_EXIT                     =

*     IS_PRINT                          =

*     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_HYPERLINK                      =

*     IT_ADD_FIELDCAT                   =

*     IT_EXCEPT_QINFO                   =

*     IR_SALV_FULLSCREEN_ADAPTER        =

*   IMPORTING

*     E_EXIT_CAUSED_BY_CALLER           =

*     ES_EXIT_CAUSED_BY_USER            =

*    TABLES

*      t_outtab                          =

*   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.

*****  Visualizar Assinaturas-

   PERFORM ucomm_dcli USING u it. "itab


END_OF_SELECTION

0 Kudos

yeah.Please do not letter capitalized.

And if my answer is correct,check correct.

0 Kudos

ok,

I'm quite sure that the problem is where I call the function because program doesn't compile the event start_of_selection. when I click on the button DCLI, program ends to run after the event AT SELECTION-SCREEN OUTPUT.

0 Kudos

you can not perform ucomm_dcli.

You should learn more about events :Event blocks - ABAP Programming (BC-ABA) - SAP Library

There is a standard sample and take a look : BCALV_FULLSCREEN_GRID_EDIT

0 Kudos

Thank you all,

I'm fighting for reach my goal. In that standard BCALV_FULLSCREEN_GRID_EDIT the list is an ALV but mine is simple report.

Thank you for the topics you have suggested...

revanchatraban
Participant
0 Kudos

It is better to use factory method of the class cl_salv_table.

data: lo_table type ref to cl_salv_table,

          lo_events TYPE REF TO  cl_salv_events_table,

          lo_error_log TYPE REF TO cl_log.


Copy the status from the standard one and add your own button in application toolbar.

Set pf-status in the report as

lo_table->set_screen_status(    report = sy-repid
                                  pfstatus = 'Z STANDARD'
                             set_functions = 2 ).


Then use event class  to perform your action in the output as

lo_events = lo_table->get_event( ).


Then create the object for the local class.

set the handler for the event as :

SET HANDLER lo_error_log->handle_user_command FOR lo_events.


The sample code for the events using local class is:


CLASS cl_log DEFINITION.

   PUBLIC SECTION.
     METHODS handle_user_command FOR EVENT if_salv_events_functions~added_function
     OF cl_salv_events_table.

ENDCLASS


In the implementation of the local class , write the functionality u needed.

former_member397321
Participant
0 Kudos

Hi experts,

I haven't solved a problem yet,

here is what i have done:

Copied from standard status %_00 of program RSSYSTDB to my z program(sample report not an ALV) and z status,

Added new button in the z status with icon and etc in attributes,

called the new z status in my z program...

I can see new button when I run my transaction, but

Sy-ucomm is not catching  value of the new button,

Code I have added for new button is not working,

I'm looking forward to hearing from you.

raymond_giuseppi
Active Contributor
0 Kudos

For a selection-screen report don't use solutions provided for ALV but read online documentation on

  • SSCRFIELDS
  • SELECTION-SCREEN FUNCTION KEY or FM RS_SET_SELSCREEN_STATUS

Regards,

Raymond

0 Kudos

thank you experts,


The screen of the my Report is that standard screen 1000.

that was why I have copied the status %_00 of program RSSYSTDB .

regards

0 Kudos

Hi,

You are not working with an ALV but the step you are following ( "copy status and add button" ) is for  ALV.

To add button to selection screen of report you will have to use SSCRFIELDS as told by Raymond.

Search on SCN on how to use sscrfields to add button.

After the button is added. You can catch the button click in event AT SELECTION-SCREEN.

event START-OF-SELECTION only gets executed after Execution button(F8) is pressed on the selection screen.

Thanks & regards,

Ashish