Sometime we need display graphic objects on our selecction screen, ALV etc. Below code can help us displaying system and user graphics on container.

You can use your SE78 graphics in this program ;)

P.S. Please refer when you are using my codes in your personal pages. Thanks

Read the rest of this entry »

TYPE-POOLS: abap.

TYPES : BEGIN OF ty_outtab,
        celltab TYPE lvc_t_styl.
        INCLUDE STRUCTURE qals.
TYPES   END   OF ty_outtab.

DATA  : gt_outtab  TYPE TABLE OF ty_outtab WITH HEADER LINE,
        gs_layout  TYPE lvc_s_layo,
        ls_celltab TYPE lvc_s_styl,
        lt_celltab TYPE lvc_t_styl.

SELECT * FROM qals INTO CORRESPONDING FIELDS OF TABLE gt_outtab UP TO 20 ROWS.

ls_celltab-style = '00000121'.

INSERT ls_celltab INTO lt_celltab INDEX 1.

READ TABLE gt_outtab INDEX 1.

gt_outtab-celltab = lt_celltab.

INSERT gt_outtab INDEX 1.

gs_layout-stylefname = 'CELLTAB'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
  EXPORTING
    i_structure_name = 'QALS'
    is_layout_lvc    = gs_layout
  TABLES
    t_outtab         = gt_outtab
  EXCEPTIONS
    program_error    = 1
    OTHERS           = 2.
This sample show how we use cl_gui_alv_grid protected events... When you execute this example
you can sort your data when you single click on column header...

P.S. Please refer this site when you are using my examples. Thanks

 Read the rest of this entry »
