`
guanhuaing
  • 浏览: 1199831 次
文章分类
社区版块
存档分类
最新评论

获取SAP系统集成类的继承关系

阅读更多

--------------------------------------------------------------------*
*& Report ZGETCONTROLLIST *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

REPORT zget_class_list LINE-SIZE 132 NO STANDARD PAGE HEADING .
type-pools: slis.
TABLES: vseoextend.
TYPES: BEGIN OF tyclass,
clsname LIKE vseoextend-clsname,
refclsname LIKE vseoextend-refclsname,
descript LIKE seoclasstx-descript,
END OF tyclass,
BEGIN OF twclass.
INCLUDE TYPE tyclass.
TYPES: parentnum(20) TYPE c,
END OF twclass,
ttwclass TYPE TABLE OF twclass.
DATA: fieldtab TYPE slis_t_fieldcat_alv.
DATA: twclass1 TYPE ttwclass.
DATA: twclass2 LIKE twclass1.
DATA: twclass3 LIKE twclass1.
DATA: twclass1_wa LIKE LINE OF twclass1.
data: twclass2_wa like twclass1_wa.

DATA: yclass TYPE tyclass.
DATA: x TYPE i, y TYPE i, l TYPE i, n TYPE i.
DATA: isub TYPE i.
DATA: iparentnum(2) TYPE c.


PARAMETERS p_cname LIKE vseoextend-clsname OBLIGATORY
default 'CL_GUI_OBJECT'.
PARAMETERS p_check TYPE c AS CHECKBOX.

DEFINE new_grid.
y = sy-linno.
y = y + 2.
skip to line y.
x = sy-colno.
position x.
write '|'.
END-OF-DEFINITION.

DEFINE write_grid.
x = sy-colno.
y = sy-linno.
position x.
write: &1, '|'.
l = sy-colno - x + 1.
x = x - 2.
y = y + 1.
skip to line y.
position x.
uline at x(l).
y = y - 1.
x = sy-colno.
skip to line y.
position x.
END-OF-DEFINITION.

START-OF-SELECTION.
SELECT a~clsname b~descript
INTO CORRESPONDING FIELDS OF yclass
FROM seoclass AS a
INNER JOIN seoclasstx AS b
ON a~clsname = b~clsname AND b~langu = sy-langu
WHERE a~clsname = p_cname.
isub = isub + 1.
IF isub > 99.
CONTINUE.
ENDIF.
MOVE-CORRESPONDING yclass TO twclass1_wa.
PERFORM get_parentnum USING isub CHANGING iparentnum.
twclass1_wa-parentnum = iparentnum.
APPEND twclass1_wa TO twclass1.
ENDSELECT.

twclass2[] = twclass1[].
DESCRIBE TABLE twclass2 LINES n.
WHILE n > 0.
LOOP AT twclass2 into twclass2_wa.
isub = 0.
SELECT a~clsname a~refclsname b~descript
INTO CORRESPONDING FIELDS OF yclass
FROM vseoextend AS a
INNER JOIN seoclasstx AS b
ON a~clsname = b~clsname AND b~langu = sy-langu
WHERE a~refclsname = twclass2_wa-clsname.
isub = isub + 1.
IF isub > 99.
CONTINUE.
ENDIF.
MOVE-CORRESPONDING yclass TO twclass1_wa.
PERFORM get_parentnum USING isub CHANGING iparentnum.
CONCATENATE twclass2_wa-parentnum iparentnum
into twclass1_wa-parentnum.
APPEND twclass1_wa TO twclass1.
APPEND twclass1_wa TO twclass3.
ENDSELECT.
ENDLOOP.
refresh twclass2.
twclass2[] = twclass3[].
refresh twclass3.
DESCRIBE TABLE twclass2 LINES n.
ENDWHILE.

SORT twclass1 BY parentnum.
PERFORM initialize_fieldcat USING fieldtab[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fieldtab
TABLES
t_outtab = twclass1.

* LOOP AT twclass1 INTO twclass1_wa.
* new_grid.
* write_grid: twclass1_wa-clsname,
* twclass1_wa-parentnum,
* twclass1_wa-descript.
* ENDLOOP.
* y = sy-linno.
* y = y + 2.
* SKIP TO LINE y.
* x = sy-colno.
* POSITION x.
* WRITE: / sy-dbcnt.

TOP-OF-PAGE.
FORMAT COLOR COL_NEGATIVE.
ULINE AT 2.
WRITE '|'.
POSITION 3.
WRITE: 'CLass Name'.
POSITION 34.
WRITE '|'.
WRITE: 'Parent String'.
POSITION 67.
WRITE '|'.
WRITE: 'Reference Class Name'.
ULINE.
y = sy-linno.
SKIP TO LINE y.
*&---------------------------------------------------------------------*
*& Form Get_parentnum
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_ISUB text
* <--P_IPARENTNUM text
*----------------------------------------------------------------------*
FORM get_parentnum USING p_isub
CHANGING p_iparentnum.
DATA: iparentnum(2) TYPE c.
WRITE p_isub TO iparentnum.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = iparentnum
IMPORTING
output = p_iparentnum.
ENDFORM. " Get_parentnum

FORM initialize_fieldcat USING p_fieldtab TYPE slis_t_fieldcat_alv.
DATA: l_fieldcat TYPE slis_fieldcat_alv.
l_fieldcat-seltext_s = 'CLASS NAME'.
l_fieldcat-outputlen = 30.
l_fieldcat-fieldname = 'CLSNAME'.
APPEND l_fieldcat TO p_fieldtab.
CLEAR l_fieldcat.
l_fieldcat-seltext_s = 'CLASS NAME'.
l_fieldcat-outputlen = 30.
l_fieldcat-fieldname = 'REFCLSNAME'.
APPEND l_fieldcat TO p_fieldtab.
CLEAR l_fieldcat.
l_fieldcat-seltext_s = 'DESCRIPTION'.
l_fieldcat-outputlen = 60.
l_fieldcat-fieldname = 'DESCRIPT'.
APPEND l_fieldcat TO p_fieldtab.
CLEAR l_fieldcat.
l_fieldcat-seltext_s = 'TREENUM'.
l_fieldcat-outputlen = 20.
l_fieldcat-fieldname = 'PARENTNUM'.
APPEND l_fieldcat TO p_fieldtab.
ENDFORM. " INITIALIZE_FIELDCATORD

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics