Posts

Showing posts from May, 2013

ABAP : Dynamic ITAB for Ranges

Example of ABAP Code Dynamic Internal Table - Ranges *---------------------------------------------------------------------* *      Form  f_ranges_str *      By Oka Wirasatha *---------------------------------------------------------------------* form F_RANGES_STR   using FV_FIELD         FV_SIGN FV_OPTION FV_LOW FV_HIGH.   type-pools:     ABAP.   data:     GR_STRUCTDESCR    type ref to CL_ABAP_STRUCTDESCR,     GR_TABLEDESCR     type ref to CL_ABAP_TABLEDESCR,     GR_DATADESCR      type ref to CL_ABAP_DATADESCR,     GR_TYPEDESCR      type ref to CL_ABAP_TYPEDESCR,     GT_COMPONENTS     type ABAP_COMPONENT_TAB,     GW_COMPONENT      type line of ABAP_COMPONENT_TAB,     GR_WA             type ref to DATA,     GR_TAB            type ref to DATA,     LV_TEXT(20).   field-symbols: <fs_wa> type any,                  <fs_val> type any,                  <fs_tab> type TABLE. * determine components of structure -> GT_COMPONENTS   move 'SIGN&

ABAP Dialog Programming : Set Filter data of Table Control

Example ABAP code for Filter data of table control *---------------------------------------------------------------------* *      Form  F_filter_data *---------------------------------------------------------------------* *  By Oka Wirasatha *---------------------------------------------------------------------* form F_FILTER_DATA .   field-symbols :     <selected_col> type CXTAB_COLUMN.   data : LW_COLS like TC_ITEM-COLS.   data : GT_FIELDCAT type LVC_T_FCAT.   data LAYO type LVC_S_LAYO.   data : GT_FILTER_INDEX type LVC_T_FIDX,          LT_SELCOL type table of LVC_S_COL with header line.   data : LT_FILT type LVC_T_FILT,          LW_FILT type LVC_S_FILT,          LT_LAYOUT type LVC_S_LAYO. * find out if a column is selected.   loop at TC_ITEM-COLS assigning <selected_col>.     if <selected_col>-SELECTED = 'X'.       LT_SELCOL-FIELDNAME = <selected_col>-SCREEN-NAME+7(10).       append LT_SELCOL.     endif.   endloop.   call

ABAP Dialog Programming : Sorting selected column in Table Control

This is example of abap code for sorting selected table control. *---------------------------------------------------------------------* *      Form  F_SORT_TABLE *---------------------------------------------------------------------* *       text *----------------------------------------------------------------------* *      By Oka Wirasatha *----------------------------------------------------------------------* form F_SORT_TABLE using FV_CODE.   field-symbols :     <lfs1>,     <selected_col> type CXTAB_COLUMN.   data : LW_COLS like TC_ITEM-COLS.   data : LV_TXT1(20),          LV_INDEX(2) type N.   data : begin of W_SORT,           SORT01(20),           SORT02(20),           SORT03(20),           SORT04(20),           SORT05(20),           SORT06(20),           SORT07(20),     end of W_SORT. * find out if a column is selected.   LV_INDEX = 0.   clear W_SORT.   loop at TC_ITEM-COLS assigning <selected_col>.     if <selected_col>