report zuseofhashedtables.
************************************************************************
** Program: ZUseOfHashedTables                                        **
************************************************************************
** Author: Horacio Zapettini                                          **
**                                                                    **
** Versions: 4.6b - 4.6c                                              **
************************************************************************
** Notes:                                                             **
**     this program shows how we can use hashed tables to improve     **
**     the responce time.                                             **
**     It shows,                                                      **
**        1. how to declare hashed tables                             **
**        2. a cache-like technique to improve access to master data  **
**        3. how to collect data using hashed tables                  **
**        4. how to avoid deletions of unwanted data                  **
************************************************************************
** Results: the test we run read about 31000 rows from mkpf, 150000   **
**          rows from mseg, 500 rows from makt and 400 from lfa1.     **
**          it filled ht_lst with 24500 rows and displayed them in    **
**          alv grid format.                                          **
**                                                                    **
**          It took about 65 secodns to perform this task (first time **
**          we run it when all the db buffers are empty.              **
**                                                                    **
**          The same program with standard tables needed 140 seconds  **
**          to run with the same recordset and with buffers filled in **
**                                                                    **
**          A simmilar test over more than a million rows
************************************************************************
** Objetive: show a list that consists of  all the material movements **
**          '101' - '901' for a certain range of dates in mkpf-budat. **
** the columns to be displayed are:                                   **
**          mkpf-budat,                                               **
**          mkpf-mblnr,                                               **
**          mseg-lifnr,                                               **
**          lfa1-name1,                                               **
**          mkpf-xblnr,                                               **
**          mseg-zeile                                                **
**          mseg-charg,                                               **
**          mseg-matnr,                                               **
**          makt-maktx,                                               **
**          mseg-erfmg,                                               **
**          mseg-erfme.                                               **
** or show a sumary list by matnr - menge                             **
**                                                                    **
** You'll have to create a pf-status called vista -                   **
** See form set_pf_status for details                                 **
************************************************************************

** tables used -
tables: mkpf,
        mseg,
        lfa1,
        makt.

** global hashed tables used
*
data: begin of wa_mkpf, "header
      mblnr like mkpf-mblnr,
      mjahr like mkpf-mjahr,
      budat like mkpf-budat,
      xblnr like mkpf-xblnr,
      end of wa_mkpf.
data: ht_mkpf like hashed table of wa_mkpf
      with unique key mblnr mjahr
      with header line.
data: st_mkpf like standard table of wa_mkpf
      with header line.

*
data: begin of wa_mseg, " line items
      mblnr like mseg-mblnr,
      mjahr like mseg-mjahr,
      zeile like mseg-zeile,
      bwart like mseg-bwart,
      charg like mseg-charg,
      matnr like mseg-matnr,
      lifnr like mseg-lifnr,
      erfmg like mseg-erfmg,
      erfme like mseg-erfme,
      end of wa_mseg.
data ht_mseg like hashed table of wa_mseg
      with unique key mblnr mjahr zeile
      with header line.
data st_mseg like standard table of wa_mseg
      with header line.

** cache structure for lfa1 records
data: begin of wa_lfa1,
      lifnr like lfa1-lifnr,
      name1 like lfa1-name1,
      end of wa_lfa1.
data ht_lfa1 like hashed table of wa_lfa1
      with unique key lifnr
      with header line.

** cache structure for material related data
data: begin of wa_material,
      matnr like makt-matnr,
      maktx like makt-maktx,
      end of wa_material.
data: ht_material like hashed table of wa_material
        with unique key matnr
        with header line.

** result table
data: begin of wa_lst, "
      budat like mkpf-budat,
      mblnr like mseg-mblnr,
      lifnr like mseg-lifnr,
      name1 like lfa1-name1,
      xblnr like mkpf-xblnr,
      zeile like mseg-zeile,
      charg like mseg-charg,
      matnr like mseg-matnr,
      maktx like makt-maktx,
      erfmg like mseg-erfmg,
      erfme like mseg-erfme,
      mjahr like mseg-mjahr,
      end of wa_lst.

data: ht_lst like hashed table of wa_lst
        with unique key mblnr mjahr zeile
        with header line.

data: begin of wa_lst1, " sumary by material
      matnr like mseg-matnr,
      maktx like makt-maktx,
      erfmg like mseg-erfmg,
      erfme like mseg-erfme,
      color_line(4) TYPE c,           " Line color
      color_cell    TYPE lvc_t_scol,  " Cell color
      celltab type LVC_T_STYL,
      end of wa_lst1.

data: ht_lst1 like hashed table of wa_lst1
        with unique key matnr
        with header line.

** structures for alv grid display.
** itabs
type-pools: slis.

data: it_lst            like standard table of wa_lst with header line,
      it_fieldcat_lst   type slis_t_fieldcat_alv with header line,
      it_sort_lst       type slis_t_sortinfo_alv,
      it_lst1           like standard table of wa_lst1 with header line,
      it_fieldcat_lst1  type slis_t_fieldcat_alv with header line,
      it_sort_lst1      type slis_t_sortinfo_alv.
** structures
data: wa_sort         type slis_sortinfo_alv,
      ls_layout       type slis_layout_alv.
** color management.
DATA  : wa_color    TYPE lvc_s_scol.
* Internal table for color management.
DATA : it_color    TYPE TABLE          OF lvc_s_scol.

* itab for input enabling.
DATA: lt_celltab TYPE lvc_t_styl. "

** global varialbes

data: g_lines type i.

data: g_repid like sy-repid,
      ok_code       like sy-ucomm.

** selection-screen

"text: Dates:
select-options: so_budat for mkpf-budat default sy-datum.
"text: Material numbers.
select-options: so_matnr for mseg-matnr.
selection-screen uline.
selection-screen skip 1.
"Text: show summary by material.
parameters: gp_bymat as checkbox default ''.
parameters: gp_hier  as checkbox default 'X'.
start-of-selection.
  perform get_data.
  perform show_data.

end-of-selection.

*---------------------------------------------------------------------*
*       FORM get_data                                                 *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form get_data.
  	select mblnr mjahr budat xblnr
            into table ht_mkpf
           from mkpf
          where budat in so_budat. " make use of std index.
** have we retrieved data from mkpf?
  describe table ht_mkpf lines g_lines.
  if g_lines > 0.
** if true then retrieve all related records from mseg.
** Doing this way we make sure that the access is by primary key
** of mseg.
** The reason is that is faster to filter them in memory
** than to allow the db server to do it.
    select mblnr mjahr zeile bwart charg
             matnr lifnr erfmg erfme
      into table ht_mseg
      from mseg
        for all entries in ht_mkpf
     where mblnr = ht_mkpf-mblnr
       and mjahr = ht_mkpf-mjahr.
  endif.

** fill t_lst or t_lst1 according to user's choice.
  if gp_bymat = ' '.
    perform fill_ht_lst.
  else.
    perform fill_ht_lst1.
  endif.
endform.

form fill_ht_lst.
  refresh ht_lst.
** Example: how to discard unwanted data in an efficient way.
  loop at ht_mseg.
*   filter unwanted data
    check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
    check ht_mseg-matnr in so_matnr.
*   read header line.
    read table ht_mkpf with table key mblnr = ht_mseg-mblnr
    mjahr = ht_mseg-mjahr.
    clear ht_lst.
*  * note : this may be faster if you specify field by field.
    move-corresponding ht_mkpf to ht_lst.
    move-corresponding ht_mseg to ht_lst.

    perform read_lfa1 using ht_mseg-lifnr changing ht_lst-name1.
    perform read_material using ht_mseg-matnr changing ht_lst-maktx.
    insert table ht_lst.
  endloop.
endform.

form fill_ht_lst1.
data: colorear.
  refresh ht_lst1.
** Example: how to discard unwanted data in an efficient way.
**          hot to simulate a collect in a faster way
  loop at ht_mseg.
*   filter unwanted data
    check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
    check ht_mseg-matnr in so_matnr.
*  * note : this may be faster if you specify field by field.

    read table ht_lst1 with table key matnr = ht_mseg-matnr
    transporting erfmg.
    if sy-subrc <> 0. " if matnr doesn't exist in sumary table
    " insert a new record
      clear ht_lst1.
      ht_lst1-matnr = ht_mseg-matnr.
      perform read_material using ht_mseg-matnr changing ht_lst1-maktx.
      ht_lst1-erfmg = ht_mseg-erfmg.
      ht_lst1-erfme = ht_mseg-erfme.
      if colorear = ''.
        colorear = 'X'.
        refresh it_color.
        ht_lst1-color_cell[] = it_color[].
        MOVE 'C410' TO ht_lst1-color_line.
      else.
        colorear = ' '.
        refresh it_color. clear it_color.
        MOVE 'MATNR' TO wa_color-fname.
        MOVE '6'         TO wa_color-color-col.
        MOVE '1'         TO wa_color-color-int.
        MOVE '1'         TO wa_color-color-inv.
        APPEND wa_color TO it_color.
        MOVE 'MAKTX' TO wa_color-fname.
        MOVE '3'         TO wa_color-color-col.
        MOVE '1'         TO wa_color-color-int.
        MOVE '1'         TO wa_color-color-inv.
        APPEND wa_color TO it_color.

        MOVE 'ERFMG' TO wa_color-fname.
        MOVE '5'         TO wa_color-color-col.
        MOVE '1'         TO wa_color-color-int.
        MOVE '1'         TO wa_color-color-inv.

        APPEND wa_color TO it_color.
        ht_lst1-color_cell[] = it_color[].

        clear ht_lst1-color_line.

      endif.

      insert table ht_lst1.
    else." a record was found.
    " collect erfmg.  To do so, fill in the unique key and add
    " the numeric fields.
      ht_lst1-matnr = ht_mseg-matnr.
      add ht_mseg-erfmg to ht_lst1-erfmg.
      modify table ht_lst1 transporting erfmg.
    endif.
  endloop.
endform.

** implementation of cache for lfa1.
form read_lfa1 using p_lifnr changing p_name1.
  	read table ht_lfa1 with table key lifnr = p_lifnr
        transporting name1.
  if sy-subrc <> 0.
    clear ht_lfa1.
    ht_lfa1-lifnr = p_lifnr.
    select single name1
       into ht_lfa1-name1
      from lfa1
    where lifnr = p_lifnr.
    if sy-subrc <> 0. ht_lfa1-name1 = 'n/a in lfa1'. endif.
    insert table ht_lfa1.
  endif.
  p_name1 = ht_lfa1-name1.
endform.

** implementation of cache for material data
form read_material using p_matnr changing p_maktx.
  read table ht_material with table key matnr = p_matnr
  transporting maktx.
  if sy-subrc <> 0.
    ht_material-matnr = p_matnr.
    select single maktx into  ht_material-maktx
      from makt
     where spras = sy-langu
       and matnr = p_matnr.
    if sy-subrc <> 0. ht_material-maktx = 'n/a in makt'. endif.
    insert table ht_material.
  endif.
  p_maktx = ht_material-maktx.
endform.
form show_data.
  if gp_hier = 'X'. "no anda.
*    perform show_hierarchicalALV.
  else.
    if gp_bymat = ' '.
      perform show_ht_lst.
    else.
      perform show_ht_lst1.
    endif.
  endif.
endform.
form show_hierarchicalALV.
st_mkpf[] = ht_mkpf[].
st_mseg[] = ht_mseg[].
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
*  exporting
*   I_INTERFACE_CHECK              = ' '
*   I_CALLBACK_PROGRAM             =
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   IS_LAYOUT                      =
*   IT_FIELDCAT                    =
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*    i_tabname_header               =
*    i_tabname_item                 =
*   I_STRUCTURE_NAME_HEADER        =
*   I_STRUCTURE_NAME_ITEM          =
*    is_keyinfo                     =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_BUFFER_ACTIVE                =
*   I_BYPASSING_BUFFER             =
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
  tables
    t_outtab_header                = st_mkpf
    t_outtab_item                  = st_mseg
* EXCEPTIONS
*   PROGRAM_ERROR                  = 1
*   OTHERS                         = 2
          .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

endform.
form show_ht_lst.
  "needed because the FM can't use a hashed table.
  it_lst[] = ht_lst[].

  perform fill_layout using 'full display'
                       changing ls_layout.

  perform fill_columns_lst.
*  perform sort_lst.
  g_repid = sy-repid.
  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program       = g_repid
            i_callback_pf_status_set = 'SET_PF_STATUS'
            is_layout                = ls_layout
            it_fieldcat              = it_fieldcat_lst[]
*            it_sort                  = it_sort_lst
       tables
            t_outtab                 = it_lst
       exceptions
            program_error            = 1
            others                   = 2.

endform.
form show_ht_lst1.
  "needed because the FM can't use a hashed table.
  it_lst1[] = ht_lst1[].

  perform fill_layout using 'Sumary by matnr'
                       changing ls_layout.

  perform fill_columns_lst1.
*  perform sort_lst.
  g_repid = sy-repid.
  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program       = g_repid
            i_callback_pf_status_set = 'SET_PF_STATUS'
            is_layout                = ls_layout
            it_fieldcat              = it_fieldcat_lst1[]
*            it_sort                  = it_sort_lst
       tables
            t_outtab                 = it_lst1
       exceptions
            program_error            = 1
            others                   = 2.

endform.

form fill_layout using p_window_titlebar
               changing cs_layo type slis_layout_alv.
  clear cs_layo.
  cs_layo-window_titlebar        = p_window_titlebar.
  cs_layo-edit                   = 'X'.
  cs_layo-edit_mode              = space.
  MOVE 'COLOR_LINE' TO cs_layo-info_fieldname.

* Field that identify cell color in inetrnal table
  MOVE 'COLOR_CELL' TO cs_layo-coltab_fieldname.
*  move 'CELLTAB' TO cs_layo-stylefname.

endform.                    " armar_layout_stock

form set_pf_status using rt_extab type slis_t_extab.
** create a new status
** and then select extras -> adjust template -> listviewer
  set pf-status 'VISTA'.
endform.        "set_pf_status
define add_lst.
  clear it_fieldcat_lst.
  it_fieldcat_lst-fieldname     = &1.
  it_fieldcat_lst-outputlen     = &2.
  it_fieldcat_lst-ddictxt       = 'L'.
  it_fieldcat_lst-seltext_l       = &1.
  it_fieldcat_lst-seltext_m       = &1.
  it_fieldcat_lst-seltext_m       = &1.
  if &1 = 'MATNR'.
    it_fieldcat_lst-emphasize = 'C111'.
  endif.
  append it_fieldcat_lst.
end-of-definition.
define add_lst1.
  clear it_fieldcat_lst.
  it_fieldcat_lst1-fieldname     = &1.
  it_fieldcat_lst1-outputlen     = &2.
  it_fieldcat_lst1-ddictxt       = 'L'.
  it_fieldcat_lst1-seltext_l       = &1.
  it_fieldcat_lst1-seltext_m       = &1.
  it_fieldcat_lst1-seltext_m       = &1.
  append it_fieldcat_lst1.
end-of-definition.

form fill_columns_lst.
* set columns for output.

  refresh it_fieldcat_lst.
*
  add_lst 'BUDAT' 10.
  add_lst   'MBLNR' 10.
  add_lst  'LIFNR' 10.
  add_lst  'NAME1' 35.
  add_lst  'XBLNR' 15.
  add_lst    'ZEILE' 5.
  add_lst    'CHARG' 10.
  add_lst   'MATNR' 18.
  add_lst   'MAKTX' 30.
  add_lst   'ERFMG' 17.
  add_lst   'ERFME' 5.
  add_lst   'MJAHR' 4.
endform.
form fill_columns_lst1.
* set columns for output.

  refresh it_fieldcat_lst1.

  add_lst1 'MATNR' 18.
  add_lst1 'MAKTX' 30.
  add_lst1 'ERFMG' 17.
  add_lst1 'ERFME' 5..
endform.

TYPE-POOLS: abap,
col.
*&———————————————————————*
*& Dynamic Table
*&———————————————————————*
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa>,
<fs>.
DATA: gt_dyn          TYPE REF TO data,
gw_dyn          TYPE REF TO data,
r_table         TYPE REF TO cl_salv_table,
r_header        TYPE REF TO cl_salv_form_element,
r_footer        TYPE REF TO cl_salv_form_element,
r_columns_table TYPE REF TO cl_salv_columns_table,
r_column_table  TYPE REF TO cl_salv_column_table,
r_datadescr     TYPE REF TO cl_abap_datadescr,
r_structdescr   TYPE REF TO cl_abap_structdescr,
gw_component    TYPE abap_componentdescr,
gt_component    TYPE abap_component_tab.
START-OF-SELECTION.
PERFORM build_dynamic_table.
PERFORM get_data.
END-OF-SELECTION.
PERFORM display_report.
*&———————————————————————*
*&      Form  build_dynamic_table
*&———————————————————————*
FORM build_dynamic_table .
DATA: l_idx    TYPE c,
l_desc   TYPE char50,
l_hslxx  TYPE p LENGTH 5 DECIMALS 2,
lt_color TYPE lvc_t_scol.
* Column 1
r_datadescr ?= cl_abap_datadescr=>describe_by_data( l_desc ).
gw_component-name = ‘COLUMN’.
gw_component-type = r_datadescr.
APPEND gw_component TO gt_component.
* Column 2 – Types of color for each line
* Do not display this column
r_datadescr ?= cl_abap_datadescr=>describe_by_data( lt_color ).
gw_component-name = ‘COLOR’.
gw_component-type = r_datadescr.
APPEND gw_component TO gt_component.
DO 5 TIMES.
l_idx = sy-index.
r_datadescr ?= cl_abap_datadescr=>describe_by_data( l_hslxx ).
CONCATENATE ‘COL’ l_idx INTO gw_component-name.
gw_component-type = r_datadescr.
APPEND gw_component TO gt_component.
ENDDO.
TRY.
r_structdescr = cl_abap_structdescr=>create( p_components = gt_component ).
CATCH cx_sy_struct_creation .
WRITE: / ‘CX_SY_STRUCT_CREATION ERROR’.
ENDTRY.
* Fill the table with data from GT_DATA
CREATE DATA gw_dyn TYPE HANDLE r_structdescr.
ASSIGN gw_dyn->* TO <dyn_wa>.
CREATE DATA gt_dyn LIKE STANDARD TABLE OF <dyn_wa>.
ASSIGN gt_dyn->* TO <dyn_table>.
ENDFORM.                    ” build_dynamic_table
*&———————————————————————*
*&      Form  get_data
*&———————————————————————*
FORM get_data .
* select statement
ENDFORM.                    ” get_data
*&———————————————————————*
*&      Form  display_report
*&———————————————————————*
FORM display_report .
PERFORM display_header.   ” Display ALV Header
PERFORM display_footer.   ” DIsplay ALV Footer
PERFORM fill_data.        ” Fill data
PERFORM set_color.        ” Set color
PERFORM display_list.     ” Display the ALV
ENDFORM.                    ” display_report
*&———————————————————————*
*&      Form  display_header
*&———————————————————————*
FORM display_header .
DATA: lr_grid   TYPE REF TO cl_salv_form_layout_grid.
CREATE OBJECT lr_grid.
lr_grid->create_text(
row    = 1
column = 1
text   = ‘Header Line 1′ ).
lr_grid->create_text(
row    = 2
column = 1
text   = ‘Header Line 2′ ).
r_header = lr_grid.
ENDFORM.                    ” display_header
*&———————————————————————*
*&      Form  display_footer
*&———————————————————————*
FORM display_footer .
DATA: lr_grid   TYPE REF TO cl_salv_form_layout_grid.
CREATE OBJECT lr_grid.
lr_grid->create_text(
row    = 1
column = 1
text   = text-266 ).
lr_grid->create_text(
row    = 2
column = 1
text   = text-267 ).
r_footer = lr_grid.
ENDFORM.                    ” display_footer
*&———————————————————————*
*&      Form  set_color
*&———————————————————————*
FORM set_color.
DATA: lt_color TYPE lvc_t_scol,
ls_color LIKE LINE OF lt_color,
l_idx    TYPE sy-tabix.
FIELD-SYMBOLS: <fs_color>.
LOOP AT <dyn_table> INTO <dyn_wa>.
l_idx = sy-tabix.
ASSIGN COMPONENT ‘COLOR’ OF STRUCTURE <dyn_wa> TO <fs_color>.
ls_color-color-col = col_total.
*    ls_color-color-col = col_normal.
*    ls_color-color-col = col_group.
APPEND ls_color TO lt_color.
<fs_color> = lt_color.
MODIFY <dyn_table> FROM <dyn_wa> INDEX l_idx.
UNASSIGN: <fs_color>.
ENDLOOP.
ENDFORM.                    ” set_color
*&———————————————————————*
*&      Form  display_list
*&———————————————————————*
FORM display_list.
DATA: r_display TYPE REF TO cl_salv_display_settings.
* Prepare the internal table for display
cl_salv_table=>factory(
EXPORTING
list_display   = ‘X’
IMPORTING
r_salv_table   = r_table
CHANGING
t_table        = <dyn_table> ).
* Set report page title
r_table->set_top_of_list( r_header ).
* Set report footer
r_table->set_end_of_list( r_footer ).
r_display = r_table->get_display_settings( ).
*  r_display->set_vertical_lines( ‘ ‘ ).
* Assign all the column names
PERFORM set_column_attr.
* Display the report
r_table->display( ).
ENDFORM.                    ” display_list
*&———————————————————————*
*&      Form  set_column_attr
*&———————————————————————*
FORM set_column_attr.
DATA: l_idx     TYPE c,
l_text(4) TYPE c,
colname   TYPE lvc_fname,
outps     TYPE scrtext_s,
outpm     TYPE scrtext_m,
outpl     TYPE scrtext_l.
r_columns_table = r_table->get_columns( ).
*  r_columns_table->set_headers_visible( abap_false ).
* column 2
* set color column
r_columns_table->set_color_column( ‘COLOR’ ).
DO 5 TIMES.
l_idx = sy-index.
CONCATENATE ‘COL’ l_idx INTO colname.
outps = colname.
outpm = colname.
outpl = colname.
r_column_table ?= r_columns_table->get_column( colname ).
r_column_table->set_optimized( value  = abap_true ).
r_column_table->set_alignment( value  = 1 ).
r_column_table->set_zero( value  = space ).
r_column_table->set_short_text( outps ).
r_column_table->set_medium_text( outpm ).
r_column_table->set_long_text( outpl ).
ENDDO.
ENDFORM.                    “set_column_attr
*&———————————————————————*
*&      Form  fill_data
*&———————————————————————*
FORM fill_data .
DATA:  l_idx TYPE c,
l_col  TYPE string.
DO 5 TIMES.
l_idx = sy-index.
CONCATENATE ‘COL’ l_idx INTO l_col.
ASSIGN COMPONENT l_col OF STRUCTURE <dyn_wa> TO <fs>.
<fs> = 0.
UNASSIGN <fs>.
ENDDO.
DO 5 TIMES.
l_idx = sy-index.
ASSIGN COMPONENT ‘COLUMN’ OF STRUCTURE <dyn_wa> TO <fs>.
CONCATENATE ‘Row’ l_idx INTO <fs> SEPARATED BY space.
UNASSIGN <fs>.
APPEND <dyn_wa> TO <dyn_table>.
ENDDO.
ENDFORM.                    ” fill_data

This HOWTO will give the steps you need to find where the data is stored in SAP when you want to create an ABAP query or ABAP report using fields that you can find on transaction screens.
Read the rest of this entry »

In this example I will show you below selection screen properties

* Adding button on selection screen
* Define radiobuttons
* Define checkboxes
* Add more than one object in per line of selection screen
* Disable an object
* Hide/Show an object
* Display blue colored parameters

Read the rest of this entry »

Selection Screen Without Execute Button 

Read the rest of this entry »

Dear friends,

Currently I am working an international SAP project. I don’t have enough time for adding new codes. And unfortunately our government blocked worpress.com :( . I am writing this message another country.

I will write new codes to my blog when I still out of Turkey.

Please feel free to e-mail me (mavsar @!@ gmail @.@ com )

 

Mehmet

*———————————————————————*
* Report Name : YGECICI
*———————————————————————*
* Author : Mehmet Avşar
* Location : @Altunizade - Uskudar / Istanbul
* Date / Time : 29 Oct 2007
* Subject : Alpha Numeric Number Range Auto Increment
*———————————————————————*

REPORT YGECICI MESSAGE-ID 00
No Standard Page Heading
Line-Size 200
Line-Count 65.

DATA: l_seq(36) type c Value '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ',
l_pointer type i,
g_counter(4) type c.

g_counter = '9ZZZ'.

if g_counter+3(1) = 'Z'.
g_counter+3(1) = '0'.
if g_counter+2(1) = 'Z'.
g_counter+2(1) = '0'.
if g_counter+1(1) = 'Z'.
g_counter+1(1) = '0'.
if g_counter+0(1) = 'Z'.
g_counter+0(1) = '0'.
else.
perform counter_change changing g_counter+0(1).
endif.
else.
perform counter_change changing g_counter+1(1).
endif.
else.
perform counter_change changing g_counter+2(1).
endif.
else.
perform counter_change changing g_counter+3(1).
endif.

write / g_counter.

FORM counter_change CHANGING p_counter.
search l_seq for p_counter.
l_pointer = sy-fdpos + 1.
P_counter = l_seq+l_pointer(1).
ENDFORM.

a