0
votes

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.

2
Your question is very unclear. You empty the fields with CLEAR, then complain that they are empty afterwards, then remove CLEAR and then complain that the fields stay filled...? - vwegert
NO,when I press enter the fields are emptied,how to prevent this?And how to clear the fields when I move from one screen to another! - user6780121
To prevent this you should remove CLEAR :)) - Suncatcher
Your code is a total mess. Move selection into separate module and rebuild the CASE into more compact view. Now your values are emptied no matter what key was pressed. - Suncatcher
Also, the code is now incomplete and the CLEAR statement is still in a nonsensical position in the code. - vwegert

2 Answers

0
votes

here you go buddy:

 WHEN 'BACK'.
        CLEAR: ekpo-ebeln ,ekpo-ebelp.
        ssn = '500'.
0
votes

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