Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Screen Painter - Enter clears all fields

Former Member
0 Kudos
89

I have 2 input fields in a screen and a table control. When I press the enter key all fields are cleared except the table control values. How to retain the values

PROCESS BEFORE OUTPUT.

  MODULE status_0100.

  MODULE tblcntrl_change_tc_attr.
  LOOP AT   i_items
       INTO wa_items
       WITH CONTROL tblcntrl
       CURSOR tblcntrl-current_line.
  ENDLOOP.

PROCESS AFTER INPUT.

  LOOP AT i_items.
    MODULE tblcntrl_modify.
  ENDLOOP.

  MODULE user_command_0100.

MODULE tblcntrl_change_tc_attr OUTPUT.
  DESCRIBE TABLE i_items LINES tblcntrl-lines.
  tblcntrl-lines = tblcntrl-lines + 10.
ENDMODULE.           

MODULE tblcntrl_modify INPUT.
  MODIFY i_items FROM wa_items INDEX tblcntrl-current_line.
  IF sy-subrc <> 0.
    INSERT wa_items INTO i_items INDEX tblcntrl-current_line.
  ENDIF.
ENDMODULE. 

MODULE user_command_0100 INPUT.

  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'BACK'.   LEAVE PROGRAM.
    WHEN 'EXIT'.   LEAVE PROGRAM.
    WHEN 'CANCEL'. LEAVE PROGRAM.
    WHEN 'CREATE'.
      SET SCREEN 200.
    WHEN OTHERS.   CALL SCREEN 100.
  ENDCASE.

ENDMODULE.   

3 REPLIES 3

franois_henrotte
Active Contributor
0 Kudos
41

in event PROCESS AFTER INPUT you have to specify all the input fields so that the values are transferred from screen to your variables

currently you have fields of your table control (in the LOOP) but you don't have the two other fields. Just add

FIELD w_field1.

FIELD w_field2.

Former Member
0 Kudos
41

I tried this .. but it does not work.

PROCESS AFTER INPUT.

  FIELD p_vorna.
  FIELD p_bednr.

  LOOP AT i_items.
    MODULE tblcntrl_modify.
  ENDLOOP.

  MODULE user_command_0100.

Former Member
0 Kudos
41

The way I solved it is ..

* All the fields in screen
DATA:
  p_vorna  TYPE pa0002-vorna,
  p_bednr  TYPE ekpo-bednr,
  p_vstel  TYPE ekpv-vstel,
  p_notes  TYPE pa0002-cname,
  p_ekorg  TYPE ekko-ekorg,
  p_ekgrp  TYPE ekko-ekgrp,
  p_bukrs  TYPE ekko-bukrs,
  p_swerks TYPE ekpo-werks,
  p_rwerks TYPE ekpo-werks.

MODULE user_command_0100 INPUT.

  MOVE p_vorna  TO wa_header-vorna.
  MOVE p_bednr  TO wa_header-bednr.
  MOVE p_vstel  TO wa_header-vstel.
  MOVE p_notes  TO wa_header-notes.
  MOVE p_ekorg  TO wa_header-ekorg.
  MOVE p_ekgrp  TO wa_header-ekgrp.
  MOVE p_bukrs  TO wa_header-bukrs.
  MOVE p_swerks TO wa_header-swerks.
  MOVE p_rwerks TO wa_header-rwerks.

MODULE status_0100 OUTPUT.

  SET TITLEBAR 'TITLE_0100'.
  SET PF-STATUS 'SCREEN_100'.

  MOVE wa_header-vorna  TO p_vorna.
  MOVE wa_header-bednr  TO p_bednr.
  MOVE wa_header-vstel  TO p_vstel.
  MOVE wa_header-notes  TO p_notes.
  MOVE wa_header-ekorg  TO p_ekorg.
  MOVE wa_header-ekgrp  TO p_ekgrp.
  MOVE wa_header-bukrs  TO p_bukrs.
  MOVE wa_header-swerks TO p_swerks.
  MOVE wa_header-rwerks TO p_rwerks.