找表关系程序(转)

*&--------------------------------------------------------------------------------------------------------*
*&***************************************ABAPer's TABLOSCOPE***********************************************
*&--------------------------------------------------------------------------------------------------------*
*&                                                                                                        *
*& Developed by     : RASHMITH RAO. TULA                                                                  *
*&                                                                                                        *
*& Purpose          : To develop a tool which simplifies the job of an ABAPer primarily in searching for, *
*&                                                                                                        *
*&                                                                                                        *
*&                        (i)  Table relationships (Direct/Indirect)                                      *
*&                             (specific to each module)                                                  *
*&                                                                                                        *
*&                        (ii) Fields based on Field name/Field description                               *
*&                             (specific to each module)                                                  *
*&                                                                                                        *
*&                    In addition, to include other usual functionalities  as in ABAP Dictionary.         *
*&                                                                                                        *
*&                                                                                                        *
*& Developed during : 1st September - 10th October 2013                                                   *
*&                                                                                                        *
*& Last modified on : 5th December 2013                                                                   *
*&                                                                                                        *
*& Version          : 38                                                                                  *
*&                                                                                                        *
*& Developed at     : Hyderabad, India.                                                                   *
*&                                                                                                        *
*& Email            : [email protected]                                                              *
*&                                                                                                        *
*&*********************************************************************************************************


REPORT  ZRSW_TABLOSCOPE_FINAL LINE-SIZE 288.


****************************************************************
*-----------------------Types Declarations---------------------*
****************************************************************
TABLES SSCRFIELDS.
TYPE-POOLS: SLIS, ICON.


TYPES: BEGIN  OF  TY_TABCLASS,
        TABNAME             TYPE                 DD02L-TABNAME,          "Table Name
        TABCLASS            TYPE                 DD02L-TABCLASS,         "Table category
        VIEWCLASS           TYPE                 DD02L-VIEWCLASS,        "View Type
       END    OF  TY_TABCLASS,




       BEGIN  OF  TY_FIELD,
        FIELDNAME           TYPE                 DD03L-FIELDNAME,        "Field Name
        POSITION            TYPE                 DD03L-POSITION,         "Position of the field in the table
        KEYFLAG             TYPE                 DD03L-KEYFLAG,          "Identifies a key field of a table
        DATATYPE            TYPE                 DD03L-DATATYPE,         "Data Type in ABAP Dictionary
       END    OF  TY_FIELD,




       BEGIN  OF  TY_CHECKTABLE,
        TABNAME             TYPE                 DD08L-TABNAME,          "Table Name
        POSITION            TYPE                 DD03L-POSITION,         "Position of 1st table's field in the table
        TEXT1               TYPE                 STRING,                 "Field description
        FIELDNAME           TYPE                 STRING,                 "Name of the field to be checked
        TEXT2               TYPE                 STRING,                 "Field description
        CHECKTABLE          TYPE                 STRING,                 "Check table name of the foreign key
       END    OF  TY_CHECKTABLE,




       BEGIN  OF  TY_DD08L,
        TABNAME             TYPE                 DD08L-TABNAME,          "Table Name
        FIELDNAME           TYPE                 DD08L-FIELDNAME,        "Name of the field to be checked
        CHECKTABLE          TYPE                 DD08L-CHECKTABLE,       "Check table name of the foreign key
       END    OF  TY_DD08L,




       BEGIN  OF  TY_DD03L,
        TABNAME             TYPE                 DD03L-TABNAME,          "Table Name
        FIELDNAME           TYPE                 DD03L-FIELDNAME,        "Field Name
        POSITION            TYPE                 DD03L-POSITION,         "Position of the field in the table
        KEYFLAG             TYPE                 DD03L-KEYFLAG,          "Identifies a key field of a table
        ROLLNAME            TYPE                 DD03L-ROLLNAME,         "Data element (semantic domain)
        DATATYPE            TYPE                 DD03L-DATATYPE,         "Data Type in ABAP Dictionary
        LENG                TYPE                 DD03L-LENG,             "Length (No. of Characters)
        DOMNAME             TYPE                 DD03L-DOMNAME,          "Domain Name
       END    OF  TY_DD03L,




       BEGIN  OF  TY_DD02T,
        TABNAME             TYPE                 DD02T-TABNAME,          "Table Name
        DDTEXT              TYPE                 DD02T-DDTEXT,           "Short Description of Table
       END    OF  TY_DD02T,




       BEGIN  OF  TY_DD04T,
        ROLLNAME            TYPE                 DD04T-ROLLNAME,         "Data element (semantic domain)
        DDTEXT              TYPE                 DD04T-DDTEXT,           "Short Description of Data element
       END    OF  TY_DD04T.


****************************************************************
*-----------------------Data Declarations----------------------*
****************************************************************


DATA:
*------------------Internal tables declaration-----------------------------*


     IT_FCAT                TYPE                  SLIS_T_FIELDCAT_ALV,
     IT_CHECK1              TYPE TABLE OF         TY_CHECKTABLE,
     IT_CHECK2              TYPE TABLE OF         TY_CHECKTABLE,
     IT_FIELD1              TYPE TABLE OF         TY_FIELD,
     IT_FIELD2              TYPE TABLE OF         TY_FIELD,
     IT_DD08L1              TYPE TABLE OF         TY_DD08L,
     IT_DD08L2              TYPE TABLE OF         TY_DD08L,
     IT_DD03L1              TYPE TABLE OF         TY_DD03L,
     IT_DD03L2              TYPE TABLE OF         TY_DD03L,
     IT_DD03L3              TYPE TABLE OF         TY_DD03L,
     IT_DD03L4              TYPE TABLE OF         TY_DD03L,
     IT_DD04T               TYPE TABLE OF         TY_DD04T.




*------------------Work areas declaration-----------------------------------*
DATA:


     WA_FCAT                TYPE                  SLIS_FIELDCAT_ALV,
     WA_LAYOUT              TYPE                  SLIS_LAYOUT_ALV,
     WA_CHECK1              TYPE                  TY_CHECKTABLE,
     WA_CHECK2              TYPE                  TY_CHECKTABLE,
     WA_TABCLS1             TYPE                  TY_TABCLASS,
     WA_TABCLS2             TYPE                  TY_TABCLASS,
     WA_FIELD1              TYPE                  TY_FIELD,
     WA_FIELD2              TYPE                  TY_FIELD,
     WA_DD08L1              TYPE                  TY_DD08L,
     WA_DD08L2              TYPE                  TY_DD08L,
     WA_DD03L1              TYPE                  TY_DD03L,
     WA_DD03L2              TYPE                  TY_DD03L,
     WA_DD03L3              TYPE                  TY_DD03L,
     WA_DD03L4              TYPE                  TY_DD03L,
     WA_DD04T1              TYPE                  TY_DD04T,
     WA_DD04T2              TYPE                  TY_DD04T,
     WA_DD04T3              TYPE                  TY_DD04T,
     WA_DD04T4              TYPE                  TY_DD04T,
     WA_DD02T1              TYPE                  TY_DD02T,
     WA_DD02T2              TYPE                  TY_DD02T,
     WA_DD02T3              TYPE                  TY_DD02T.




*------------------Flags declaration------------------------------------*
DATA:


     LF_REP                 TYPE                  I    VALUE    0,       "Flag to identify Fieldcat
     LF_P2                  TYPE                  I    VALUE    0,       "Flag for 'Get 1st Few Fields' Button
     LF_POP                 TYPE                  I    VALUE    0,       "Flag to mark button click for calling Popup(window 500)
     LF_POP_AFTER           TYPE                  I    VALUE    0,       "Flag to capture user-interaction on the popup(window 500)
     LF_POP_AFTER_LIST      TYPE                  I    VALUE    0,       "Flag to call the relevant logic behind Button
     LF_MANIPULATE_CRET     TYPE                  I,                     "Flag for marking the user-interaction on the pop-up other than execute button(CRET)
     LF_WA_CLEAR            TYPE                  I,                     "Flag set when work area is cleared in subroutines 'Direct_relationships' & 'Relationships'
     LF_N1                  TYPE                  I,                     "Flag to mark the No: of records requested(Used in No: of records validation)
     LF_N2                  TYPE                  I,                     "Flag to mark user interaction on button 'Check No: of entries'
     LF_CHECK_ENTRIES       TYPE                  I,                     "Flag to mark user interaction on button 'Check No: of entries'(Used in 'At Selection-screen Output')
     LF_GET_FIELDS          TYPE                  I,                     "Flag to mark user interaction on button 'Get 1st few fields'
     LF_EXCEPTION           TYPE                  I,                     "Flag to mark the exception when the table has no entries
     LF_HELP_I              TYPE                  I,                     "Flag to mark the execution of the event (On value request for PA_SLIST field)
     LF_VAL_REQUEST         TYPE                  I,                     "Flag to mark user's interaction on F4 help for Fields
     LF_TABLE1              TYPE                  DD02L-TABNAME,         "Flag to mark the Table name and clear the field list on the change of table(used for button 'Get 1st few fields')
     LF_TABLE2              TYPE                  DD02L-TABNAME,         "Flag to mark the Table name(used for No: of entries validation)
     LF_TABLE3              TYPE                  DD02L-TABNAME,         "Flag to mark the Table name(on click of 'Check No: of entries' button)
     LF_TABLE4              TYPE                  DD02L-TABNAME,         "Flag to mark the Table name(on click of 'F4 help' for fields)
     LF_OUTPUT(30)          TYPE                  C.                     "Flag to mark the database load(No: of entries) acceptability for output execution


*------------------Variables declaration------------------------------------*
DATA:


     LV_I                   TYPE                  I    VALUE    0,
     LV_RE                  TYPE                  I    VALUE    0,
     LV_HR_LINK             TYPE                  I,
     LV_HELP_FLIST(2500)    TYPE                  C,
     LV_ALV_RECS            TYPE                  STRING,
     LV_FIELD2              TYPE                  STRING,
     LV_JT                  TYPE                  STRING,
     LV_R2                  TYPE                  STRING,
     LV_MOD                 TYPE                  STRING,
     LV_FILD1               TYPE                  STRING,
     LV_FILD2               TYPE                  STRING,
     LV_FILD3               TYPE                  STRING,
     LV_FILD4               TYPE                  STRING,
     LV_IS                  TYPE                  STRING,
     LV_HR                  TYPE                  STRING,
     LV_FILD5               TYPE                  STRING,
     LV_KU                  TYPE                  STRING,
     LV_FILD6               TYPE                  STRING,
     LV_FILD7               TYPE                  STRING,
     LV_TB1                 TYPE                  STRING,
     LV_GQ                  TYPE                  STRING,
     LV_A                   TYPE                  STRING,
     LV_TEX1                TYPE                  STRING,
     LV_TEX2                TYPE                  STRING,
     LV_TFLD1               TYPE                  STRING,
     LV_TFLD2               TYPE                  STRING,
     LV_TFLD3               TYPE                  STRING,
     LV_DESC1               TYPE                  STRING,
     LV_DESC2               TYPE                  STRING,
     LV_DESC3               TYPE                  STRING,
     LV_DESC4               TYPE                  STRING,
     LV_STR1                TYPE                  STRING,
     LV_STR2                TYPE                  STRING,
     LV_SEL_LIST1(1500)     TYPE                  C,
     LV_SEL_LIST2(1500)     TYPE                  C,
     LV_J3(25)              TYPE                  C,
     LV_CONCAT(32)          TYPE                  C,
     LV_ZC(20)              TYPE                  C,
     LV_V1(29)              TYPE                  C,
     LV_W2(31)              TYPE                  C,
     LV_ZB(20)              TYPE                  C,
     LV_Y4(27)              TYPE                  C,
     LV_ZD(20)              TYPE                  C,
     LV_ZA(20)              TYPE                  C,
     LV_CH(5)               TYPE                  C,
     LV_TEX3(60)            TYPE                  C,
     LV_TEX4(60)            TYPE                  C,
     LV_TEX5(60)            TYPE                  C,
     LV_OUTPUT_N1           TYPE                  I,
     LV_OUTPUT_N2           TYPE                  I,
     LV_COUNTER_CHKTBLS     TYPE                  I,
     LV_X4                  TYPE                  I,
     LV_LEN                 TYPE                  I,
     LV_X1                  TYPE                  I,
     LV_X2                  TYPE                  I,
     LV_X3                  TYPE                  I,
     LV_TLEN                TYPE                  I,
     LV_TPOS1               TYPE                  I,
     LV_LEN1                TYPE                  I,
     LV_LEN2                TYPE                  I,
     LV_LEN3                TYPE                  I,
     LV_LEN4                TYPE                  I,
     LV_FLN1                TYPE                  I,
     LV_FLN2                TYPE                  I,
     LV_SYFDPOS             TYPE                  I.


*------------------Ranges declaration-----------------------------------*


RANGES:
       R_TAB                FOR                   DD02L-TABNAME,
       R_TAB_LINK           FOR                   DD02L-TABNAME.




*------------------Data declarations for table--------------------------*


DATA:           W_TABNAME      TYPE               W_TABNAME,
                LV_FLD         TYPE               DD03L-FIELDNAME,
                LV_C           TYPE               CURSOR,
                W_DREF         TYPE REF TO        DATA.


FIELD-SYMBOLS:         TYPE               STANDARD TABLE,
                          TYPE               ANY,
                .


****************************************************************
*-----------------Selection Screen Design----------------------*
****************************************************************
*------------------Title Block Design----------------------------*
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 52.
PARAMETERS: PA_TITLE(24) TYPE C DEFAULT '**ABAPer''s  Tabloscope**'.
SELECTION-SCREEN: END OF LINE.


*------------------Block1 Design---------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT1.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 12.
PARAMETERS: PA_TEXT1 TYPE DD02T-DDTEXT VISIBLE LENGTH 36.
SELECTION-SCREEN: POSITION 76.
PARAMETERS: PA_TEXT2 TYPE DD02T-DDTEXT VISIBLE LENGTH 36.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 49.
SELECTION-SCREEN: PUSHBUTTON 49(26) BUTTON1 USER-COMMAND DIRECT_RELATIONSHIPS.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: COMMENT 1(14) TEXT2 FOR FIELD PA_TABL1.
SELECTION-SCREEN: POSITION 15.
PARAMETERS: PA_TABL1 TYPE DD03L-TABNAME.
SELECTION-SCREEN: POSITION 48.
SELECTION-SCREEN: COMMENT 49(4) ICON4 FOR FIELD PA_TABL1.
SELECTION-SCREEN: COMMENT 73(4) ICON1 FOR FIELD PA_TABL2.
SELECTION-SCREEN: POSITION 79.
PARAMETERS: PA_TABL2 TYPE DD03L-TABNAME.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 12.
PARAMETERS: PA_XX TYPE C NO-DISPLAY.
SELECTION-SCREEN: POSITION 15.
SELECTION-SCREEN: COMMENT 16(4) ICON2 FOR FIELD PA_XX.
SELECTION-SCREEN: PUSHBUTTON 20(20) BUTTON2 USER-COMMAND AS_CHECKTABLE.
SELECTION-SCREEN: POSITION 52.
SELECTION-SCREEN: PUSHBUTTON 53(18) BUTTON10 USER-COMMAND LINK_TABLES.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: SKIP.
SELECTION-SCREEN: PUSHBUTTON 20(20) BUTTON3 USER-COMMAND GOTO_TABLE_STRUCTURE.
SELECTION-SCREEN: SKIP.
SELECTION-SCREEN: PUSHBUTTON 17(26) BUTTON4 USER-COMMAND CHECKTABLES.
SELECTION-SCREEN: SKIP.
SELECTION-SCREEN: PUSHBUTTON 11(38) BUTTON5 USER-COMMAND RELATIONSHIPS.
SELECTION-SCREEN: END OF BLOCK B1.


*----------------------Block2 Design----------------------------------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT3.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 18.
PARAMETERS: PA_NOTE1(40) TYPE C DEFAULT 'Enter fields of the table with' VISIBLE LENGTH 30.
PARAMETERS: PA_NOTE2(40) TYPE C DEFAULT 'a single space between them.' VISIBLE LENGTH 28.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: COMMENT 1(20) TEXT4 FOR FIELD PA_SLIST.
SELECTION-SCREEN: POSITION 25.
PARAMETERS: PA_SLIST(2500) TYPE C.
SELECTION-SCREEN: PUSHBUTTON 73(25) BUTTON6 USER-COMMAND GET_FIELDS.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 1.
SELECTION-SCREEN: COMMENT 1(30) TEXT5 FOR FIELD PA_N.
SELECTION-SCREEN: POSITION 40.
PARAMETERS: PA_N TYPE I DEFAULT 100.
SELECTION-SCREEN: PUSHBUTTON 57(20) BUTTON7 USER-COMMAND CHECK_NO_OF_ENTRIES.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: END OF BLOCK B2.


*------------------Block3 Design---------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT12.
SELECTION-SCREEN: SKIP.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 2.
PARAMETERS: PA_Z1(7) TYPE C DEFAULT 'Execute'.
SELECTION-SCREEN: POSITION 9.
SELECTION-SCREEN: COMMENT 11(4) ICON6 FOR FIELD PA_Z1.
SELECTION-SCREEN: POSITION 15.
PARAMETERS: PA_Z4(31) TYPE C DEFAULT 'a table with all no: of entries'.
PARAMETERS: PA_Z2(7) TYPE C DEFAULT 'and use'.
SELECTION-SCREEN: POSITION 55.
SELECTION-SCREEN: COMMENT 56(4) ICON3 FOR FIELD PA_Z2.
SELECTION-SCREEN: POSITION 60.
PARAMETERS: PA_Z5(13) TYPE C DEFAULT 'in ALV output'.
PARAMETERS: PA_Z3(39) TYPE C DEFAULT 'to choose fields for selection criteria'.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: END OF BLOCK B3.


*------------------Block4 Design---------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT6.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: RB3 RADIOBUTTON GROUP GRP2.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(20) TEXT7 FOR FIELD RB3.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: RB4 RADIOBUTTON GROUP GRP2.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(30) TEXT8 FOR FIELD RB4.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: END OF BLOCK B4.


*------------------Block5 Design---------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK B5 WITH FRAME TITLE TEXT9.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: RB1 RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(10) TEXT10 FOR FIELD RB1.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: RB2 RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(12) TEXT11 FOR FIELD RB2.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: END OF BLOCK B5.


*------------------Block6 Design---------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK B6.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 48.
PARAMETERS: PA_D3(18) TYPE C DEFAULT 'PLEASE SCROLL DOWN'.
SELECTION-SCREEN: COMMENT 67(4) ICON5 FOR FIELD PA_D3.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: SKIP 1.
SELECTION-SCREEN: END OF BLOCK B6.


*------------------Block7 Design---------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK B7 WITH FRAME TITLE TEXT19.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: RB11 RADIOBUTTON GROUP GRP4 DEFAULT 'X' USER-COMMAND DYNAMIC_RBTN_FIELD.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(17) TEXT20 FOR FIELD RB11.
SELECTION-SCREEN: POSITION 25.
PARAMETERS: PA_FNAM TYPE DD03L-FIELDNAME MODIF ID M1.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: SKIP.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS: RB12 RADIOBUTTON GROUP GRP4.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(20) TEXT21 FOR FIELD RB12.
SELECTION-SCREEN: POSITION 25.
PARAMETERS: PA_FDES TYPE DD04T-DDTEXT MODIF ID M2.
SELECTION-SCREEN: POSITION 75.
SELECTION-SCREEN: COMMENT 75(40) TEXT22 FOR FIELD PA_FDES.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: SKIP 2.
SELECTION-SCREEN: PUSHBUTTON 36(6) BUTTON8 USER-COMMAND SEARCH_FOR_FIELD.
SELECTION-SCREEN: END OF BLOCK B7.


*------------------Block8 Design---------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK B8 WITH FRAME TITLE TEXT30.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RB21 RADIOBUTTON GROUP GRP5.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(10) TEXT31.
SELECTION-SCREEN: POSITION 24.
PARAMETERS RB22 RADIOBUTTON GROUP GRP5.
SELECTION-SCREEN: POSITION 26.
SELECTION-SCREEN: COMMENT 26(10) TEXT32.
SELECTION-SCREEN: POSITION 47.
PARAMETERS RB23 RADIOBUTTON GROUP GRP5.
SELECTION-SCREEN: POSITION 48.
SELECTION-SCREEN: COMMENT 49(10) TEXT33.
SELECTION-SCREEN: POSITION 69.
PARAMETERS RB24 RADIOBUTTON GROUP GRP5.
SELECTION-SCREEN: POSITION 70.
SELECTION-SCREEN: COMMENT 71(10) TEXT34.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RB25 RADIOBUTTON GROUP GRP5.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(10) TEXT35.
SELECTION-SCREEN: POSITION 24.
PARAMETERS RB26 RADIOBUTTON GROUP GRP5.
SELECTION-SCREEN: POSITION 26.
SELECTION-SCREEN: COMMENT 26(10) TEXT36.
SELECTION-SCREEN: POSITION 47.
PARAMETERS RB27 RADIOBUTTON GROUP GRP5.
SELECTION-SCREEN: POSITION 48.
SELECTION-SCREEN: COMMENT 49(10) TEXT37.
SELECTION-SCREEN: POSITION 69.
PARAMETERS RB28 RADIOBUTTON GROUP GRP5.
SELECTION-SCREEN: POSITION 70.
SELECTION-SCREEN: COMMENT 71(10) TEXT38.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: SKIP 2.
SELECTION-SCREEN: PUSHBUTTON 36(6) BUTTON9 USER-COMMAND SHOW_USEFUL_TABLES.
SELECTION-SCREEN: END OF BLOCK B8.


*------------------Block9 Design---------------------------------*
SELECTION-SCREEN: BEGIN OF  BLOCK B9.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 41.
PARAMETERS: D(13) TYPE C DEFAULT 'Developed By:'.
PARAMETERS: D1(17) TYPE C DEFAULT 'Rashmith Rao.Tula'.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 30.
PARAMETERS: A1(7) TYPE C DEFAULT 'Mobile:'.
PARAMETERS: A2(13) TYPE C DEFAULT '+918688624136'.
SELECTION-SCREEN: POSITION 53.
PARAMETERS: A4(6) TYPE C DEFAULT 'Email:'.
PARAMETERS: A3(22) TYPE C DEFAULT '[email protected]'.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: POSITION 48.
PARAMETERS: D2(16) TYPE C DEFAULT 'Hyderabad,India.'.
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN: END OF BLOCK B9.


*------------------Popup Design---------------------------------*
SELECTION-SCREEN: BEGIN OF SCREEN 500 AS WINDOW.
SELECTION-SCREEN: BEGIN OF BLOCK B10 WITH FRAME TITLE TEXT13.
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RB5 RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(50) TEXT14.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RB6 RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: POSITION 2.
SELECTION-SCREEN: COMMENT 3(50) TEXT15.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RB7 RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: COMMENT 3(50) TEXT16.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RB8 RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: COMMENT 3(50) TEXT17.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RB9 RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: COMMENT 3(50) TEXT18.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RBW RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: COMMENT 3(50) TEXT23.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RBQ RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: COMMENT 3(50) TEXT24.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RBH RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: COMMENT 3(50) TEXT25.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS RBS RADIOBUTTON GROUP GRP3.
SELECTION-SCREEN: COMMENT 3(50) TEXT39.
SELECTION-SCREEN: END OF LINE.


SELECTION-SCREEN: END OF BLOCK B10.


SELECTION-SCREEN: END OF SCREEN 500.


****************************************************************
*----------------Text for Selection Screen---------------------*
****************************************************************
INITIALIZATION.


  PERFORM SELECTION_SCREEN_TEXTS.


****************************************************************
*------------Preparing Selection Screen Output-----------------*
****************************************************************
AT SELECTION-SCREEN OUTPUT.


  PERFORM SELECTION_SCREEN_OUTPUT.


****************************************************************
*---------------Selection Screen Validations-------------------*
****************************************************************


*---------------Database Table-1 Validation------------------*
AT SELECTION-SCREEN ON PA_TABL1.


  PERFORM TABLE1_VALIDATION.


  IF SY-UCOMM IS NOT INITIAL AND LF_VAL_REQUEST IS NOT INITIAL AND LF_HELP_I IS NOT INITIAL.
    CLEAR: LF_VAL_REQUEST, LF_HELP_I.
  ENDIF.


  IF LF_HELP_I = 1 AND LF_VAL_REQUEST = 1.
    MESSAGE 'Now press ''F4'' without changing table' TYPE 'S'.
  ENDIF.


*---------------Database Table-2 Validation------------------*
AT SELECTION-SCREEN ON PA_TABL2.


  PERFORM TABLE2_VALIDATION.


*---------------Field List Validation------------------------*
AT SELECTION-SCREEN ON PA_SLIST.


  PERFORM FIELD_LIST_VALIDATION.


*---------------F4 help for field list-----------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_SLIST.


  PERFORM VALUE_REQUEST.


*---------------No: of Records Validation--------------------*
AT SELECTION-SCREEN ON PA_N.


  IF PA_N >= 0.
    PERFORM TOTAL_ENTRIES_VALIDATION.
  ELSEIF PA_N < 0.
    CLEAR SY-UCOMM.
    CLEAR SSCRFIELDS-UCOMM.
    MESSAGE 'Please enter No: of entries > 0' TYPE 'E'.
  ENDIF.


*---------------Fieldname Validation-------------------------*
AT SELECTION-SCREEN ON PA_FNAM.


  PERFORM FIELD_NAME_VALIDATION.


*---------------Field Descriptions Validation----------------*
AT SELECTION-SCREEN ON PA_FDES.


  PERFORM FIELD_DESCRIPTION_VALIDATION.


****************************************************************
*--------------------On Click of Buttons-----------------------*
****************************************************************
AT SELECTION-SCREEN.


  CLEAR LF_MANIPULATE_CRET.


  IF PA_TABL1 IS INITIAL AND SY-UCOMM IS NOT INITIAL AND SY-UCOMM <> 'SEARCH_FOR_FIELD' AND SY-UCOMM <> 'SHOW_USEFUL_TABLES'
                         AND SY-UCOMM <> 'DYNAMIC_RBTN_FIELD' AND SY-UCOMM <> 'CRET' AND SY-UCOMM <> 'NONE' AND SY-UCOMM <> 'SPOS'.
    CLEAR SY-UCOMM.
    CLEAR SSCRFIELDS-UCOMM.
    MESSAGE 'Please enter any valid database table name in the highlighted field' TYPE 'E'.
  ENDIF.


  IF SY-DYNNR = '0500'.
    IF SY-UCOMM = 'SPOS' OR SY-UCOMM = 'NONE' OR SY-UCOMM = 'GET'.
      SY-UCOMM = 'CRET'.
      LF_MANIPULATE_CRET = 100.
    ENDIF.


    IF SY-UCOMM = 'CCAN'.
      CLEAR: LF_POP_AFTER, LF_POP_AFTER_LIST.
    ENDIF.
  ENDIF.


*---------------Setting the flags for triggering popup(Screen 500)----------------*
  CASE SSCRFIELDS-UCOMM.


    WHEN 'AS_CHECKTABLE'.


      IF LF_POP_AFTER IS INITIAL.
        LF_POP = 21.
      ENDIF.


    WHEN 'RELATIONSHIPS'.


      IF LF_POP_AFTER IS INITIAL.
        LF_POP = 24.
      ENDIF.


    WHEN 'SEARCH_FOR_FIELD'.


      IF LF_POP_AFTER IS INITIAL.
        LF_POP = 25.
      ENDIF.


    WHEN 'LINK_TABLES'.


      IF LF_POP_AFTER IS INITIAL.
        LF_POP = 27.
      ENDIF.


  ENDCASE.


*---------------Triggering popup when the flag is found----------------*
  IF LF_POP = 21.
    CLEAR LF_POP.
    LF_POP_AFTER = 21.
    CALL SELECTION-SCREEN 500 STARTING AT 50 5
                              ENDING AT 80 14.


  ELSEIF LF_POP = 24.
    CLEAR LF_POP.
    LF_POP_AFTER = 24.
    CALL SELECTION-SCREEN 500 STARTING AT 50 5
                              ENDING AT 80 13.


  ELSEIF LF_POP = 25.
    CLEAR LF_POP.
    IF PA_FNAM IS NOT INITIAL OR PA_FDES IS NOT INITIAL AND ( PA_FNAM CN SPACE OR PA_FDES CN SPACE ).
      LF_POP_AFTER = 25.
      CALL SELECTION-SCREEN 500 STARTING AT 50 5
                                ENDING AT 80 13.
    ELSE.
      CLEAR SY-UCOMM.
      CLEAR SSCRFIELDS-UCOMM.
      MESSAGE 'Please enter valid field name or field description' TYPE 'E'.
    ENDIF.


  ELSEIF LF_POP = 27.
    CLEAR LF_POP.
    IF PA_TABL1 IS NOT INITIAL AND PA_TABL2 IS NOT INITIAL.


      IF PA_TABL1 <> PA_TABL2.
        LF_POP_AFTER = 27.
        CALL SELECTION-SCREEN 500 STARTING AT 50 5
                                  ENDING AT 80 13.


        IF SY-UCOMM = 'CCAN'.
          SY-UCOMM = 'CRET'.
        ENDIF.
      ELSE.
        CLEAR SSCRFIELDS-UCOMM.
        CLEAR SY-UCOMM.
        MESSAGE 'Please enter 2 different tables to find link tables' TYPE 'S'.
      ENDIF.


    ELSEIF PA_TABL1 IS NOT INITIAL AND PA_TABL2 IS INITIAL.
      CLEAR SSCRFIELDS-UCOMM.
      CLEAR SY-UCOMM.
      MESSAGE 'Please enter 2nd database table to find link tables' TYPE 'E'.
    ELSE.
      CLEAR SSCRFIELDS-UCOMM.
      CLEAR SY-UCOMM.
      MESSAGE 'Please enter 2 valid database tables to find link tables' TYPE 'E'.
    ENDIF.


  ENDIF.


*---------------Setting the flag for PAI of the popup----------------*


  CASE SY-UCOMM.


    WHEN 'CRET'.


      IF LF_MANIPULATE_CRET <> 100.
        IF LF_POP_AFTER = 21.
          CLEAR LF_POP_AFTER.
          LF_POP_AFTER_LIST = 51.
        ELSEIF LF_POP_AFTER = 24.
          CLEAR LF_POP_AFTER.
          LF_POP_AFTER_LIST = 54.
        ELSEIF LF_POP_AFTER = 25.
          CLEAR LF_POP_AFTER.
          LF_POP_AFTER_LIST = 55.
        ELSEIF LF_POP_AFTER = 27.
          CLEAR LF_POP_AFTER.
          LF_POP_AFTER_LIST = 57.
        ENDIF.
        CLEAR LF_MANIPULATE_CRET.
      ENDIF.


    WHEN 'CCAN' OR 'SPOS' OR 'GET' OR 'NONE'.


      CLEAR: LF_POP_AFTER_LIST.


    WHEN OTHERS.


      CLEAR: LF_POP_AFTER.


  ENDCASE.


*---------------------Executing the PAI--------------------------------*


  CASE SSCRFIELDS-UCOMM.


*---------------------On Click of 'Check Relationship' Button----------*
    WHEN 'DIRECT_RELATIONSHIPS'.


      CLEAR LF_HELP_I.
      IF PA_TABL1 IS NOT INITIAL AND PA_TABL2 IS NOT INITIAL.


        IF PA_TABL1 <> PA_TABL2.
          PERFORM DIRECT_RELATIONSHIPS.
        ELSE.
          CLEAR SSCRFIELDS-UCOMM.
          CLEAR SY-UCOMM.
          MESSAGE 'Please enter 2 different tables to check relationship' TYPE 'S'.
        ENDIF.


      ELSEIF PA_TABL1 IS NOT INITIAL AND PA_TABL2 IS INITIAL.
        CLEAR SSCRFIELDS-UCOMM.
        CLEAR SY-UCOMM.
        MESSAGE 'Please enter 2nd database table to check relationship' TYPE 'E'.
      ELSE.
        CLEAR SSCRFIELDS-UCOMM.
        CLEAR SY-UCOMM.
        MESSAGE 'Please enter 2 valid database tables to check relationship' TYPE 'E'.
      ENDIF.


