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?
Related
Is it possible to call the function MAT1_F4_HELP_EXIT in the PBO module of the screen to trigger search help for a material field on a custom screen (assigning the search help using se11 and search help exit is not working).
I am confused regarding the parameters that are being passed in the function.
Edit (taken from discussion)
I have a field called material, and I want to trigger a search help (MAT1). I have assigned it the table field and it is not letting the user do it automatically. So, I want to call it explicitly.
I have reproduced the issue (cf minimal code and screen at the bottom).
Steps to reproduce :
start the program (-> ALV displayed)
double click one line of the ALV (-> screen 0100 displayed)
press F4 on screen field defined with search help (-> popup 'abnormal situation' instead of search help!)
Reason: the active GUI status reassigns the F4 function key a classic function key behavior instead of calling the search help and as you didn't set a GUI status in your screen, the one of the previous screen is used again.
Solution: define your own GUI status and set it in the PBO of the screen (and don't redefine F4 of course!)
Rule of thumb : always define your own buttons and menus for every screen (why would you display buttons and menus from other screens which make no sense).
Minimal code:
REPORT.
SELECT * FROM sflight INTO TABLE #DATA(flights).
" does a CALL SCREEN which does SET PF-STATUS 'STANDARD_FULLSCREEN' (in program SAPLKKBL)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'SFLIGHT'
TABLES
t_outtab = flights
EXCEPTIONS
OTHERS = 2.
FORM user_command
USING
r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
IF r_ucomm = '&IC1'.
CALL SCREEN 100.
ENDIF.
ENDFORM.
MODULE pbo OUTPUT.
" missing part !! ==> create GUI status 0100 and do SET PF-STATUS '0100'
ENDMODULE.
MODULE pai INPUT.
CASE sy-ucomm.
WHEN '&F03'.
SET SCREEN 0.
WHEN '&F4'.
" corresponds to F4 key inherited from ALV GUI status 'STANDARD_FULLSCREEN'
MESSAGE 'abnormal situation -> define your own GUI status !' TYPE 'I'.
ENDCASE.
ENDMODULE.
Screen 0100 :
Any field with search help (same as you did)
Flow logic of screen 0100 :
PROCESS BEFORE OUTPUT.
MODULE pbo.
PROCESS AFTER INPUT.
MODULE pai.
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 an ABAP Z-report which shows a modal popup window(screen). Is it possible to close it when user presses an escape key?
I'm showing the popup using the next screen call
call screen 0100 STARTING AT 10 10 ENDING AT 110 30.
The screen has the next PAI module:
MODULE USER_COMMAND_0100 INPUT.
clear gv_ok.
case sy-ucomm.
when 'BTN_OK'.
gv_ok = 'X'.
LEAVE TO SCREEN 0.
when 'BTN_CANC'.
perform clean.
LEAVE TO SCREEN 0.
endcase.
ENDMODULE. " USER_COMMAND_0100 INPUT
But the PAI module is not called whe the user presses an escape key.
The flow logic section is
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
module exit at exit-command.
Nothing from PAI modules is called while Esc key is being pressed.
Here is what you have to check in the GUI status:
The escape key is assigned automatically to this, you only need to assign the command (BUT_CANC, it is ZCANC in my example).
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.
my current screen-build looks like this:
But when i try to get back from Screen 250(called screen) to 100(the calling screen) it just leaves the program.
CASE OK_CODE.
*Navigation back to the calling screen
WHEN 'BACK'.
SET SCREEN 0.
I hope you guys could help me out. Thanks!
You might want to try LEAVE TO SCREEN 100 instead of SET SCREEN 0.
This post gives detailed infos about it.
Solved
ok_code = sy-ucomm.
*updating the value of the ok_code
CASE OK_CODE.
*Navigation back to the calling screen
WHEN 'BACK'.
SET SCREEN 0.
*all not applicable conditions
WHEN OTHERS.
ENDCASE.
ENDMODULE.
Had to set ok_code = sy-ucomm because the ok_code value didnt change.
Assign the OK code field in screen 250 to OK_CODE. In screen painter set the OK code in the screen (it's the bottom attribute with the type OK) to OK_CODE and your original code should work.
leave to screen 0
or
set screen 0
both variants work to return to previous screen, but it is important that you called the subsequent screen with
call screen '1234'
so it behaves like a stack of screens.
instead of
set screen '1234'
(the latter would replace the current screen with the new screen, so no "pop from screen stack" is possible)