Thursday, October 13, 2011

Screen programming

Screen programming

DIAGRAM 1.0

DIAGRAM 2.0

Best practice to make the sy-ucomm to be fcode.

 

leave to screen 0. <--- to exit the current screen
leave program. <---- to exit the whole rogram

*** normally the program created in module pool (not executable) execute via TRANSACTION CODE



PROGRAM  ZBC400_22_SCREEN.

DATA : FCODE TYPE SY-UCOMM.
tables : sflight.

*&---------------------------------------------------------------------*
*&      Module  SET_GUI_AND_TITLE  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE SET_GUI_AND_TITLE OUTPUT.
  set PF-STATUS 'GUI100'.
  set TITLEBAR  'TITLE' with sy-uname.
ENDMODULE.                 " SET_GUI_AND_TITLE  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  PROCESS_F_CODE  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE PROCESS_F_CODE INPUT.
CASE FCODE.
  when 'ENTER'.

    select single *
      from sflight
      WHERE carrid = sflight-carrid
      and   connid = sflight-connid
      and   fldate = sflight-fldate.

    call screen 200.

  WHEN 'GO_BACK'.

    IF sy-dynnr = 200.
        LEAVE to SCREEN 0.
      else.
        leave PROGRAM.
    ENDIF.

  WHEN 'SPECIAL'.
    MESSAGE i010(ad) with 'special report'.
  WHEN OTHERS.
ENDCASE.

ENDMODULE.                 " PROCESS_F_CODE  INPUT

 

DIAGRAM 3.0

Based on the above data.

 

1. create a program (module pool)

2. create screen100 *try not to use 1000 above cause it is standard

PROCESS BEFORE OUTPUT.
 MODULE set_gui_and_title.
* MODULE STATUS_0100.
*
PROCESS AFTER INPUT.

-- remember to use the Fcode in element list

3. create gui_status <--- this is for the screen

DIAGRAM 4.0

with this you can create icon and remember th fcode you can use the variable you created too

As for the application tool bar you can add your own ICON!! and apply the same FCODE too

 

Last but not least dont forget to create the title 

DIAGRAM 5.0

**** CLICK on SCREEN then LAYOUT

here you can create your layout 

remember for function aka push button remember to put the function code so that your system can manipulate it

remember what ever RED in colour when editing during layout its meaning is more towards error.

REMEMBER TO CALL YOUR PBO AND PAI  MODULE INSIDE THE SCREEN!!! EXAMPLE DIAGRAM 3.0

 

* notice that we are all working in se80 that is why you can see the layout besides 

* remember the coding above is sufficient for normal usage.

No comments:

Post a Comment