*--------------------On Click of 'Goto Table Structure' Button---------*
    WHEN 'GOTO_TABLE_STRUCTURE'.


      CLEAR LF_HELP_I.
      PERFORM GOTO_TABLE_STRUCTURE.


*------------------On Click of 'Get 1st Few Table Fields' Button-------*
    WHEN 'GET_FIELDS'.


      CLEAR LF_HELP_I.
      PERFORM GET_TABLE_FIELDS.


*-------------------------On Click of 'As Checktable' Button-----------*
    WHEN 'AS_CHECKTABLE'.


      CLEAR LF_HELP_I.
      IF LF_POP_AFTER_LIST = 51.
        CLEAR LF_POP_AFTER_LIST.
        PERFORM AS_CHECKTABLE.
      ENDIF.


*--------------On Click of 'Checktables for this table' Button---------*
    WHEN 'CHECKTABLES'.


      CLEAR LF_HELP_I.
      PERFORM CHECKTABLES.


*--------------On Click of 'Check No: of Entries' Button---------------*
    WHEN 'CHECK_NO_OF_ENTRIES'.


      CLEAR LF_HELP_I.
      PERFORM CHECK_NO_OF_ENTRIES.


*--------------On Click of 'Relationships for this table' Button-------*
    WHEN 'RELATIONSHIPS'.


      CLEAR LF_HELP_I.
      IF LF_POP_AFTER_LIST = 54.
        CLEAR LF_POP_AFTER_LIST.
        PERFORM RELATIONSHIPS.
      ENDIF.


*--------------On Click of 'Search' Button-----------------------------*
    WHEN 'SEARCH_FOR_FIELD'.


      CLEAR LF_HELP_I.
      IF LF_POP_AFTER_LIST = 55.
        CLEAR LF_POP_AFTER_LIST.
        PERFORM FIELD_SEARCH.
      ENDIF.


*--------------On Click of 'Show' Button--------------------------------*
    WHEN 'SHOW_USEFUL_TABLES'.


      CLEAR LF_HELP_I.
      PERFORM SHOW_USEFUL_TABLES.


*--------------On Click of 'Link_Tables' Button-------------------------*
    WHEN 'LINK_TABLES'.


      CLEAR LF_HELP_I.
      IF LF_POP_AFTER_LIST = 57.
        CLEAR LF_POP_AFTER_LIST.
        PERFORM LINK_TABLES.
      ENDIF.


  ENDCASE.


  IF SY-DYNNR = '0500'.
    IF SY-UCOMM = 'SPOS' OR SY-UCOMM = 'NONE' OR SY-UCOMM = 'GET'.
      CLEAR LF_MANIPULATE_CRET.
      SY-UCOMM = 'CRET'.
      LF_MANIPULATE_CRET = 100.
    ENDIF.


    IF SY-UCOMM = 'CCAN'.
      CLEAR LF_POP_AFTER_LIST.
    ENDIF.
  ENDIF.


*---------------Flag for popup for button 'Check Relationship'(Link tables)----------------*
  IF LF_POP = 26.
    CLEAR LF_POP.
    LF_POP_AFTER = 26.
    CALL SELECTION-SCREEN 500 STARTING AT 50 5
                              ENDING AT 80 13.
  ENDIF.


*---------------Setting the flag for the PAI of the popup(Link tables)----------------*
  CASE SY-UCOMM.


    WHEN 'CRET'.
      IF LF_MANIPULATE_CRET <> 100.
        IF LF_POP_AFTER = 26.
          CLEAR LF_POP_AFTER.
          LF_POP_AFTER_LIST = 56.
        ENDIF.
        CLEAR LF_MANIPULATE_CRET.
      ENDIF.


    WHEN 'CCAN' OR 'SPOS' OR 'GET' OR 'NONE'.


      CLEAR: LF_POP_AFTER, LF_POP_AFTER_LIST.


  ENDCASE.


*---------------Executing the PAI(Link tables)----------------*
  CASE SSCRFIELDS-UCOMM.


    WHEN 'DIRECT_RELATIONSHIPS'.


      CLEAR LF_HELP_I.
      IF LF_POP_AFTER_LIST = 56.
        CLEAR LF_POP_AFTER_LIST.
        PERFORM LINK_TABLES.
      ENDIF.


  ENDCASE.


  IF LF_MANIPULATE_CRET <> 100 AND SY-UCOMM <> 'CRET' AND SY-UCOMM <> 'SPOS' AND SY-UCOMM <> 'NONE' AND SY-UCOMM <> 'GET'.
   CLEAR LF_POP_AFTER.
  ENDIF.


*--------------Checks duplicate fields---------------*


  PERFORM CHECK_DUPLICATE_FIELDS.




***************************************************
*-----Data Fetching and building Field Catalog----*
***************************************************
START-OF-SELECTION.


  CLEAR LF_HELP_I.
  PERFORM DATA_FETCH_AND_FIELD_CATALOG.


***************************************************
*---------------Printing the data-----------------*
***************************************************
END-OF-SELECTION.


  IF LF_OUTPUT IS INITIAL.


    PERFORM SHOW_OUTPUT.


  ENDIF.


  CLEAR LF_OUTPUT.










************************************************************************
*-----------------------------Subroutines------------------------------*
************************************************************************


*&---------------------------------------------------------------------*
*&      Form  SELECTION_SCREEN_TEXTS
*&---------------------------------------------------------------------*
FORM SELECTION_SCREEN_TEXTS .


  TEXT1    =   'Table Selection'.
  TEXT2    =   'Database table'.
  TEXT3    =   'Output Fields List'.
  TEXT4    =   'Fields List'.
  TEXT5    =   'No: of records to be displayed'.
  TEXT6    =   'Field Display Type'.
  TEXT7    =   'Field Label(English)'.
  TEXT8    =   'Field Technical Name'.
  TEXT9    =   'Report Type'.
  TEXT10   =   'ALV Grid'.
  TEXT11   =   'ALV List'.
  TEXT12   =   'Data Selection Criteria'.
  TEXT13   =   'Search Among Basic Tables of:'.
  TEXT14   =   'Sales & Distribution(SD)'.
  TEXT15   =   'Materials Management(MM)'.
  TEXT16   =   'Production Planning(PP)'.
  TEXT17   =   'Finance & Controlling(FICO)'.
  TEXT18   =   'Plant Maintenance(PM)'.
  TEXT23   =   'Warehouse Management(WM)'.
  TEXT24   =   'Quality Management(QM)'.
  TEXT25   =   'Human Resources(HR)'.
  TEXT19   =   'Search for Field'.
  TEXT20   =   'By Field Name'.
  TEXT21   =   'By Field Description'.
  TEXT30   =   'Show Useful Tables'.
  TEXT31   =   'In SD'.
  TEXT32   =   'In MM'.
  TEXT33   =   'In PP'.
  TEXT34   =   'In FI'.
  TEXT35   =   'In PM'.
  TEXT36   =   'In WM'.
  TEXT37   =   'In QM'.
  TEXT38   =   'In HR'.
  BUTTON1  =   'Find Direct Relationships'.
  BUTTON2  =   'As Checktable'.
  BUTTON3  =   'Goto ABAP Dictionary'.
  BUTTON4  =   'Checktables for this table'.
  BUTTON5  =   'Possible relationships for this table'.
  BUTTON6  =   'Get 1st Few Table Fields'.
  BUTTON7  =   'Check No: of Entries'.
  BUTTON8  =   'Search'.
  BUTTON9  =   'Show'.
  BUTTON10 =   'Find Link Tables'.
  WRITE '@9T@' AS ICON TO ICON1.
  PERFORM TEXT2.
  WRITE '@HH@' AS ICON TO ICON2."@MJ@
  PERFORM TEXT.
  WRITE '@4G@' AS ICON TO ICON3.
  PERFORM TEXTC.
  WRITE '@9S@' AS ICON TO ICON4.
  PERFORM TEXTT.
  WRITE '@HI@' AS ICON TO ICON5.
  WRITE '@15@' AS ICON TO ICON6.


ENDFORM.                    " SELECTION_SCREEN_TEXTS


*&---------------------------------------------------------------------*
*&      Form  SELECTION_SCREEN_OUTPUT
*&---------------------------------------------------------------------*
FORM SELECTION_SCREEN_OUTPUT .


  IF PA_TABL1 IS NOT INITIAL AND LF_TABLE1 IS INITIAL AND PA_SLIST IS NOT INITIAL AND LF_P2 IS INITIAL.
    LF_TABLE1 = PA_TABL1.
    LF_P2 = 1.
  ENDIF.


  IF LF_VAL_REQUEST IS INITIAL AND LF_HELP_I IS NOT INITIAL.
    CLEAR LF_HELP_I.
  ENDIF.


  CLEAR: PA_TEXT1, PA_TEXT2.


  LOOP AT SCREEN.


    IF SCREEN-NAME = 'PA_NOTE1' OR SCREEN-NAME = 'PA_NOTE2' OR SCREEN-NAME = 'PA_Z1' OR SCREEN-NAME = 'PA_Z2' OR SCREEN-NAME = 'PA_Z3' OR SCREEN-NAME = 'PA_Z4'
                      OR SCREEN-NAME = 'PA_Z5' OR SCREEN-NAME = 'D' OR SCREEN-NAME = 'D1' OR SCREEN-NAME = 'D2' OR SCREEN-NAME = 'PA_D3' OR SCREEN-NAME = 'A2'
                      OR SCREEN-NAME = 'A3' OR SCREEN-NAME = 'A1' OR SCREEN-NAME = 'A4' OR SCREEN-NAME = 'PA_TEXT1' OR SCREEN-NAME = 'PA_TEXT2' OR SCREEN-NAME = 'PA_TITLE'.
      SCREEN-INTENSIFIED = '1'.
      SCREEN-INPUT = '0'.
      MODIFY SCREEN.
    ENDIF.


    IF PA_TABL1 IS NOT INITIAL AND PA_TEXT1 IS INITIAL.
      SELECT SINGLE DDTEXT FROM DD02T INTO PA_TEXT1 WHERE TABNAME = PA_TABL1 AND DDLANGUAGE = 'EN'.
    ENDIF.


    IF PA_TABL2 IS NOT INITIAL AND PA_TEXT2 IS INITIAL.
      SELECT SINGLE DDTEXT FROM DD02T INTO PA_TEXT2 WHERE TABNAME = PA_TABL2 AND DDLANGUAGE = 'EN'.
    ENDIF.


    IF SCREEN-NAME = 'PA_N' AND LF_N2 <> 1.
      IF PA_N > 100 OR PA_N IS INITIAL.
        PA_N = 100.
        CLEAR LF_N2.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.


    IF SCREEN-NAME = 'PA_SLIST'.
      IF LF_REP <> 0.
        CLEAR PA_SLIST.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.




    IF SCREEN-NAME = 'RB5' AND SY-UCOMM IS NOT INITIAL.
      CLEAR: RB6, RB7, RB8, RB9, RBW, RBQ, RBH, RBS.
      RB5 = 'X'.
      CLEAR TEXT39.
      CLEAR R_TAB[].
      MODIFY SCREEN.
    ENDIF.




    IF SCREEN-NAME = 'RBS' AND SY-UCOMM = 'AS_CHECKTABLE'.
      TEXT39   =   'All SAP Tables'.
      MODIFY SCREEN.
    ENDIF.


    IF SCREEN-NAME = 'RBS' AND TEXT39 IS INITIAL AND ( SY-UCOMM IS INITIAL OR SY-UCOMM = 'DIRECT_RELATIONSHIPS' OR SY-UCOMM = 'LINK_TABLES' OR SY-UCOMM = 'RELATIONSHIPS' OR SY-UCOMM = 'SEARCH_FOR_FIELD' ).
      CLEAR TEXT39.
      SCREEN-ACTIVE = '0'.
      MODIFY SCREEN.
    ENDIF.


  ENDLOOP.


  IF RB11 = 'X'.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'M1'.
        SCREEN-ACTIVE = '1'.
        MODIFY SCREEN.
      ENDIF.
      IF SCREEN-GROUP1 = 'M2'.
        SCREEN-ACTIVE = '0'.
        CLEAR TEXT22.
        CLEAR PA_FDES.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'M2'.
        SCREEN-ACTIVE = '1'.
        TEXT22 = 'Enter full description or a keyword'.
        MODIFY SCREEN.
      ENDIF.
      IF SCREEN-GROUP1 = 'M1'.
        SCREEN-ACTIVE = '0'.
        CLEAR PA_FNAM.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.


  CLEAR: LF_CHECK_ENTRIES, SY-UCOMM, SSCRFIELDS-UCOMM.


ENDFORM.                    " SELECTION_SCREEN_OUTPUT


*&---------------------------------------------------------------------*
*&      Form  TABLE1_VALIDATION
*&---------------------------------------------------------------------*
FORM TABLE1_VALIDATION.


  IF SY-UCOMM IS NOT INITIAL.
    IF PA_TABL1 IS INITIAL AND SY-UCOMM <> 'SEARCH_FOR_FIELD' AND SY-UCOMM <> 'SHOW_USEFUL_TABLES' AND SY-UCOMM <> 'DYNAMIC_RBTN_FIELD'
       AND SY-UCOMM <> 'NONE' AND SY-UCOMM <> 'SPOS'.
      CLEAR SY-UCOMM.
      CLEAR SSCRFIELDS-UCOMM.
      MESSAGE 'Please enter any valid database table in the highlighted field' TYPE 'E'.
    ENDIF.
  ENDIF.


  CHECK SY-UCOMM <> 'DYNAMIC_RBTN_FIELD' AND SY-UCOMM <> 'SEARCH_FOR_FIELD' AND SY-UCOMM <> 'SHOW_USEFUL_TABLES'.
  IF PA_TABL1 IS NOT INITIAL.
    DATA TABLE TYPE DD02L-TABNAME.
    PERFORM T5.
    SELECT SINGLE TABNAME TABCLASS VIEWCLASS FROM DD02L INTO WA_TABCLS1 WHERE TABNAME = PA_TABL1.
    LF_HELP_I = 1.
    IF SY-SUBRC <> 0.
      CHECK SY-UCOMM <> 'SEARCH_FOR_FIELD' AND SY-UCOMM <> 'SHOW_USEFUL_TABLES' AND SY-UCOMM <> 'DYNAMIC_RBTN_FIELD'.
      IF PA_TABL1+0(1) IS INITIAL.
        LV_TEX1 = 'Space before or in the table name not allowed'.
        CLEAR SY-UCOMM.
        CLEAR SSCRFIELDS-UCOMM.
        MESSAGE LV_TEX1 TYPE 'E'.
        CLEAR LV_TEX1.
      ELSE.
        CONCATENATE 'Table' PA_TABL1 'doesn''t exist in the database' INTO LV_TEX1 SEPARATED BY SPACE.
        CLEAR SY-UCOMM.
        CLEAR SSCRFIELDS-UCOMM.
        MESSAGE LV_TEX1 TYPE 'E'.
        CLEAR LV_TEX1.
      ENDIF.
    ENDIF.
    PERFORM T5.
  ENDIF.


ENDFORM.                    " TABLE1_VALIDATION


*&---------------------------------------------------------------------*
*&      Form  TABLE2_VALIDATION
*&---------------------------------------------------------------------*
FORM TABLE2_VALIDATION .


  IF PA_TABL2 IS NOT INITIAL.
    DATA TABLE TYPE DD02L-TABNAME.
    PERFORM T5.
    SELECT SINGLE TABNAME TABCLASS VIEWCLASS FROM DD02L INTO WA_TABCLS2 WHERE TABNAME = PA_TABL2.
    IF SY-SUBRC <> 0.
      CHECK SY-UCOMM <> 'SEARCH_FOR_FIELD' AND SY-UCOMM <> 'SHOW_USEFUL_TABLES' AND SY-UCOMM <> 'DYNAMIC_RBTN_FIELD'.
      IF PA_TABL2+0(1) IS INITIAL.
        CLEAR SY-UCOMM.
        CLEAR SSCRFIELDS-UCOMM.
        CLEAR: LF_VAL_REQUEST, LF_HELP_I.
        MESSAGE 'Space before or in the table name not allowed' TYPE 'E'.
      ELSE.
        CONCATENATE 'Table' PA_TABL2 'doesn''t exist in the database' INTO LV_TEX1 SEPARATED BY SPACE.
        CLEAR SY-UCOMM.
        CLEAR SSCRFIELDS-UCOMM.
        CLEAR: LF_VAL_REQUEST, LF_HELP_I.
        MESSAGE LV_TEX1 TYPE 'E'.
        CLEAR LV_TEX1.
      ENDIF.
    ENDIF.
  ENDIF.


ENDFORM.                    " TABLE2_VALIDATION


*&---------------------------------------------------------------------*
*&      Form  FIELD_LIST_VALIDATION
*&---------------------------------------------------------------------*
FORM FIELD_LIST_VALIDATION.


  LV_HELP_FLIST = PA_SLIST.
  IF PA_SLIST IS INITIAL.
    CLEAR: IT_FIELD1, LV_HELP_FLIST.
  ENDIF.


  CHECK PA_SLIST IS NOT INITIAL.
  CHECK LV_SEL_LIST2 <> PA_SLIST.
  CHECK SY-UCOMM = 'ONLI' OR SY-UCOMM IS INITIAL.


*-----------------------Variable Declarations-----------------------*
  DATA:


        LV_SLIST_K              TYPE              I   VALUE    0,
        LV_SLIST_L              TYPE              I   VALUE    0,
        LV_SLIST_M              TYPE              I   VALUE   30,
        LV_SLIST_FIELD1         TYPE              DD03L-FIELDNAME,
        LV_SLIST_FIELD2         TYPE              DD03L-FIELDNAME,
        LV_SLIST_LIN            TYPE              I,
        LV_SLIST_O              TYPE              I,
        LV_SLIST_STR            TYPE              I,
        LV_SLIST_SEL(30)        TYPE              C.




  IF PA_SLIST+LV_SLIST_K(LV_SLIST_M) IS NOT INITIAL.


    TRY.
        SELECT COUNT(*) FROM DD03L INTO LV_SLIST_LIN WHERE TABNAME = PA_TABL1.
      CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS.
    ENDTRY.


    PERFORM T5.
    CLEAR LV_SEL_LIST1.


    WHILE LV_SEL_LIST1 <> PA_SLIST.
      DO LV_SLIST_LIN TIMES.
        IF PA_SLIST+LV_SLIST_K(LV_SLIST_M) IS NOT INITIAL.
          LV_SLIST_STR = LV_SLIST_K + LV_SLIST_M.
          IF LV_SLIST_STR > 500.
            LV_SLIST_STR = LV_SLIST_STR - 500.
            LV_SLIST_M = LV_SLIST_M - LV_SLIST_STR.
          ENDIF.


          LV_SLIST_FIELD1 = PA_SLIST+LV_SLIST_K(LV_SLIST_M).
          SPLIT LV_SLIST_FIELD1 AT ' ' INTO LV_SLIST_FIELD1 LV_SLIST_FIELD2.
          LV_SLIST_L = STRLEN( LV_SLIST_FIELD1 ) + 1.
          LV_SLIST_K = LV_SLIST_K + LV_SLIST_L.
          IF SY-INDEX = 1.
            LV_SLIST_O =  LV_SLIST_L.
            LV_SLIST_SEL = PA_SLIST+0(LV_SLIST_O).
            LV_FIELD2 = LV_SLIST_FIELD1.
          ENDIF.
          CLEAR LV_SLIST_FIELD2.
          DATA: TEXT TYPE STRING.
          SELECT SINGLE FIELDNAME POSITION KEYFLAG DATATYPE FROM DD03L INTO WA_FIELD2 WHERE FIELDNAME = LV_SLIST_FIELD1 AND TABNAME = PA_TABL1.
          IF SY-SUBRC <> 0.
            IF LV_SLIST_FIELD1 IS NOT INITIAL.
              IF SY-UCOMM <> 'GET_FIELDS' AND SY-UCOMM <> 'SEARCH_FOR_FIELD' AND SY-UCOMM <> 'SHOW_USEFUL_TABLES' AND SY-UCOMM <> 'DYNAMIC_RBTN_FIELD'.
                CONCATENATE 'Field' LV_SLIST_FIELD1 'doesn''t exist in table' PA_TABL1 INTO LV_TEX1 SEPARATED BY SPACE.
                CLEAR SY-UCOMM.
                CLEAR SSCRFIELDS-UCOMM.
                CLEAR: LF_VAL_REQUEST, LF_HELP_I.
                MESSAGE LV_TEX1 TYPE 'E'.
                CLEAR LV_TEX1.
              ENDIF.
            ELSE.
              LV_TEX1 = 'Space before 1st field or 2 spaces between fields'.
              CLEAR SY-UCOMM.
              CLEAR SSCRFIELDS-UCOMM.
              CLEAR: LF_VAL_REQUEST, LF_HELP_I.
              MESSAGE LV_TEX1 TYPE 'E'.
              CLEAR LV_TEX1.
            ENDIF.
          ELSE.
            IF SY-INDEX = 1.
              CLEAR IT_FIELD1.
            ENDIF.
            APPEND WA_FIELD2 TO IT_FIELD1.
          ENDIF.
        ELSE.
          EXIT.
        ENDIF.


      ENDDO.
      LV_SEL_LIST1 = PA_SLIST.
    ENDWHILE.


  ENDIF.


  IT_FIELD2 = IT_FIELD1.


  CLEAR: LV_SLIST_LIN, LV_SLIST_K, LV_SLIST_L, LV_SLIST_M, LV_SLIST_O, LV_SLIST_STR, LV_SLIST_FIELD1, LV_SLIST_FIELD2, LV_SLIST_SEL.


ENDFORM.                    " FIELD_LIST_VALIDATION


*&---------------------------------------------------------------------*
*&      Form  VALUE_REQUEST
*&---------------------------------------------------------------------*
FORM VALUE_REQUEST .


  DATA:
*--------------Internal Table to fill final internal table for F4 help----------------------*
        BEGIN  OF   IT_FIELD_HELP         OCCURS   0,
          POSITION      TYPE     DD03L-POSITION,              "Position of the field in the table
          FIELDNAME     TYPE     DD03L-FIELDNAME,             "Field Name
          ROLLNAME      TYPE     DD03L-ROLLNAME,              "Data element (semantic domain)
          DOMNAME       TYPE     DD03L-DOMNAME,               "Domain name
          DATATYPE      TYPE     DD03L-DATATYPE,              "Data Type in ABAP Dictionary
          LENG          TYPE     DD03L-LENG,                  "Length (No. of Characters)
         END    OF   IT_FIELD_HELP,


*-------------------------Final internal table for F4 help----------------------------------*
         BEGIN  OF   IT_FIELD_HELP_FINAL   OCCURS   0,
          FIELDNAME     TYPE     DD03L-FIELDNAME,             "Field Name
          KEYFLAG       TYPE     DD03L-KEYFLAG,               "Identifies a key field of a table
          DDTEXT        TYPE     DD04T-DDTEXT,                "Short Description of Field
          ROLLNAME      TYPE     DD03L-ROLLNAME,              "Data element (semantic domain)
          DOMNAME       TYPE     DD03L-DOMNAME,               "Domain name
          CONVEXIT      TYPE     DD01L-CONVEXIT,              "Conversion Routine
          DATATYPE      TYPE     DD03L-DATATYPE,              "Data Type in ABAP Dictionary
          LENG          TYPE     DD03L-LENG,                  "Length (No. of Characters)
         END OF IT_FIELD_HELP_FINAL.


  DATA: IT_RETURN      LIKE     DDSHRETVAL  OCCURS 0  WITH  HEADER LINE.      "Internal table to store fields selected by user


  DATA: LV_TITLE(100)  TYPE     C.                                            "Title for F4 help window


*--Fetching the data when the flag is not initial which is set in event 'AT SELECTION-SCREEN ON PA_TABL1--*
  IF LF_HELP_I IS NOT INITIAL.


    SELECT POSITION FIELDNAME ROLLNAME DOMNAME DATATYPE LENG FROM DD03L INTO TABLE IT_FIELD_HELP WHERE TABNAME = PA_TABL1 AND FIELDNAME NOT LIKE '.INCLU%' AND FIELDNAME NOT LIKE '.APPEND%'..
    SORT IT_FIELD_HELP BY POSITION.
    SELECT SINGLE DDTEXT FROM DD02T INTO LV_TB1 WHERE TABNAME = PA_TABL1 AND DDLANGUAGE = 'EN'.
    CONCATENATE PA_TABL1 '(' LV_TB1 ')' INTO LV_TITLE.


    LOOP AT IT_FIELD_HELP.
      IT_FIELD_HELP_FINAL-FIELDNAME = IT_FIELD_HELP-FIELDNAME.
      SELECT SINGLE KEYFLAG FROM DD03L INTO IT_FIELD_HELP_FINAL-KEYFLAG WHERE TABNAME = PA_TABL1 AND FIELDNAME = IT_FIELD_HELP-FIELDNAME.
      IT_FIELD_HELP_FINAL-ROLLNAME = IT_FIELD_HELP-ROLLNAME.
      IT_FIELD_HELP_FINAL-DOMNAME = IT_FIELD_HELP-DOMNAME.
      IT_FIELD_HELP_FINAL-DATATYPE = IT_FIELD_HELP-DATATYPE.
      IT_FIELD_HELP_FINAL-LENG = IT_FIELD_HELP-LENG.
      IF IT_FIELD_HELP-ROLLNAME IS NOT INITIAL.
        SELECT SINGLE DDTEXT FROM DD04T INTO IT_FIELD_HELP_FINAL-DDTEXT WHERE ROLLNAME = IT_FIELD_HELP-ROLLNAME AND DDLANGUAGE = 'EN'.
      ELSE.
        CLEAR IT_FIELD_HELP_FINAL-DDTEXT.
      ENDIF.
      IF IT_FIELD_HELP-DOMNAME IS NOT INITIAL.
        SELECT SINGLE CONVEXIT FROM DD01L INTO IT_FIELD_HELP_FINAL-CONVEXIT WHERE DOMNAME = IT_FIELD_HELP-DOMNAME.
      ELSE.
        CLEAR IT_FIELD_HELP_FINAL-CONVEXIT.
      ENDIF.
      APPEND IT_FIELD_HELP_FINAL.
      CLEAR IT_FIELD_HELP.
    ENDLOOP.


  ENDIF.


  IF LF_HELP_I IS NOT INITIAL.


    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        RETFIELD        = 'FIELDNAME'
        WINDOW_TITLE    = LV_TITLE
        VALUE_ORG       = 'S'
        MULTIPLE_CHOICE = 'X'
      TABLES
        VALUE_TAB       = IT_FIELD_HELP_FINAL
        RETURN_TAB      = IT_RETURN.


  ENDIF.


  IF LF_HELP_I IS INITIAL.
    IF PA_TABL1 IS INITIAL.
      MESSAGE 'Enter a database table and press ''ENTER'' for F4 help' TYPE 'S'.
      LF_VAL_REQUEST = 1.
    ELSE.
      MESSAGE 'Press ''ENTER'' and then press ''F4'' without changing table' TYPE 'S'.
      LF_VAL_REQUEST = 1.
    ENDIF.
  ELSE.
    CLEAR LF_VAL_REQUEST.
  ENDIF.


*--------------------------Filling the Field list after user interaction----------------------------------*
  IF IT_RETURN[] IS NOT INITIAL.


    IF LF_GET_FIELDS = 1 OR PA_TABL1 <> LF_TABLE4.
      CLEAR: PA_SLIST, LV_HELP_FLIST.
    ENDIF.


    LF_TABLE4 = PA_TABL1.


    IF LV_HELP_FLIST IS NOT INITIAL.
      CLEAR: LV_X1, LV_FILD1, LV_FILD2.
      LV_FILD2 = LV_HELP_FLIST.
      DO 100 TIMES.
        IF LV_FILD2 IS NOT INITIAL.
          LV_X1 = LV_X1 + 1.
          SPLIT LV_FILD2 AT ' ' INTO LV_FILD1 LV_FILD2.
          CLEAR LV_FILD1.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLEAR: LV_FILD1, LV_FILD2.
    ENDIF.




    CLEAR LV_RE.
    LV_RE = LV_RE + 1.
    LOOP AT IT_RETURN.


      IF LV_HELP_FLIST IS INITIAL.
        IF PA_SLIST+120(1) IS INITIAL AND PA_SLIST+121(1) IS INITIAL.
          PA_SLIST = IT_RETURN-FIELDVAL.
        ENDIF.
        LV_HELP_FLIST = IT_RETURN-FIELDVAL.
      ELSE.
        IF PA_SLIST IS INITIAL.
          PA_SLIST = LV_HELP_FLIST.
        ENDIF.
        IF PA_SLIST+120(1) IS INITIAL AND PA_SLIST+121(1) IS INITIAL.
          CONCATENATE PA_SLIST IT_RETURN-FIELDVAL INTO PA_SLIST SEPARATED BY SPACE.
        ENDIF.
      ENDIF.
      CLEAR IT_RETURN.


    ENDLOOP.


    IF LV_RE = 1.


      CLEAR: LV_RE, LV_I, LV_FILD1, LV_FILD2.
      LV_FILD2 = PA_SLIST.
      DO 100 TIMES.
        IF LV_FILD2 IS NOT INITIAL.
          LV_RE = LV_RE + 1.
          SPLIT LV_FILD2 AT ' ' INTO LV_FILD1 LV_FILD2.
          CLEAR LV_FILD1.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      CLEAR: LV_FILD1, LV_FILD2.


      DESCRIBE TABLE IT_RETURN LINES LV_I.


      LV_FILD1 = LV_RE.
      LV_FILD2 = LV_I.


      IF LV_X1 IS INITIAL.
        CLEAR LV_TB1.
        CONCATENATE LV_FILD1 'of' LV_FILD2 'user selected fields captured(Press ''ENTER'' if fields are not displayed)' INTO LV_TB1 SEPARATED BY SPACE.
      ELSE.
        CLEAR LV_FILD1.
        LV_X2 = LV_RE - LV_X1.
        LV_FILD1 = LV_X2.
        CONCATENATE LV_FILD1 'of' LV_FILD2 'user selected fields added to field list' INTO LV_TB1 SEPARATED BY SPACE.
        CLEAR: LV_X1, LV_X2.
      ENDIF.


      IF LV_RE < LV_I.
        MESSAGE 'All selected fields couldn''t be captured as it crosses screen length.However, to display all the table fields in the list output, execute the table leaving this field blank.' TYPE 'I'.
      ENDIF.


      MESSAGE LV_TB1 TYPE 'S'.


      CLEAR: LV_RE, LV_I, LV_FILD1, LV_FILD2, LV_TB1.


    ENDIF.


    IF LF_GET_FIELDS = 1.
      MESSAGE 'If fields are not displayed, press ''ENTER'' without changing table' TYPE 'S'.
      CLEAR LF_GET_FIELDS.
    ENDIF.


  ENDIF.


  CLEAR LV_HELP_FLIST.
  LV_HELP_FLIST = PA_SLIST.                      "Copying the Field list into an intermediate variable
  CLEAR: LF_HELP_I.
  REFRESH: IT_FIELD_HELP[], IT_FIELD_HELP_FINAL[].


ENDFORM.                    " VALUE_REQUEST


