0

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.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • 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 Aug 03 '17 at 13:12
  • 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! –  Aug 03 '17 at 13:14
  • To prevent this you should remove `CLEAR` :)) – Suncatcher Aug 03 '17 at 13:15
  • 1
    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 Aug 03 '17 at 13:17
  • Also, the code is now incomplete and the CLEAR statement is still in a nonsensical position in the code. – vwegert Aug 03 '17 at 13:27

2 Answers2

0

here you go buddy:

 WHEN 'BACK'.
        CLEAR: ekpo-ebeln ,ekpo-ebelp.
        ssn = '500'.
Jagger
  • 10,350
  • 9
  • 51
  • 93
Demotivated
  • 117
  • 3
  • 13
0

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

Gerd Castan
  • 6,275
  • 3
  • 44
  • 89