Buttons Back, Leave and Cancel are inoperative in Hierarchical ALV - abap

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.

Related

How to close a modal popup window when pressing the escape key

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

WRITE statement after button was clicked

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.

Disable enter in module pool sap abap

I have created a function module pool in sap abap. How can I make it possible when the user presses enter the values in input field not to disappear?
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
CALL SCREEN 100.
WHEN 'DISPLAY' .
SELECT SINGLE * FROM ekpo
WHERE ebeln = ekpo-ebeln AND ebelp = ekpo-ebelp.
ssn = 400.
ENDCASE.
CLEAR: ekpo-ebeln ,ekpo-ebelp.
CLEAR ok_code.
ENDMODULE.
What Am I missing.If I remove CLEAR: ekpo-ebeln ,ekpo-ebelp even if I change screens the fields remain filled.
How to keep the values in the field and even if the user presses enter nothing should happen.
here you go buddy:
WHEN 'BACK'.
CLEAR: ekpo-ebeln ,ekpo-ebelp.
ssn = '500'.
While the accepted answer solves the apparent problem in Dynpro 0200, this is not the best event to do it.
It appears to me you want to control the initial value of the fields for the next time dynpro 0200 appears.
Do clear/set the fields in the PAI of the Dynpro that calls Dynpro 0200.
(sometimes PBO of Dynpro 0200 also is a good place, but probably not in your case).

Event for back button after AT LINE SELECTION in ABAP list report?

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.

Find out all program dynpro screens?

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?