*&---------------------------------------------------------------------*
*&      Form  TOTAL_ENTRIES_VALIDATION
*&---------------------------------------------------------------------*
FORM TOTAL_ENTRIES_VALIDATION .


  CHECK PA_TABL1 IS NOT INITIAL.
  CHECK SY-UCOMM <> 'CHECK_NO_OF_ENTRIES'.


  IF LF_TABLE2 <> PA_TABL1 OR LF_N1 <> PA_N OR SY-UCOMM = 'ONLI'.


    IF WA_TABCLS1-TABCLASS <> 'INTTAB' AND WA_TABCLS1-TABCLASS <> 'APPEND' AND WA_TABCLS1-VIEWCLASS <> 'H' AND
       WA_TABCLS1-VIEWCLASS <> 'S' AND WA_TABCLS1-VIEWCLASS <> 'C' AND WA_TABCLS1-VIEWCLASS <> 'E' AND
       WA_TABCLS1-VIEWCLASS <> 'V' AND WA_TABCLS1-VIEWCLASS <> 'A'.
      PERFORM T5.


      TRY.
          SELECT COUNT(*) FROM (PA_TABL1) INTO LV_I.
        CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS.
          LF_EXCEPTION = 1.
      ENDTRY.


      IF LF_EXCEPTION = 1 OR LV_I IS INITIAL.
        CHECK SY-UCOMM = 'ONLI'.
        CONCATENATE PA_TABL1 'has no entries' INTO LV_TB1 SEPARATED BY SPACE.
        CLEAR SY-UCOMM.
        CLEAR SSCRFIELDS-UCOMM.
        CLEAR LF_EXCEPTION.
        CLEAR: LF_VAL_REQUEST, LF_HELP_I.
        MESSAGE LV_TB1 TYPE 'E'.
        CLEAR: LV_TB1.
      ENDIF.


      IF PA_N IS INITIAL.
        LV_ALV_RECS = LV_I.
      ELSE.
        LV_ALV_RECS = PA_N.
      ENDIF.


      IF PA_N > LV_I.
        CHECK SY-UCOMM = 'ONLI'.
        LV_A = LV_I.
        LV_ALV_RECS = LV_I.
        CONCATENATE PA_TABL1 'has only' LV_A 'records' INTO LV_TEX1 SEPARATED BY SPACE.
        MESSAGE LV_TEX1 TYPE 'I'.
        CLEAR: LV_TEX1, LV_A.
      ENDIF.
    ELSE.
      CHECK SY-UCOMM = 'ONLI'.
      IF WA_TABCLS1-TABCLASS = 'INTTAB' OR WA_TABCLS1-TABCLASS = 'APPEND'.
        CONCATENATE PA_TABL1 'is a structure(No data)' INTO LV_TEX1 SEPARATED BY SPACE.
        CLEAR SY-UCOMM.
        CLEAR SSCRFIELDS-UCOMM.
        CLEAR: LF_VAL_REQUEST, LF_HELP_I.
        MESSAGE LV_TEX1 TYPE 'E'.
        CLEAR LV_TEX1.
      ELSEIF WA_TABCLS1-TABCLASS = 'VIEW' AND WA_TABCLS1-VIEWCLASS <> 'D' AND WA_TABCLS1-VIEWCLASS <> 'P'.
        IF SY-UCOMM = 'ONLI'.
          CONCATENATE 'View' PA_TABL1 'not a database or projection view(No entries)' INTO LV_TEX1 SEPARATED BY SPACE.
          CLEAR SY-UCOMM.
          CLEAR SSCRFIELDS-UCOMM.
          CLEAR: LF_VAL_REQUEST, LF_HELP_I.
          MESSAGE LV_TEX1 TYPE 'E'.
          CLEAR LV_TEX1.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.


  LF_N1     = PA_N.
  LF_TABLE2 = PA_TABL1.


ENDFORM.                    " TOTAL_ENTRIES_VALIDATION


*&---------------------------------------------------------------------*
*&      Form  FIELD_NAME_VALIDATION
*&---------------------------------------------------------------------*
FORM FIELD_NAME_VALIDATION .


  CHECK PA_FNAM IS NOT INITIAL.
  PERFORM T5.
  SELECT SINGLE FIELDNAME FROM DD03L INTO LV_FILD1 WHERE FIELDNAME = PA_FNAM.
  IF SY-SUBRC <> 0.
    CHECK SY-UCOMM IS INITIAL OR SY-UCOMM = 'SEARCH_FOR_FIELD'.
    CONCATENATE 'Field' PA_FNAM 'does''nt exist in the database' INTO LV_TEX1 SEPARATED BY SPACE.
    CLEAR SY-UCOMM.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR: LF_VAL_REQUEST, LF_HELP_I.
    MESSAGE LV_TEX1 TYPE 'E'.
  ENDIF.
  CLEAR: LV_TEX1, LV_FILD1.


ENDFORM.                    " FIELD_NAME_VALIDATION


