`
Jack Wu
  • 浏览: 887443 次
  • 来自: ...
社区版块
存档分类
最新评论

abap--一个简单类浏览器的代码(等有空继续完善)

阅读更多

REPORT ZBrowse_Class_tool.

type-pools:
    SEOO,
    SEOR,
    slis,
    SEOS.
tables:
    sscrfields.
types: begin of t_attr,
     CLSNAME type SEOCLSNAME,
     CMPNAME type SEOCMPNAME,
     DESCRIPT type SEODESCR,
*Private,Protected,Public
     EXPOSURE type SEOEXPOSE,
     SEOEXPOF1I type SEOEXPOF1I,
*Instance Attribute,Static Attribute,Constant
     ATTDECLTYP type SEOATTDECL,
     SEOATTDF1I type SEOATTDF1I,
*ReadOnly
     ATTRDONLY type SEORDONLY,
*Attribute reference (LIKE),Type reference (TYPE),Object (TYPE),Object reference (TYPE REF TO),See coding
     TYPTYPE type SEOTYPTYPE,
     SEOTYPTF1I type SEOTYPTF1I,
*Initial value
     ATTVALUE type SEOVALUE,
     level   type i,
     lights type i,
     color(4)  type c,
     tabcolor  type slis_t_specialcol_alv,
   end of t_attr.

types: begin of t_meth,
     CLSNAME type SEOCLSNAME,
     CMPNAME type SEOCMPNAME,
     DESCRIPT type SEODESCR,
*Private,Protected,Public
     EXPOSURE type SEOEXPOSE,
     SEOEXPOF1I type SEOEXPOF1I,
*Instance,Static
     MTDDECLTYP type SEOMTDDECL,
     SEOATTDF1I type SEOATTDF1I,
     level   type i,
     lights type i,
     color(4)  type c,
     tabcolor  type slis_t_specialcol_alv,
   end of t_meth.

types: begin of t_event,
     CLSNAME type SEOCLSNAME,
     CMPNAME type SEOCMPNAME,
     DESCRIPT type SEODESCR,
*Private,Protected,Public
     EXPOSURE type SEOEXPOSE,
     SEOEXPOF1I type SEOEXPOF1I,
*Instance,Static
     EVTDECLTYP type SEOEVTDECL,
     SEOEVTDF1I type SEOEVTDF1I,
     level   type i,
     lights type i,
     color(4)  type c,
     tabcolor  type slis_t_specialcol_alv,
   end of t_event.

data: gt_classkey type seoclskey.
data: NOT_ACTIVE TYPE  SEOX_BOOLEAN.
field-symbols: <gt_outtab> type standard table.
data: i_gettype type i value 1.
data: gt_field   type slis_t_fieldcat_alv,
      gt_sort       type slis_t_sortinfo_alv.
data  gt_layout type slis_layout_alv.
data:
   g_wa_attr type t_attr,
   gt_attr type standard table of t_attr,
   g_wa_event type t_event,
   gt_event type standard table of t_event,
   g_wa_meth type t_meth,
   gt_meth type standard table of t_meth.

parameters p_CLS like  SEOCLASS-CLSNAME obligatory default 'CL_GUI_ALV_GRID'.

SELECTION-SCREEN: FUNCTION KEY 1,
                  FUNCTION KEY 2,
                  FUNCTION KEY 3.

load-of-program.
  sscrfields-functxt_01 = 'Methods'.
  sscrfields-functxt_02 = 'Attributes'.
  sscrfields-functxt_03 = 'Events'.

INITIALIZATION.

AT SELECTION-SCREEN OUTPUT.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_CLS.
  gt_classkey-clsname =  p_CLS.
  call function 'F4_DD_ALLTYPES'
    EXPORTING
      object               = gt_classkey-clsname
      suppress_selection   = 'X'
      display_only         = ' '
      only_types_for_clifs = 'X'
    IMPORTING
      result               = p_CLS.

AT SELECTION-SCREEN.
* check class existence
  gt_classkey-CLSNAME = p_CLS.
  call function 'SEO_CLASS_EXISTENCE_CHECK'
    EXPORTING
      clskey        = gt_classkey
    IMPORTING
      not_active    = not_active
    EXCEPTIONS
      not_specified = 1
      not_existing  = 2
      is_interface  = 3
      no_text       = 4
      inconsistent  = 5
      others        = 6.
  if sy-subrc ne 0.
    message 'The % is not existent.' TYPE 'E'.
  endif.
  CASE sscrfields-ucomm.
    WHEN 'FC01'.
*trigge  start-of-SELECTION event
      sscrfields-ucomm = 'ONLI'.
      i_gettype = 1.
    WHEN 'FC02'.
*trigge  start-of-SELECTION event
      sscrfields-ucomm = 'ONLI'.
      i_gettype = 2.
    WHEN 'FC03'.
*trigge  start-of-SELECTION event
      sscrfields-ucomm = 'ONLI'.
      i_gettype = 3.
    when others.
      i_gettype = 2.
  ENDCASE.

start-of-SELECTION.
  case i_gettype.
    when 1.
      perform get_meth.
    when 2.
      perform get_att.
    when 3.
      perform get_event.
  endcase.

END-OF-SELECTION.
  call function 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = sy-repid
      i_callback_user_command = 'USER_COMMAND'
      it_fieldcat             = gt_field[]
      is_layout               = gt_layout
      it_sort                 = gt_sort[]
    TABLES
      t_outtab                = <gt_outtab>.

*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->R_UCOMM      text
*      -->RS_SELFIELD  text
*----------------------------------------------------------------------*
form user_command using r_ucomm like sy-ucomm
                  rs_selfield type slis_selfield.
  data:
    bdcdata_wa  type bdcdata,
    bdcdata_tab type standard table of bdcdata with default key.

  case r_ucomm.
    when '&IC1'.                       "doubleclick
      clear bdcdata_wa.
      bdcdata_wa-program  = 'SAPLSEOD'.
      bdcdata_wa-dynpro   = '1000'.
      bdcdata_wa-dynbegin = 'X'.
      append bdcdata_wa to bdcdata_tab.

      clear bdcdata_wa.
      bdcdata_wa-fnam = 'BDC_CURSOR'.
      bdcdata_wa-fval = 'SEOCLASS-CLSNAME'.
      append bdcdata_wa to bdcdata_tab.

      clear bdcdata_wa.
      bdcdata_wa-fnam = 'BDC_OKCODE'.
      bdcdata_wa-fval = '=CIDI'.
      append bdcdata_wa to bdcdata_tab.

      clear bdcdata_wa.
      bdcdata_wa-fnam = 'SEOCLASS-CLSNAME'.
      bdcdata_wa-fval = p_cls.
      append bdcdata_wa to bdcdata_tab.
      call transaction 'SE24' using bdcdata_tab mode 'E'.
      clear r_ucomm.
  endcase.
endform.                    "USER_COMMAND

*&---------------------------------------------------------------------*
*&      Form  get_attfield
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_att .
  data: classkey type seoclskey,
        superclskey type seoclsref,
        constructor_exists_in_class type seox_boolean,
        rede       type seor_redefinitions_r,
        it_rede    type seor_redefinitions_r,
        wa_redes   type seoredef,
        it_atts    type seoo_attributes_r,
        atts       type seoo_attributes_r,
        i_level    type i.
  i_level = 0.
  call function 'SEO_CLASS_TYPEINFO_GET'
    EXPORTING
      clskey        = gt_classkey
      version       = '1'
      state         = seoc_state_model_and_impl
    IMPORTING
      attributes    = it_atts
      REDEFINITIONS = it_rede
    EXCEPTIONS
      not_existing  = 1
      is_interface  = 2
      others        = 3.
  if sy-subrc = 0.
    perform addattr using it_atts it_rede i_level.
    classkey  = gt_classkey.
    do.
      clear superclskey.
      call function 'SEO_CLASS_GET'
        EXPORTING
          clskey        = classkey
          version       = '1'
          state         = seoc_state_model_and_impl
        IMPORTING
          superclass    = superclskey
        EXCEPTIONS
          error_message = 1
          others        = 1.
      if sy-subrc = 1 or superclskey is initial.
        exit.
      endif.
      classkey  = superclskey.
      i_level = i_level + 1.
      refresh: atts.
      call function 'SEO_CLASS_TYPEINFO_GET'
        EXPORTING
          clskey        = classkey
          version       = '1'
          state         = seoc_state_model_and_impl
        IMPORTING
          attributes    = atts
          REDEFINITIONS = rede.
      delete atts where exposure = seoc_exposure_private.
      loop at it_rede into wa_redes.
        delete atts where CMPNAME = wa_redes-mtdname.
      endloop.
      perform addattr using atts rede i_level.
      it_rede[] = rede[].
    enddo.
    perform sub_field_des_d using   '' '' 'LEVEL'       '' '' ''  '' '' 'Class Level'  '2' '' 'X' '' gt_field[].
    perform sub_field_des_d using   '' '' 'SEOEXPOF1I'       '' 'X' 'X' '' '' 'Visiblity'  '10' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'CMPNAME'       '' 'X' 'X' '' '' 'Attribute name'  '30' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'CLSNAME'       '' '' '' '' '' 'Class name'  '30' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'DESCRIPT'       '' '' '' '' '' 'Description'  '60' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'SEOATTDF1I'       '' '' ''  '' '' 'Attribute Level'  '15' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'ATTRDONLY'       '' '' '' '' '' 'ReadOnly'  '1' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'SEOTYPTF1I'       '' '' '' '' '' 'Typing'  '10' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'ATTVALUE'       '' '' '' '' '' 'Initial Value'  '20' '' '' '' gt_field[].
    gt_layout-lights_fieldname  = 'LIGHTS'.
    gt_layout-info_fieldname = 'COLOR'.
    refresh gt_sort.
    clear gt_sort.
    perform sub_field_sort using:
       'SEOEXPOF1I' '' '1' '' 'X' gt_sort[],
       'LEVEL' '' '2' 'X' '' gt_sort[],
       'CMPNAME' '' '3' 'X' '' gt_sort[],
       'CLSNAME' '' '4' 'X' '' gt_sort[].
  endif.
  assign gt_attr to <gt_outtab>.
ENDFORM.                    " get_attfield
*&---------------------------------------------------------------------*
*&      Form  addattr
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_ATTRS[]  text
*      -->P_I_LEVEL  text
*----------------------------------------------------------------------*
FORM addattr  USING  P_IT_ATTRS  type  seoo_attributes_r
                     p_rede      type  seor_redefinitions_r
                     P_LEVEL     type  i.
  data:  wa_atts    type seoo_attribute_r.
  loop at   P_IT_ATTRS into wa_atts.
    move-corresponding wa_atts to g_wa_attr.
    g_wa_attr-level = P_LEVEL.
*Private,Protected,Public
    case g_wa_attr-EXPOSURE.
      when 0.
        g_wa_attr-SEOEXPOF1I = 'Private'.
        g_wa_attr-lights = 1.
      when 1.
        g_wa_attr-SEOEXPOF1I = 'Protected'.
        g_wa_attr-lights = 2.
      when 2.
        g_wa_attr-SEOEXPOF1I = 'Public'.
        g_wa_attr-lights = 3.
    endcase.
*Instance Attribute,Static Attribute,Constant
    case g_wa_attr-ATTDECLTYP.
      when 0.
        g_wa_attr-SEOATTDF1I = 'Instance'.
        g_wa_attr-color      = ''.
      when 1.
        g_wa_attr-SEOATTDF1I = 'Static'.
        g_wa_attr-color      = 'C510'.
      when 2.
        g_wa_attr-SEOATTDF1I = 'Constant'.
        g_wa_attr-color      = 'C510'.
        continue."Do not display constant attributes
    endcase.
*Attribute reference (LIKE),Type reference (TYPE),Object (TYPE),Object reference (TYPE REF TO),See coding
*     TYPTYPE type SEOTYPTYPE,
*     SEOTYPTF1I type SEOTYPTF1I,
*      case g_wa_attr-TYPTYPE.
*        when 0.
*          g_wa_attr-SEOTYPTF1I = 'Like'.
*          g_wa_attr-color      = ''.
*        when 1.
*          g_wa_attr-SEOTYPTF1I = 'Type'.
*          g_wa_attr-color      = 'C510'.
*        when 2.
*          g_wa_attr-SEOTYPTF1I = 'Type'.
*        when 3.
*          g_wa_attr-SEOTYPTF1I = 'Type Ref To'.
*      endcase.
    append g_wa_attr to gt_attr.
  endloop.
ENDFORM.                    " addattr
*&---------------------------------------------------------------------*
*&      Form  get_meth
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_meth .
  data: classkey type seoclskey,
        superclskey type seoclsref,
        constructor_exists_in_class type seox_boolean,
        rede       type seor_redefinitions_r,
        it_rede    type seor_redefinitions_r,
        wa_redes   type seoredef,
        it_meth type  seoo_methods_r,
        meth type  seoo_methods_r,
        i_level    type i.
  i_level = 0.
  call function 'SEO_CLASS_TYPEINFO_GET'
    EXPORTING
      clskey        = gt_classkey
      version       = '1'
      state         = seoc_state_model_and_impl
    IMPORTING
      METHODS       = it_meth
      REDEFINITIONS = it_rede
    EXCEPTIONS
      not_existing  = 1
      is_interface  = 2
      others        = 3.
  if sy-subrc = 0.
    perform addmeth using it_meth it_rede i_level.
    classkey  = gt_classkey.
    do.
      clear superclskey.
      call function 'SEO_CLASS_GET'
        EXPORTING
          clskey        = classkey
          version       = '1'
          state         = seoc_state_model_and_impl
        IMPORTING
          superclass    = superclskey
        EXCEPTIONS
          error_message = 1
          others        = 1.
      if sy-subrc = 1 or superclskey is initial.
        exit.
      endif.
      classkey  = superclskey.
      i_level   = i_level + 1.
      refresh:  meth.
      call function 'SEO_CLASS_TYPEINFO_GET'
        EXPORTING
          clskey        = classkey
          version       = '1'
          state         = seoc_state_model_and_impl
        IMPORTING
          METHODS       = meth
          REDEFINITIONS = rede.
      delete meth where exposure = seoc_exposure_private.
      loop at it_rede into wa_redes.
        delete meth where CMPNAME = wa_redes-mtdname.
      endloop.
      perform addmeth using meth rede i_level.
      it_rede[] = rede[].
    enddo.
    perform sub_field_des_d using   '' '' 'LEVEL'       '' '' ''  '' '' 'Class Level'  '2' '' 'X' '' gt_field[].
    perform sub_field_des_d using   '' '' 'SEOEXPOF1I'       '' 'X' 'X' '' '' 'Visiblity'  '10' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'CMPNAME'       '' 'X' 'X' '' '' 'Method name'  '30' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'CLSNAME'       '' '' '' '' '' 'Class name'  '30' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'DESCRIPT'       '' '' '' '' '' 'Description'  '60' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'SEOATTDF1I'       '' '' ''  '' '' 'Method Level'  '15' '' '' '' gt_field[].
    gt_layout-lights_fieldname  = 'LIGHTS'.
    gt_layout-info_fieldname = 'COLOR'.
    refresh gt_sort.
    clear gt_sort.
    perform sub_field_sort using:
       'SEOEXPOF1I' '' '1' '' 'X' gt_sort[],
       'LEVEL' '' '2' 'X' '' gt_sort[],
       'CMPNAME' '' '3' 'X' '' gt_sort[],
       'CLSNAME' '' '4' 'X' '' gt_sort[].
  endif.
  assign gt_meth to <gt_outtab>.
ENDFORM.                    " get_meth
*&---------------------------------------------------------------------*
*&      Form  addattr
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_ATTRS[]  text
*      -->P_I_LEVEL  text
*----------------------------------------------------------------------*
FORM addmeth  USING  P_IT_meth  type  seoo_methods_r
                     p_rede      type  seor_redefinitions_r
                     P_LEVEL     type  i.
  data   wa_meth type seoo_method_r.
  loop at P_IT_meth into wa_meth.
    move-corresponding wa_meth to g_wa_meth.
    g_wa_meth-level = P_LEVEL.
*Private,Protected,Public
    case g_wa_meth-EXPOSURE.
      when 0.
        g_wa_meth-SEOEXPOF1I = 'Private'.
        g_wa_meth-lights = 1.
      when 1.
        g_wa_meth-SEOEXPOF1I = 'Protected'.
        g_wa_meth-lights = 2.
      when 2.
        g_wa_meth-SEOEXPOF1I = 'Public'.
        g_wa_meth-lights = 3.
    endcase.
*Instance Attribute,Static Attribute,Constant
    case g_wa_meth-MTDDECLTYP.
      when 0.
        g_wa_meth-SEOATTDF1I = 'Instance'.
        g_wa_meth-color      = ''.
      when 1.
        g_wa_meth-SEOATTDF1I = 'Static'.
        g_wa_meth-color      = 'C510'.
      when 2.
        g_wa_meth-SEOATTDF1I = 'Constant'.
        g_wa_meth-color      = 'C510'.
        continue."Do not display constant attributes
    endcase.
    append g_wa_meth to gt_meth.
  endloop.
ENDFORM.                    " addmeth
*&---------------------------------------------------------------------*
*&      Form  get_meth
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_event .
  data: classkey type seoclskey,
        superclskey type seoclsref,
        constructor_exists_in_class type seox_boolean,
        rede       type seor_redefinitions_r,
        it_rede    type seor_redefinitions_r,
        wa_redes   type seoredef,
        it_event   type  seoo_events_r,
        event      type  seoo_events_r,
        i_level    type i.
  i_level = 0.
  call function 'SEO_CLASS_TYPEINFO_GET'
    EXPORTING
      clskey        = gt_classkey
      version       = '1'
      state         = seoc_state_model_and_impl
    IMPORTING
      EVENTS        = it_event
      REDEFINITIONS = it_rede
    EXCEPTIONS
      not_existing  = 1
      is_interface  = 2
      others        = 3.
  if sy-subrc = 0.
    perform addevent using it_event it_rede i_level.
    classkey  = gt_classkey.
    do.
      clear superclskey.
      call function 'SEO_CLASS_GET'
        EXPORTING
          clskey        = classkey
          version       = '1'
          state         = seoc_state_model_and_impl
        IMPORTING
          superclass    = superclskey
        EXCEPTIONS
          error_message = 1
          others        = 1.
      if sy-subrc = 1 or superclskey is initial.
        exit.
      endif.
      classkey  = superclskey.
      i_level   = i_level + 1.
      refresh:  event.
      call function 'SEO_CLASS_TYPEINFO_GET'
        EXPORTING
          clskey        = classkey
          version       = '1'
          state         = seoc_state_model_and_impl
        IMPORTING
          eventS        = event
          REDEFINITIONS = rede.
      delete event where exposure = seoc_exposure_private.
      loop at it_rede into wa_redes.
        delete event where CMPNAME = wa_redes-mtdname.
      endloop.
      perform addevent using event rede i_level.
      it_rede[] = rede[].
    enddo.
    perform sub_field_des_d using   '' '' 'LEVEL'       '' '' ''  '' '' 'Class Level'  '2' '' 'X' '' gt_field[].
    perform sub_field_des_d using   '' '' 'SEOEXPOF1I'       '' 'X' 'X' '' '' 'Visiblity'  '10' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'CMPNAME'       '' 'X' 'X' '' '' 'Event name'  '30' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'CLSNAME'       '' '' '' '' '' 'Class name'  '30' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'DESCRIPT'       '' '' '' '' '' 'Description'  '60' '' '' '' gt_field[].
    perform sub_field_des_d using   '' '' 'SEOEVTDF1I'       '' '' ''  '' '' 'Event Level'  '15' '' '' '' gt_field[].
    gt_layout-lights_fieldname  = 'LIGHTS'.
    gt_layout-info_fieldname = 'COLOR'.
    refresh gt_sort.
    clear gt_sort.
    perform sub_field_sort using:
       'SEOEXPOF1I' '' '1' '' 'X' gt_sort[],
       'LEVEL' '' '2' 'X' '' gt_sort[],
       'CMPNAME' '' '3' 'X' '' gt_sort[],
       'CLSNAME' '' '4' 'X' '' gt_sort[].
  endif.
  assign gt_event to <gt_outtab>.
ENDFORM.                    " get_event
*&---------------------------------------------------------------------*
*&      Form  addattr
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_IT_ATTRS[]  text
*      -->P_I_LEVEL  text
*----------------------------------------------------------------------*
FORM addevent  USING  P_IT_event  type  seoo_events_r
                     p_rede      type  seor_redefinitions_r
                     P_LEVEL     type  i.
  data   wa_event type seoo_event_r.
  loop at P_IT_event into wa_event.
    move-corresponding wa_event to g_wa_event.
    g_wa_event-level = P_LEVEL.
*Private,Protected,Public
    case g_wa_event-EXPOSURE.
      when 0.
        g_wa_event-SEOEXPOF1I = 'Private'.
        g_wa_event-lights = 1.
      when 1.
        g_wa_event-SEOEXPOF1I = 'Protected'.
        g_wa_event-lights = 2.
      when 2.
        g_wa_event-SEOEXPOF1I = 'Public'.
        g_wa_event-lights = 3.
    endcase.
*Instance Attribute,Static Attribute,Constant
    case g_wa_event-EVTDECLTYP.
      when 0.
        g_wa_event-SEOEVTDF1I = 'Instance'.
        g_wa_event-color      = ''.
      when 1.
        g_wa_event-SEOEVTDF1I = 'Static'.
        g_wa_event-color      = 'C510'.
      when 2.
        g_wa_event-SEOEVTDF1I = 'Constant'.
        g_wa_event-color      = 'C510'.
        continue."Do not display constant attributes
    endcase.
    append g_wa_event to gt_event.
  endloop.
ENDFORM.                    " addevent
*----------------------------------------------------------------------*
* Form         : SUB_FIELD_DES_D
*----------------------------------------------------------------------*
*      Description:  Set the fields which will be displayed
*----------------------------------------------------------------------*
*      im_ref_FIELD---must upper case                                 *
*      im_ref_TABLE---internal table name                             *
*      im_FIELDname---must upper case                                 *
*      im_TABname  ---internal table name                             *
*      im_KEY      ---column with key-color AND frozen                *
*      im_CHECKBOX ---the column is checkbox                          *
*      im_dosum    ---total,if total, the field must be sumed         *
*      im_SELTEX_L ---column Long description of title                *
*      im_outputlen---column output length
*      IM_dec--?????
*      re_field : ????????
*----------------------------------------------------------------------*
* Modification Log:                                                    *
* Date        Programmer     Correction Number                         *
*----------------------------------------------------------------------*
form sub_field_des_d using im_ref_field type c
                         im_ref_table type c
                         im_fieldname type c
                         im_tabname type c
                         im_key type c
                         im_fix type c
                         im_checkbox type c
                         im_dosum type c
                         im_seltex_l type c
                         im_outputlen type i
                         im_zero type c
                         im_out  type c
                         im_dec  type c
                         re_field type slis_t_fieldcat_alv.
  data: wa_fieldcat type slis_fieldcat_alv.
  clear wa_fieldcat.
  wa_fieldcat-ref_fieldname = im_ref_field.
  wa_fieldcat-ref_tabname = im_ref_table.
  wa_fieldcat-fieldname = im_fieldname.
  wa_fieldcat-tabname   = im_tabname.
  wa_fieldcat-key       = im_key.
  wa_fieldcat-fix_column = IM_fix.
  wa_fieldcat-checkbox  = im_checkbox.
  wa_fieldcat-do_sum     = im_dosum.
  wa_fieldcat-no_zero     = im_zero.
  wa_fieldcat-no_out     = im_out.
  wa_fieldcat-seltext_l = im_seltex_l.
  wa_fieldcat-seltext_m = im_seltex_l.
  wa_fieldcat-seltext_s = im_seltex_l.
  wa_fieldcat-outputlen = im_outputlen.
  wa_fieldcat-decimals_out = im_dec.
*  wa_fieldcat-col_pos   = IM_colpos.
  append wa_fieldcat to re_field.
endform.                    "SUB_FIELD_DES

*&---------------------------------------------------------------------*
*&      Form  sub_field_sort
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->IM_FIELDNAME  text
*      -->IM_TABNAME    text
*      -->IM_SPOS       text
*      -->IM_UP         text
*      -->IM_SUBTOT     text
*      -->RE_SORT       text
*----------------------------------------------------------------------*
form sub_field_sort using im_fieldname type c
                          im_tabname type c
                          im_spos type i
                          im_up type c
                          im_subtot type c
                          re_sort type slis_t_sortinfo_alv.
  data: wa_sort     type slis_sortinfo_alv.
  clear wa_sort .
  wa_sort-fieldname = im_fieldname.  "The field will be sorted
  wa_sort-tabname   = im_tabname.    "internal table name
  wa_sort-spos      = im_spos.       "Sort sequence
  wa_sort-up        = im_up.         "Ascending,down-Descending
  wa_sort-subtot    = im_subtot.
  append wa_sort to re_sort.
endform.                    "SUB_FIELD_SORT 

分享到:
评论

相关推荐

    ABAP751 ABAP - Keyword Documentation

    ABAP - Keyword Documentation This documentation describes the syntax and meaning of the keywords of the ABAP language and its object-oriented part ABAP Objects. Alongside this, language frameworks ...

    SAP中文教材全系列之ABAP-BC400_ZH

    结构是一种复合数据类型,允许将多个数据元素组合成一个数据结构;内部表则是一种特殊的数据类型,用于在ABAP程序中处理大量数据集合。 最后,文档探讨了数据建模和数据检索的概念。在SAP系统中,数据建模是组织和...

    CD260-ABAP-in-Eclipse-开发-CN

    CD260-ABAP-in-Eclipse-开发-CN CD260-ABAP-in-Eclipse-开发-CNCD260-ABAP-in-Eclipse-开发-CNCD260-ABAP-in-Eclipse-开发-CN

    ABAP-培训教材目录

    ABAP-培训教材附录 ABAP-培训教材ABAP-培训教材ABAP-培训教材ABAP-培训教材

    eclipse-abap-keywordcolors-master.rar

    eclipse-abap-keywordcolors eclipse-abap-关键字颜色

    ABAP-ALV进阶

    使用了 ABAP 的对象以后,列表是通过 ALV 的一个实例(INSTANCE)来显示的,程序员可以使用 ABAP 对象的事件管理。 四、ALV GRID CONTROL 相关的几个控制结构 1. 字段目录 [Field catalog] 字段目录是用来控制 ...

    ABAP-学习笔记-通用

    ABAP-学习笔记-通用

    SAP ABAP-采购申请释放后到更新发布标识.zip

    ABAP(Advanced Business Application Programming)是一种编程语言,用于开发和定制企业资源规划(ERP)软件,而MM(Materials Management)模块则是SAP中的一个重要部分,主要处理采购、库存管理和物料需求计划等...

    ABAP-4目前最完美学习手册

    - **ABAP/4基础**:介绍了创建简单ABAP/4程序的方法,包括命名规则、程序属性指定等。 #### 创建简单的ABAP/4程序 - **命名程序**: - 程序名称必须遵循特定的规则,例如避免使用SAP保留的名称。 - **命名规则**...

    SAP-ABAP-OO-实现-CL-SALV-TABLE

    为了更好地组织代码,可以定义一个自己的 ALV 控制类 `LCL_ALV`。这个类包含了获取数据、处理 ALV 显示等逻辑。下面是对该类的定义与实现的详细解释: **定义部分:** ```ababp CLASS lcl_alv DEFINITION. PUBLIC...

    ABAP-OLE开发[汇编].pdf

    1. **CREATE OBJECT**:这个关键字用于创建一个OLE对象实例,即在ABAP程序中实例化一个外部应用程序的对象。这通常是启动OLE服务器应用程序的第一步。 2. **SET PROPERTY**:设置OLE对象的属性。这允许你改变对象的...

    ABAP--ALV

    - 首先定义了一个内部表`ITAB`,用于存储查询结果。 - 使用`SELECT`语句从`MARA`表中选择所需的字段,并根据`S_MATNR`的`SELECT-OPTIONS`参数过滤出指定范围内的物料信息。 2. **ALV初始化与配置**: - 调用`...

    SAP-ABAP-Certification-Review.pdf

    SAP-ABAP-Certification-Review.pdf

    abap-ALV.rar_ABAP系统ALV_abap_abap开发alv

    REUSE_ALV_GRID_DISPLAY_LVC函数是ABAP ALV编程中常用的一个函数模块,它负责初始化并显示ALV网格。这个函数的主要步骤包括: 1. 初始化ALV:调用FUNCTION模块`REUSE_ALV_GRID_DISPLAY`,并传递必要的参数,如选择的...

    ABAP-数据类型学习笔记

    ABAP-数据类型学习笔记

    web-dynpro-abap-ui-element-tree_Ch01_CV_Introduction_

    在Web Dynpro ABAP中,一个树由节点组成,每个节点可以有子节点。用户可以通过展开和折叠节点来查看和操作层次结构。树控件支持单击、双击等交互操作,以及自定义的事件处理。 创建树形UI元素涉及以下步骤: 1. **...

    ABAP-OLE[借鉴].pdf

    在上述代码中,我们看到了一个名为`ZWM_015`的报告,它展示了如何使用ABAP-OLE来生成Excel文件。下面将详细介绍这一过程的关键知识点: 1. **ABAP Reports**:`REPORT zwm_015`定义了一个ABAP报告,这是SAP系统中...

    ABAP-操作Excel导出数据

    在ABAP中,我们可以利用DO (Document Object) Interface(DOI),这是一个与OLE相关的接口,来实现对Office应用程序(如Excel)的控制。 首先,我们需要创建一个ABAP报告或函数模块,用于执行数据导出。在这个过程...

    ABAP-WebDynpro实例.pdf

    ABAP-WebDynpro 实例 ABAP-WebDynpro 实例是 SAP 中的一种开发技术...总结来说,本实例展示了如何使用 ABAP-WebDynpro 创建一个基于 Web 的应用程序,并介绍了控制器COMPONENTCONTROLLER 和 Context 节点的设置方法。

Global site tag (gtag.js) - Google Analytics