I want to use the abap WRITE statement after the button was clicked.
Right now nothing happens. Can someone help?
Heres my code:
TABLES: sscrfields.
SELECTION-SCREEN:
PUSHBUTTON /33(10) submit USER-COMMAND start_search.
* button.click
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'START_SEARCH'.
WRITE: 'btn.click'.
ENDCASE.
* button label
INITIALIZATION.
submit = 'OK'.
There are several ways you can communicate with the user on the selection screen:
Use a message that shows in the bottom of the screen;
Use a popup;
Change the value of a comment on the selection screen.
Since I think the first one is the most elegant, here is the example code:
MESSAGE 'Button clicked' TYPE 'S'.
Just replace the WRITE statement you have now with the above and it should work. For a real solution you should or create a message in SE91 or a text element in your program.
Related
I created a TableView with some data from database table. This view opens in a pop-up window.
When I select any row from the pop-up, my selected value is saved into some global variable.
How can I close the pop-up window after the row is selected? How to redirect to the view from where the pop-up was triggered?
Make this:
Create on_close event and put its name into lc_close var
Assign it to your table view click and to popup like this
<htmlb:tableView>
....
onRowSelection = "ON_CLOSE" >
</htmlb:tableView>
gr_pop_up->set_on_close_event( iv_event_name = lc_close iv_view = me ).
gr_pop_up->open( ).
Make in popup outbound plug named EXIT
Fire this plug inside itself recursively
method OP_EXIT.
me->fire_outbound_plug( iv_outbound_plug = 'EXIT' ).
endmethod.
This will close your popup.
You can save your value in a data base table or in a Singelton-Object.
What type of pop-up are you using? POPUP_TO_CONFIRM? Or a DynPro?
If it's the Function Module POPUP_TO_CONFIRM then just implement your logic based on a if statement checking the attribute "answer" of the FM.
If it's a DynPro then you need to add logic on the closing event. In a PAI Module.
Dear all I need your help on the below desperately.
I have created an ALV from SALV and I have copied a GUI Status SALV_STANDARD from a standard program. Firstly I added 2 buttons the POSTNEW & POSTDIFF and after a day I added the SELECT button.
Depending on the selection of the user I want to enable or disable the buttons according to the business requirements.
I have this code in a procedure:
r_alv type reference CL_SALV_TABLE.
if status_name is not initial and report_name is not initial.
set pf-status status_name.
r_alv->set_screen_status(
pfstatus = status_name
report = report_name
set_functions = r_alv->c_functions_all ).
endif.
data: lit_functions_list type salv_t_ui_func,
lwa_functions_list like line of lit_functions_list.
r_functions = r_alv->get_functions( ). "Get Toolbar functions
lit_functions_list = r_functions->get_functions( ).
if i_button_name is not initial.
** Now hide the BUTTON
loop at lit_functions_list into lwa_functions_list.
if lwa_functions_list-r_function->get_name( ) = i_button_name.
lwa_functions_list-r_function->set_visible( i_button_visable ).
endif.
endloop.
endif.
The variables status_name, report_name, i_button_name and i_button_visable are parameters of the procedure and I think that their names show what they are carrying.
The internal table lit_functions_list has 60 records and the last 2 have data for the first 2 buttons and this is the reason that I can enable/disable them.
But there is no record with my 3rd button SELECT. Instead there is a record with the button MYFUNCTION which I have already deleted.
Can someone tell me what to do in order to have the 3rd button available in the lit_functions_list?
Can someone tell me why this itab has so many garbages?
Thanks in advance
Elias
Even I had the same problem. After I ran the report BALVBUFDEL it solved the issue.
Newly created buttons now coming inside the function list ..
lit_functions_list = r_functions->get_functions( ).
For Adding 3rd button in the lit_functions_list, You can use below code.
r_functions->set_function( NAME = 'BUT3' BOOLEAN = 'X' ).
you can also use add_function to add new button.
try.
r_functions->add_function(
name = 'BUT3'
icon = l_icon
text = l_text
tooltip = l_text
position = if_salv_c_function_position=>right_of_salv_functions ).
catch cx_salv_existing cx_salv_wrong_call.
endtry.
itab does not have garbage. It contains all the data related to status like menu bar, application tool bar and function keys.
Finally I found the answer at least to my problem. Let me describe again what I did:
I copy the GUI Status from the standard program SALV_DEMO_TABLE_FUNCTIONS to my program through Tcode SE41. I added 2 buttons POSTNEW & POSTDIF. Until now all working perfect and I can Enable/Disable these 2 buttons.
Next day the business asked me to add a button SELECT with which the user can make editable the corresponding SELECT column of the itab in order to choose which record to be posted. And here started my problem where the itab with the functions didn't contain the last created button SELECT. What I did was, I created a button through the design process of the GUI Status but I could not get it through the below code:
lit_functions_list = r_functions->get_functions( ).
With your answers I found other problems in my code but still I could not get the new button in the above itab.
Finally, yesterday evening I remembered, what someone told me in the past. In old systems (like oursSAP ECC 6.0 R701 SP007) sometimes the ALV buffer stuck and we have to reset it. So I run the program BALVBUFDEL and vuala the button SELECT appeared in the itab and I can now Enable or Disable.
So keep in mind that sometimes the ALV buffer needs a reset.
Thanks all for your help.
Elias
I display a hierarchical ALV. When I click the BACK or LEAVE or CANCEL buttons (in the toolbar), I'm supposed to go back or leave the program or cancel .
But when I click one of those buttons an additional row appends in the ALV hierarchy.
Any help ?
Check yor PBO/PAI moduls.
EXAMPLE:
IN PBO i said
module status_0100 output.
set pf-status 'GUI_STATUS_0100'.
" and some other code
" and some other code
endmodule.
IN PAI i said
module user_command_0100 input.
case sy-ucomm.
when 'CANCEL' or 'BACK'.
set screen 0.
when 'EXIT'.
leave program.
endcase.
endmodule.
In GUI_STATUS_0100 i told about buttons that i used
It might help you. Good luck!
There must be event(s) trigger along side with BACK, LEAVE and CANCEL.
Double check the function code of 3 buttons, ensure they only appears in Exit-command and when triggered, ensure there is no other subroutines inside/next to the LEAVE, RETURN... statement
If possible, please post some code.
I have a list report that uses the event block AT LINE SELECTION (and HIDE).
AT LINE-SELECTION.
WRITE: 'Testline'.
* and some more things
When I double click on a line in the main list, AT LINE SELECTION is processed, and the main list is replaced with a list that consists of the text 'Testline'.
When I klick on the green back button, the main list is shown again.
Everything works as espected.
Now to my question:
Is there some way how the report can be notified when the user clicks on the green back button to go from the detail list to the main list?
The obvious solution AT USER-COMMAND is not called.
This is the event where I want to SUBMIT the same report again to update the list.
(I know I could do this with an ALV report, but is this possible with a simple list report?)
When you check the documentation you will find the following information:
The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
table 2 includes BACK (that's the default code for the green arrow).
What you can do: Write your own status.
REPORT ytest.
DATA pf_exclude TYPE TABLE OF sy-ucomm WITH HEADER LINE.
START-OF-SELECTION.
SET PF-STATUS 'LIST'. "<--- here
WRITE: / 'Hello World'.
AT LINE-SELECTION.
WRITE: 'Testline'.
* and some more things
AT USER-COMMAND.
BREAK-POINT.
CASE sy-ucomm.
WHEN 'MYBACK'.
ENDCASE.
Now you can define your own status:
Don't forget to define PICK - or the double click will not work.
Define your own back-function.
I am new to ABAP and I want to make a program with multiple screens and an initial home screen where one can see the list of all program screens. I understand that I can hardcode them but there should be a better way.
If there is any what kind of field/area do I need to make this list clickable (to go to screen). So far I have made an initial screen and when the GO button is pressed it leads to the next screen
REPORT Z_UZD_1_LOCAL.
CALL SCREEN 1001.
MODULE STATUS_1000 OUTPUT.
* SET PF-STATUS 'ZMENU'.
* SET TITLEBAR 'ZMENU_PAINTER'.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'GO'.
CALL SCREEN 1001.
ENDCASE.
ENDMODULE.
MODULE STATUS_1001 OUTPUT.
* SET PF-STATUS 'ZMENU'.
* SET TITLEBAR 'ZMENU_PAINTER'.
CASE SY-UCOMM.
WHEN 'GO2'.
CALL SCREEN 1000.
ENDCASE.
ENDMODULE.
It looks like this:
Go to Personas button leads to the next screen, and I would like to have a list of all the screens under the find button.
You can read the table D020S and its text-table D020T with the key program = sy-repid, which should give you all dynpros which belongs to this program (sy-repid is your actual program).
Is this what you want?