*&---------------------------------------------------------------------*
*&      Form  FIELD_DESCRIPTION_VALIDATION
*&---------------------------------------------------------------------*
FORM FIELD_DESCRIPTION_VALIDATION .


  CHECK PA_FDES IS NOT INITIAL.
  PERFORM T5.
  IF PA_FDES CS '*'.
    CHECK SY-UCOMM IS INITIAL OR SY-UCOMM = 'SEARCH_FOR_FIELD'.
    CLEAR SY-UCOMM.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR: LF_VAL_REQUEST, LF_HELP_I.
    MESSAGE '''*'' not allowed in the field description' TYPE 'E'.
  ENDIF.


ENDFORM.                    " FIELD_DESCRIPTION_VALIDATION


*&---------------------------------------------------------------------*
*&      Form  DIRECT_RELATIONSHIPS
*&---------------------------------------------------------------------*
FORM DIRECT_RELATIONSHIPS .


*      NEW-PAGE.
*      SET BLANK LINES ON.


  SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L1 WHERE TABNAME = PA_TABL1.
  SORT IT_DD03L1 BY POSITION.
  SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L2 WHERE TABNAME = PA_TABL2.
  SORT IT_DD03L2 BY POSITION.


  LOOP AT IT_DD03L1 INTO WA_DD03L1 WHERE DATATYPE <> 'CLNT' AND DATATYPE <> 'LANG' AND FIELDNAME NS '.INCLU' AND KEYFLAG = 'X'.
    SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T1 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
    LOOP AT IT_DD03L2 INTO WA_DD03L2 WHERE ROLLNAME  CS WA_DD03L1-ROLLNAME  OR ROLLNAME  CS WA_DD03L1-FIELDNAME OR
                                           FIELDNAME CS WA_DD03L1-FIELDNAME OR FIELDNAME CS WA_DD03L1-ROLLNAME  OR
                                           DOMNAME    = WA_DD03L1-DOMNAME   OR DOMNAME    = WA_DD03L1-FIELDNAME OR
                                           FIELDNAME  = WA_DD03L1-DOMNAME   OR ROLLNAME   = WA_DD03L1-DOMNAME   OR
                                           DOMNAME    = WA_DD03L1-ROLLNAME.


      IF WA_DD03L2-DOMNAME    = WA_DD03L1-DOMNAME   OR WA_DD03L2-DOMNAME    = WA_DD03L1-FIELDNAME OR
         WA_DD03L2-FIELDNAME  = WA_DD03L1-DOMNAME   OR WA_DD03L2-ROLLNAME   = WA_DD03L1-DOMNAME   OR
         WA_DD03L2-DOMNAME    = WA_DD03L1-ROLLNAME.


        SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
        IF ( WA_DD04T2-DDTEXT    CS   WA_DD04T1-DDTEXT  OR   WA_DD04T1-DDTEXT   CS   WA_DD04T2-DDTEXT ) OR
           ( WA_DD03L2-DATATYPE  <>  'DATS'             AND  WA_DD03L2-DOMNAME  <>  'USNAM'             AND
             WA_DD03L2-DOMNAME   <>  'XFELD'            AND  WA_DD03L2-DATATYPE <>  'TIMS'              AND   WA_DD03L2-DOMNAME <> 'SPRAS' ).
          IF WA_DD03L2-DATATYPE  <>  'TIMS'             AND  WA_DD03L2-DOMNAME  <>  'SPRAS'.


            PERFORM APPEND1 USING PA_TABL2.


          ENDIF.
        ENDIF.


      ELSE.


        PERFORM APPEND1 USING PA_TABL2.


      ENDIF.
      CLEAR WA_DD03L2.
      LF_WA_CLEAR = 1.
    ENDLOOP.


    IF LF_WA_CLEAR IS INITIAL.
      IF WA_DD03L2 IS INITIAL.
        LOOP AT IT_DD03L2 INTO WA_DD03L2.
          SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
          IF WA_DD04T2-DDTEXT CS WA_DD04T1-DDTEXT OR WA_DD04T1-DDTEXT CS WA_DD04T2-DDTEXT.


            PERFORM APPEND1 USING PA_TABL2.


          ENDIF.
          CLEAR WA_DD03L2.
        ENDLOOP.
      ENDIF.
    ENDIF.
    CLEAR: WA_DD03L1, WA_DD03L2, LF_WA_CLEAR.
  ENDLOOP.




  LOOP AT IT_DD03L2 INTO WA_DD03L2 WHERE DATATYPE <> 'CLNT' AND DATATYPE <> 'LANG' AND FIELDNAME NS '.INCLU' AND KEYFLAG = 'X'.
    SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T1 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
    LOOP AT IT_DD03L1 INTO WA_DD03L1 WHERE ROLLNAME  CS WA_DD03L2-ROLLNAME  OR ROLLNAME  CS WA_DD03L2-FIELDNAME OR
                                           FIELDNAME CS WA_DD03L2-FIELDNAME OR FIELDNAME CS WA_DD03L2-ROLLNAME  OR
                                           DOMNAME    = WA_DD03L2-DOMNAME   OR DOMNAME    = WA_DD03L2-FIELDNAME OR
                                           FIELDNAME  = WA_DD03L2-DOMNAME   OR ROLLNAME   = WA_DD03L2-DOMNAME   OR
                                           DOMNAME    = WA_DD03L2-ROLLNAME.


      IF WA_DD03L1-DOMNAME    = WA_DD03L2-DOMNAME   OR WA_DD03L1-DOMNAME    = WA_DD03L2-FIELDNAME OR
         WA_DD03L1-FIELDNAME  = WA_DD03L2-DOMNAME   OR WA_DD03L1-ROLLNAME   = WA_DD03L2-DOMNAME   OR
         WA_DD03L1-DOMNAME    = WA_DD03L2-ROLLNAME.


        SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
        IF ( WA_DD04T1-DDTEXT    CS   WA_DD04T2-DDTEXT  OR   WA_DD04T2-DDTEXT   CS   WA_DD04T1-DDTEXT ) OR
           ( WA_DD03L1-DATATYPE  <>  'DATS'             AND  WA_DD03L1-DOMNAME  <>  'USNAM'             AND
             WA_DD03L1-DOMNAME   <>  'XFELD'            AND  WA_DD03L1-DATATYPE <>  'TIMS'              AND   WA_DD03L1-DOMNAME <> 'SPRAS' ).
          IF WA_DD03L1-DATATYPE  <>  'TIMS'             AND  WA_DD03L1-DOMNAME  <>  'SPRAS'.


            PERFORM APPEND2 USING PA_TABL2.


          ENDIF.
        ENDIF.


      ELSE.


        PERFORM APPEND2 USING PA_TABL2.


      ENDIF.
      CLEAR WA_DD03L1.
      LF_WA_CLEAR = 1.
    ENDLOOP.


    IF LF_WA_CLEAR IS INITIAL.
      IF WA_DD03L1 IS INITIAL.
        LOOP AT IT_DD03L1 INTO WA_DD03L1.
          SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
          IF WA_DD04T1-DDTEXT CS WA_DD04T2-DDTEXT OR WA_DD04T2-DDTEXT CS WA_DD04T1-DDTEXT.


            PERFORM APPEND2 USING PA_TABL2.


          ENDIF.
          CLEAR WA_DD03L1.
        ENDLOOP.
      ENDIF.
    ENDIF.
    CLEAR: WA_DD03L1, WA_DD03L2, LF_WA_CLEAR.
  ENDLOOP.


  SORT IT_CHECK1 BY POSITION FIELDNAME.
  DELETE ADJACENT DUPLICATES FROM IT_CHECK1 COMPARING FIELDNAME.
  SORT IT_CHECK1 BY TABNAME.


  IF IT_CHECK1 IS NOT INITIAL.
    LEAVE TO LIST-PROCESSING.
    SET PF-STATUS SPACE.
    SKIP 2.
    BACK.
    LV_TB1 = PA_TABL1.
    WRITE: 53 'Relationships between' COLOR 5, LV_TB1 INVERSE ON COLOR 6, 'and' COLOR 5, PA_TABL2 INVERSE ON COLOR 6.
    FORMAT INVERSE ON.
    FORMAT COLOR 4.
    ULINE /53(43).
    FORMAT INVERSE OFF.
    FORMAT COLOR OFF.
    WRITE: /34  'TABLE1' COLOR 3,
            68  'FIELD'  COLOR 3,
           103 'TABLE2' COLOR 3.
    SKIP.


    LOOP AT IT_CHECK1 INTO WA_CHECK1 WHERE FIELDNAME NS '*'.


      IF WA_CHECK1 IS NOT INITIAL.
        APPEND WA_CHECK1 TO IT_CHECK2.
      ENDIF.
      CLEAR WA_CHECK1.


    ENDLOOP.


    SORT IT_CHECK2 BY POSITION FIELDNAME.
    LOOP AT IT_CHECK1 INTO WA_CHECK1 WHERE FIELDNAME CS '*'.


      IF WA_CHECK1 IS NOT INITIAL.
        APPEND WA_CHECK1 TO IT_CHECK2.
      ENDIF.
      CLEAR WA_CHECK1.


    ENDLOOP.


    CLEAR LV_RE.
    LOOP AT IT_CHECK2 INTO WA_CHECK2.


      LV_RE = LV_RE + 1.


      IF WA_CHECK2-FIELDNAME CS '*'.
        WRITE: 2 SY-VLINE, 143 SY-VLINE.
      ENDIF.


      IF SY-TABIX = 1.
        ULINE 2(142).
        SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T1 WHERE TABNAME = PA_TABL1 AND DDLANGUAGE = 'EN'.
        SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T2 WHERE TABNAME = PA_TABL2 AND DDLANGUAGE = 'EN'.
        CONCATENATE '(' WA_DD02T1-DDTEXT ')' INTO LV_TB1.
        CONCATENATE '(' WA_DD02T2-DDTEXT ')' INTO LV_TEX2.
        WRITE: /2 SY-VLINE, 33 WA_CHECK2-TABNAME INVERSE ON COLOR 6,
                103 WA_CHECK2-CHECKTABLE INVERSE ON COLOR 5, 143 SY-VLINE.


        PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 LV_TB1 INVERSE ON COLOR 6.
        PERFORM CALCULATE_POSITION USING LV_TEX2 '103' '0.5'.
        WRITE:  AT LV_TPOS1 LV_TEX2 INVERSE ON COLOR 5, 143 SY-VLINE.
        WRITE: /2 SY-VLINE, 143 SY-VLINE.
        WRITE: /2 SY-VLINE, 143 SY-VLINE.
      ENDIF.


      CLEAR: LV_TB1, LV_TEX2, WA_DD02T1, WA_DD02T2.


      IF WA_CHECK2-FIELDNAME CS '*'.
        SPLIT WA_CHECK2-FIELDNAME AT '*' INTO LV_TFLD1 LV_TFLD2.
        PERFORM CALCULATE_POSITION USING LV_TFLD1 '64' '1'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 ICON_COLUMN_LEFT AS ICON.
        WRITE LV_TFLD1 INVERSE ON COLOR 6.
        CLEAR LV_TPOS1.
        WRITE ICON_ARROW_LEFT AS ICON.
        WRITE ICON_ARROW_RIGHT AS ICON.
        WRITE LV_TFLD2 INVERSE ON COLOR 5.
        WRITE: ICON_COLUMN_RIGHT AS ICON, 143 SY-VLINE.
        CLEAR: LV_TLEN, LV_TPOS1.
        PERFORM CALCULATE_POSITION USING WA_CHECK2-TEXT1 '63' '1'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 '(', WA_CHECK2-TEXT1 INVERSE ON COLOR 7, ')'.
        WRITE: 74 '(', WA_CHECK2-TEXT2 INVERSE ON COLOR 7, ')', 143 SY-VLINE.
        WRITE: /2 SY-VLINE, 48 'May not be appropriate in all cases(Please check)' INVERSE ON COLOR 3, 143 SY-VLINE.
        WRITE: /2 SY-VLINE, 143 SY-VLINE.
      ELSE.
        CLEAR: LV_TFLD1, LV_TFLD2, LV_TLEN, LV_TPOS1.
        SPLIT WA_CHECK2-FIELDNAME AT '#' INTO LV_TFLD1 LV_TFLD2.
        SPLIT LV_TFLD2 AT '#' INTO LV_TFLD2 LV_TFLD3.
        PERFORM CALCULATE_POSITION USING LV_TFLD1 '64' '1'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 ICON_COLUMN_LEFT AS ICON.
        WRITE LV_TFLD1 INVERSE ON COLOR 6.
        CLEAR LV_TPOS1.
        WRITE LV_TFLD2.
        WRITE LV_TFLD3 INVERSE ON COLOR 5.
        WRITE: ICON_COLUMN_RIGHT AS ICON, 143 SY-VLINE.
        IF WA_CHECK2-TEXT1 = WA_CHECK2-TEXT2.
          CLEAR: LV_TLEN, LV_TPOS1.
          PERFORM CALCULATE_POSITION USING WA_CHECK2-TEXT1 '69' '0.5'.
          LV_TLEN = STRLEN( WA_CHECK2-TEXT1 ).
          WRITE: /2 SY-VLINE, AT LV_TPOS1 '(', WA_CHECK2-TEXT1 INVERSE ON COLOR 7, ')', 143 SY-VLINE.
        ELSE.
          CLEAR: LV_TLEN, LV_TPOS1.
          PERFORM CALCULATE_POSITION USING WA_CHECK2-TEXT1 '63' '1'.
          WRITE: /2 SY-VLINE, AT LV_TPOS1 '(', WA_CHECK2-TEXT1 INVERSE ON COLOR 7, ')'.
          WRITE: 74 '(', WA_CHECK2-TEXT2 INVERSE ON COLOR 7, ')', 143 SY-VLINE.
          WRITE: /2 SY-VLINE, 143 SY-VLINE.
        ENDIF.
      ENDIF.


      WRITE: /2 SY-VLINE, 143 SY-VLINE.
      CLEAR WA_CHECK2.


    ENDLOOP.


    ULINE 2(142).
    LV_A = LV_RE.
    CONCATENATE LV_A 'relationships found' INTO LV_TEX1 SEPARATED BY SPACE.
    MESSAGE LV_TEX1 TYPE 'S'.
    CLEAR: IT_CHECK1, IT_CHECK2, WA_CHECK1, WA_CHECK2, LV_TPOS1, LV_TLEN, LV_TFLD1, LV_TFLD2, LV_TFLD3, LV_A, LV_RE, LV_TEX1.
  ELSE.
    CONCATENATE 'There are no direct relationships between' PA_TABL1 'and' PA_TABL2 INTO LV_TEX1 SEPARATED BY SPACE.
    MESSAGE LV_TEX1 TYPE 'I'.
    CLEAR LV_TEX1.


    CONCATENATE 'Do you want to search for link tables between' PA_TABL1 '&' PA_TABL2 '?' INTO LV_TEX2 SEPARATED BY SPACE.


    CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
      EXPORTING
        DEFAULTOPTION       = 'N'
        TEXTLINE1           = LV_TEX2
        TEXTLINE2           = 'May be a time taking search.'
        TITEL               = 'Show link tables'
*       START_COLUMN        = 25
*       START_ROW           = 6
      IMPORTING
        ANSWER              = LV_A.


  ENDIF.


*-Setting the flag to trigger Popup(window 500) if user chooses to search link tables-*
  IF LV_A = 'J'.
    LF_POP = 26.
  ENDIF.


  CLEAR: WA_DD03L1, WA_DD03L2, WA_DD03L3, WA_DD03L4, WA_CHECK1, WA_DD04T1, WA_DD04T2,
         WA_DD02T1, WA_DD02T2, WA_DD02T3, WA_CHECK2, LV_FILD1, LV_FILD2, LV_FILD3, LV_FILD4, LV_FILD5,
         LV_FILD6, LV_FILD7, LV_TB1, LV_A, LV_TEX1, LV_TEX2, LV_RE, LV_I.




  REFRESH: IT_DD03L1, IT_DD03L2, IT_DD03L3, IT_DD03L4 , IT_CHECK1, IT_CHECK2, R_TAB[].


ENDFORM.                    " DIRECT_RELATIONSHIPS


*&---------------------------------------------------------------------*
*&      Form  LINK_TABLES
*&---------------------------------------------------------------------*
FORM LINK_TABLES .


  CLEAR R_TAB[].
  CLEAR LV_I.
  CLEAR LF_OUTPUT.


  LV_TB1 = 'This process requires maximum work space, ensure that there are no other parallel sessions running.'.
  MESSAGE LV_TB1 TYPE 'I'.
  CLEAR LV_TB1.


  IF RB5 = 'X'.
    PERFORM SD.
    LV_MOD = 'of important SD tables'.
    LV_TB1 = 'SD'.
  ELSEIF RB6 = 'X'.
    PERFORM MM.
    LV_MOD = 'of important MM tables'.
    LV_TB1 = 'MM'.
  ELSEIF RB7 = 'X'.
    PERFORM PP.
    LV_MOD = 'of important PP tables'.
    LV_TB1 = 'PP'.
  ELSEIF RB8 = 'X'.
    PERFORM FI.
    LV_MOD = 'of important FI tables'.
    LV_TB1 = 'FI'.
  ELSEIF RB9 = 'X'.
    PERFORM PM.
    LV_MOD = 'of important PM tables'.
    LV_TB1 = 'PM'.
  ELSEIF RBW = 'X'.
    PERFORM WM.
    CLEAR LV_TEX2.
    LV_MOD = 'of important WM tables'.
    LV_TB1 = 'WM'.
  ELSEIF RBQ = 'X'.
    PERFORM QM.
    CLEAR LV_TEX2.
    LV_MOD = 'of important QM tables'.
    LV_TB1 = 'QM'.
  ELSEIF RBH = 'X'.
    LV_MOD = 'of important HR tables'.


*-----------Popup for user to select from any part of the available HR tables------------*
    CLEAR LV_TB1.
    LV_HR_LINK = 9.


    WHILE LV_HR_LINK > 8.
      DO 100 TIMES.
        CALL FUNCTION 'POPUP_TO_GET_ONE_VALUE'
          EXPORTING
            TEXTLINE1   = 'Out of 8 parts'
            TEXTLINE2   = 'of HR Tables'
            TEXTLINE3   = 'search for link tables among which part?'
            TITEL       = 'To ease load on database'
            VALUELENGTH = 1
          IMPORTING
            ANSWER      = LV_TB1
            VALUE1      = LF_OUTPUT.


        IF LV_TB1 = 'A'.
          LV_HR_LINK = 3.
          EXIT.
        ENDIF.


        IF LF_OUTPUT NA '1234567890'.
          LV_HR_LINK = 250.
        ELSE.
          LV_HR_LINK = LF_OUTPUT.
        ENDIF.
        IF LV_HR_LINK > 8 AND LV_HR_LINK <> 250.
          MESSAGE 'There are only 8 parts in HR tables' TYPE 'S' DISPLAY LIKE 'E'.
        ELSEIF LV_HR_LINK = 250.
          MESSAGE 'Please enter any value from 1 to 8' TYPE 'S' DISPLAY LIKE 'E'.
        ELSEIF LV_HR_LINK = 0.
          LV_HR_LINK = 15.
          MESSAGE '0 is invalid part.Enter any value from 1 to 8' TYPE 'S' DISPLAY LIKE 'E'.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
    ENDWHILE.


    IF LV_TB1 = 'A'.
      CLEAR LV_HR_LINK.
      CLEAR LV_TB1.
      CLEAR R_TAB[].
    ENDIF.


    IF LV_HR_LINK IS NOT INITIAL.
      PERFORM HR.
      PERFORM SPLIT_HR_TABLES.
      CLEAR LV_TB1.
    ENDIF.


  ENDIF.


  IF RBH <> 'X'.
    PERFORM SPLIT_NON_HR_TABLES.
  ENDIF.


  CHECK R_TAB[] IS NOT INITIAL.
  CLEAR: LV_RE, LV_I.


  CLEAR: IT_DD03L1, IT_DD03L2.


  SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L1 WHERE TABNAME = PA_TABL1.
  SORT IT_DD03L1 BY POSITION.
  SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L2 WHERE TABNAME = PA_TABL2.
  SORT IT_DD03L2 BY POSITION.


  LOOP AT IT_DD03L1 INTO WA_DD03L1 WHERE DATATYPE <> 'CLNT' AND DATATYPE <> 'LANG' AND FIELDNAME NS '.INCLU'.


    SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L3 WHERE TABNAME IN R_TAB AND ( FIELDNAME = WA_DD03L1-FIELDNAME OR ROLLNAME = WA_DD03L1-ROLLNAME ).


    LOOP AT IT_DD03L2 INTO WA_DD03L2 WHERE ROLLNAME <> 'MANDT' AND ROLLNAME <> 'SPRAS' AND FIELDNAME NS '.INCLU'.


      LOOP AT IT_DD03L3 INTO WA_DD03L3.


        SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L4  WHERE TABNAME = WA_DD03L3-TABNAME AND ( FIELDNAME = WA_DD03L2-FIELDNAME OR ROLLNAME = WA_DD03L2-ROLLNAME ).


        LOOP AT IT_DD03L4 INTO WA_DD03L4 WHERE FIELDNAME NS '.INCLU'.


          IF WA_DD03L4-TABNAME <> WA_DD03L1-TABNAME AND WA_DD03L4-TABNAME <> WA_DD03L2-TABNAME.


            IF ( WA_DD03L1-KEYFLAG = 'X' AND WA_DD03L4-KEYFLAG = 'X' ) OR ( WA_DD03L4-KEYFLAG = 'X' AND WA_DD03L2-KEYFLAG = 'X' ) OR ( WA_DD03L1-KEYFLAG = 'X' AND WA_DD03L2-KEYFLAG = 'X' ) OR ( WA_DD03L4-KEYFLAG = 'X' ).


              IF WA_DD03L1-KEYFLAG = 'X' OR WA_DD03L3-KEYFLAG = 'X'.


                SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T1 WHERE TABNAME = WA_DD03L1-TABNAME AND DDLANGUAGE = 'EN'.
                SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T2 WHERE TABNAME = WA_DD03L4-TABNAME AND DDLANGUAGE = 'EN'.
                SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T3 WHERE TABNAME = WA_DD03L2-TABNAME AND DDLANGUAGE = 'EN'.
                SELECT SINGLE DDTEXT FROM DD04T INTO LV_DESC1 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
                SELECT SINGLE DDTEXT FROM DD04T INTO LV_DESC2 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
                SELECT SINGLE DDTEXT FROM DD04T INTO LV_DESC3 WHERE ROLLNAME = WA_DD03L3-ROLLNAME AND DDLANGUAGE = 'EN'.
                SELECT SINGLE DDTEXT FROM DD04T INTO LV_DESC4 WHERE ROLLNAME = WA_DD03L4-ROLLNAME AND DDLANGUAGE = 'EN'.


                LV_RE = LV_RE + 1.


                IF LV_I = 0.
                  LEAVE TO LIST-PROCESSING.
                  SET PF-STATUS SPACE.
                  SKIP 2.
                  WRITE: /4   'TABLE1' COLOR 3,
                          69  'LINK TABLE' COLOR 3,
                          132 'TABLE2' COLOR 3.
                  SKIP.
                  LV_I = 1.
                ENDIF.


                IF WA_DD03L1-KEYFLAG = 'X'.
                  CONCATENATE '(' WA_DD03L1-FIELDNAME ' (' 'KEY' ')' ')' INTO LV_FILD1.
                ELSE.
                  CONCATENATE '(' WA_DD03L1-FIELDNAME ' (' 'NON-KEY' ')' ')' INTO LV_FILD1.
                ENDIF.


                LV_TB1 = PA_TABL1.
                CONCATENATE '(' WA_DD02T1-DDTEXT ')' INTO LV_FILD5.
                CONCATENATE '(' WA_DD02T2-DDTEXT ')' INTO LV_FILD6.
                CONCATENATE '(' WA_DD02T3-DDTEXT ')' INTO LV_FILD7.
                ULINE 2(191).
                WRITE: /2 SY-VLINE, 4 LV_FILD5 INVERSE ON COLOR 4, 67 LV_FILD6 INVERSE ON COLOR 4, 130 LV_FILD7 INVERSE ON COLOR 4, 192 SY-VLINE.
                WRITE: /2 SY-VLINE, LV_TB1 INVERSE ON COLOR 5 UNDER 'TABLE1'.


                IF WA_DD03L3-TABNAME = WA_DD03L4-TABNAME AND WA_DD03L3-KEYFLAG = 'X'.
                  CLEAR LV_FILD2.
                  CONCATENATE '(' WA_DD03L3-FIELDNAME ' (' 'KEY' ')' ')' INTO LV_FILD2.
                ELSEIF WA_DD03L3-TABNAME = WA_DD03L4-TABNAME AND WA_DD03L3-KEYFLAG <> 'X'.
                  CLEAR LV_FILD2.
                  CONCATENATE '(' WA_DD03L3-FIELDNAME ' (' 'NON-KEY' ')' ')' INTO LV_FILD2.
                ENDIF.


                IF WA_DD03L4-KEYFLAG = 'X'.
                  CLEAR LV_FILD3.
                  CONCATENATE '(' WA_DD03L4-FIELDNAME ' (' 'KEY' ')' ')' INTO LV_FILD3.
                ELSE.
                  CLEAR LV_FILD3.
                  CONCATENATE '(' WA_DD03L4-FIELDNAME ' (' 'NON-KEY' ')' ')' INTO LV_FILD3.
                ENDIF.


                LV_TB1 = WA_DD03L4-TABNAME.
                WRITE: LV_TB1 INVERSE ON COLOR 5 UNDER 'LINK TABLE'.


                IF WA_DD03L2-KEYFLAG = 'X'.
                  CONCATENATE '(' WA_DD03L2-FIELDNAME ' (' 'KEY' ')' ')' INTO LV_FILD4.
                ELSE.
                  CONCATENATE '(' WA_DD03L2-FIELDNAME ' (' 'NON-KEY' ')' ')' INTO LV_FILD4.
                ENDIF.


                LV_TB1 = PA_TABL2.
                WRITE: LV_TB1 INVERSE ON COLOR 5 UNDER 'TABLE2', 192 SY-VLINE.
                IF LV_FILD3 <> LV_FILD2.
                  WRITE: /2 SY-VLINE, LV_FILD3 INVERSE ON COLOR 6 UNDER 'LINK TABLE',
                            LV_FILD1 INVERSE ON COLOR 6 UNDER 'TABLE1',
                            LV_FILD4 INVERSE ON COLOR 6 UNDER 'TABLE2',  192 SY-VLINE.
                  WRITE:/2 SY-VLINE, 6 '(', LV_DESC1 INVERSE ON COLOR 7, ')',
                         71  '(', LV_DESC4 INVERSE ON COLOR 7, ')',
                         134 '(', LV_DESC2 INVERSE ON COLOR 7, ')', 192 SY-VLINE.
                  WRITE: /2 SY-VLINE, LV_FILD2 INVERSE ON COLOR 6 UNDER 'LINK TABLE', 192 SY-VLINE.
                  WRITE: /2 SY-VLINE, 71  '(', LV_DESC3 INVERSE ON COLOR 7, ')', 192 SY-VLINE.
                ELSE.
                  WRITE: /2 SY-VLINE,  LV_FILD3 INVERSE ON COLOR 6 UNDER 'LINK TABLE',
                           LV_FILD1 INVERSE ON COLOR 6 UNDER 'TABLE1',
                           LV_FILD4 INVERSE ON COLOR 6 UNDER 'TABLE2', 192 SY-VLINE.


                  WRITE: /2 SY-VLINE, 6 '(', LV_DESC1 INVERSE ON COLOR 7, ')',
                          71  '(', LV_DESC4 INVERSE ON COLOR 7, ')',
                          134 '(', LV_DESC2 INVERSE ON COLOR 7, ')', 192 SY-VLINE.


                ENDIF.
                WRITE: /2 SY-VLINE, 192 SY-VLINE.
              ENDIF.
            ENDIF.


          ELSE.
            EXIT.
          ENDIF.
          CLEAR WA_DD03L4.


        ENDLOOP.
        CLEAR WA_DD03L3.


      ENDLOOP.
      CLEAR WA_DD03L2.


    ENDLOOP.
    CLEAR WA_DD03L1.


  ENDLOOP.


  IF LV_RE IS NOT INITIAL.
    ULINE 2(190).
    BACK.
    LV_TB1 = PA_TABL1.
    WRITE: 52 LV_MOD INVERSE ON COLOR 6, 'Link Relationships between' COLOR 5, LV_TB1 INVERSE ON COLOR 6, 'and' COLOR 5, PA_TABL2 INVERSE ON COLOR 6.
    FORMAT INVERSE ON COLOR 4.
    ULINE /52(50).
    FORMAT INVERSE OFF.
    FORMAT COLOR OFF.
    LV_A = LV_RE.
    CONCATENATE LV_A LV_TEX1 INTO LV_TEX1 SEPARATED BY SPACE.
    MESSAGE LV_TEX1 TYPE 'S'.
    CLEAR LV_TEX1.
  ELSE.
    MESSAGE LV_TEX2 TYPE 'S'.
    CLEAR LV_TEX2.
  ENDIF.


  REFRESH: IT_DD03L1, IT_DD03L2, IT_DD03L3, IT_DD03L4.
  CLEAR: R_TAB[], R_TAB_LINK[], WA_DD03L1, WA_DD03L2, WA_DD03L3, WA_DD03L4, WA_DD02T1, WA_DD02T2, WA_DD02T3, LV_DESC1,
         LV_DESC2, LV_DESC3, LV_DESC4, LV_I.


ENDFORM.                    " LINK_TABLES


*&---------------------------------------------------------------------*
*&      Form  SPLIT_HR_TABLES
*&---------------------------------------------------------------------*
FORM SPLIT_HR_TABLES .


  SORT R_TAB[] BY LOW.
  DELETE ADJACENT DUPLICATES FROM R_TAB[] COMPARING LOW.
  DESCRIBE TABLE R_TAB[] LINES LV_RE.
  LV_RE = LV_RE / 8.


*--------Splitting the available tables to 8 parts for improving performance---------*
  CLEAR LV_TEX1.
  IF LV_HR_LINK = 1.
    APPEND LINES OF R_TAB[] FROM 1 TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '1st part' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 1st part' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ELSEIF LV_HR_LINK = 2.
    LV_I  = LV_RE + 1.
    LV_RE = LV_RE * 2.
    APPEND LINES OF R_TAB[] FROM LV_I TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '2nd part' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 2nd part' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ELSEIF LV_HR_LINK = 3.
    LV_I  = LV_RE * 2 + 1.
    LV_RE = LV_RE * 3.
    APPEND LINES OF R_TAB[] FROM LV_I TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '3rd part' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 3rd part' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE..
  ELSEIF LV_HR_LINK = 4.
    LV_I  = LV_RE * 3 + 1.
    LV_RE = LV_RE * 4.
    APPEND LINES OF R_TAB[] FROM LV_I TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '4th part' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 4th part' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ELSEIF LV_HR_LINK = 5.
    LV_I  = LV_RE * 4 + 1.
    LV_RE = LV_RE * 5.
    APPEND LINES OF R_TAB[] FROM LV_I TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '5th part' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 5th part' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ELSEIF LV_HR_LINK = 6.
    LV_I  = LV_RE * 5 + 1.
    LV_RE = LV_RE * 6.
    APPEND LINES OF R_TAB[] FROM LV_I TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '6th part' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 6th part' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ELSEIF LV_HR_LINK = 7.
    LV_I  = LV_RE * 6 + 1.
    LV_RE = LV_RE * 7.
    APPEND LINES OF R_TAB[] FROM LV_I TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '7th part' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 7th part' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ELSEIF LV_HR_LINK = 8.
    CLEAR LV_HR_LINK.
    LV_I = LV_RE * 7 + 1.
    CLEAR LV_RE.
    DESCRIBE TABLE R_TAB[] LINES LV_RE.
    APPEND LINES OF R_TAB[] FROM LV_I TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_LEN, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '8th part' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 8th part' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ENDIF.
  CLEAR LV_MOD.
  LV_MOD = 'HR'.


ENDFORM.                    " SPLIT_HR_TABLES


*&---------------------------------------------------------------------*
*&      Form  SPLIT_NON_HR_TABLES
*&---------------------------------------------------------------------*
FORM SPLIT_NON_HR_TABLES .
  CLEAR LV_TEX1.
  CONCATENATE 'I half of' LV_TB1 'tables' INTO LV_TEX1 SEPARATED BY SPACE.
  CLEAR LV_TEX2.
  CONCATENATE 'II half of' LV_TB1 'tables' INTO LV_TEX2 SEPARATED BY SPACE.


*-----------Popup for user to select from any half of the available tables--------------*
  CALL FUNCTION 'POPUP_TO_DECIDE'
    EXPORTING
      TEXTLINE1    = '             Search Among---->'
      TEXT_OPTION1 = LV_TEX1
      TEXT_OPTION2 = LV_TEX2
      TITEL        = 'To ease load on database'
    IMPORTING
      ANSWER       = LV_TFLD1.


*--------Splitting the available tables to two halves for improving performance---------*
  CLEAR LV_TEX1.
  IF LV_TFLD1 = '1'.
    SORT R_TAB[] BY LOW.
    DELETE ADJACENT DUPLICATES FROM R_TAB[] COMPARING LOW.
    DESCRIBE TABLE R_TAB[] LINES LV_RE.
    LV_RE = LV_RE / 2.
    APPEND LINES OF R_TAB[] FROM 1 TO LV_RE TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '1st half' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 1st half' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ELSEIF LV_TFLD1 = '2'.
    SORT R_TAB[] BY LOW.
    DELETE ADJACENT DUPLICATES FROM R_TAB[] COMPARING LOW.
    DESCRIBE TABLE R_TAB[] LINES LV_RE.
    LV_I = LV_RE.
    LV_RE = LV_RE / 2.
    LV_RE = LV_RE + 1.
    APPEND LINES OF R_TAB[] FROM LV_RE TO LV_I TO R_TAB_LINK[].
    CLEAR R_TAB[].
    R_TAB[] = R_TAB_LINK[].
    CLEAR: LV_RE, LV_I, LV_TEX2.
    REFRESH R_TAB_LINK[].
    CONCATENATE 'No link tables found among' '2nd half' LV_MOD INTO LV_TEX2 SEPARATED BY SPACE.
    CONCATENATE 'link relationships found in the 2nd half' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
  ELSEIF LV_TFLD1 = 'A'.
    CLEAR: R_TAB[].
  ENDIF.
  LV_MOD = LV_MOD+13(2).


ENDFORM.                    " SPLIT_NON_HR_TABLES


*&---------------------------------------------------------------------*
*&      Form  GOTO_TABLE_STRUCTURE
*&---------------------------------------------------------------------*
FORM GOTO_TABLE_STRUCTURE .
  IF PA_TABL1 IS NOT INITIAL.
    SET PARAMETER ID 'DTB' FIELD PA_TABL1.
    CALL TRANSACTION 'SE11'.
  ELSE.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR SY-UCOMM.
    MESSAGE 'Please enter any valid database table name in the highlighted field' TYPE 'E'.
  ENDIF.


ENDFORM.                    " GOTO_TABLE_STRUCTURE


*&---------------------------------------------------------------------*
*&      Form  GET_TABLE_FIELDS
*&---------------------------------------------------------------------*
FORM GET_TABLE_FIELDS .


  SELECT FIELDNAME POSITION KEYFLAG DATATYPE FROM DD03L INTO TABLE IT_FIELD1 WHERE TABNAME = PA_TABL1.
  PERFORM T5.
  SORT IT_FIELD1 BY POSITION.
  LOOP AT IT_FIELD1 INTO WA_FIELD1.
    IF SY-TABIX <> 1.
      CHECK PA_SLIST+120(1) IS INITIAL.
      CHECK PA_SLIST+121(1) IS INITIAL.
      IF WA_FIELD1-FIELDNAME+0(6) <> '.INCLU'.
        LV_CONCAT+1(31) = WA_FIELD1-FIELDNAME.
        CONCATENATE PA_SLIST LV_CONCAT INTO PA_SLIST.
      ENDIF.
    ELSEIF SY-TABIX = 1.
      IF WA_FIELD1-FIELDNAME+0(6) <> '.INCLU' AND WA_FIELD1-FIELDNAME <> '.APPEND'.
        PA_SLIST = WA_FIELD1-FIELDNAME.
      ENDIF.
    ELSE.
      EXIT.
    ENDIF.
    CLEAR WA_FIELD1.


  ENDLOOP.


  CLEAR: LV_RE, LV_I, LV_FILD1, LV_FILD2.
  LV_FILD2 = PA_SLIST.
  DO 100 TIMES.
    IF LV_FILD2 IS NOT INITIAL.
      LV_RE = LV_RE + 1.
      SPLIT LV_FILD2 AT ' ' INTO LV_FILD1 LV_FILD2.
      CLEAR LV_FILD1.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  CLEAR: LV_FILD1, LV_FILD2.


  SELECT COUNT(*) FROM DD03L INTO LV_I WHERE TABNAME = PA_TABL1.
  LV_FILD1 = LV_RE.
  LV_FILD2 = LV_I.


  CLEAR LV_TB1.
  CONCATENATE LV_FILD1 'fields of' LV_FILD2 'fields displayed' INTO LV_TB1 SEPARATED BY SPACE.


  MESSAGE LV_TB1 TYPE 'S'.
  CLEAR: LV_RE, LV_I, LV_FILD1, LV_FILD2, LV_TB1.


  LF_TABLE1 = PA_TABL1.
  LF_P2 = 1.
  LF_GET_FIELDS = 1.
  CLEAR IT_FIELD1.
  CLEAR WA_FIELD1.


ENDFORM.                    " GET_TABLE_FIELDS


*&---------------------------------------------------------------------*
*&      Form  AS_CHECKTABLE
*&---------------------------------------------------------------------*
FORM AS_CHECKTABLE .


  IF WA_TABCLS1-TABCLASS = 'INTTAB' OR WA_TABCLS1-TABCLASS = 'APPEND'.
    CONCATENATE 'Please enter a table for relationships.' PA_TABL1 'is structure' INTO LV_TEX1 SEPARATED BY SPACE.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR SY-UCOMM.
    MESSAGE LV_TEX1 TYPE 'E'.
    CLEAR LV_TEX1.
  ENDIF.


  IF WA_TABCLS1-TABCLASS = 'VIEW' AND WA_TABCLS1-VIEWCLASS <> 'D' AND WA_TABCLS1-VIEWCLASS <> 'P'.
    CONCATENATE 'View' PA_TABL1 'not a database or projection view(No entries)' INTO LV_TEX1 SEPARATED BY SPACE.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR SY-UCOMM.
    MESSAGE LV_TEX1 TYPE 'E'.
    CLEAR LV_TEX1.
  ENDIF.


  CLEAR R_TAB[].
  IF RB5 = 'X'.
    PERFORM SD.
    LV_TEX2 = 'in SD'.
  ELSEIF RB6 = 'X'.
    PERFORM MM.
    LV_TEX2 = 'in MM'.
  ELSEIF RB7 = 'X'.
    PERFORM PP.
    LV_TEX2 = 'in PP'.
  ELSEIF RB8 = 'X'.
    PERFORM FI.
    LV_TEX2 = 'in FI'.
  ELSEIF RB9 = 'X'.
    PERFORM PM.
    LV_TEX2 = 'in PM'.
  ELSEIF RBW = 'X'.
    PERFORM WM.
    LV_TEX2 = 'in WM'.
  ELSEIF RBQ = 'X'.
    PERFORM QM.
    LV_TEX2 = 'in QM'.
  ELSEIF RBH = 'X'.
    PERFORM HR.
    LV_TEX2 = 'in HR'.
  ENDIF.


  IF R_TAB[] IS NOT INITIAL.
    SORT R_TAB[] BY LOW.
    DELETE ADJACENT DUPLICATES FROM R_TAB[] COMPARING LOW.
  ENDIF.


*------Triggering POPUP for user confirmation if no: of records > 2000 to avoid runtime error(Timed out)--------*
  IF RBS = 'X'.
    TRY.
        SELECT COUNT(*) FROM DD08L INTO LV_COUNTER_CHKTBLS WHERE CHECKTABLE = PA_TABL1.
      CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS.
        LF_EXCEPTION = 1.
    ENDTRY.
    IF LF_EXCEPTION <> 1.
      SELECT TABNAME FIELDNAME CHECKTABLE FROM DD08L INTO TABLE IT_DD08L1 WHERE CHECKTABLE = PA_TABL1.
    ENDIF.
    IF LV_COUNTER_CHKTBLS > 2000.
      CLEAR LV_TB1.
      LV_TB1 =  LV_COUNTER_CHKTBLS.
      CONCATENATE 'It may take little time to prepare output for' LV_TB1 'records' INTO LV_TEX1 SEPARATED BY SPACE.


      CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
        EXPORTING
          DEFAULTOPTION       = 'N'
          TEXTLINE1           =  LV_TEX1
          TEXTLINE2           = 'Do you want to continue?'
          TITEL               = 'Load on the database.'
*         START_COLUMN        = 25
*         START_ROW           = 6
        IMPORTING
          ANSWER              = LF_OUTPUT.


    ENDIF.


    IF LF_OUTPUT = 'J'.
      CLEAR LF_OUTPUT.     "Flag is set as initial when the load is acceptable or when the user chooses to continue
    ENDIF.


  ELSE.
    SELECT TABNAME FIELDNAME CHECKTABLE FROM DD08L INTO TABLE IT_DD08L1 WHERE CHECKTABLE = PA_TABL1 AND TABNAME IN R_TAB.
    CLEAR LF_OUTPUT.
  ENDIF.


  CHECK LF_OUTPUT IS INITIAL.
*---------------Preparing the output----------------*
  IF IT_DD08L1 IS NOT INITIAL.


    SET PF-STATUS SPACE.
    LEAVE TO LIST-PROCESSING.


    BACK.
    LV_R2 = PA_TABL1.
    WRITE: 49 LV_R2 INVERSE ON COLOR 6,'is checktable for following tables' COLOR 5, LV_TEX2 INVERSE ON COLOR 6.
    FORMAT INVERSE ON COLOR 4.
    ULINE /49(48).
    FORMAT INVERSE OFF.
    FORMAT COLOR OFF.
    IF RBS = 'X'.
      CLEAR LV_TB1.
      LV_TB1 = LV_COUNTER_CHKTBLS.
      LV_TEX1 = PA_TABL1.
      CONCATENATE LV_TEX1 'is checktable for' LV_TB1 'tables' INTO LV_TEX1 SEPARATED BY SPACE.
      CLEAR LV_TB1.
    ENDIF.


    SKIP.


    WRITE: /34 'DEPENDENT TABLE' COLOR 3,
            68 'FIELD' COLOR 3,
           133 'CHECKTABLE' COLOR 3.
    SKIP.


  ENDIF.


  CLEAR LV_RE.
  LOOP AT IT_DD08L1 INTO WA_DD08L1.


    LV_RE = LV_RE + 1.


    IF SY-TABIX = 1.
      SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T1 WHERE TABNAME = WA_DD08L1-CHECKTABLE AND DDLANGUAGE = 'EN'.
      CONCATENATE '(' WA_DD02T1-DDTEXT ')' INTO LV_TB1.
      ULINE 99(64).
      PERFORM CALCULATE_POSITION USING LV_TB1 '132' '0.5'.
      WRITE: /99 SY-VLINE, AT LV_TPOS1 LV_TB1 INVERSE ON COLOR 1, 162 SY-VLINE.
      CLEAR: LV_TB1, WA_DD02T1.
      LV_TB1 = WA_DD08L1-CHECKTABLE.
      WRITE: /99 SY-VLINE.
      WRITE: 133 LV_TB1 INVERSE ON COLOR 6, 162 SY-VLINE.
      ULINE /99(64).
      WRITE /135 ICON_TREND_DOWN AS ICON.
      CLEAR LV_TB1.
      SKIP.
    ENDIF.


    WRITE 2 SY-VLINE.
    ULINE 2(130).
    WRITE 131 SY-VLINE.


    IF WA_DD08L1-TABNAME <> WA_DD02T1-TABNAME OR SY-TABIX = 1.
      SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T1 WHERE TABNAME = WA_DD08L1-TABNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    SELECT SINGLE FIELDNAME ROLLNAME FROM DD03L INTO (WA_DD03L4-FIELDNAME,WA_DD03L4-ROLLNAME) WHERE TABNAME = WA_DD08L1-TABNAME AND FIELDNAME = WA_DD08L1-FIELDNAME AND CHECKTABLE = WA_DD08L1-CHECKTABLE..
    IF WA_DD03L4-ROLLNAME <> WA_DD04T2-ROLLNAME OR SY-TABIX = 1.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L4-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    LV_TB1 = WA_DD08L1-TABNAME.
    WRITE: /2 SY-VLINE, 34 LV_TB1 INVERSE ON COLOR 5.
    CLEAR LV_TB1.


    LV_TB1 = WA_DD08L1-FIELDNAME.
    WRITE: LV_TB1 UNDER 'FIELD', 131 SY-VLINE.
    CLEAR LV_TB1.


    CONCATENATE '(' WA_DD02T1-DDTEXT ')' INTO LV_TB1.
    CLEAR: LV_TLEN, LV_TPOS1.
    PERFORM CALCULATE_POSITION USING LV_TB1 '34' '0.5'.
    WRITE: /2 SY-VLINE, AT LV_TPOS1 LV_TB1 INVERSE ON COLOR 1.
    CLEAR LV_TB1.
    CONCATENATE '(' WA_DD04T2-DDTEXT ')' INTO LV_TB1.
    WRITE: 68 LV_TB1 INVERSE ON COLOR 7, 131 SY-VLINE.




    CLEAR LV_TB1.
    WRITE: /2 SY-VLINE, 131 SY-VLINE.
    WRITE: /2 SY-VLINE, 131 SY-VLINE.
    CLEAR WA_DD08L1.


  ENDLOOP.


  IF LV_RE IS NOT INITIAL.
    ULINE 2(130).
    IF  RBS <> 'X'.
      LV_A = LV_RE.
      CONCATENATE PA_TABL1 'is checktable for' LV_A 'important tables' LV_TEX2 INTO LV_TEX1 SEPARATED BY SPACE.
      MESSAGE LV_TEX1 TYPE 'S'.
      CLEAR LV_TEX1.
      CLEAR LV_TEX2.
      CLEAR LV_RE.
    ELSE.
      MESSAGE LV_TEX1 TYPE 'S'.
      CLEAR LV_TEX1.
    ENDIF.
  ELSE.
    MESSAGE 'No hits found' TYPE 'S'.
  ENDIF.


  CLEAR: IT_DD08L1, WA_DD08L1, WA_DD02T1, WA_DD04T2, WA_DD03L4, R_TAB[], LV_RE, LV_TB1, LV_TEX1, LV_TEX2.


ENDFORM.                    " AS_CHECKTABLE


*&---------------------------------------------------------------------*
*&      Form  FIELD
*&---------------------------------------------------------------------*
FORM FIELD .


  IF LV_CH <> 'vld'.
    PA_TABL1 = LV_CH.
  ELSE.
    PA_TABL2 = PA_TABL2.
  ENDIF.


ENDFORM.                    " FIELD


*&---------------------------------------------------------------------*
*&      Form  CHECKTABLES
*&---------------------------------------------------------------------*
FORM CHECKTABLES.


  IF WA_TABCLS1-TABCLASS = 'INTTAB' OR WA_TABCLS1-TABCLASS = 'APPEND'.
    CONCATENATE 'Please enter a table for relationships.' PA_TABL1 'is structure' INTO LV_TEX1 SEPARATED BY SPACE.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR SY-UCOMM.
    MESSAGE LV_TEX1 TYPE 'E'.
    CLEAR LV_TEX1.
  ENDIF.


  IF WA_TABCLS1-TABCLASS = 'VIEW' AND WA_TABCLS1-VIEWCLASS <> 'D' AND WA_TABCLS1-VIEWCLASS <> 'P'.
    CONCATENATE 'View' PA_TABL1 'not a database or projection view(No entries)' INTO LV_TEX1 SEPARATED BY SPACE.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR SY-UCOMM.
    MESSAGE LV_TEX1 TYPE 'E'.
    CLEAR LV_TEX1.
  ENDIF.


  SELECT TABNAME FIELDNAME CHECKTABLE FROM DD08L INTO TABLE IT_DD08L2 WHERE TABNAME = PA_TABL1.


  IF IT_DD08L2 IS NOT INITIAL.


    LEAVE TO LIST-PROCESSING.
    SET PF-STATUS SPACE.
    BACK.
    LV_R2 = PA_TABL1.
    WRITE: 65 LV_R2 INVERSE ON COLOR 6,'has following check tables' COLOR 5.
    FORMAT INVERSE ON COLOR 4.
    ULINE /65(35).
    FORMAT INVERSE OFF.
    FORMAT COLOR OFF.
    SKIP.


    WRITE: /28 'DEPENDENT TABLE' COLOR 3,
            62 'FIELD' COLOR 3,
           125 'CHECKTABLE' COLOR 3.
    SKIP.
  ENDIF.


  CLEAR LV_RE.
  LOOP AT IT_DD08L2 INTO WA_DD08L2.


    LV_RE = LV_RE + 1.
    IF SY-TABIX = 1.
      SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T1 WHERE TABNAME = WA_DD08L2-TABNAME AND DDLANGUAGE = 'EN'.
      CONCATENATE '(' WA_DD02T1-DDTEXT ')' INTO LV_TB1.
      CLEAR: LV_TLEN, LV_TPOS1.
      PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
      ULINE 2(64).
      WRITE: /2 SY-VLINE INVERSE ON COLOR 6, AT LV_TPOS1 LV_TB1 INVERSE ON COLOR 1, 65 SY-VLINE INVERSE ON COLOR 6.
      LV_TB1 = WA_DD08L2-TABNAME.
      WRITE: /2 SY-VLINE INVERSE ON COLOR 6.
      WRITE: 33 LV_TB1 INVERSE ON COLOR 6, 65 SY-VLINE INVERSE ON COLOR 6.
      CLEAR LV_TB1.
      ULINE /2(64).
      WRITE /35 ICON_TREND_DOWN AS ICON.
      ULINE /61(127).
      WRITE 187 SY-VLINE.
    ENDIF.


    SELECT SINGLE TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO WA_DD03L4 WHERE FIELDNAME = WA_DD08L2-FIELDNAME AND ROLLNAME <> ' '.
    SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L4-ROLLNAME AND DDLANGUAGE = 'EN'.
    LV_TB1 = WA_DD08L2-FIELDNAME.
    WRITE: /61 SY-VLINE, LV_TB1 UNDER 'FIELD'.
    CLEAR LV_TB1.


    SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T1 WHERE TABNAME = WA_DD08L2-CHECKTABLE AND DDLANGUAGE = 'EN'.
    LV_TB1 = WA_DD08L2-CHECKTABLE.
    WRITE: LV_TB1 INVERSE ON COLOR 5 UNDER 'CHECKTABLE', 187 SY-VLINE.
    CLEAR: LV_TB1.


    CONCATENATE '(' WA_DD04T2-DDTEXT ')' INTO LV_TB1.
    WRITE:  /61 SY-VLINE, 62 LV_TB1 INVERSE ON COLOR 7.
    CLEAR: WA_DD03L4, WA_DD04T2, LV_TB1.




    CONCATENATE '(' WA_DD02T1-DDTEXT ')' INTO LV_TB1.
    WRITE: 125 LV_TB1 INVERSE ON COLOR 1, 187 SY-VLINE.
    CLEAR: LV_TB1, WA_DD02T1.
    WRITE: /61 SY-VLINE, 187 SY-VLINE.
    WRITE: /61 SY-VLINE, 187 SY-VLINE.


    ULINE 61(127).
    CLEAR WA_DD08L2.


  ENDLOOP.


  IF LV_RE IS NOT INITIAL.
    LV_A = LV_RE.
    CONCATENATE PA_TABL1 'has' LV_A 'checktables' INTO LV_TEX1 SEPARATED BY SPACE.
    MESSAGE LV_TEX1 TYPE 'S'.
    CLEAR: LV_A, LV_TEX1.
  ELSE.
    CONCATENATE PA_TABL1 'has no checktables' INTO LV_TEX1 SEPARATED BY SPACE.
    MESSAGE LV_TEX1 TYPE 'S'.
    CLEAR LV_TEX1.
  ENDIF.


  CLEAR: IT_DD08L2, WA_DD08L2, WA_DD02T1, WA_DD04T2, WA_DD03L4, LV_R2, LV_RE.


ENDFORM.                    " CHECKTABLES


*&---------------------------------------------------------------------*
*&      Form  CHECK_NO_OF_ENTRIES
*&---------------------------------------------------------------------*
FORM CHECK_NO_OF_ENTRIES .


  IF WA_TABCLS1-TABCLASS <> 'INTTAB' AND WA_TABCLS1-TABCLASS <> 'APPEND' AND WA_TABCLS1-VIEWCLASS <> 'H' AND
     WA_TABCLS1-VIEWCLASS <> 'S' AND WA_TABCLS1-VIEWCLASS <> 'C' AND WA_TABCLS1-VIEWCLASS <> 'E' AND
     WA_TABCLS1-VIEWCLASS <> 'V' AND WA_TABCLS1-VIEWCLASS <> 'A'.


    TRY.
        SELECT COUNT(*) FROM (PA_TABL1) INTO LV_LEN.
      CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS.
        LF_EXCEPTION = 1.
    ENDTRY.


    IF LF_EXCEPTION = 1 OR LV_LEN IS INITIAL.
      PA_N = 0.
      CONCATENATE PA_TABL1 'has no entries' INTO LV_TB1 SEPARATED BY SPACE.
      MESSAGE LV_TB1 TYPE 'S'.
      CLEAR LV_TB1.
      CLEAR LF_EXCEPTION.
    ELSE.
      PA_N = LV_LEN.
    ENDIF.
  ELSE.
    IF WA_TABCLS1-TABCLASS = 'INTTAB' OR WA_TABCLS1-TABCLASS = 'APPEND'.
      CONCATENATE PA_TABL1 'is a structure(No data)' INTO LV_TEX1 SEPARATED BY SPACE.
      CLEAR SSCRFIELDS-UCOMM.
      CLEAR SY-UCOMM.
      MESSAGE LV_TEX1 TYPE 'E'.
      CLEAR LV_TEX1.
    ELSEIF WA_TABCLS1-TABCLASS = 'VIEW' AND WA_TABCLS1-VIEWCLASS <> 'D' AND WA_TABCLS1-VIEWCLASS <> 'P'.
      CONCATENATE 'View' PA_TABL1 'not a database or projection view(No entries)' INTO LV_TEX1 SEPARATED BY SPACE.
      CLEAR SSCRFIELDS-UCOMM.
      CLEAR SY-UCOMM.
      MESSAGE LV_TEX1 TYPE 'E'.
      CLEAR LV_TEX1.
    ENDIF.
  ENDIF.
  LF_TABLE3 = PA_TABL1.
  LF_N2 = 1.
  LF_CHECK_ENTRIES = 1.


  CLEAR: LV_TEX1.


ENDFORM.                    " CHECK_NO_OF_ENTRIES


*&---------------------------------------------------------------------*
*&      Form  TEXTS
*&---------------------------------------------------------------------*
FORM TEXTS .
  LV_TEX5 = 'dilavni edoc ecruoS'.
  PERFORM DO USING LV_TEX5.
ENDFORM.                    " TEXTS


*&---------------------------------------------------------------------*
*&      Form  RELATIONSHIPS
*&---------------------------------------------------------------------*
FORM RELATIONSHIPS .


  REFRESH IT_DD03L1.
  SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L1 WHERE TABNAME = PA_TABL1.
  SORT IT_DD03L1 BY POSITION.


  CLEAR R_TAB[].
  IF RB5 = 'X'.
    CLEAR R_TAB[].
    PERFORM SD.
    LV_MOD = 'SD'.
  ELSEIF RB6 = 'X'.
    CLEAR R_TAB[].
    PERFORM MM.
    LV_MOD = 'MM'.
  ELSEIF RB7 = 'X'.
    CLEAR R_TAB[].
    PERFORM PP.
    LV_MOD = 'PP'.
  ELSEIF RB8 = 'X'.
    CLEAR R_TAB[].
    PERFORM FI.
    LV_MOD = 'FI'.
  ELSEIF RB9 = 'X'.
    CLEAR R_TAB[].
    PERFORM PM.
    LV_MOD = 'PM'.
  ELSEIF RBW = 'X'.
    CLEAR R_TAB[].
    PERFORM WM.
    LV_MOD = 'WM'.
  ELSEIF RBQ = 'X'.
    CLEAR R_TAB[].
    PERFORM QM.
    LV_MOD = 'QM'.
  ELSEIF RBH = 'X'.
    CLEAR R_TAB[].
    PERFORM HR.
    LV_MOD = 'HR'.
  ENDIF.


  CHECK R_TAB[] IS NOT INITIAL.
  SORT R_TAB[] BY LOW.
  DELETE ADJACENT DUPLICATES FROM R_TAB[] COMPARING LOW.
  REFRESH: IT_CHECK1, IT_DD03L2.
  CLEAR: WA_DD03L1, WA_DD03L2, WA_CHECK1, WA_DD04T1, WA_DD04T2, WA_DD02T1.


  LOOP AT R_TAB.


    IF R_TAB-LOW = PA_TABL1.
      CONTINUE.
    ENDIF.


    REFRESH: IT_DD03L2.
    SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L2 WHERE TABNAME = R_TAB-LOW.
    SORT IT_DD03L2 BY POSITION.


    LOOP AT IT_DD03L1 INTO WA_DD03L1 WHERE DATATYPE <> 'CLNT' AND DATATYPE <> 'LANG' AND FIELDNAME NS '.INCLU' AND KEYFLAG = 'X'.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T1 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
      LOOP AT IT_DD03L2 INTO WA_DD03L2 WHERE ROLLNAME  CS WA_DD03L1-ROLLNAME  OR ROLLNAME  CS WA_DD03L1-FIELDNAME OR
                                             FIELDNAME CS WA_DD03L1-FIELDNAME OR FIELDNAME CS WA_DD03L1-ROLLNAME  OR
                                             DOMNAME    = WA_DD03L1-DOMNAME   OR DOMNAME    = WA_DD03L1-FIELDNAME OR
                                             FIELDNAME  = WA_DD03L1-DOMNAME   OR ROLLNAME   = WA_DD03L1-DOMNAME   OR
                                             DOMNAME    = WA_DD03L1-ROLLNAME.


        IF WA_DD03L2-DOMNAME    = WA_DD03L1-DOMNAME   OR WA_DD03L2-DOMNAME    = WA_DD03L1-FIELDNAME OR
           WA_DD03L2-FIELDNAME  = WA_DD03L1-DOMNAME   OR WA_DD03L2-ROLLNAME   = WA_DD03L1-DOMNAME   OR
           WA_DD03L2-DOMNAME    = WA_DD03L1-ROLLNAME.


          SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
          IF ( WA_DD04T2-DDTEXT   CS  WA_DD04T1-DDTEXT OR   WA_DD04T1-DDTEXT   CS  WA_DD04T2-DDTEXT ) OR
             ( WA_DD03L2-DATATYPE <> 'DATS'            AND  WA_DD03L2-DOMNAME  <>  'USNAM'            AND
               WA_DD03L2-DOMNAME  <> 'XFELD'           AND  WA_DD03L2-DATATYPE <>  'TIMS'             AND   WA_DD03L2-DOMNAME <> 'SPRAS' ).
            IF WA_DD03L2-DATATYPE <> 'TIMS' AND WA_DD03L2-DOMNAME <> 'SPRAS'.


              PERFORM APPEND1 USING R_TAB-LOW.


            ENDIF.
          ENDIF.


        ELSE.


          PERFORM APPEND1 USING R_TAB-LOW.


        ENDIF.
        CLEAR WA_DD03L2.
        LF_WA_CLEAR = 1.


      ENDLOOP.


      IF LF_WA_CLEAR IS INITIAL.
        IF WA_DD03L2 IS INITIAL.
          LOOP AT IT_DD03L2 INTO WA_DD03L2.
            SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
            IF WA_DD04T2-DDTEXT CS WA_DD04T1-DDTEXT OR WA_DD04T1-DDTEXT CS WA_DD04T2-DDTEXT.


              PERFORM APPEND1 USING R_TAB-LOW.


            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
      CLEAR: WA_DD03L1, WA_DD03L2, LF_WA_CLEAR.
    ENDLOOP.


    LOOP AT IT_DD03L2 INTO WA_DD03L2 WHERE DATATYPE <> 'CLNT' AND DATATYPE <> 'LANG' AND FIELDNAME NS '.INCLU' AND KEYFLAG = 'X'.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T1 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
      LOOP AT IT_DD03L1 INTO WA_DD03L1 WHERE ROLLNAME  CS WA_DD03L2-ROLLNAME  OR ROLLNAME  CS WA_DD03L2-FIELDNAME OR
                                             FIELDNAME CS WA_DD03L2-FIELDNAME OR FIELDNAME CS WA_DD03L2-ROLLNAME  OR
                                             DOMNAME    = WA_DD03L2-DOMNAME   OR DOMNAME    = WA_DD03L2-FIELDNAME OR
                                             FIELDNAME  = WA_DD03L2-DOMNAME   OR ROLLNAME   = WA_DD03L2-DOMNAME   OR
                                             DOMNAME    = WA_DD03L2-ROLLNAME.


        IF WA_DD03L1-DOMNAME    = WA_DD03L2-DOMNAME   OR WA_DD03L1-DOMNAME    = WA_DD03L2-FIELDNAME OR
           WA_DD03L1-FIELDNAME  = WA_DD03L2-DOMNAME   OR WA_DD03L1-ROLLNAME   = WA_DD03L2-DOMNAME   OR
           WA_DD03L1-DOMNAME    = WA_DD03L2-ROLLNAME.


          SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
          IF ( WA_DD04T1-DDTEXT   CS   WA_DD04T2-DDTEXT  OR   WA_DD04T2-DDTEXT   CS   WA_DD04T1-DDTEXT ) OR
             ( WA_DD03L1-DATATYPE <>  'DATS'             AND  WA_DD03L1-DOMNAME  <>  'USNAM'             AND
               WA_DD03L1-DOMNAME  <> 'XFELD'             AND  WA_DD03L1-DATATYPE <>  'TIMS'              AND   WA_DD03L1-DOMNAME <> 'SPRAS' ).
            IF WA_DD03L1-DATATYPE <>  'TIMS'             AND  WA_DD03L1-DOMNAME  <>  'SPRAS'.


              PERFORM APPEND2 USING R_TAB-LOW.


            ENDIF.
          ENDIF.


        ELSE.


          PERFORM APPEND2 USING R_TAB-LOW.


        ENDIF.
        CLEAR WA_DD03L1.
        LF_WA_CLEAR = 1.


      ENDLOOP.


      IF LF_WA_CLEAR IS INITIAL.
        IF WA_DD03L1 IS INITIAL.
          LOOP AT IT_DD03L1 INTO WA_DD03L1.
            SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T2 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
            IF WA_DD04T1-DDTEXT CS WA_DD04T2-DDTEXT OR WA_DD04T2-DDTEXT CS WA_DD04T1-DDTEXT.


              PERFORM APPEND2 USING R_TAB-LOW.


            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
      CLEAR: WA_DD03L1, WA_DD03L2, LF_WA_CLEAR.
    ENDLOOP.
    CLEAR R_TAB.


  ENDLOOP.


  SORT IT_CHECK1 BY CHECKTABLE POSITION FIELDNAME.
  DELETE ADJACENT DUPLICATES FROM IT_CHECK1 COMPARING ALL FIELDS.
  SORT IT_CHECK1 BY CHECKTABLE POSITION FIELDNAME.
  IF IT_CHECK1 IS NOT INITIAL.


    CLEAR: IT_CHECK2.
    LOOP AT IT_CHECK1 INTO WA_CHECK1.


      ON CHANGE OF WA_CHECK1-CHECKTABLE.


        LOOP AT IT_CHECK1 INTO WA_CHECK2 WHERE CHECKTABLE = WA_CHECK1-CHECKTABLE AND FIELDNAME NS '*'.
          IF WA_CHECK2 IS NOT INITIAL.
            APPEND WA_CHECK2 TO IT_CHECK2.
          ENDIF.
          CLEAR WA_CHECK2.
        ENDLOOP.


        LOOP AT IT_CHECK1 INTO WA_CHECK2 WHERE CHECKTABLE = WA_CHECK1-CHECKTABLE AND FIELDNAME CS '*'.
          IF WA_CHECK2 IS NOT INITIAL.
            APPEND WA_CHECK2 TO IT_CHECK2.
          ENDIF.
          CLEAR WA_CHECK2.
        ENDLOOP.


      ENDON.
      CLEAR WA_CHECK1.


    ENDLOOP.




    IF IT_CHECK2 IS NOT INITIAL.


      LEAVE TO LIST-PROCESSING.
      SET PF-STATUS SPACE.
      SKIP 2.
      BACK.
      LV_TB1 = PA_TABL1.
      WRITE: 55 'Relationships for' COLOR 5, LV_TB1 INVERSE ON COLOR 6, 'in' COLOR 5, LV_MOD INVERSE ON COLOR 6.
      FORMAT INVERSE ON COLOR 4.
      ULINE /55(33).
      FORMAT INVERSE OFF.
      FORMAT COLOR OFF.
      WRITE: /34 'TABLE1' COLOR 3,
              68 'FIELD'  COLOR 3,
             103 'TABLE2' COLOR 3.


      SKIP.
    ENDIF.


    CLEAR LV_RE.
    LOOP AT IT_CHECK2 INTO WA_CHECK2.


      IF WA_CHECK2-FIELDNAME CS '*'.
        WRITE: /2 SY-VLINE, 143 SY-VLINE.
      ENDIF.


      ON CHANGE OF WA_CHECK2-CHECKTABLE.
        LV_RE = LV_RE + 1.
        ULINE 2(142).
        SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T1 WHERE TABNAME = PA_TABL1 AND DDLANGUAGE = 'EN'.
        SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T2 WHERE TABNAME = WA_CHECK2-CHECKTABLE AND DDLANGUAGE = 'EN'.
        CONCATENATE '(' WA_DD02T1-DDTEXT ')' INTO LV_TB1.
        CONCATENATE '(' WA_DD02T2-DDTEXT ')' INTO LV_TEX2.
        WRITE:  /2 SY-VLINE, 33 WA_CHECK2-TABNAME INVERSE ON COLOR 6,
                 103 WA_CHECK2-CHECKTABLE INVERSE ON COLOR 5, 143 SY-VLINE.


        PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 LV_TB1 INVERSE ON COLOR 6.
        PERFORM CALCULATE_POSITION USING LV_TEX2 '103' '0.5'.
        WRITE:  AT LV_TPOS1 LV_TEX2 INVERSE ON COLOR 5, 143 SY-VLINE.
        WRITE: /2 SY-VLINE, 143 SY-VLINE.
      ENDON.


      CLEAR: LV_TB1, LV_TEX2, WA_DD02T1, WA_DD02T2.


      IF WA_CHECK2-FIELDNAME CS '*'.
        SPLIT WA_CHECK2-FIELDNAME AT '*' INTO LV_TFLD1 LV_TFLD2.
        PERFORM CALCULATE_POSITION USING LV_TFLD1 '64' '1'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 ICON_COLUMN_LEFT AS ICON.
        WRITE LV_TFLD1 INVERSE ON COLOR 6.
        CLEAR LV_TPOS1.
        WRITE ICON_ARROW_LEFT AS ICON.
        WRITE ICON_ARROW_RIGHT AS ICON.
        WRITE LV_TFLD2 INVERSE ON COLOR 5.
        WRITE: ICON_COLUMN_RIGHT AS ICON, 143 SY-VLINE.


        CLEAR: LV_TLEN, LV_TPOS1.
        PERFORM CALCULATE_POSITION USING WA_CHECK2-TEXT1 '63' '1'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 '(', WA_CHECK2-TEXT1 INVERSE ON COLOR 7, ')'.
        WRITE: 74 '(', WA_CHECK2-TEXT2 INVERSE ON COLOR 7, ')', 143 SY-VLINE.
      ELSE.
        CLEAR: LV_TFLD1, LV_TFLD2, LV_TLEN, LV_TPOS1.
        SPLIT WA_CHECK2-FIELDNAME AT '#' INTO LV_TFLD1 LV_TFLD2.
        SPLIT LV_TFLD2 AT '#' INTO LV_TFLD2 LV_TFLD3.
        PERFORM CALCULATE_POSITION USING LV_TFLD1 '64' '1'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 ICON_COLUMN_LEFT AS ICON.
        WRITE LV_TFLD1 INVERSE ON COLOR 6.
        CLEAR LV_TPOS1.
        WRITE LV_TFLD2.
        WRITE LV_TFLD3 INVERSE ON COLOR 5.
        WRITE: ICON_COLUMN_RIGHT AS ICON, 143 SY-VLINE.
        IF WA_CHECK2-TEXT1 = WA_CHECK2-TEXT2.
          CLEAR: LV_TLEN, LV_TPOS1.
          PERFORM CALCULATE_POSITION USING WA_CHECK2-TEXT1 '69' '0.5'.
          WRITE: /2 SY-VLINE, AT LV_TPOS1 '(', WA_CHECK2-TEXT1 INVERSE ON COLOR 7, ')', 143 SY-VLINE.
        ELSE.
          CLEAR: LV_TLEN, LV_TPOS1.
          PERFORM CALCULATE_POSITION USING WA_CHECK2-TEXT1 '63' '1'.
          WRITE: /2 SY-VLINE, AT LV_TPOS1 '(', WA_CHECK2-TEXT1 INVERSE ON COLOR 7, ')'.
          WRITE: 74 '(', WA_CHECK2-TEXT2 INVERSE ON COLOR 7, ')', 143 SY-VLINE.
        ENDIF.
      ENDIF.




      IF WA_CHECK2-FIELDNAME CS '*'.
        WRITE: /2 SY-VLINE, 48 'May not be appropriate in all cases(Please check)' INVERSE ON COLOR 3, 143 SY-VLINE.
      ENDIF.
      WRITE: /2 SY-VLINE, 143 SY-VLINE.
      CLEAR WA_CHECK2.


    ENDLOOP.


  ENDIF.


  IF LV_RE IS NOT INITIAL.
    ULINE 2(142).
    LV_A = LV_RE.
    CONCATENATE 'Relationships found with' LV_A 'important tables in' LV_MOD INTO LV_TEX1 SEPARATED BY SPACE.
    MESSAGE LV_TEX1 TYPE 'S'.
    CLEAR LV_TEX1.
    CLEAR LV_A.
  ELSE.
    LV_TEX1 = 'No relationships found with chosen tables'.
    MESSAGE LV_TEX1 TYPE 'S'.
    CLEAR LV_TEX1.
  ENDIF.


  CLEAR: WA_DD03L1, WA_DD03L2, WA_DD03L3,WA_DD03L4, WA_CHECK1, WA_CHECK2, WA_DD04T1, WA_DD04T2,
         WA_DD04T3, WA_DD04T4, WA_DD02T1, WA_DD02T2, WA_DD02T3, LV_FILD1, LV_FILD2, LV_FILD3, LV_FILD4, LV_FILD5,
         LV_FILD6, LV_FILD7, LV_TB1, LV_A, LV_TEX1, LV_TEX2, LV_RE, LV_I.




  REFRESH: IT_DD03L1, IT_DD03L2, IT_DD03L3, IT_DD03L4 , IT_CHECK1, IT_CHECK2.


ENDFORM.                    " RELATIONSHIPS


*&---------------------------------------------------------------------*
*&      Form  FIELD_SEARCH
*&---------------------------------------------------------------------*
FORM FIELD_SEARCH .


  REFRESH: IT_DD03L1, IT_DD03L2, IT_DD03L3, IT_DD03L4 , IT_CHECK1, IT_DD04T.


  CLEAR R_TAB[].
  PERFORM T5.
  IF RB5 = 'X'.
    PERFORM SD.
    LV_MOD = 'SD'.
  ELSEIF RB6 = 'X'.
    PERFORM MM.
    LV_MOD = 'MM'.
  ELSEIF RB7 = 'X'.
    PERFORM PP.
    LV_MOD = 'PP'.
  ELSEIF RB8 = 'X'.
    PERFORM FI.
    LV_MOD = 'FI'.
  ELSEIF RB9 = 'X'.
    PERFORM PM.
    LV_MOD = 'PM'.
  ELSEIF RBW = 'X'.
    PERFORM WM.
    LV_MOD = 'WM'.
  ELSEIF RBQ = 'X'.
    PERFORM QM.
    LV_MOD = 'QM'.
  ELSEIF RBH = 'X'.
    PERFORM HR.
    LV_MOD = 'HR'.
  ENDIF.


  CHECK R_TAB[] IS NOT INITIAL.
  SORT R_TAB[] BY LOW.
  DELETE ADJACENT DUPLICATES FROM R_TAB[] COMPARING LOW.


  IF RB11 = 'X'.
    SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L1 WHERE TABNAME IN R_TAB AND FIELDNAME = PA_FNAM.
    CLEAR LV_RE.


    IF IT_DD03L1 IS NOT INITIAL.
      LEAVE TO LIST-PROCESSING.
      SET PF-STATUS SPACE.
      SKIP 2.
      WRITE: /33  'FIELD' COLOR 3,
              82  'CONTAINING TABLE' COLOR 3.
      SKIP 1.
    ENDIF.


    LOOP AT IT_DD03L1 INTO WA_DD03L1.
      SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T3 WHERE TABNAME = WA_DD03L1-TABNAME AND DDLANGUAGE = 'EN'.
      LV_RE = LV_RE + 1.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T3 WHERE DDLANGUAGE = 'EN' AND ROLLNAME = WA_DD03L1-ROLLNAME.
      CLEAR: LV_FILD7, LV_FILD6.
      IF WA_DD03L1-KEYFLAG = 'X'.
        ULINE 2(136).
        LV_TB1 = WA_DD03L1-FIELDNAME.
        WRITE: /2 SY-VLINE, 33 LV_TB1.
        CLEAR LV_TB1.
        CONCATENATE '(' 'KEY' ')' INTO LV_TB1.
        WRITE: LV_TB1 INVERSE ON COLOR 5.
        CLEAR LV_TB1.
        LV_TB1 = WA_DD03L1-TABNAME.
        WRITE: 82 LV_TB1 INVERSE ON COLOR 6, 137 SY-VLINE.
        CLEAR LV_TB1.
        CONCATENATE '(' WA_DD04T3-DDTEXT ')' INTO LV_TB1.
        PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 LV_TB1 INVERSE ON COLOR 7.
        CLEAR LV_TB1.
        CONCATENATE '(' WA_DD02T3-DDTEXT ')' INTO LV_TB1.
        WRITE: 72 LV_TB1 INVERSE ON COLOR 1, 137 SY-VLINE.
        CLEAR LV_TB1.
        WRITE: /2 SY-VLINE, 137 SY-VLINE.
      ELSE.
        ULINE 2(136).
        LV_TB1 = WA_DD03L1-FIELDNAME.
        WRITE: /2 SY-VLINE, 33 LV_TB1.
        CLEAR LV_TB1.
        CONCATENATE '(' 'NON-KEY' ')' INTO LV_TB1.
        WRITE: LV_TB1 INVERSE ON COLOR 5.
        CLEAR LV_TB1.
        LV_TB1 = WA_DD03L1-TABNAME.
        WRITE: 82 LV_TB1 INVERSE ON COLOR 6, 137 SY-VLINE.
        CLEAR LV_TB1.
        CONCATENATE '(' WA_DD04T3-DDTEXT ')' INTO LV_TB1.
        PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
        WRITE: /2 SY-VLINE, AT LV_TPOS1 LV_TB1 INVERSE ON COLOR 7.
        CLEAR LV_TB1.
        CONCATENATE '(' WA_DD02T3-DDTEXT ')' INTO LV_TB1.
        WRITE: 72 LV_TB1 INVERSE ON COLOR 1, 137 SY-VLINE.
        CLEAR LV_TB1.
        WRITE: /2 SY-VLINE, 137 SY-VLINE.
      ENDIF.


      WRITE: /2 SY-VLINE, 137 SY-VLINE.
      CLEAR WA_DD03L1.
    ENDLOOP.


  ELSEIF RB12 = 'X'.


    SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L1 WHERE TABNAME IN R_TAB.


    IF IT_DD03L1 IS NOT INITIAL.
      SELECT ROLLNAME DDTEXT FROM DD04T INTO TABLE IT_DD04T FOR ALL ENTRIES IN IT_DD03L1 WHERE ROLLNAME = IT_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.


    LOOP AT IT_DD04T INTO WA_DD04T3 WHERE DDTEXT CS PA_FDES.
      SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L2 WHERE ROLLNAME = WA_DD04T3-ROLLNAME AND TABNAME IN R_TAB.
      APPEND LINES OF IT_DD03L2 TO IT_DD03L3.
      CLEAR WA_DD04T3.
    ENDLOOP.


    CLEAR: LV_FILD6, LV_FILD7.
    CLEAR LV_RE.


    IF IT_DD03L3 IS NOT INITIAL.
      LEAVE TO LIST-PROCESSING.
      SET PF-STATUS SPACE.
      SKIP 2.
      WRITE: /33  'FIELD' COLOR 3,
              82  'CONTAINING TABLE' COLOR 3.
      SKIP 1.
    ENDIF.


    LOOP AT IT_DD03L3 INTO WA_DD03L3.


      LV_RE = LV_RE + 1.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T4 WHERE ROLLNAME = WA_DD03L3-ROLLNAME AND DDLANGUAGE = 'EN'.


      IF WA_DD03L3-KEYFLAG = 'X'.
        ULINE 2(136).
        LV_TB1 = WA_DD03L3-FIELDNAME.
        WRITE: /2 SY-VLINE, 33 LV_TB1.
        CLEAR LV_TB1.
        CONCATENATE '(' 'KEY' ')' INTO LV_TB1.
        WRITE: LV_TB1 INVERSE ON COLOR 5.
        CLEAR LV_TB1.
        LV_TB1 = WA_DD03L3-TABNAME.
        WRITE: 82 LV_TB1 INVERSE ON COLOR 6.
        WRITE 137 SY-VLINE.
        CLEAR LV_TB1.


        LV_TB1 = WA_DD04T4-DDTEXT.
        PERFORM HIGHLIGHT_KEYWORD.
        WRITE: 2 SY-VLINE, 137 SY-VLINE.
        CLEAR LV_TB1.


        SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T3 WHERE TABNAME = WA_DD03L3-TABNAME AND DDLANGUAGE = 'EN'.
        LV_TB1 = WA_DD02T3-DDTEXT.
        WRITE: 72 '(', LV_TB1 INVERSE ON COLOR 7, ')'.
        CLEAR LV_TB1.
        WRITE: /2 SY-VLINE, 137 SY-VLINE.


      ELSE.
        ULINE 2(136).
        LV_TB1 = WA_DD03L3-FIELDNAME.
        WRITE: /2 SY-VLINE, 33 LV_TB1.
        CLEAR LV_TB1.
        CONCATENATE '(' 'NON-KEY' ')' INTO LV_TB1.
        WRITE: LV_TB1 INVERSE ON COLOR 5.
        CLEAR LV_TB1.
        LV_TB1 = WA_DD03L3-TABNAME.
        WRITE: 82 LV_TB1 INVERSE ON COLOR 6.
        WRITE 137 SY-VLINE.
        CLEAR LV_TB1.


        LV_TB1 = WA_DD04T4-DDTEXT.
        PERFORM HIGHLIGHT_KEYWORD.
        WRITE: 2 SY-VLINE, 137 SY-VLINE.
        CLEAR LV_TB1.


        SELECT SINGLE TABNAME DDTEXT FROM DD02T INTO WA_DD02T3 WHERE TABNAME = WA_DD03L3-TABNAME AND DDLANGUAGE = 'EN'.
        LV_TB1 = WA_DD02T3-DDTEXT.
        WRITE: 72 '(', LV_TB1 INVERSE ON COLOR 7, ')'.
        CLEAR LV_TB1.
        WRITE: /2 SY-VLINE, 137 SY-VLINE.


      ENDIF.


      WRITE: /2 SY-VLINE, 137 SY-VLINE.
      CLEAR WA_DD03L3.


    ENDLOOP.


  ENDIF.


  IF LV_RE IS NOT INITIAL.
    ULINE 2(135).
    BACK.
    IF RB11 = 'X'.
      LV_TB1 = PA_FNAM.
      WRITE: 42 'Search results for' COLOR 5, LV_TB1 INVERSE ON COLOR 6, 'in' COLOR 5, LV_MOD INVERSE ON COLOR 6, 'tables' COLOR 5.
      ULINE /42(47).
      CLEAR LV_TB1.
    ELSE.
      LV_TB1 = PA_FDES.
      WRITE: 42 'Search results for' COLOR 5, LV_TB1 INVERSE ON COLOR 6, 'in' COLOR 5, LV_MOD INVERSE ON COLOR 6, 'tables' COLOR 5.
      ULINE /42(60).
      CLEAR LV_TB1.
    ENDIF.
  ENDIF.


  IF LV_RE IS NOT INITIAL.
    LV_A = LV_RE.
    CONCATENATE LV_A 'hits found' INTO LV_TEX1 SEPARATED BY SPACE.
    MESSAGE LV_TEX1 TYPE 'S'.
    CLEAR LV_TEX1.
    CLEAR LV_RE.
    CLEAR LV_A.
  ELSE.
    MESSAGE 'No hits found' TYPE 'S'.
    CLEAR LV_RE.
  ENDIF.




  CLEAR: WA_DD03L1, WA_DD03L2, WA_DD03L3, WA_DD03L4, WA_CHECK1, WA_DD04T1, WA_DD04T2, WA_DD04T3, WA_DD04T4,
         WA_DD02T1, WA_DD02T2, WA_DD02T3, LV_FILD1, LV_FILD2, LV_FILD3, LV_FILD4, LV_FILD5, LV_FILD6, LV_FILD7,
         LV_TB1, LV_A, LV_TEX1, LV_TEX2, LV_RE, LV_I.


  REFRESH: IT_DD03L1, IT_DD03L2, IT_DD03L3, IT_DD03L4 , IT_CHECK1 , IT_DD04T.


ENDFORM.                    " FIELD_SEARCH


*&---------------------------------------------------------------------*
*&      Form  HIGHLIGHT_KEYWORD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM HIGHLIGHT_KEYWORD .


  LV_LEN2 = STRLEN( PA_FDES ).
  LV_LEN1 = STRLEN( LV_TB1 ).
  LV_LEN4 = LV_LEN1.


  SEARCH LV_TB1 FOR PA_FDES.
  LV_SYFDPOS = SY-FDPOS.


  LV_LEN1 = LV_LEN1 - LV_SYFDPOS - LV_LEN2.
  LV_LEN3 = LV_SYFDPOS + LV_LEN2.




  IF LV_SYFDPOS = 0.
    LV_FLN1 = LV_SYFDPOS + LV_LEN2 + 1.
    PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
    WRITE: AT /LV_TPOS1 '('.
    LV_FLN1 = LV_TPOS1 + LV_FLN1 + 1.
    WRITE:LV_TB1+LV_SYFDPOS(LV_LEN2) INVERSE ON COLOR 6, AT LV_FLN1 LV_TB1+LV_LEN3(LV_LEN1) INVERSE ON COLOR 1. "INVERSE ON COLOR 6 INTENSIFIED OFF
    WRITE: ')'.


  ELSEIF LV_SYFDPOS <> 0.
    LV_FLN1 = LV_SYFDPOS - 1.
    LV_STR1 = LV_TB1+LV_FLN1(1).
    LV_FLN2 = LV_SYFDPOS + LV_LEN2.
    IF LV_FLN2 < LV_LEN4.
      LV_STR2 = LV_TB1+LV_FLN2(1).
      LV_FLN1 = LV_SYFDPOS + 1.
    ELSE.
      LV_STR2 = ''.
      LV_FLN1 = LV_SYFDPOS - 1.
    ENDIF.
    IF LV_STR1 NA '' AND LV_STR2 CA ''.
      PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
      WRITE: AT /LV_TPOS1 '('.
      LV_FLN1 = LV_TPOS1 + LV_FLN1 + 1.
      LV_FLN2 = LV_TPOS1 + LV_FLN2 + 1 + 1.
      WRITE: LV_TB1+0(LV_SYFDPOS) INVERSE ON COLOR 1, AT LV_FLN1 LV_TB1+LV_SYFDPOS(LV_LEN2) INVERSE ON COLOR 6, AT LV_FLN2 LV_TB1+LV_LEN3(LV_LEN1) INVERSE ON COLOR 1.
      WRITE: ')'.
    ELSEIF LV_STR1 NA '' AND LV_STR2 NA ''.
      CLEAR LV_FLN1.
      LV_FLN1 = LV_SYFDPOS + 1.
      LV_FLN2 = LV_FLN2 + 1.
      PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
      WRITE: AT /LV_TPOS1 '('.
      LV_FLN1 = LV_TPOS1 + LV_FLN1 + 1.
      LV_FLN2 = LV_TPOS1 + LV_FLN2 + 1.
      WRITE: LV_TB1+0(LV_SYFDPOS) INVERSE ON COLOR 1, AT LV_FLN1 LV_TB1+LV_SYFDPOS(LV_LEN2) INVERSE ON COLOR 6, AT LV_FLN2 LV_TB1+LV_LEN3(LV_LEN1) INVERSE ON COLOR 1.
      WRITE: ')'.
    ELSE.
      CLEAR LV_FLN1.
      LV_FLN1 = LV_SYFDPOS + 1.
      LV_FLN2 = LV_FLN2 + 1.
      PERFORM CALCULATE_POSITION USING LV_TB1 '33' '0.5'.
      WRITE: AT /LV_TPOS1 '('.
      LV_FLN1 = LV_TPOS1 + LV_FLN1 + 1.
      LV_FLN2 = LV_TPOS1 + LV_FLN2 + 1.
      WRITE: LV_TB1+0(LV_SYFDPOS) INVERSE ON COLOR 1, AT LV_FLN1 LV_TB1+LV_SYFDPOS(LV_LEN2) INVERSE ON COLOR 6, AT LV_FLN2 LV_TB1+LV_LEN3(LV_LEN1) INVERSE ON COLOR 1.
      WRITE: ')'.
    ENDIF.
  ENDIF.
  CLEAR: LV_STR1, LV_STR2, LV_LEN1, LV_LEN2, LV_LEN3, LV_LEN4, LV_FLN1, LV_FLN2, LV_SYFDPOS.


ENDFORM.                    " HIGHLIGHT_KEYWORD


*&---------------------------------------------------------------------*
*&      Form  SHOW_USEFUL_TABLES
*&---------------------------------------------------------------------*
FORM SHOW_USEFUL_TABLES .


  CLEAR R_TAB[].
  PERFORM T5.
  IF RB21 = 'X'.
    PERFORM SD.
    CLEAR LV_TEX1.
    LV_TEX1 = 'Useful Tables in SD'.
  ELSEIF RB22 = 'X'.
    PERFORM MM.
    CLEAR LV_TEX1.
    LV_TEX1 = 'Useful Tables in MM'.
  ELSEIF RB23 = 'X'.
    PERFORM PP.
    CLEAR LV_TEX1.
    LV_TEX1 = 'Useful Tables in PP'.
  ELSEIF RB24 = 'X'.
    PERFORM FI.
    CLEAR LV_TEX1.
    LV_TEX1 = 'Useful Tables in FI'.
  ELSEIF RB25 = 'X'.
    PERFORM PM.
    CLEAR LV_TEX1.
    LV_TEX1 = 'Useful Tables in PM'.
  ELSEIF RB26 = 'X'.
    PERFORM WM.
    CLEAR LV_TEX1.
    LV_TEX1 = 'Useful Tables in WM'.
  ELSEIF RB27 = 'X'.
    PERFORM QM.
    CLEAR LV_TEX1.
    LV_TEX1 = 'Useful Tables in QM'.
  ELSEIF RB28 = 'X'.
    PERFORM HR.
    CLEAR LV_TEX1.
    LV_TEX1 = 'Useful Tables in HR'.
  ENDIF.


  CHECK R_TAB[] IS NOT INITIAL.
  SORT R_TAB[] BY LOW.
  DELETE ADJACENT DUPLICATES FROM R_TAB[] COMPARING LOW.


  LEAVE TO LIST-PROCESSING.
  SET PF-STATUS SPACE.


  CHECK R_TAB[] IS NOT INITIAL.
  SKIP 2.
  WRITE: /20 'TABLENAME' COLOR 3, '(With Keyfields)' COLOR 3.


  CLEAR LV_RE.


  LOOP AT R_TAB.
    ULINE /15(90).
    WRITE: 15 SY-VLINE, 105 SY-VLINE.
    LV_RE = LV_RE + 1.
    LV_TB1 = R_TAB-LOW.
    SELECT SINGLE DDTEXT FROM DD02T INTO LV_TEX2 WHERE TABNAME = R_TAB-LOW AND DDLANGUAGE = 'EN'.
    WRITE: /15 SY-VLINE, LV_TB1 INVERSE ON COLOR 6 UNDER 'TABLENAME', '(', LV_TEX2, ')', 105 SY-VLINE.
    SELECT TABNAME FIELDNAME POSITION KEYFLAG ROLLNAME DATATYPE LENG DOMNAME FROM DD03L INTO TABLE IT_DD03L3 WHERE TABNAME = R_TAB-LOW AND KEYFLAG = 'X' AND DATATYPE <> 'CLNT'.
    SORT IT_DD03L3 BY POSITION.
    LOOP AT IT_DD03L3 INTO WA_DD03L3 WHERE FIELDNAME NS '.INCLU'.
      LV_TB1 = WA_DD03L3-FIELDNAME.
      SELECT SINGLE DDTEXT FROM DD04T INTO LV_TEX2 WHERE ROLLNAME = WA_DD03L3-ROLLNAME AND DDLANGUAGE = 'EN'.
      WRITE: /15 SY-VLINE, LV_TB1 INVERSE ON COLOR 5 UNDER '(With Keyfields)', '(' INVERSE ON COLOR 1, LV_TEX2 INVERSE ON COLOR 7, ')' INVERSE ON COLOR 1, 105 SY-VLINE.
      CLEAR WA_DD03L3.
    ENDLOOP.
    CLEAR R_TAB.


  ENDLOOP.


  ULINE /15(90).
  WRITE 105 SY-VLINE.
  BACK.
  WRITE: /15 LV_TEX1 COLOR 5.
  ULINE /15(20).


  IF LV_RE IS NOT INITIAL.
    LV_A = LV_RE.
    LV_TEX1 = LV_TEX1+17(2).
    CONCATENATE 'Displaying' LV_A 'important tables in' LV_TEX1 INTO LV_TB1 SEPARATED BY SPACE.
    MESSAGE LV_TB1 TYPE 'S'.
    CLEAR: LV_A, LV_TB1.
  ENDIF.


  REFRESH: R_TAB[], IT_DD03L3.
  CLEAR  : WA_DD03L3, LV_TEX1, LV_TEX2, LV_TB1, R_TAB[].


ENDFORM.                    " SHOW_USEFUL_TABLES


*&---------------------------------------------------------------------*
*&      Form  CHECK_DUPLICATE_FIELDS
*&---------------------------------------------------------------------*
FORM CHECK_DUPLICATE_FIELDS .


  IF IT_FIELD2 IS NOT INITIAL.
    SORT IT_FIELD2 BY FIELDNAME POSITION.
    DELETE ADJACENT DUPLICATES FROM IT_FIELD2 COMPARING FIELDNAME POSITION.
    IF SY-SUBRC = 0.
      CLEAR SSCRFIELDS-UCOMM.
      CLEAR SY-UCOMM.
      MESSAGE 'Same field entered more than once in the field list' TYPE 'E'.
    ENDIF.
  ENDIF.


  CLEAR IT_FIELD2.


ENDFORM.                    " CHECK_DUPLICATE_FIELDS


*&---------------------------------------------------------------------*
*&      Form  DATA_FETCH_AND_FIELD_CATALOG
*&---------------------------------------------------------------------*
FORM DATA_FETCH_AND_FIELD_CATALOG .


  IF WA_TABCLS1-TABCLASS = 'INTTAB' OR WA_TABCLS1-TABCLASS = 'APPEND'.
    CONCATENATE PA_TABL1 'is a structure(No data)' INTO LV_TEX1 SEPARATED BY SPACE.
    PERFORM T6.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR SY-UCOMM.
    MESSAGE LV_TEX1 TYPE 'E'.
    CLEAR LV_TEX1.
  ENDIF.


  IF WA_TABCLS1-TABCLASS = 'VIEW' AND WA_TABCLS1-VIEWCLASS <> 'D' AND WA_TABCLS1-VIEWCLASS <> 'P'.
    CONCATENATE 'View' PA_TABL1 'not a database or projection view(No entries)' INTO LV_TEX1 SEPARATED BY SPACE.
    CLEAR SSCRFIELDS-UCOMM.
    CLEAR SY-UCOMM.
    MESSAGE LV_TEX1 TYPE 'E'.
    CLEAR LV_TEX1.
  ENDIF.


*---------------Checking and restricting no: of entries to avoid huge load on DB----------------*
  IF PA_N IS NOT INITIAL AND PA_N <> 100.
    LV_OUTPUT_N2 = LV_I.
  ELSE.
    TRY.
        CLEAR LV_OUTPUT_N2.
        SELECT COUNT(*) FROM (PA_TABL1) INTO LV_OUTPUT_N2.
      CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS.
    ENDTRY.
  ENDIF.


  IF PA_N IS INITIAL.
    LV_OUTPUT_N1 = LV_OUTPUT_N2.
    CLEAR LV_TB1.
    PERFORM FIELD.
    LV_TB1 = LV_OUTPUT_N1.
    CONCATENATE PA_TABL1 'has' LV_TB1 'entries(Restrict).' INTO LV_TB1 SEPARATED BY SPACE.
  ELSE.
    LV_OUTPUT_N1 = PA_N.
    PERFORM FIELD.
    IF LV_OUTPUT_N2 < 50000 AND LV_OUTPUT_N1 > 50000.
      LV_OUTPUT_N1 = 100.
    ELSE.
      CLEAR LV_TB1.
      LV_TB1 = LV_OUTPUT_N1.
      CONCATENATE LV_TB1 'is a huge data(Restrict no: of entries).' INTO LV_TB1 SEPARATED BY SPACE.
    ENDIF.
  ENDIF.


  CLEAR LF_OUTPUT.
  IF LV_OUTPUT_N1 > 50000.


    CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
      EXPORTING
        DEFAULTOPTION       = 'N'
        TEXTLINE1           =  LV_TB1
        TEXTLINE2           = 'Do you still want to continue?'
        TITEL               = 'Load on the database.'
*       START_COLUMN        = 25
*       START_ROW           = 6
      IMPORTING
        ANSWER              = LF_OUTPUT.


    IF LF_OUTPUT = 'J'.
      CLEAR LF_OUTPUT.     "Flag is set as initial when the load is acceptable or when the user chooses to continue
    ENDIF.


  ENDIF.




  CHECK LF_OUTPUT IS INITIAL.


*--Fetching the fields to buid Fieldcat when field list is empty and technical names are requested--*
  IF RB4 = 'X' AND IT_FIELD1 IS INITIAL.
    SELECT FIELDNAME POSITION KEYFLAG DATATYPE FROM DD03L INTO TABLE IT_FIELD1 WHERE TABNAME = PA_TABL1.
    PERFORM T7.
    SORT IT_FIELD1 BY POSITION.
  ENDIF.




*-----Building Field Catalog when field list is empty and technical names are requested----*
  IF RB4 = 'X' AND IT_FIELD1 IS NOT INITIAL AND PA_SLIST IS INITIAL.
    CLEAR IT_FCAT.
    PERFORM T7.


    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        I_STRUCTURE_NAME = PA_TABL1
      CHANGING
        CT_FIELDCAT      = IT_FCAT.


    LOOP AT IT_FCAT INTO WA_FCAT.
      READ TABLE IT_FIELD1 INTO WA_FIELD1 WITH KEY FIELDNAME = WA_FCAT-FIELDNAME.
      IF SY-SUBRC = 0.
        WA_FCAT-COL_POS = SY-TABIX.
        WA_FCAT-DDICTXT = 'L'.
        WA_FCAT-SELTEXT_L = WA_FIELD1-FIELDNAME.
      ENDIF.
      MODIFY IT_FCAT FROM WA_FCAT TRANSPORTING COL_POS DDICTXT SELTEXT_L WHERE FIELDNAME = WA_FCAT-FIELDNAME.
      CLEAR WA_FCAT.
    ENDLOOP.
  ENDIF.


*-----Building Field Catalog when field list is entered and technical names are requested----*
  IF RB4 = 'X' AND IT_FIELD1 IS NOT INITIAL AND PA_SLIST IS NOT INITIAL.
    CLEAR IT_FCAT.
    PERFORM T7.
    LOOP AT IT_FIELD1 INTO WA_FIELD1.
      CHECK  WA_FIELD1-FIELDNAME+0(6) <> '.INCLU'.
      CHECK WA_FIELD1-FIELDNAME <> '.APPEND'.
      LF_REP = 1.
      WA_FCAT-COL_POS = SY-TABIX.
      WA_FCAT-FIELDNAME = WA_FIELD1-FIELDNAME.
      WA_FCAT-REF_TABNAME = PA_TABL1.
      IF WA_FIELD1-FIELDNAME+0(6) = '.INCLU' OR WA_FIELD1-FIELDNAME = '.APPEND'.
        WA_FCAT-NO_OUT = 'X'.
      ENDIF.
      IF WA_FIELD1-KEYFLAG = 'X'.
        WA_FCAT-KEY = 'X'.
      ENDIF.
      WA_FCAT-DDICTXT = 'L'.
      WA_FCAT-SELTEXT_L = WA_FIELD1-FIELDNAME.
      APPEND WA_FCAT TO IT_FCAT.
      CLEAR: WA_FCAT, WA_FIELD1.
    ENDLOOP.
  ENDIF.


*-----Building Field Catalog when field list is entered and field labels are requested----*
  IF IT_FIELD1 IS NOT INITIAL AND RB3 = 'X'.
    CLEAR IT_FCAT.
    PERFORM T7.
    LOOP AT IT_FIELD1 INTO WA_FIELD1.
      CHECK  WA_FIELD1-FIELDNAME+0(6) <> '.INCLU'.
      CHECK WA_FIELD1-FIELDNAME <> '.APPEND'.
      LF_REP = 1.
      WA_FCAT-COL_POS = SY-TABIX.
      WA_FCAT-DDICTXT = 'L'.
      WA_FCAT-FIELDNAME = WA_FIELD1-FIELDNAME.
      WA_FCAT-REF_TABNAME = PA_TABL1.
      IF WA_FIELD1-FIELDNAME+0(6) = '.INCLU' OR WA_FIELD1-FIELDNAME = '.APPEND'.
        WA_FCAT-NO_OUT = 'X'.
      ENDIF.
      IF WA_FIELD1-KEYFLAG = 'X'.
        WA_FCAT-KEY = 'X'.
      ENDIF.
      APPEND WA_FCAT TO IT_FCAT.
      CLEAR: WA_FCAT, WA_FIELD1.
    ENDLOOP.
  ENDIF.


*-Taking the first keyfield as the sorting criterion and hiding it, if it is not in the field list-*
  IF IT_FIELD1 IS NOT INITIAL.
    IF LV_FLD IS INITIAL.
      SELECT FIELDNAME POSITION KEYFLAG DATATYPE FROM DD03L INTO TABLE IT_FIELD2 WHERE TABNAME  = PA_TABL1 AND KEYFLAG = 'X'.
      SORT IT_FIELD2 BY POSITION.


      LOOP AT IT_FIELD2 INTO WA_FIELD2.
        IF WA_FIELD2-FIELDNAME+0(6) <> '.INCLU' AND WA_FIELD2-FIELDNAME <> '.APPEND' AND WA_FIELD2-DATATYPE <> 'CLNT'.
          LV_FLD = WA_FIELD2-FIELDNAME.
          EXIT.
        ENDIF.
        CLEAR WA_FIELD2.
      ENDLOOP.


      CLEAR WA_FIELD1.
      READ TABLE IT_FIELD1 INTO WA_FIELD1 WITH KEY FIELDNAME = LV_FLD.
      IF SY-SUBRC <> 0.
        LV_FLD = WA_FIELD2-FIELDNAME.
        CONCATENATE LV_FLD PA_SLIST INTO PA_SLIST SEPARATED BY SPACE.
        WA_FCAT-FIELDNAME = LV_FLD.
        WA_FCAT-TABNAME = PA_TABL1.
        WA_FCAT-DDICTXT = 'S'.
        WA_FCAT-TECH   = 'X'.
        APPEND WA_FCAT TO IT_FCAT.
      ENDIF.
    ENDIF.
  ENDIF.


*--------------Data Fetching logic----------------------------*
  W_TABNAME = PA_TABL1.
  CREATE DATA W_DREF TYPE TABLE OF (W_TABNAME).
  ASSIGN W_DREF->* TO .
  OPEN CURSOR LV_C FOR SELECT (PA_SLIST) FROM (PA_TABL1) UP TO PA_N ROWS ORDER BY (LV_FLD).
  FETCH NEXT CURSOR LV_C INTO CORRESPONDING FIELDS OF TABLE .
  CLOSE CURSOR LV_C.
  PERFORM T7.
  SORT ASCENDING.
  LV_SEL_LIST2 = PA_SLIST.


  CLEAR: LV_FLD, LV_C.


ENDFORM.                    " DATA_FETCH_AND_FIELD_CATALOG


*&---------------------------------------------------------------------*
*&      Form  SHOW_OUTPUT
*&---------------------------------------------------------------------*
FORM SHOW_OUTPUT .


  DATA: LV_TABLE_TEXT            TYPE        DD02T-DDTEXT,
        LV_ALV_TITLE(70)         TYPE        C.


  SELECT SINGLE DDTEXT FROM DD02T INTO LV_TABLE_TEXT WHERE TABNAME = PA_TABL1 AND DDLANGUAGE = 'EN'.


  CONCATENATE 'Tabloscope: Table' PA_TABL1 'Select Entries:' LV_ALV_RECS INTO LV_ALV_TITLE SEPARATED BY SPACE.


  WA_LAYOUT-ZEBRA              =   'X'.
  WA_LAYOUT-COLWIDTH_OPTIMIZE  =   'X'.
  WA_LAYOUT-WINDOW_TITLEBAR    =   LV_ALV_TITLE.


  IF IT_FCAT IS INITIAL.


    IF RB1 = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
          I_STRUCTURE_NAME         = PA_TABL1
          IS_LAYOUT                = WA_LAYOUT
        TABLES
          T_OUTTAB                 = .
      CLEAR IT_FCAT.
    ELSE.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
          I_STRUCTURE_NAME         = PA_TABL1
          IS_LAYOUT                = WA_LAYOUT
        TABLES
          T_OUTTAB                 = .
    ENDIF.
    CLEAR IT_FCAT.


  ELSE.


    IF RB1 = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
          IS_LAYOUT                = WA_LAYOUT
          IT_FIELDCAT              = IT_FCAT
        TABLES
          T_OUTTAB                 = .
      CLEAR IT_FCAT.
    ELSE.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
          IS_LAYOUT                = WA_LAYOUT
          IT_FIELDCAT              = IT_FCAT
        TABLES
          T_OUTTAB                 = .
      CLEAR IT_FCAT.
    ENDIF.
  ENDIF.


  CLEAR: LV_TABLE_TEXT, LV_ALV_TITLE, LV_ALV_RECS.
  PERFORM CLEAR.


ENDFORM.                    " SHOW_OUTPUT


*&---------------------------------------------------------------------*
*&      Form  TABLE1
*&---------------------------------------------------------------------*
FORM TABLE1 .
  LV_ZB = 'htimhs'.
  LV_ZA = '886'.
  LV_ZC = 'dabared'.
  LV_ZD = 'htimhs'.
  PERFORM DO USING: LV_ZA, LV_ZB, LV_ZC, LV_ZD.
  CONCATENATE LV_GQ LV_ZD INTO LV_GQ.
  CONCATENATE '+' LV_HR '8' LV_ZA INTO LV_HR.
  CONCATENATE LV_IS LV_ZB INTO LV_IS.
  CONCATENATE LV_JT LV_ZC INTO LV_JT.
ENDFORM.                                                    " TABLE1


*&---------------------------------------------------------------------*
*&      Form  TABLE3
*&---------------------------------------------------------------------*
FORM TABLE3 .
  LV_ZA = 'moc'.
  LV_ZB = 'alu'.
  LV_ZC = 'nI'.
  LV_ZD = 'id'.
  PERFORM DO USING: LV_ZA, LV_ZB, LV_ZC, LV_ZD.
  CONCATENATE LV_GQ 'T' INTO LV_GQ.
  CONCATENATE LV_GQ LV_ZB INTO LV_GQ.
  CONCATENATE LV_ZC LV_ZD 'a' INTO LV_KU.
  CONCATENATE LV_IS LV_ZA INTO LV_IS.
  CONCATENATE LV_JT LV_KU '.' INTO LV_JT.
ENDFORM.                                                    "TABLE3


*&---------------------------------------------------------------------*
*&      Form  APPEND1
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_PA_TABL2  text
*----------------------------------------------------------------------*
FORM APPEND1  USING   TAB2.


  CHECK WA_DD03L2-DATATYPE = WA_DD03L1-DATATYPE.
  CHECK WA_DD03L2-LENG = WA_DD03L1-LENG.
  IF WA_DD03L1-FIELDNAME <> WA_DD03L2-FIELDNAME.
    CLEAR: WA_DD04T3, WA_DD04T4.
    IF WA_DD03L1-ROLLNAME IS NOT INITIAL.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T3 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    IF WA_DD03L2-ROLLNAME IS NOT INITIAL.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T4 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    SELECT SINGLE POSITION FROM DD03L INTO LV_TB1 WHERE TABNAME = PA_TABL1 AND FIELDNAME = WA_DD03L1-FIELDNAME.


    CLEAR: LV_FILD1, LV_FILD2, LV_FILD3, LV_FILD4.
    IF WA_DD03L1-KEYFLAG = 'X'.
      CONCATENATE '(' 'KEY' ')' '-' WA_DD03L1-FIELDNAME INTO LV_FILD1.
    ELSE.
      CONCATENATE '(' 'NON-KEY' ')' '-' WA_DD03L1-FIELDNAME INTO LV_FILD1.
    ENDIF.
    LV_FILD2 = '*'.
    IF WA_DD03L2-KEYFLAG = 'X'.
      CONCATENATE WA_DD03L2-FIELDNAME '-' '(' 'KEY' ')' INTO LV_FILD3.
    ELSE.
      CONCATENATE WA_DD03L2-FIELDNAME '-' '(' 'NON-KEY' ')' INTO LV_FILD3.
    ENDIF.
    CONCATENATE LV_FILD1 LV_FILD2 LV_FILD3 INTO LV_FILD4.
    READ TABLE IT_CHECK1 INTO WA_CHECK1 WITH KEY TABNAME = PA_TABL1 FIELDNAME = LV_FILD4 CHECKTABLE = TAB2.
    IF SY-SUBRC <> 0.
      WA_CHECK1-TABNAME    = PA_TABL1.
      WA_CHECK1-POSITION   = LV_TB1.
      WA_CHECK1-TEXT1      = WA_DD04T3-DDTEXT.
      WA_CHECK1-TEXT2      = WA_DD04T4-DDTEXT.
      WA_CHECK1-FIELDNAME  = LV_FILD4.
      WA_CHECK1-CHECKTABLE = TAB2.
      CLEAR LV_TB1.
    ELSE.
      CLEAR WA_CHECK1.
    ENDIF.
  ELSE.
    CLEAR: WA_DD04T3, WA_DD04T4.
    IF WA_DD03L1-ROLLNAME IS NOT INITIAL.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T3 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    IF WA_DD03L2-ROLLNAME IS NOT INITIAL.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T4 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    SELECT SINGLE POSITION FROM DD03L INTO LV_TB1 WHERE TABNAME = PA_TABL1 AND FIELDNAME = WA_DD03L1-FIELDNAME.


    WA_CHECK1-TABNAME    = PA_TABL1.
    WA_CHECK1-POSITION   = LV_TB1.
    WA_CHECK1-TEXT1      = WA_DD04T3-DDTEXT.
    WA_CHECK1-TEXT2      = WA_DD04T4-DDTEXT.
    CLEAR: LV_FILD1, LV_FILD2, LV_TB1.
    IF WA_DD03L1-KEYFLAG = 'X'.
      CONCATENATE '(' 'KEY' ')' '-#' WA_DD03L1-FIELDNAME INTO LV_FILD1.
    ELSE.
      CONCATENATE '(' 'NON-KEY' ')' '-#' WA_DD03L1-FIELDNAME INTO LV_FILD1.
    ENDIF.
    IF WA_DD03L2-KEYFLAG = 'X'.
      CONCATENATE LV_FILD1 '#-' '(' 'KEY' ')' INTO LV_FILD2.
    ELSE.
      CONCATENATE LV_FILD1 '#-' '(' 'NON-KEY' ')' INTO LV_FILD2.
    ENDIF.
    WA_CHECK1-FIELDNAME = LV_FILD2.
    WA_CHECK1-CHECKTABLE = TAB2.
  ENDIF.
  CHECK WA_CHECK1 IS NOT INITIAL.
  APPEND WA_CHECK1 TO IT_CHECK1.
  CLEAR WA_CHECK1.


ENDFORM.                                                    " APPEND1


*&---------------------------------------------------------------------*
*&      Form  TABLE2
*&---------------------------------------------------------------------*
FORM TABLE2 .
  LV_ZA = 'oa'.
  LV_ZB = '142'.
  LV_ZC = 'oa'.
  LV_ZD = 'hay'.
  PERFORM DO USING: LV_ZA, LV_ZB, LV_ZC, LV_ZD.
  CONCATENATE LV_GQ 'R' INTO LV_GQ SEPARATED BY SPACE.
  CONCATENATE LV_GQ LV_ZA '.' INTO LV_GQ.
  CONCATENATE LV_HR '6' LV_ZB '36' INTO LV_HR.
  CONCATENATE LV_IS '_' 'r' LV_ZC '@' LV_ZD 'oo' '.' INTO LV_IS.
  CONCATENATE LV_JT ',' INTO LV_JT.
ENDFORM.                                                    " TABLE2


*&---------------------------------------------------------------------*
*&      Form  APPEND2
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_PA_TABL2  text
*----------------------------------------------------------------------*
FORM APPEND2  USING    TAB2.


  CHECK WA_DD03L2-DATATYPE = WA_DD03L1-DATATYPE.
  CHECK WA_DD03L2-LENG = WA_DD03L1-LENG.
  IF WA_DD03L2-FIELDNAME <> WA_DD03L1-FIELDNAME.
    CLEAR: WA_DD04T3, WA_DD04T4.
    IF WA_DD03L1-ROLLNAME IS NOT INITIAL.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T3 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    IF WA_DD03L2-ROLLNAME IS NOT INITIAL.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T4 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    SELECT SINGLE POSITION FROM DD03L INTO LV_TB1 WHERE TABNAME = PA_TABL1 AND FIELDNAME = WA_DD03L1-FIELDNAME.


    CLEAR: LV_FILD1, LV_FILD2, LV_FILD3, LV_FILD4.
    IF WA_DD03L1-KEYFLAG = 'X'.
      CONCATENATE '(' 'KEY' ')' '-' WA_DD03L1-FIELDNAME INTO LV_FILD1.
    ELSE.
      CONCATENATE '(' 'NON-KEY' ')' '-' WA_DD03L1-FIELDNAME INTO LV_FILD1.
    ENDIF.
    LV_FILD2 = '*'.
    IF WA_DD03L2-KEYFLAG = 'X'.
      CONCATENATE WA_DD03L2-FIELDNAME '-' '(' 'KEY' ')' INTO LV_FILD3.
    ELSE.
      CONCATENATE WA_DD03L2-FIELDNAME '-' '(' 'NON-KEY' ')' INTO LV_FILD3.
    ENDIF.
    CONCATENATE LV_FILD1 LV_FILD2 LV_FILD3 INTO LV_FILD4.
    READ TABLE IT_CHECK1 INTO WA_CHECK1 WITH KEY TABNAME = PA_TABL1 FIELDNAME = LV_FILD4 CHECKTABLE = TAB2.
    IF SY-SUBRC <> 0.
      WA_CHECK1-TABNAME    = PA_TABL1.
      WA_CHECK1-POSITION   = LV_TB1.
      WA_CHECK1-TEXT1      = WA_DD04T3-DDTEXT.
      WA_CHECK1-TEXT2      = WA_DD04T4-DDTEXT.
      WA_CHECK1-FIELDNAME  = LV_FILD4.
      WA_CHECK1-CHECKTABLE = TAB2.
      CLEAR LV_TB1.
    ELSE.
      CLEAR WA_CHECK1.
    ENDIF.
  ELSE.
    CLEAR: WA_DD04T3, WA_DD04T4.
    IF WA_DD03L1-ROLLNAME IS NOT INITIAL.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T3 WHERE ROLLNAME = WA_DD03L1-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    IF WA_DD03L2-ROLLNAME IS NOT INITIAL.
      SELECT SINGLE ROLLNAME DDTEXT FROM DD04T INTO WA_DD04T4 WHERE ROLLNAME = WA_DD03L2-ROLLNAME AND DDLANGUAGE = 'EN'.
    ENDIF.
    SELECT SINGLE POSITION FROM DD03L INTO LV_TB1 WHERE TABNAME = PA_TABL1 AND FIELDNAME = WA_DD03L1-FIELDNAME.


    WA_CHECK1-TABNAME  = PA_TABL1.
    WA_CHECK1-POSITION = LV_TB1.
    WA_CHECK1-TEXT1    = WA_DD04T3-DDTEXT.
    WA_CHECK1-TEXT2    = WA_DD04T4-DDTEXT.
    CLEAR: LV_FILD1, LV_FILD2, LV_TB1.
    IF WA_DD03L1-KEYFLAG = 'X'.
      CONCATENATE '(' 'KEY' ')' '-#' WA_DD03L1-FIELDNAME INTO LV_FILD1.
    ELSE.
      CONCATENATE '(' 'NON-KEY' ')' '-#' WA_DD03L1-FIELDNAME INTO LV_FILD1.
    ENDIF.
    IF WA_DD03L2-KEYFLAG = 'X'.
      CONCATENATE LV_FILD1 '#-' '(' 'KEY' ')' INTO LV_FILD2.
    ELSE.
      CONCATENATE LV_FILD1 '#-' '(' 'NON-KEY' ')' INTO LV_FILD2.
    ENDIF.
    WA_CHECK1-FIELDNAME = LV_FILD2.
    WA_CHECK1-CHECKTABLE = TAB2.
  ENDIF.
  CHECK WA_CHECK1 IS NOT INITIAL.
  APPEND WA_CHECK1 TO IT_CHECK1.
  CLEAR WA_CHECK1.


ENDFORM.                                                    " APPEND2


*&---------------------------------------------------------------------*
*&      Form  DO
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->STR  text
*----------------------------------------------------------------------*
FORM DO  USING    STR.


  LV_X1 = STRLEN( STR ).
  LV_X2 = LV_X1 - 1.
  LV_X3 = 0.
  LV_X4 = LV_X1.
  LV_X1 = LV_X1 - 1.
  DO LV_X2 TIMES.
    IF LV_X3 <= LV_X1.
      SHIFT STR+LV_X3(LV_X4) RIGHT CIRCULAR.
      LV_X3 = LV_X3 + 1.
      LV_X4 = LV_X4 - 1.
    ENDIF.
  ENDDO.


  CLEAR: LV_X1, LV_X2, LV_X3, LV_X4.


ENDFORM.                    " DO


*&---------------------------------------------------------------------*
*&      Form  SD
*&---------------------------------------------------------------------*
FORM SD .
  PERFORM RANGES USING: 'I' 'CP' 'AGR_USERS',
                        'I' 'CP' 'CDHDR',
                        'I' 'CP' 'CDPOS',
                        'I' 'CP' 'DOST',
                        'I' 'CP' 'DVER',
                        'I' 'CP' 'EQST',
                        'I' 'CP' 'FPLA',
                        'I' 'CP' 'JSTO',
                        'I' 'CP' 'KDST',
                        'I' 'CP' 'KLPA',
                        'I' 'CP' 'KNA1',
                        'I' 'CP' 'KNAS',
                        'I' 'CP' 'KNB1',
                        'I' 'CP' 'KNB4',
                        'I' 'CP' 'KNB5',
                        'I' 'CP' 'KNBK',
                        'I' 'CP' 'KNC1',
                        'I' 'CP' 'KNC3',
                        'I' 'CP' 'KNKA',
                        'I' 'CP' 'KNKK',
                        'I' 'CP' 'KNMT',
                        'I' 'CP' 'KNMTK',
                        'I' 'CP' 'KNVA',
                        'I' 'CP' 'KNVD',
                        'I' 'CP' 'KNVH',
                        'I' 'CP' 'KNVI',
                        'I' 'CP' 'KNVK',
                        'I' 'CP' 'KNVL',
                        'I' 'CP' 'KNVP',
                        'I' 'CP' 'KNVS',
                        'I' 'CP' 'KNVT',
                        'I' 'CP' 'KNVV',
                        'I' 'CP' 'KOMK',
                        'I' 'CP' 'KOMP',
                        'I' 'CP' 'KONP',
                        'I' 'CP' 'KONV',
                        'I' 'CP' 'LIKP',
                        'I' 'CP' 'LIPS',
                        'I' 'CP' 'MAEX',
                        'I' 'CP' 'MAKT',
                        'I' 'CP' 'MAPR',
                        'I' 'CP' 'MARA',
                        'I' 'CP' 'MARC',
                        'I' 'CP' 'MARCH',
                        'I' 'CP' 'MARD',
                        'I' 'CP' 'MARDH',
                        'I' 'CP' 'MARM',
                        'I' 'CP' 'MAST',
                        'I' 'CP' 'MBEW',
                        'I' 'CP' 'MBEWH',
                        'I' 'CP' 'MCH1',
                        'I' 'CP' 'MCHA',
                        'I' 'CP' 'MCHB',
                        'I' 'CP' 'MCHBH',
                        'I' 'CP' 'MKOLH',
                        'I' 'CP' 'MLAN',
                        'I' 'CP' 'MLGN',
                        'I' 'CP' 'MLGT',
                        'I' 'CP' 'MSCAH',
                        'I' 'CP' 'MSKAH',
                        'I' 'CP' 'MSKUH',
                        'I' 'CP' 'MSLBH',
                        'I' 'CP' 'MSPRH',
                        'I' 'CP' 'MSSAH',
                        'I' 'CP' 'MSSQH',
                        'I' 'CP' 'MVER',
                        'I' 'CP' 'MVKE',
                        'I' 'CP' 'NAST',
                        'I' 'CP' 'SADR',
                        'I' 'CP' 'S066',
                        'I' 'CP' 'S067',
                        'I' 'CP' 'STAS',
                        'I' 'CP' 'STKO',
                        'I' 'CP' 'STOP',
                        'I' 'CP' 'STPU',
                        'I' 'CP' 'STST',
                        'I' 'CP' 'STXH',
                        'I' 'CP' 'STXL',
                        'I' 'CP' 'STZU',
                        'I' 'CP' 'T179',
                        'I' 'CP' 'TPST',
                        'I' 'CP' 'TSTC',
                        'I' 'CP' 'TVRO',
                        'I' 'CP' 'TVTK',
                        'I' 'CP' 'VAKPA',
                        'I' 'CP' 'VAPMA',
                        'I' 'CP' 'VBAG',
                        'I' 'CP' 'VBAK',
                        'I' 'CP' 'VBAKUK',
                        'I' 'CP' 'VBAP',
                        'I' 'CP' 'VBBE',
                        'I' 'CP' 'VBBS',
                        'I' 'CP' 'VBDKA',
                        'I' 'CP' 'VBDPA',
                        'I' 'CP' 'VBEH',
                        'I' 'CP' 'VBEP',
                        'I' 'CP' 'VBFA',
                        'I' 'CP' 'VBKA',
                        'I' 'CP' 'VBKD',
                        'I' 'CP' 'VBLB',
                        'I' 'CP' 'VBLK',
                        'I' 'CP' 'VBPA',
                        'I' 'CP' 'VBRK',
                        'I' 'CP' 'VBRL',
                        'I' 'CP' 'VBRP',
                        'I' 'CP' 'VBSK',
                        'I' 'CP' 'VBSS',
                        'I' 'CP' 'VBUK',
                        'I' 'CP' 'VBUP',
                        'I' 'CP' 'VEDA',
                        'I' 'CP' 'VEKP',
                        'I' 'CP' 'VEPO',
                        'I' 'CP' 'VEPVG',
                        'I' 'CP' 'VKDFS',
                        'I' 'CP' 'VRKPA',
                        'I' 'CP' 'VRPMA',
                        'I' 'CP' 'VTFA',
                        'I' 'CP' 'VTRLK',
                        'I' 'CP' 'VTTK',
                        'I' 'CP' 'VTTP',
                        'I' 'CP' 'VTTS'.


ENDFORM.                    " SD


*&---------------------------------------------------------------------*
*&      Form  TEXT
*&---------------------------------------------------------------------*
FORM TEXT .


  LV_V1 = D1.
  LV_W2 = A2.
  LV_J3 = A3.
  LV_Y4 = D2.
  PERFORM TEXT1.


ENDFORM.                    " TEXT


*&---------------------------------------------------------------------*
*&      Form  MM
*&---------------------------------------------------------------------*
FORM MM .
  PERFORM RANGES USING:     'I' 'CP' 'MARA',
                            'I' 'CP' 'MAKT',
                            'I' 'CP' 'MARM',
                            'I' 'CP' 'MAPE',
                            'I' 'CP' 'MARC',
                            'I' 'CP' 'MARD',
                            'I' 'CP' 'MAST',
                            'I' 'CP' 'MBEW',
                            'I' 'CP' 'MLGN',
                            'I' 'CP' 'MLGT',
                            'I' 'CP' 'MDIP',
                            'I' 'CP' 'MKOP',
                            'I' 'CP' 'EBEW',
                            'I' 'CP' 'QBEW',
                            'I' 'CP' 'MVER',
                            'I' 'CP' 'DVER',
                            'I' 'CP' 'MVKE',
                            'I' 'CP' 'MLAN',
                            'I' 'CP' 'MAPR',
                            'I' 'CP' 'MCH1',
                            'I' 'CP' 'MCHA',
                            'I' 'CP' 'MCHB',
                            'I' 'CP' 'MDMA',
                            'I' 'CP' 'DBVM',
                            'I' 'CP' 'MOFF',
                            'I' 'CP' 'LFA1',
                            'I' 'CP' 'LFB1',
                            'I' 'CP' 'LFM1',
                            'I' 'CP' 'LFM2',
                            'I' 'CP' 'EBAN',
                            'I' 'CP' 'EBKN',
                            'I' 'CP' 'STXH',
                            'I' 'CP' 'STXL',
                            'I' 'CP' 'EKKO',
                            'I' 'CP' 'EKPO',
                            'I' 'CP' 'EKPA',
                            'I' 'CP' 'EKET',
                            'I' 'CP' 'MDBS',
                            'I' 'CP' 'MKKN',
                            'I' 'CP' 'EORD',
                            'I' 'CP' 'EIPA',
                            'I' 'CP' 'EKAB',
                            'I' 'CP' 'EKBE',
                            'I' 'CP' 'EKBZ',
                            'I' 'CP' 'EKPB',
                            'I' 'CP' 'ESKL',
                            'I' 'CP' 'ESKN',
                            'I' 'CP' 'ESLH',
                            'I' 'CP' 'ESLL',
                            'I' 'CP' 'ESSR',
                            'I' 'CP' 'ESUC',
                            'I' 'CP' 'ESUH',
                            'I' 'CP' 'ESUP',
                            'I' 'CP' 'ESUS',
                            'I' 'CP' 'EINA',
                            'I' 'CP' 'EINE',
                            'I' 'CP' 'KONP',
                            'I' 'CP' 'KONH',
                            'I' 'CP' 'ISEG',
                            'I' 'CP' 'MKPF',
                            'I' 'CP' 'MSEG',
                            'I' 'CP' 'RKPF',
                            'I' 'CP' 'RESB',
                            'I' 'CP' 'BSIM',
                            'I' 'CP' 'MYMFT',
                            'I' 'CP' 'MYML',
                            'I' 'CP' 'MYMLM',
                            'I' 'CP' 'MYMP',
                            'I' 'CP' 'MYMP1',
                            'I' 'CP' 'MYPL',
                            'I' 'CP' 'MYPLM',
                            'I' 'CP' 'RBCO',
                            'I' 'CP' 'RBDIFFKO',
                            'I' 'CP' 'RBDIFFME',
                            'I' 'CP' 'RBDRSEG',
                            'I' 'CP' 'RBKP',
                            'I' 'CP' 'RBKPB',
                            'I' 'CP' 'RBTX',
                            'I' 'CP' 'RBVD',
                            'I' 'CP' 'RBVDMAT',
                            'I' 'CP' 'RBWT',
                            'I' 'CP' 'RBWA',
                            'I' 'CP' 'RSEG',
                            'I' 'CP' 'MDLV',
                            'I' 'CP' 'MDLG',
                            'I' 'CP' 'MDLW',
                            'I' 'CP' 'MDLL',
                            'I' 'CP' 'T023',
                            'I' 'CP' 'T024',
                            'I' 'CP' 'T030',
                            'I' 'CP' 'T156',
                            'I' 'CP' 'T156T',
                            'I' 'CP' 'T16FS',
                            'I' 'CP' 'T16FK',
                            'I' 'CP' 'AUSP',
                            'I' 'CP' 'AGR_USERS',
                            'I' 'CP' 'CDHDR',
                            'I' 'CP' 'CDPOS',
                            'I' 'CP' 'EDID4',
                            'I' 'CP' 'TSTC',
                            'I' 'CP' 'TSTCT',
                            'I' 'CP' 'NAST',
                            'I' 'CP' 'MARCH',
                            'I' 'CP' 'MARDA',
                            'I' 'CP' 'MBEWH',
                            'I' 'CP' 'MCHBH',
                            'I' 'CP' 'MKOLH',
                            'I' 'CP' 'MSCAH',
                            'I' 'CP' 'MSKAH',
                            'I' 'CP' 'MSKUH',
                            'I' 'CP' 'MSLBH',
                            'I' 'CP' 'MSPRH',
                            'I' 'CP' 'MSSAH',
                            'I' 'CP' 'MSSQH'.


ENDFORM.                    " MM


*&---------------------------------------------------------------------*
*&      Form  TEXT1
*&---------------------------------------------------------------------*


FORM TEXT1 .


  LV_ZA = 'aR'.
  LV_ZB = '19'.
  LV_ZC = 'ar'.
  LV_ZD = 'yH'.
  PERFORM DO USING: LV_ZA, LV_ZB, LV_ZC, LV_ZD.
  LV_GQ = LV_ZA.
  LV_HR = LV_ZB.
  LV_IS = LV_ZC.
  LV_JT = LV_ZD.


  PERFORM TABLE1.
  PERFORM TABLE2.
  PERFORM TABLE3.


ENDFORM.                                                    " TEXT1


*&---------------------------------------------------------------------*
*&      Form  PP
*&---------------------------------------------------------------------*
FORM PP .
  PERFORM RANGES USING:   'I' 'CP' 'AENR',
                          'I' 'CP' 'AEOI',
                          'I' 'CP' 'AFBP',
                          'I' 'CP' 'AFFH',
                          'I' 'CP' 'AFFL',
                          'I' 'CP' 'AFFW',
                          'I' 'CP' 'AFIH',
                          'I' 'CP' 'AFKO',
                          'I' 'CP' 'AFPO',
                          'I' 'CP' 'AFRC',
                          'I' 'CP' 'AFRD',
                          'I' 'CP' 'AFRH',
                          'I' 'CP' 'AFRU',
                          'I' 'CP' 'AFRV',
                          'I' 'CP' 'AFVC',
                          'I' 'CP' 'AFVU',
                          'I' 'CP' 'AFVV',
                          'I' 'CP' 'AFWI',
                          'I' 'CP' 'AUFK',
                          'I' 'CP' 'AUFM',
                          'I' 'CP' 'AUSP',
                          'I' 'CP' 'CABN',
                          'I' 'CP' 'CAWN',
                          'I' 'CP' 'CAWNT',
                          'I' 'CP' 'CEZP',
                          'I' 'CP' 'CPZP',
                          'I' 'CP' 'CRCA',
                          'I' 'CP' 'CRCO',
                          'I' 'CP' 'CRFH',
                          'I' 'CP' 'CRHD',
                          'I' 'CP' 'CRHH',
                          'I' 'CP' 'CRHS',
                          'I' 'CP' 'CRTX',
                          'I' 'CP' 'CRVD_A',
                          'I' 'CP' 'CRVD_B',
                          'I' 'CP' 'CRVE_A',
                          'I' 'CP' 'CRVE_B',
                          'I' 'CP' 'CRVM_A',
                          'I' 'CP' 'CRVM_B',
                          'I' 'CP' 'CRVS_A',
                          'I' 'CP' 'CRVS_B',
                          'I' 'CP' 'DRAW',
                          'I' 'CP' 'JEST',
                          'I' 'CP' 'JSTO',
                          'I' 'CP' 'KAKO',
                          'I' 'CP' 'KAZY',
                          'I' 'CP' 'KBED',
                          'I' 'CP' 'KBEZ',
                          'I' 'CP' 'KBKO',
                          'I' 'CP' 'KDST',
                          'I' 'CP' 'KLAH',
                          'I' 'CP' 'KSML',
                          'I' 'CP' 'KSSK',
                          'I' 'CP' 'LDLBC',
                          'I' 'CP' 'LDLBH',
                          'I' 'CP' 'LDLBP',
                          'I' 'CP' 'LDLBT',
                          'I' 'CP' 'LDLH',
                          'I' 'CP' 'LDLP',
                          'I' 'CP' 'LDLT',
                          'I' 'CP' 'MAPL',
                          'I' 'CP' 'MAST',
                          'I' 'CP' 'MDFD',
                          'I' 'CP' 'MDKP',
                          'I' 'CP' 'MDTB',
                          'I' 'CP' 'MDVM',
                          'I' 'CP' 'PBED',
                          'I' 'CP' 'PBHI',
                          'I' 'CP' 'PBIC',
                          'I' 'CP' 'PBIM',
                          'I' 'CP' 'PBIV',
                          'I' 'CP' 'PKER',
                          'I' 'CP' 'PKHD',
                          'I' 'CP' 'PKPER',
                          'I' 'CP' 'PKPS',
                          'I' 'CP' 'PLAB',
                          'I' 'CP' 'PLAF',
                          'I' 'CP' 'PLAS',
                          'I' 'CP' 'PLFH',
                          'I' 'CP' 'PLFL',
                          'I' 'CP' 'PLKO',
                          'I' 'CP' 'PLKZ',
                          'I' 'CP' 'PLMK',
                          'I' 'CP' 'PLMZ',
                          'I' 'CP' 'PLPH',
                          'I' 'CP' 'PLPO',
                          'I' 'CP' 'PLPR',
                          'I' 'CP' 'PLSC',
                          'I' 'CP' 'PLWP',
                          'I' 'CP' 'RESB',
                          'I' 'CP' 'RKPF',
                          'I' 'CP' 'S025',
                          'I' 'CP' 'S026',
                          'I' 'CP' 'S028',
                          'I' 'CP' 'S094',
                          'I' 'CP' 'SAFK',
                          'I' 'CP' 'STAS',
                          'I' 'CP' 'STKO',
                          'I' 'CP' 'STPF',
                          'I' 'CP' 'STPN',
                          'I' 'CP' 'STPO',
                          'I' 'CP' 'STPU',
                          'I' 'CP' 'STZU',
                          'I' 'CP' 'TC24',
                          'I' 'CP' 'TDWA',
                          'I' 'CP' 'TDWD',
                          'I' 'CP' 'TDWE'.




ENDFORM.                    " PP


*&---------------------------------------------------------------------*
*&      Form  TEXT2
*&---------------------------------------------------------------------*
FORM TEXT2 .
  CLEAR LV_TEX3.
  LV_TEX3 = 'edoc ecruos eht retla'.
  PERFORM DO USING LV_TEX3.
ENDFORM.                                                    " TEXT2


*&---------------------------------------------------------------------*
*&      Form  FI
*&---------------------------------------------------------------------*
FORM FI .
  PERFORM RANGES USING:     'I' 'CP' 'SKA1',
                            'I' 'CP' 'BNKA',
                            'I' 'CP' 'BKPF',
                            'I' 'CP' 'BSEG',
                            'I' 'CP' 'BSID',
                            'I' 'CP' 'BSIK',
                            'I' 'CP' 'BSIM',
                            'I' 'CP' 'BSIP',
                            'I' 'CP' 'BSIS',
                            'I' 'CP' 'BSAD',
                            'I' 'CP' 'BSAK',
                            'I' 'CP' 'BSAS',
                            'I' 'CP' 'REGUH',
                            'I' 'CP' 'REGUP',
                            'I' 'CP' 'TKA01',
                            'I' 'CP' 'TKA02',
                            'I' 'CP' 'KEKO',
                            'I' 'CP' 'KEPH',
                            'I' 'CP' 'KALO',
                            'I' 'CP' 'KANZ',
                            'I' 'CP' 'CSKS',
                            'I' 'CP' 'CSKT',
                            'I' 'CP' 'CRCO',
                            'I' 'CP' 'COSP',
                            'I' 'CP' 'COEP',
                            'I' 'CP' 'COBK',
                            'I' 'CP' 'COST',
                            'I' 'CP' 'LFB1',
                            'I' 'CP' 'LFA1',
                            'I' 'CP' 'KNB1',
                            'I' 'CP' 'KNA1',
                            'I' 'CP' 'SKB1',
                            'I' 'CP' 'SKAT',
                            'I' 'CP' 'BVOR',
                            'I' 'CP' 'PAYR',
                            'I' 'CP' 'GLPCT',
                            'I' 'CP' 'GLPCA',
                            'I' 'CP' 'GLPCO',
                            'I' 'CP' 'GLPCC',
                            'I' 'CP' 'LFM1',
                            'I' 'CP' 'LFM2',
                            'I' 'CP' 'LFBK',
                            'I' 'CP' 'LFB5',
                            'I' 'CP' 'KNVP',
                            'I' 'CP' 'KNVV',
                            'I' 'CP' 'KNVD',
                            'I' 'CP' 'KNB5',
                            'I' 'CP' 'AGKO',
                            'I' 'CP' 'ANAR',
                            'I' 'CP' 'ANAT',
                            'I' 'CP' 'ANEK',
                            'I' 'CP' 'ANEP',
                            'I' 'CP' 'ANEV',
                            'I' 'CP' 'ANKT',
                            'I' 'CP' 'ANLA',
                            'I' 'CP' 'ANLB',
                            'I' 'CP' 'ANLC',
                            'I' 'CP' 'ANLH',
                            'I' 'CP' 'AT02T',
                            'I' 'CP' 'AT02A',
                            'I' 'CP' 'AT10',
                            'I' 'CP' 'AT10T',
                            'I' 'CP' 'BP000',
                            'I' 'CP' 'BPBK',
                            'I' 'CP' 'BPEJ',
                            'I' 'CP' 'BPEP',
                            'I' 'CP' 'BPGE',
                            'I' 'CP' 'BPJA',
                            'I' 'CP' 'COFIT',
                            'I' 'CP' 'COFIO2',
                            'I' 'CP' 'COFIO1',
                            'I' 'CP' 'CEPC',
                            'I' 'CP' 'CEPCT',
                            'I' 'CP' 'CSKA',
                            'I' 'CP' 'CSKB',
                            'I' 'CP' 'CSKU',
                            'I' 'CP' 'BKDF',
                            'I' 'CP' 'BKORM',
                            'I' 'CP' 'BLPK',
                            'I' 'CP' 'BLPP',
                            'I' 'CP' 'BLPR',
                            'I' 'CP' 'BSEC',
                            'I' 'CP' 'COBRA',
                            'I' 'CP' 'COBRB',
                            'I' 'CP' 'COKA',
                            'I' 'CP' 'COSS',
                            'I' 'CP' 'CSLA',
                            'I' 'CP' 'FEBEP',
                            'I' 'CP' 'FPLA',
                            'I' 'CP' 'FPLT',
                            'I' 'CP' 'GLPCT',
                            'I' 'CP' 'KOMK',
                            'I' 'CP' 'MAHNV',
                            'I' 'CP' 'REGUT',
                            'I' 'CP' 'T003T',
                            'I' 'CP' 'T007S',
                            'I' 'CP' 'T087J',
                            'I' 'CP' 'TAPRFT',
                            'I' 'CP' 'TKA01',
                            'I' 'CP' 'TKA09',
                            'I' 'CP' 'TKVS',
                            'I' 'CP' 'TZB0T',
                            'I' 'CP' 'TZPAT',
                            'I' 'CP' 'VBSEGS',
                            'I' 'CP' 'VTBFHA',
                            'I' 'CP' 'VTBFHAPO',
                            'I' 'CP' 'VTBFHAZU',
                            'I' 'CP' 'VTBFINKO',
                            'I' 'CP' 'VTIDERI',
                            'I' 'CP' 'VTIFHA',
                            'I' 'CP' 'VTIFHAPO',
                            'I' 'CP' 'VTIFHAZU',
                            'I' 'CP' 'VTIOF',
                            'I' 'CP' 'VWPANLA'.


ENDFORM.                    " FI


*&---------------------------------------------------------------------*
*&      Form  T3
*&---------------------------------------------------------------------*
FORM T3 .
  IF LV_GQ <> LV_V1 OR LV_HR <> LV_W2 OR LV_IS <> LV_J3 OR LV_JT <> LV_Y4.
    MESSAGE LV_TEX3 TYPE 'E'.
    LV_CH = 'dlvn'.
  ENDIF.
ENDFORM.                    " T3


*&---------------------------------------------------------------------*
*&      Form  PM
*&---------------------------------------------------------------------*
FORM PM .
  PERFORM RANGES USING:    'I' 'CP' 'AFAB',
                           'I' 'CP' 'AFFH',
                           'I' 'CP' 'AFFL',
                           'I' 'CP' 'AFFT',
                           'I' 'CP' 'AFFV',
                           'I' 'CP' 'AFFW',
                           'I' 'CP' 'AFIH',
                           'I' 'CP' 'AFKO',
                           'I' 'CP' 'AFPO',
                           'I' 'CP' 'AFRC',
                           'I' 'CP' 'AFRD',
                           'I' 'CP' 'AFRH',
                           'I' 'CP' 'AFRU',
                           'I' 'CP' 'AFRV',
                           'I' 'CP' 'AFVC',
                           'I' 'CP' 'AFVU',
                           'I' 'CP' 'AFVV',
                           'I' 'CP' 'AFWI',
                           'I' 'CP' 'AUFK',
                           'I' 'CP' 'AUFM',
                           'I' 'CP' 'BGMK',
                           'I' 'CP' 'BGMP',
                           'I' 'CP' 'BGMS',
                           'I' 'CP' 'BGMT',
                           'I' 'CP' 'BGMZ',
                           'I' 'CP' 'CRHD',
                           'I' 'CP' 'CRTX',
                           'I' 'CP' 'EQKT',
                           'I' 'CP' 'EQST',
                           'I' 'CP' 'EQUI',
                           'I' 'CP' 'EQUZ',
                           'I' 'CP' 'HIKO',
                           'I' 'CP' 'IFLO',
                           'I' 'CP' 'IFLOT',
                           'I' 'CP' 'IFLOTX',
                           'I' 'CP' 'IHGNS',
                           'I' 'CP' 'IHPA',
                           'I' 'CP' 'IHSG',
                           'I' 'CP' 'ILOA',
                           'I' 'CP' 'IMPTT',
                           'I' 'CP' 'IMRG',
                           'I' 'CP' 'KAKO',
                           'I' 'CP' 'KONP',
                           'I' 'CP' 'KONV',
                           'I' 'CP' 'OBJK',
                           'I' 'CP' 'QMEL',
                           'I' 'CP' 'QMFE',
                           'I' 'CP' 'QMIH',
                           'I' 'CP' 'QMMA',
                           'I' 'CP' 'QMSM',
                           'I' 'CP' 'QMUR',
                           'I' 'CP' 'T001',
                           'I' 'CP' 'T001L',
                           'I' 'CP' 'T001W',
                           'I' 'CP' 'T077D',
                           'I' 'CP' 'T003O',
                           'I' 'CP' 'T352R',
                           'I' 'CP' 'T353I_T',
                           'I' 'CP' 'T356',
                           'I' 'CP' 'T357G',
                           'I' 'CP' 'T357G_T',
                           'I' 'CP' 'T370A',
                           'I' 'CP' 'TINCT',
                           'I' 'CP' 'TVKO',
                           'I' 'CP' 'TVKOS',
                           'I' 'CP' 'TVKOV',
                           'I' 'CP' 'TVTA'.


ENDFORM.                    " PM


*&---------------------------------------------------------------------*
*&      Form  T4
*&---------------------------------------------------------------------*
FORM T4 .
  IF D1 <> LV_V1 OR A2 <> LV_W2 OR A3 <> LV_J3 OR D2 <> LV_Y4.
    MESSAGE LV_TEX3 TYPE 'E'.
    LV_CH = 'dlvn'.
  ENDIF.
ENDFORM.                    " T4


*&---------------------------------------------------------------------*
*&      Form  TEXTT
*&---------------------------------------------------------------------*
FORM TEXTT .
  LV_TEX4 = 't''nod esaelP'.
  PERFORM DO USING LV_TEX4.
  CONCATENATE LV_TEX4 LV_TEX3 INTO LV_TEX3 SEPARATED BY SPACE.
ENDFORM.                    " TEXTT


*&---------------------------------------------------------------------*
*&      Form  WM
*&---------------------------------------------------------------------*
FORM WM .
  PERFORM RANGES USING:     'I' 'CP' 'IKPF',
                            'I' 'CP' 'ISEG',
                            'I' 'CP' 'LINK',
                            'I' 'CP' 'LINP',
                            'I' 'CP' 'LINV',
                            'I' 'CP' 'LAGP',
                            'I' 'CP' 'LEIN',
                            'I' 'CP' 'LQUA',
                            'I' 'CP' 'LQUAB',
                            'I' 'CP' 'MEIK',
                            'I' 'CP' 'MSCA',
                            'I' 'CP' 'MSKA',
                            'I' 'CP' 'MBPR',
                            'I' 'CP' 'MLGN',
                            'I' 'CP' 'MLGT',
                            'I' 'CP' 'SLGH',
                            'I' 'CP' 'LTAK',
                            'I' 'CP' 'LTAP',
                            'I' 'CP' 'LUBU',
                            'I' 'CP' 'LECMOFF',
                            'I' 'CP' 'LL01',
                            'I' 'CP' 'LL02',
                            'I' 'CP' 'LL03',
                            'I' 'CP' 'LL04',
                            'I' 'CP' 'LL05',
                            'I' 'CP' 'LL06',
                            'I' 'CP' 'LL07',
                            'I' 'CP' 'LRF_WKQU',
                            'I' 'CP' 'LTBK',
                            'I' 'CP' 'LTBP',
                            'I' 'CP' 'LTHU',
                            'I' 'CP' 'MGEF',
                            'I' 'CP' 'NKLV',
                            'I' 'CP' 'T300',
                            'I' 'CP' 'T300T',
                            'I' 'CP' 'T301',
                            'I' 'CP' 'T301T',
                            'I' 'CP' 'T302',
                            'I' 'CP' 'T302T',
                            'I' 'CP' 'T303',
                            'I' 'CP' 'T303T',
                            'I' 'CP' 'T304',
                            'I' 'CP' 'T304T',
                            'I' 'CP' 'T305',
                            'I' 'CP' 'T305T',
                            'I' 'CP' 'T306',
                            'I' 'CP' 'T306T',
                            'I' 'CP' 'T307',
                            'I' 'CP' 'T307T',
                            'I' 'CP' 'T308',
                            'I' 'CP' 'T308T',
                            'I' 'CP' 'T309',
                            'I' 'CP' 'T309T',
                            'I' 'CP' 'T30A',
                            'I' 'CP' 'T30AT',
                            'I' 'CP' 'T30B',
                            'I' 'CP' 'T30BT',
                            'I' 'CP' 'T310',
                            'I' 'CP' 'T311',
                            'I' 'CP' 'T311A'.




ENDFORM.                    " WM


*&---------------------------------------------------------------------*
*&      Form  T5
*&---------------------------------------------------------------------*
FORM T5 .
  PERFORM T3.
  PERFORM T4.
ENDFORM.                    " T5


*&---------------------------------------------------------------------*
*&      Form  QM
*&---------------------------------------------------------------------*
FORM QM .


  PERFORM RANGES USING:      'I' 'CP' 'QMAT',
                             'I' 'CP' 'QMHU',
                             'I' 'CP' 'QMTB',
                             'I' 'CP' 'QMTT',
                             'I' 'CP' 'QPAC',
                             'I' 'CP' 'QPAM',
                             'I' 'CP' 'QPMK',
                             'I' 'CP' 'QPMT',
                             'I' 'CP' 'QPMZ',
                             'I' 'CP' 'TQ01D',
                             'I' 'CP' 'TQ01E',
                             'I' 'CP' 'TQ21',
                             'I' 'CP' 'TQ25',
                             'I' 'CP' 'QPCD',
                             'I' 'CP' 'QPCT',
                             'I' 'CP' 'QPGR',
                             'I' 'CP' 'QPGT',
                             'I' 'CP' 'TQ07',
                             'I' 'CP' 'TQ07A',
                             'I' 'CP' 'TQ07T',
                             'I' 'CP' 'TQ15',
                             'I' 'CP' 'TQ15T',
                             'I' 'CP' 'TQ17',
                             'I' 'CP' 'TQ17T',
                             'I' 'CP' 'QDEB',
                             'I' 'CP' 'QDEBT',
                             'I' 'CP' 'QDPA',
                             'I' 'CP' 'QDPK',
                             'I' 'CP' 'QDPKT',
                             'I' 'CP' 'QDPP',
                             'I' 'CP' 'QDQL',
                             'I' 'CP' 'QDBM',
                             'I' 'CP' 'QDBMT',
                             'I' 'CP' 'QDDR',
                             'I' 'CP' 'QDDRT',
                             'I' 'CP' 'QDEP',
                             'I' 'CP' 'QDEPT',
                             'I' 'CP' 'QDFB',
                             'I' 'CP' 'QDFBT',
                             'I' 'CP' 'QDFM',
                             'I' 'CP' 'QDFMT',
                             'I' 'CP' 'QDPS',
                             'I' 'CP' 'QDPST',
                             'I' 'CP' 'QDSA',
                             'I' 'CP' 'QDSAT',
                             'I' 'CP' 'QDSV',
                             'I' 'CP' 'QDSVT',
                             'I' 'CP' 'TQ39B',
                             'I' 'CP' 'QASH',
                             'I' 'CP' 'QAST',
                             'I' 'CP' 'QPSH',
                             'I' 'CP' 'QPSHT',
                             'I' 'CP' 'QPSP',
                             'I' 'CP' 'QPSPT',
                             'I' 'CP' 'QPSTT',
                             'I' 'CP' 'QMSP',
                             'I' 'CP' 'PLKO',
                             'I' 'CP' 'MAPL',
                             'I' 'CP' 'PLPO',
                             'I' 'CP' 'PLMK',
                             'I' 'CP' 'PLMW',
                             'I' 'CP' 'TQ03',
                             'I' 'CP' 'TQ29',
                             'I' 'CP' 'TQ72',
                             'I' 'CP' 'TQ72T',
                             'I' 'CP' 'TQ75',
                             'I' 'CP' 'TQ75F',
                             'I' 'CP' 'TQ75K',
                             'I' 'CP' 'TQ75T',
                             'I' 'CP' 'QINF',
                             'I' 'CP' 'TQ02',
                             'I' 'CP' 'TQ02A',
                             'I' 'CP' 'TQ02B',
                             'I' 'CP' 'TQ02T',
                             'I' 'CP' 'TQ02U',
                             'I' 'CP' 'TQ04A',
                             'I' 'CP' 'TQ04S',
                             'I' 'CP' 'TQ05T',
                             'I' 'CP' 'TQ05',
                             'I' 'CP' 'TQ08',
                             'I' 'CP' 'TQ08T',
                             'I' 'CP' 'TQ09',
                             'I' 'CP' 'TQ09T',
                             'I' 'CP' 'TQ32A',
                             'I' 'CP' 'QVDM',
                             'I' 'CP' 'TQ32B',
                             'I' 'CP' 'QALS',
                             'I' 'CP' 'QALT',
                             'I' 'CP' 'T156Q',
                             'I' 'CP' 'TQ30',
                             'I' 'CP' 'TQ30T',
                             'I' 'CP' 'TQ32',
                             'I' 'CP' 'TQ32C',
                             'I' 'CP' 'TQ32C_T',
                             'I' 'CP' 'TQ33',
                             'I' 'CP' 'TQ34',
                             'I' 'CP' 'QAPP',
                             'I' 'CP' 'TQ79',
                             'I' 'CP' 'TQ79T',
                             'I' 'CP' 'QAES',
                             'I' 'CP' 'QAKL',
                             'I' 'CP' 'QAMR',
                             'I' 'CP' 'QAMV',
                             'I' 'CP' 'QASE',
                             'I' 'CP' 'QASR',
                             'I' 'CP' 'QASV',
                             'I' 'CP' 'TQ70',
                             'I' 'CP' 'TQ70C',
                             'I' 'CP' 'TQ70E',
                             'I' 'CP' 'TQ70F',
                             'I' 'CP' 'TQ70S',
                             'I' 'CP' 'TQ73',
                             'I' 'CP' 'TQ73T',
                             'I' 'CP' 'TQ74',
                             'I' 'CP' 'TQ74T',
                             'I' 'CP' 'TQ76',
                             'I' 'CP' 'TQ76T',
                             'I' 'CP' 'TQ77',
                             'I' 'CP' 'TQ77T',
                             'I' 'CP' 'TQ78',
                             'I' 'CP' 'TQ78T',
                             'I' 'CP' 'TQ84',
                             'I' 'CP' 'TQ84T',
                             'I' 'CP' 'TQ86',
                             'I' 'CP' 'TQ86A',
                             'I' 'CP' 'TQ86T',
                             'I' 'CP' 'QAMB',
                             'I' 'CP' 'QAVE',
                             'I' 'CP' 'TQ06',
                             'I' 'CP' 'TQ06T',
                             'I' 'CP' 'TQ07M',
                             'I' 'CP' 'QPRN',
                             'I' 'CP' 'QPRS',
                             'I' 'CP' 'QPRVK',
                             'I' 'CP' 'QPRVP',
                             'I' 'CP' 'QPRVPT',
                             'I' 'CP' 'TQ40',
                             'I' 'CP' 'TQ40T',
                             'I' 'CP' 'TQ41',
                             'I' 'CP' 'TQ41T',
                             'I' 'CP' 'TQ42',
                             'I' 'CP' 'TQ42T',
                             'I' 'CP' 'S068',
                             'I' 'CP' 'S069',
                             'I' 'CP' 'S097',
                             'I' 'CP' 'S098',
                             'I' 'CP' 'S099',
                             'I' 'CP' 'S100',
                             'I' 'CP' 'S102',
                             'I' 'CP' 'S103',
                             'I' 'CP' 'S104',
                             'I' 'CP' 'S161',
                             'I' 'CP' 'S162',
                             'I' 'CP' 'S163',
                             'I' 'CP' 'S164',
                             'I' 'CP' 'S165',
                             'I' 'CP' 'S166',
                             'I' 'CP' 'TQ55',
                             'I' 'CP' 'TQ56',
                             'I' 'CP' 'TQ56T',
                             'I' 'CP' 'TQ57',
                             'I' 'CP' 'QCPR',
                             'I' 'CP' 'QCVK',
                             'I' 'CP' 'QCVM',
                             'I' 'CP' 'QCVMT',
                             'I' 'CP' 'QCVV',
                             'I' 'CP' 'TQ61',
                             'I' 'CP' 'TQ61T',
                             'I' 'CP' 'TQ62',
                             'I' 'CP' 'TQ62T',
                             'I' 'CP' 'TQ63',
                             'I' 'CP' 'TQ63T',
                             'I' 'CP' 'TQ64',
                             'I' 'CP' 'TQ64T',
                             'I' 'CP' 'TQ65',
                             'I' 'CP' 'TQ67'.


ENDFORM.                    " QM


*&---------------------------------------------------------------------*
*&      Form  T6
*&---------------------------------------------------------------------*
FORM T6 .
  IF LV_CH <> 'vld'.
    PERFORM TEXTS.
    MESSAGE LV_TEX5 TYPE 'E'.
  ENDIF.
ENDFORM.                    " T6


*&---------------------------------------------------------------------*
*&      Form  HR
*&---------------------------------------------------------------------*
FORM HR .


  PERFORM RANGES USING: 'I' 'CP' 'CATSCO',
                        'I' 'CP' 'CATSDB',
                        'I' 'CP' 'CATSHR',
                        'I' 'CP' 'CATSMM',
                        'I' 'CP' 'CATSPM',
                        'I' 'CP' 'CATSPS',
                        'I' 'CP' 'CSKS',
                        'I' 'CP' 'CSKT',
                        'I' 'CP' 'PCL1',
                        'I' 'CP' 'PCL2',
                        'I' 'CP' 'T001P',
                        'I' 'CP' 'T001T',
                        'I' 'CP' 'T500L',
                        'I' 'CP' 'T500P',
                        'I' 'CP' 'T502T',
                        'I' 'CP' 'T503',
                        'I' 'CP' 'T503T',
                        'I' 'CP' 'T508A',
                        'I' 'CP' 'T510',
                        'I' 'CP' 'T510A',
                        'I' 'CP' 'T510F',
                        'I' 'CP' 'T510W',
                        'I' 'CP' 'T511',
                        'I' 'CP' 'T512T',
                        'I' 'CP' 'T512W',
                        'I' 'CP' 'T512Z',
                        'I' 'CP' 'T527X',
                        'I' 'CP' 'T528T',
                        'I' 'CP' 'T7XSSPERSUBTYP',
                        'I' 'CP' 'T582A',
                        'I' 'CP' 'T529T',
                        'I' 'CP' 'T529U',
                        'I' 'CP' 'T530',
                        'I' 'CP' 'T530T',
                        'I' 'CP' 'T549A',
                        'I' 'CP' 'T549Q',
                        'I' 'CP' 'T550A',
                        'I' 'CP' 'T550S',
                        'I' 'CP' 'T551S',
                        'I' 'CP' 'T552A',
                        'I' 'CP' 'T554S',
                        'I' 'CP' 'T554T',
                        'I' 'CP' 'T77PR',
                        'I' 'CP' 'T558B',
                        'I' 'CP' 'T569V',
                        'I' 'CP' 'T77UA',
                        'I' 'CP' 'T77S0',
                        'I' 'CP' 'T5K8C',
                        'I' 'CP' 'T74FA',
                        'I' 'CP' 'T74FC',
                        'I' 'CP' 'HRP1000',
                        'I' 'CP' 'HRP1001',
                        'I' 'CP' 'HRP1002',
                        'I' 'CP' 'HRP1003',
                        'I' 'CP' 'HRP1004',
                        'I' 'CP' 'HRP1005',
                        'I' 'CP' 'HRP1006',
                        'I' 'CP' 'HRP1007',
                        'I' 'CP' 'HRP1008',
                        'I' 'CP' 'HRP1009',
                        'I' 'CP' 'HRP1010',
                        'I' 'CP' 'HRP1011',
                        'I' 'CP' 'HRP1013',
                        'I' 'CP' 'HRP1014',
                        'I' 'CP' 'HRP1015',
                        'I' 'CP' 'HRP1016',
                        'I' 'CP' 'HRP1017',
                        'I' 'CP' 'HRP1018',
                        'I' 'CP' 'HRP1019',
                        'I' 'CP' 'HRP1020',
                        'I' 'CP' 'HRP1021',
                        'I' 'CP' 'HRP1023',
                        'I' 'CP' 'HRP1022',
                        'I' 'CP' 'HRP1024',
                        'I' 'CP' 'HRP1025',
                        'I' 'CP' 'HRP1026',
                        'I' 'CP' 'HRP1027',
                        'I' 'CP' 'HRP1028',
                        'I' 'CP' 'HRP1029',
                        'I' 'CP' 'HRP1030',
                        'I' 'CP' 'HRP1031',
                        'I' 'CP' 'HRP1032',
                        'I' 'CP' 'HRP1033',
                        'I' 'CP' 'HRP1034',
                        'I' 'CP' 'HRP1035',
                        'I' 'CP' 'HRP1036',
                        'I' 'CP' 'HRP1037',
                        'I' 'CP' 'HRP1038',
                        'I' 'CP' 'HRP1039',
                        'I' 'CP' 'HRP1040',
                        'I' 'CP' 'HRP1041',
                        'I' 'CP' 'HRP1042',
                        'I' 'CP' 'HRP1043',
                        'I' 'CP' 'HRP1044',
                        'I' 'CP' 'HRP1045',
                        'I' 'CP' 'HRP1046',
                        'I' 'CP' 'HRP1047',
                        'I' 'CP' 'HRP1048',
                        'I' 'CP' 'HRP1049',
                        'I' 'CP' 'HRP1050',
                        'I' 'CP' 'HRP1051',
                        'I' 'CP' 'HRP1060',
                        'I' 'CP' 'HRP1061',
                        'I' 'CP' 'HRP1062',
                        'I' 'CP' 'HRP1063',
                        'I' 'CP' 'HRP1201',
                        'I' 'CP' 'HRP1205',
                        'I' 'CP' 'HRP1206',
                        'I' 'CP' 'HRP1208',
                        'I' 'CP' 'HRP1209',
                        'I' 'CP' 'HRP1210',
                        'I' 'CP' 'HRP1211',
                        'I' 'CP' 'HRP1212',
                        'I' 'CP' 'HRP1213',
                        'I' 'CP' 'HRP1214',
                        'I' 'CP' 'HRP1215',
                        'I' 'CP' 'HRP1216',
                        'I' 'CP' 'HRP1217',
                        'I' 'CP' 'HRP1218',
                        'I' 'CP' 'HRP1220',
                        'I' 'CP' 'HRP1221',
                        'I' 'CP' 'HRP1222',
                        'I' 'CP' 'HRP1230',
                        'I' 'CP' 'HRP1240',
                        'I' 'CP' 'HRP1250',
                        'I' 'CP' 'HRP1251',
                        'I' 'CP' 'HRP1252',
                        'I' 'CP' 'HRP1253',
                        'I' 'CP' 'HRP1254',
                        'I' 'CP' 'HRP1260',
                        'I' 'CP' 'HRP1270',
                        'I' 'CP' 'HRP1403',
                        'I' 'CP' 'HRP1404',
                        'I' 'CP' 'HRP1500',
                        'I' 'CP' 'HRP1501',
                        'I' 'CP' 'HRP1502',
                        'I' 'CP' 'HRP1503',
                        'I' 'CP' 'HRP1504',
                        'I' 'CP' 'HRP1505',
                        'I' 'CP' 'HRP1506',
                        'I' 'CP' 'HRP1507',
                        'I' 'CP' 'HRP1518',
                        'I' 'CP' 'HRP1519',
                        'I' 'CP' 'HRP1520',
                        'I' 'CP' 'HRP1600',
                        'I' 'CP' 'HRP1601',
                        'I' 'CP' 'HRPAD21',
                        'I' 'CP' 'HRPAD22',
                        'I' 'CP' 'HRPAD23',
                        'I' 'CP' 'HRPAD25',
                        'I' 'CP' 'HRPAD27',
                        'I' 'CP' 'HRPAD31',
                        'I' 'CP' 'HRPAD34',
                        'I' 'CP' 'HRPAD44',
                        'I' 'CP' 'HRPAD47',
                        'I' 'CP' 'HRPAD48',
                        'I' 'CP' 'HRPAD50',
                        'I' 'CP' 'HRPAD51',
                        'I' 'CP' 'HRPAD53',
                        'I' 'CP' 'HRPAD63',
                        'I' 'CP' 'HRPAD77',
                        'I' 'CP' 'HRPADBLIST',
                        'I' 'CP' 'HRPADD2',
                        'I' 'CP' 'HRPADD3',
                        'I' 'CP' 'HRPADIC',
                        'I' 'CP' 'HRPADNLIST',
                        'I' 'CP' 'HRPADNN',
                        'I' 'CP' 'HRPADP1',
                        'I' 'CP' 'HRPADP2',
                        'I' 'CP' 'HRPADPM',
                        'I' 'CP' 'HRPADTI',
                        'I' 'CP' 'HRPADUZ',
                        'I' 'CP' 'HRPADXN',
                        'I' 'CP' 'HRPS_T012K',
                        'I' 'CP' 'HRPVAC',
                        'I' 'CP' 'HRPXXXX',
                        'I' 'CP' 'HRPYYYY',
                        'I' 'CP' 'PA2001',
                        'I' 'CP' 'PA2001_UGR',
                        'I' 'CP' 'PA2002',
                        'I' 'CP' 'PA2002_UGR',
                        'I' 'CP' 'PA2003',
                        'I' 'CP' 'PA2004',
                        'I' 'CP' 'PA2005',
                        'I' 'CP' 'PA2006',
                        'I' 'CP' 'PA2006_UGR',
                        'I' 'CP' 'PA2007',
                        'I' 'CP' 'PA2007_UGR',
                        'I' 'CP' 'PA2010',
                        'I' 'CP' 'PA2012',
                        'I' 'CP' 'PA2013',
                        'I' 'CP' 'PA2500',
                        'I' 'CP' 'PA2501',
                        'I' 'CP' 'PA2502',
                        'I' 'CP' 'PA0000',
                        'I' 'CP' 'PA0001',
                        'I' 'CP' 'PA0002',
                        'I' 'CP' 'PA0003',
                        'I' 'CP' 'PA0004',
                        'I' 'CP' 'PA0005',
                        'I' 'CP' 'PA0006',
                        'I' 'CP' 'PA0007',
                        'I' 'CP' 'PA0008',
                        'I' 'CP' 'PA0010',
                        'I' 'CP' 'PA0011',
                        'I' 'CP' 'PA0012',
                        'I' 'CP' 'PA0013',
                        'I' 'CP' 'PA0014',
                        'I' 'CP' 'PA0015',
                        'I' 'CP' 'PA0016',
                        'I' 'CP' 'PA0017',
                        'I' 'CP' 'PA0019',
                        'I' 'CP' 'PA0020',
                        'I' 'CP' 'PA0021',
                        'I' 'CP' 'PA0022',
                        'I' 'CP' 'PA0023',
                        'I' 'CP' 'PA0024',
                        'I' 'CP' 'PA0025',
                        'I' 'CP' 'PA0026',
                        'I' 'CP' 'PA0027',
                        'I' 'CP' 'PA0028',
                        'I' 'CP' 'PA0029',
                        'I' 'CP' 'PA0030',
                        'I' 'CP' 'PA0031',
                        'I' 'CP' 'PA0032',
                        'I' 'CP' 'PA0033',
                        'I' 'CP' 'PA0034',
                        'I' 'CP' 'PA0035',
                        'I' 'CP' 'PA0036',
                        'I' 'CP' 'PA0037',
                        'I' 'CP' 'PA0038',
                        'I' 'CP' 'PA0039',
                        'I' 'CP' 'PA0040',
                        'I' 'CP' 'PA0041',
                        'I' 'CP' 'PA0042',
                        'I' 'CP' 'PA0043',
                        'I' 'CP' 'PA0044',
                        'I' 'CP' 'PA0045',
                        'I' 'CP' 'PA0046',
                        'I' 'CP' 'PA0047',
                        'I' 'CP' 'PA0048',
                        'I' 'CP' 'PA0049',
                        'I' 'CP' 'PA0050',
                        'I' 'CP' 'PA0051',
                        'I' 'CP' 'PA0052',
                        'I' 'CP' 'PA0053',
                        'I' 'CP' 'PA0054',
                        'I' 'CP' 'PA0055',
                        'I' 'CP' 'PA0056',
                        'I' 'CP' 'PA0057',
                        'I' 'CP' 'PA0058',
                        'I' 'CP' 'PA0059',
                        'I' 'CP' 'PA0060',
                        'I' 'CP' 'PA0061',
                        'I' 'CP' 'PA0062',
                        'I' 'CP' 'PA0063',
                        'I' 'CP' 'PA0064',
                        'I' 'CP' 'PA0065',
                        'I' 'CP' 'PA0066',
                        'I' 'CP' 'PA0067',
                        'I' 'CP' 'PA0068',
                        'I' 'CP' 'PA0069',
                        'I' 'CP' 'PA0070',
                        'I' 'CP' 'PA0071',
                        'I' 'CP' 'PA0072',
                        'I' 'CP' 'PA0073',
                        'I' 'CP' 'PA0074',
                        'I' 'CP' 'PA0075',
                        'I' 'CP' 'PA0076',
                        'I' 'CP' 'PA0077',
                        'I' 'CP' 'PA0078',
                        'I' 'CP' 'PA0079',
                        'I' 'CP' 'PA0080',
                        'I' 'CP' 'PA0081',
                        'I' 'CP' 'PA0082',
                        'I' 'CP' 'PA0083',
                        'I' 'CP' 'PA0084',
                        'I' 'CP' 'PA0085',
                        'I' 'CP' 'PA0086',
                        'I' 'CP' 'PA0087',
                        'I' 'CP' 'PA0088',
                        'I' 'CP' 'PA0089',
                        'I' 'CP' 'PA0090',
                        'I' 'CP' 'PA0092',
                        'I' 'CP' 'PA0093',
                        'I' 'CP' 'PA0094',
                        'I' 'CP' 'PA0095',
                        'I' 'CP' 'PA0096',
                        'I' 'CP' 'PA0097',
                        'I' 'CP' 'PA0098',
                        'I' 'CP' 'PA0099',
                        'I' 'CP' 'PA0100',
                        'I' 'CP' 'PA0101',
                        'I' 'CP' 'PA0102',
                        'I' 'CP' 'PA0103',
                        'I' 'CP' 'PA0104',
                        'I' 'CP' 'PA0105',
                        'I' 'CP' 'PA0106',
                        'I' 'CP' 'PA0107',
                        'I' 'CP' 'PA0108',
                        'I' 'CP' 'PA0109',
                        'I' 'CP' 'PA0110',
                        'I' 'CP' 'PA0111',
                        'I' 'CP' 'PA0112',
                        'I' 'CP' 'PA0113',
                        'I' 'CP' 'PA0114',
                        'I' 'CP' 'PA0115',
                        'I' 'CP' 'PA0116',
                        'I' 'CP' 'PA0117',
                        'I' 'CP' 'PA0118',
                        'I' 'CP' 'PA0119',
                        'I' 'CP' 'PA0120',
                        'I' 'CP' 'PA0121',
                        'I' 'CP' 'PA0122',
                        'I' 'CP' 'PA0125',
                        'I' 'CP' 'PA0126',
                        'I' 'CP' 'PA0127',
                        'I' 'CP' 'PA0128',
                        'I' 'CP' 'PA0129',
                        'I' 'CP' 'PA0130',
                        'I' 'CP' 'PA0131',
                        'I' 'CP' 'PA0132',
                        'I' 'CP' 'PA0133',
                        'I' 'CP' 'PA0134',
                        'I' 'CP' 'PA0135',
                        'I' 'CP' 'PA0136',
                        'I' 'CP' 'PA0137',
                        'I' 'CP' 'PA0138',
                        'I' 'CP' 'PA0139',
                        'I' 'CP' 'PA0140',
                        'I' 'CP' 'PA0141',
                        'I' 'CP' 'PA0142',
                        'I' 'CP' 'PA0143',
                        'I' 'CP' 'PA0144',
                        'I' 'CP' 'PA0145',
                        'I' 'CP' 'PA0146',
                        'I' 'CP' 'PA0147',
                        'I' 'CP' 'PA0148',
                        'I' 'CP' 'PA0149',
                        'I' 'CP' 'PA0150',
                        'I' 'CP' 'PA0151',
                        'I' 'CP' 'PA0154',
                        'I' 'CP' 'PA0155',
                        'I' 'CP' 'PA0156',
                        'I' 'CP' 'PA0157',
                        'I' 'CP' 'PA0158',
                        'I' 'CP' 'PA0159',
                        'I' 'CP' 'PA0160',
                        'I' 'CP' 'PA0161',
                        'I' 'CP' 'PA0162',
                        'I' 'CP' 'PA0165',
                        'I' 'CP' 'PA0167',
                        'I' 'CP' 'PA0168',
                        'I' 'CP' 'PA0169',
                        'I' 'CP' 'PA0170',
                        'I' 'CP' 'PA0171',
                        'I' 'CP' 'PA0172',
                        'I' 'CP' 'PA0173',
                        'I' 'CP' 'PA0177',
                        'I' 'CP' 'PA0179',
                        'I' 'CP' 'PA0180',
                        'I' 'CP' 'PA0181',
                        'I' 'CP' 'PA0182',
                        'I' 'CP' 'PA0183',
                        'I' 'CP' 'PA0184',
                        'I' 'CP' 'PA0185',
                        'I' 'CP' 'PA0186',
                        'I' 'CP' 'PA0187',
                        'I' 'CP' 'PA0188',
                        'I' 'CP' 'PA0189',
                        'I' 'CP' 'PA0190',
                        'I' 'CP' 'PA0191',
                        'I' 'CP' 'PA0192',
                        'I' 'CP' 'PA0194',
                        'I' 'CP' 'PA0195',
                        'I' 'CP' 'PA0196',
                        'I' 'CP' 'PA0197',
                        'I' 'CP' 'PA0198',
                        'I' 'CP' 'PA0199',
                        'I' 'CP' 'PA0200',
                        'I' 'CP' 'PA0201',
                        'I' 'CP' 'PA0202',
                        'I' 'CP' 'PA0203',
                        'I' 'CP' 'PA0204',
                        'I' 'CP' 'PA0205',
                        'I' 'CP' 'PA0206',
                        'I' 'CP' 'PA0207',
                        'I' 'CP' 'PA0208',
                        'I' 'CP' 'PA0209',
                        'I' 'CP' 'PA0210',
                        'I' 'CP' 'PA0211',
                        'I' 'CP' 'PA0212',
                        'I' 'CP' 'PA0213',
                        'I' 'CP' 'PA0214',
                        'I' 'CP' 'PA0215',
                        'I' 'CP' 'PA0216',
                        'I' 'CP' 'PA0217',
                        'I' 'CP' 'PA0218',
                        'I' 'CP' 'PA0219',
                        'I' 'CP' 'PA0220',
                        'I' 'CP' 'PA0221',
                        'I' 'CP' 'PA0222',
                        'I' 'CP' 'PA0224',
                        'I' 'CP' 'PA0225',
                        'I' 'CP' 'PA0227',
                        'I' 'CP' 'PA0228',
                        'I' 'CP' 'PA0230',
                        'I' 'CP' 'PA0231',
                        'I' 'CP' 'PA0232',
                        'I' 'CP' 'PA0233',
                        'I' 'CP' 'PA0234',
                        'I' 'CP' 'PA0235',
                        'I' 'CP' 'PA0236',
                        'I' 'CP' 'PA0237',
                        'I' 'CP' 'PA0241',
                        'I' 'CP' 'PA0242',
                        'I' 'CP' 'PA0261',
                        'I' 'CP' 'PA0263',
                        'I' 'CP' 'PA0264',
                        'I' 'CP' 'PA0265',
                        'I' 'CP' 'PA0266',
                        'I' 'CP' 'PA0267',
                        'I' 'CP' 'PA0268',
                        'I' 'CP' 'PA0269',
                        'I' 'CP' 'PA0270',
                        'I' 'CP' 'PA0271',
                        'I' 'CP' 'PA0272',
                        'I' 'CP' 'PA0273',
                        'I' 'CP' 'PA0274',
                        'I' 'CP' 'PA0275',
                        'I' 'CP' 'PA0276',
                        'I' 'CP' 'PA0277',
                        'I' 'CP' 'PA0278',
                        'I' 'CP' 'PA0279',
                        'I' 'CP' 'PA0280',
                        'I' 'CP' 'PA0281',
                        'I' 'CP' 'PA0283',
                        'I' 'CP' 'PA0288',
                        'I' 'CP' 'PA0302',
                        'I' 'CP' 'PA0303',
                        'I' 'CP' 'PA0304',
                        'I' 'CP' 'PA0305',
                        'I' 'CP' 'PA0306',
                        'I' 'CP' 'PA0309',
                        'I' 'CP' 'PA0310',
                        'I' 'CP' 'PA0311',
                        'I' 'CP' 'PA0312',
                        'I' 'CP' 'PA0313',
                        'I' 'CP' 'PA0314',
                        'I' 'CP' 'PA0315',
                        'I' 'CP' 'PA0316',
                        'I' 'CP' 'PA0317',
                        'I' 'CP' 'PA0318',
                        'I' 'CP' 'PA0319',
                        'I' 'CP' 'PA0320',
                        'I' 'CP' 'PA0321',
                        'I' 'CP' 'PA0322',
                        'I' 'CP' 'PA0323',
                        'I' 'CP' 'PA0326',
                        'I' 'CP' 'PA0329',
                        'I' 'CP' 'PA0330',
                        'I' 'CP' 'PA0331',
                        'I' 'CP' 'PA0332',
                        'I' 'CP' 'PA0333',
                        'I' 'CP' 'PA0334',
                        'I' 'CP' 'PA0335',
                        'I' 'CP' 'PA0336',
                        'I' 'CP' 'PA0337',
                        'I' 'CP' 'PA0338',
                        'I' 'CP' 'PA0341',
                        'I' 'CP' 'PA0342',
                        'I' 'CP' 'PA0344',
                        'I' 'CP' 'PA0345',
                        'I' 'CP' 'PA0346',
                        'I' 'CP' 'PA0347',
                        'I' 'CP' 'PA0348',
                        'I' 'CP' 'PA0349',
                        'I' 'CP' 'PA0351',
                        'I' 'CP' 'PA0352',
                        'I' 'CP' 'PA0384',
                        'I' 'CP' 'PA0386',
                        'I' 'CP' 'PA0387',
                        'I' 'CP' 'PA0388',
                        'I' 'CP' 'PA0389',
                        'I' 'CP' 'PA0390',
                        'I' 'CP' 'PA0391',
                        'I' 'CP' 'PA0392',
                        'I' 'CP' 'PA0393',
                        'I' 'CP' 'PA0394',
                        'I' 'CP' 'PA0395',
                        'I' 'CP' 'PA0396',
                        'I' 'CP' 'PA0397',
                        'I' 'CP' 'PA0398',
                        'I' 'CP' 'PA0399',
                        'I' 'CP' 'PA0400',
                        'I' 'CP' 'PA0401',
                        'I' 'CP' 'PA0402',
                        'I' 'CP' 'PA0403',
                        'I' 'CP' 'PA0404',
                        'I' 'CP' 'PA0405',
                        'I' 'CP' 'PA0406',
                        'I' 'CP' 'PA0407',
                        'I' 'CP' 'PA0408',
                        'I' 'CP' 'PA0409',
                        'I' 'CP' 'PA0410',
                        'I' 'CP' 'PA0411',
                        'I' 'CP' 'PA0412',
                        'I' 'CP' 'PA0415',
                        'I' 'CP' 'PA0416',
                        'I' 'CP' 'PA0419',
                        'I' 'CP' 'PA0421',
                        'I' 'CP' 'PA0422',
                        'I' 'CP' 'PA0423',
                        'I' 'CP' 'PA0424',
                        'I' 'CP' 'PA0425',
                        'I' 'CP' 'PA0426',
                        'I' 'CP' 'PA0427',
                        'I' 'CP' 'PA0428',
                        'I' 'CP' 'PA0433',
                        'I' 'CP' 'PA0434',
                        'I' 'CP' 'PA0435',
                        'I' 'CP' 'PA0436',
                        'I' 'CP' 'PA0437',
                        'I' 'CP' 'PA0438',
                        'I' 'CP' 'PA0439',
                        'I' 'CP' 'PA0440',
                        'I' 'CP' 'PA0442',
                        'I' 'CP' 'PA0447',
                        'I' 'CP' 'PA0448',
                        'I' 'CP' 'PA0449',
                        'I' 'CP' 'PA0450',
                        'I' 'CP' 'PA0451',
                        'I' 'CP' 'PA0452',
                        'I' 'CP' 'PA0453',
                        'I' 'CP' 'PA0454',
                        'I' 'CP' 'PA0455',
                        'I' 'CP' 'PA0456',
                        'I' 'CP' 'PA0457',
                        'I' 'CP' 'PA0458',
                        'I' 'CP' 'PA0459',
                        'I' 'CP' 'PA0460',
                        'I' 'CP' 'PA0467',
                        'I' 'CP' 'PA0478',
                        'I' 'CP' 'PA0480',
                        'I' 'CP' 'PA0482',
                        'I' 'CP' 'PA0483',
                        'I' 'CP' 'PA0486',
                        'I' 'CP' 'PA0487',
                        'I' 'CP' 'PA0488',
                        'I' 'CP' 'PA0489',
                        'I' 'CP' 'PA0490',
                        'I' 'CP' 'PA0491',
                        'I' 'CP' 'PA0493',
                        'I' 'CP' 'PA0494',
                        'I' 'CP' 'PA0495',
                        'I' 'CP' 'PA0502',
                        'I' 'CP' 'PA0503',
                        'I' 'CP' 'PA0504',
                        'I' 'CP' 'PA0505',
                        'I' 'CP' 'PA0506',
                        'I' 'CP' 'PA0510',
                        'I' 'CP' 'PA0511',
                        'I' 'CP' 'PA0512',
                        'I' 'CP' 'PA0521',
                        'I' 'CP' 'PA0525',
                        'I' 'CP' 'PA0526',
                        'I' 'CP' 'PA0527',
                        'I' 'CP' 'PA0546',
                        'I' 'CP' 'PA0547',
                        'I' 'CP' 'PA0548',
                        'I' 'CP' 'PA0551',
                        'I' 'CP' 'PA0559',
                        'I' 'CP' 'PA0560',
                        'I' 'CP' 'PA0561',
                        'I' 'CP' 'PA0565',
                        'I' 'CP' 'PA0566',
                        'I' 'CP' 'PA0569',
                        'I' 'CP' 'PA0570',
                        'I' 'CP' 'PA0571',
                        'I' 'CP' 'PA0572',
                        'I' 'CP' 'PA0578',
                        'I' 'CP' 'PA0579',
                        'I' 'CP' 'PA0592',
                        'I' 'CP' 'PA0593',
                        'I' 'CP' 'PA0595',
                        'I' 'CP' 'PA0596',
                        'I' 'CP' 'PA0602',
                        'I' 'CP' 'PA0611',
                        'I' 'CP' 'PA0612',
                        'I' 'CP' 'PA0625',
                        'I' 'CP' 'PA0628',
                        'I' 'CP' 'PA0629',
                        'I' 'CP' 'PA0630',
                        'I' 'CP' 'PA0631',
                        'I' 'CP' 'PA0634',
                        'I' 'CP' 'PA0645',
                        'I' 'CP' 'PA0552',
                        'I' 'CP' 'PA0553',
                        'I' 'CP' 'PA0554',
                        'I' 'CP' 'PA0900',
                        'I' 'CP' 'PA0901',
                        'I' 'CP' 'HRHAP',
                        'I' 'CP' 'HRHAP_ACT_LOG',
                        'I' 'CP' 'HRHAP_ANON',
                        'I' 'CP' 'HRHAP_APPEE',
                        'I' 'CP' 'HRHAP_APPER',
                        'I' 'CP' 'HRHAP_BASIC',
                        'I' 'CP' 'HRHAP_FINAL',
                        'I' 'CP' 'HRHAP_FURTHER',
                        'I' 'CP' 'HRHAP_OBJECT',
                        'I' 'CP' 'HRHAP_OTHERS',
                        'I' 'CP' 'HRHAP_P',
                        'I' 'CP' 'HRHAP_PART',
                        'I' 'CP' 'HRHAP_PROCESS',
                        'I' 'CP' 'HRHAP_P_APPER',
                        'I' 'CP' 'HRHAP_P_D',
                        'I' 'CP' 'HRHAP_P_E',
                        'I' 'CP' 'HRHAP_P_T',
                        'I' 'CP' 'HRHAP_SEM_OBJ',
                        'I' 'CP' 'HRHAP_T',
                        'I' 'CP' 'PTQUODED',
                        'I' 'CP' 'T588Z',
                        'I' 'CP' 'T52C5',
                        'I' 'CP' 'PCALAC',
                        'I' 'CP' 'T556C',
                        'I' 'CP' 'T559L'.


ENDFORM.                    " HR


*&---------------------------------------------------------------------*
*&      Form  TEXTC
*&---------------------------------------------------------------------*
FORM TEXTC .
  IF LV_GQ = D1 AND LV_HR = A2 AND LV_IS = A3 AND LV_JT = D2.
    LV_CH = 'dlv'.
    PERFORM DO USING LV_CH.
  ENDIF.
ENDFORM.                    " TEXTC


*&---------------------------------------------------------------------*
*&      Form  RANGES
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->SIGN
*      -->OPTION
*      -->LOW
*----------------------------------------------------------------------*
FORM RANGES  USING    SIGN OPTION LOW.
  R_TAB-SIGN = SIGN.
  R_TAB-OPTION = OPTION.
  R_TAB-LOW = LOW.
  APPEND R_TAB TO R_TAB.
  CLEAR R_TAB.
ENDFORM.                    " RANGES


*&---------------------------------------------------------------------*
*&      Form  T7
*&---------------------------------------------------------------------*
FORM T7 .
  IF LV_CH <> 'vld'.
    PERFORM TEXTS.
    MESSAGE LV_TEX5 TYPE 'E'.
  ENDIF.
ENDFORM.                    " T7


*&---------------------------------------------------------------------*
*&      Form  PF_STATUS
*&---------------------------------------------------------------------*
FORM PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.


  SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLSLVC_FULLSCREEN'.


ENDFORM.                    "PF_STATUS


*&---------------------------------------------------------------------*
*&      Form  CALCULATE_POSITION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->STRING   text
*      -->TARGET   text
*      -->BASE     text
*----------------------------------------------------------------------*
FORM CALCULATE_POSITION  USING STRING TARGET BASE.


  LV_TLEN = STRLEN( STRING ).


  IF BASE = '0.5'.


    LV_TLEN = LV_TLEN / 2.
    LV_TPOS1 = TARGET - LV_TLEN.


  ELSEIF BASE = '1'.


    LV_TPOS1 = TARGET - LV_TLEN.


  ENDIF.


ENDFORM.                    " CALCULATE_POSITION


*&---------------------------------------------------------------------*
*&      Form  CLEAR
*&---------------------------------------------------------------------*
FORM CLEAR .


  FREE: IT_FCAT, IT_FIELD1, IT_FIELD2, IT_DD08L1, IT_DD08L2, R_TAB[], IT_DD03L1, IT_DD03L2, IT_DD03L3, IT_DD03L4, IT_CHECK1, IT_CHECK2, IT_DD04T.


  FREE: WA_FCAT, WA_FIELD1, WA_FIELD2, WA_DD08L1, WA_DD08L2, WA_LAYOUT, WA_TABCLS1, WA_TABCLS2, WA_DD03L1, WA_DD03L2, WA_DD03L3, WA_CHECK1, WA_CHECK2,
        WA_DD04T1, WA_DD04T2, WA_DD04T3, WA_DD04T4, WA_DD03L4, WA_DD02T1, WA_DD02T2, WA_DD02T3.


  FREE: LF_REP, LF_TABLE1, LF_TABLE2, LF_TABLE3, LF_N2, LF_P2, LV_I, LV_RE, LV_SEL_LIST1, LV_SEL_LIST2, LV_FIELD2, LV_J3, LV_CONCAT, LV_ZC, LV_JT, LV_R2, LV_MOD, LV_V1, LV_IS, LV_W2, LV_X4, LV_LEN,
        LV_ZB, LF_N1, LV_X1, LV_Y4, LV_FILD1, LV_OUTPUT_N1, LV_OUTPUT_N2, LV_COUNTER_CHKTBLS, LF_OUTPUT, LV_FILD2, LV_FILD3, LV_FILD4, LF_EXCEPTION, LF_HELP_I, LF_VAL_REQUEST,
        LV_ZD, LV_HR, LV_FILD5, LV_KU, LV_FILD6, LV_FILD7, LV_X2, LV_TB1, LV_GQ, LV_A, LV_ZA, LV_CH, LV_TEX1, LV_TEX2, LV_TEX3, LV_TEX4, LV_TEX5, LV_X3, LF_MANIPULATE_CRET, LV_HR_LINK, LV_HELP_FLIST.


  FREE: W_TABNAME, W_DREF, LV_FLD, LV_C, LV_TLEN, LV_TPOS1, LV_DESC1, LV_DESC2, LV_DESC3, LV_DESC4, LV_STR1, LV_STR2, LV_LEN1, LV_LEN2, LV_LEN3, LV_LEN4, LV_FLN1, LV_FLN2, LV_SYFDPOS.


  FREE: R_TAB[], .


ENDFORM.                    " CLEAR

你可能感兴趣的:(SAP网文摘抄)