Maintenance View Validations

I have a custom table for which I am maintaining a Maintenance View.
I want to provide some validations and checks on the fields entered by the user in that maintenance view.
For example, if the user enters a value greater than 1000 in quantity field, I want to display a message saying that " enter only values below 1000". This is part of customer requirement.
Can I provide validations on fields in Maintenance view and if yes, then how ?
Thanks,
Urmila

Hi this may help u.
Maintenance views offer easy ways to maintain complex application objects.
Data distributed on several tables often forms a logical unit, for example an application object, for the user. You want to be able to display, modify and create the data of such an application object together. Normally the user is not interested in the technical implementation of the application object, that is in the distribution of the data on several tables.
A maintenance view permits you to maintain the data of an application object together. The data is automatically distributed in the underlying database tables. The maintenance status determines which accesses to the data of the underlying tables are possible with the maintenance view.
All the tables in a maintenance view must be linked with foreign keys, that is the join conditions for maintenance views are always derived from the foreign key (see Foreign Key Relationship and Join Condition). You cannot directly enter the join conditions as for database views.
There are some restrictions for the attributes of the foreign keys with which the tables in a maintenance view can be linked (see Restrictions for Maintenance and Help Views).
A standardized table maintenance transaction is provided (SM30), permitting you to maintain the data from the base tables of a maintenance view together.
Maintenance mechanisms, like screens and processing programs, must be created from the view definition with the transaction Generate Table View (SE54). This makes it possible to create easy-to-use maintenance interfaces in a simple manner.
You can find out how to create such maintenance mechanisms in the documentation BC - Generate Table Maintenance Dialog.
Creating Maintenance Views
Procedure
Enter an explanatory short text in the field Short text.
You can for example find the view at a later time using this short text.
Enter the primary table of the view under Tables in the Tables/Join conditions tab page.
Only those tables that are linked with the primary table (indirectly) with a foreign key can be included in the maintenance view.
If required, include more tables in the view. In a maintenance view you can only insert tables that are linked to one another with foreign keys.
Place the cursor on the primary table and choose Relationships. All existing foreign key relationships of the primary table are displayed. Select the required foreign key and choose Copy. The secondary table used in such a foreign key is included in the view. The join conditions derived from the foreign keys (see Foreign Key Relationship and Join Condition) are displayed.
You can also insert tables that are linked by foreign key with one of the secondary tables that was already inserted. To do this, place the cursor on the secondary table and choose Relationships. Then proceed as described above.
For maintenance and help views, there are certain restrictions on the foreign keys with which the tables can be included in the view (see Restrictions for Maintenance and Help Views). The foreign keys violating these conditions are displayed at the end of the list under the header Relationships with unsuitable cardinality.
On the View fields tab page, select the fields that you want to copy to the view.
Choose Table fields. All the tables contained in the view are displayed in a dialog box. Select a table. The fields of the table are now displayed in a dialog box. You can copy fields by selecting them in the first column and choosing Copy.
All key fields of the primary table must be included in a maintenance view. In addition, all key fields of secondary tables that are not involved in the foreign key (that is, which are not linked via a join condition to a key field already included in the view) must be included in the view.
This ensures that the records inserted with a maintenance view can be written correctly in the tables contained in the view.
On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records that can be displayed with the view (see Maintaining Selection Conditions for Views).
The selection conditions define the data records that can be selected with the view.
In the Maintenance status tab page, define the maintenance status of the view.
The maintenance status defines how you can access the view data with the standard maintenance transaction (SM30).
Choose .
At activation, a log is written; it can be displayed with Utilities ® Activation log. If errors or warnings occurring when the view was activated, the activation log is automatically displayed.
Go to Transaction SE54 with Environment ® Tab.maint.generator.
From the view definition you can generate maintenance modules and maintenance interfaces that distribute the data entered with the view to the base tables of the view. You can find more information in Creating a Maintenance Dialog.
Other Options
Recording documentation: You can create information about using the view with Goto ® Documentation. This documentation is output for example when you print the view.
Changing the data element of a view field: Select column Mod (modification) for the view field. The Data element field is now ready for input. You can enter a data element that refers to the same domain as the data element of the assigned table field here. Cancel the Mod flag if you want to use the data element of the assigned table field again.
Enter the delivery class of the view: In the Maintenance status tab page, select the delivery class of the maintenance view. If you assign the delivery class G or E to the view, you must also maintain a customer namespace (key block) for the view entries. To navigate to the appropriate maintenance transaction, choose Define Customer Namespace.
Entering the maintenance attributes of the view field: In the View fields tab page you can define the Maintenance Attributes of the view field in column F.
Check functions: With Extras ® Runtime object ® Check you can determine whether the definition of the view in the ABAP Dictionary maintenance screen is identical to the definitions in the runtime object of the view. With Extras ® Runtime object ® Display you can display the runtime object of the view.
table maintai9nenece generator
The Table Maintenance Generator is used to create table maintenance program to add, modify or delete records in the database table. This can be accessed using transaction SE54 or in SE11 using the menu Utilities->Table Maintenance Generator.
Table maintenance allows you to create entries for that table
Follow these steps to generate table maintenance
1) Go to SE11 and check table maintanance check box under attributes tab.
2) Go to menu Utilities -> Table Maintanance Generator ->
Create function group and assign it under function group input box. You can enter same as table name for function group. Also assign authorization group default &NC& .
3) Select standard recording routine radio in table table mainitainence generator to move table contents to quality and production by assigning it to request.
4) Select maintenance type as single step.
5) Maintainence screen as system generated numbers this dialog box appears when you click on create button.
6) Save and activate table.
useful links
http://www.saptechies.com/how-to-create-table-maintenance-generator/
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ecdf446011d189700000e8322d00/content.htm
http://www.saptechies.com/table-maintainance-generator/
with regards,
Hema Sundara.
pls reward if u find it helpful.

Similar Messages

  • Maintenance view event for validation when changing data

    Hi All,
    I have a maintenance view on a table that should validate some fields during user input.
    I am using event 05 'Creating a new entry' to validate fields when user creates new entry in the table. That works fine.
    I would like to have the same validations happening when the user changes fields of records already existing in the database. I tried to use event 01 'Before saving the data in the database' but the problem with this is that user can change many fields of many records before clicking 'Save'. I would like to have the error raised for incorrect entry already after the change.
    So far I could not find an event to do this but only by changing the code itself. The problem with that is whenever the code is regenerated the custom part is lost.
    Is there an event I can use that would help me achieve this?
    Thanks in advance.

    Hi Abhishek,
    I tried event 21, I`m playing around with that since that`s the only one triggered when I press Enter.
    The problem with this is that
    - the check runs when you press enter, so you can still change many fields of many records (one step maintenance) before the validation runs
    - you can`t raise an error message, because only the key fields will be input ready, the non-key fields will be readonly
    The way I currently handle is I undo the changes in 21 (get previous field values from TOTAL) and raise an information message i/o an error informing user to check the entry.
    What I`m looking for is an event that will raise a message and set focus on the incorrect field (if there`s one such).

  • Data validation in maintenance view

    I have a maintenance view which is just simply a projection of a database table.
    I'm trying to add a validation before user save the data, what I have done is add a standard event by using 'Table Maintenance Generator', there is an event 'Before saving the data in the database' which I think is proper place to do the validation.
    Now the problem is if the user input is invalid, after validation and message displayed on the screen, the entry user is editing will be locked, and cannot be back to editable even you click 'Change<->Display' button, user have to back to SM30 screen and re-enter again.
    The idea behavior is the screen stays and the entry is editable, user can correct his input immediately.
    So someone can provide any advice regard this problem?
    Thanks in advance.
    Ben

    Hi
    You can set the flag VIM_ABORT_SAVING in order to abort the saving process and back to maintenance screen without to go out from SM30
    I've found a my old code:
    * Check entries with same sorting key
       loop at t_sort_key_count.
         check t_sort_key_count-tot > 1.
         message i398(00) with <...............>
         vim_abort_saving = 'X'.
         exit.
       endloop.
    I use e message tyoe I instead of E, in order not to lock the process and back to imain screen
    Max

  • How to call a maintenance view  from a program

    Hello Abapers,
    Can anybody explain with some examples. How to call a mainetenance view from a program.
    Thanks
    Ranjith.

    Use FM 'VIEW_MAINTENANCE_CALL'.
    REPORT  zmaintaintest.
    VARIABLES / CONSTANTS                          
    CONSTANTS: 
                    c_action(1) TYPE c VALUE 'U',                                 "Update
              c_viewname TYPE tabname value 'ZEMP_EXAMPLE', "View Name
              c_field(6) TYPE c VALUE 'EMPNO'.                            "Field Name
    INTERNAL TABLES
    DATA: itab_rangetab TYPE STANDARD TABLE OF vimsellist,
              v_empno TYPE zempno,
              wa_rangetab TYPE vimsellist.
    SELECTION SCREEN
    PARAMETERS:     p_empno TYPE   zempno   OBLIGATORY.  "Emplyee ID
    AT SELECTION-SCREEN                                                 
    AT SELECTION-SCREEN.
    Chcking the existence of the user in EMPLOYEE table
      PERFORM validate_employee.
    START_OF_SELECTION                                                  
    START-OF-SELECTION.
    This will restrict the user view so that user can only view/change
    Table data corresponding to his/her Employee ID
      PERFORM define_limited_data_area.
    Displaying table maintenance view for a particular employee ID
      PERFORM call_view_maintenance.
    *&      Form validate_employee
    Validate plant entered in the selection screen
    FORM validate_employee.
      SELECT SINGLE empno     u201CEmployee ID
        FROM zemp_example     u201CEmployee Table
        INTO v_empno
        WHERE empno = p_empno.
      IF sy-subrc <> 0.
        MESSAGE 'Not an Valid User' TYPE 'I'.
      ENDIF.
    ENDFORM.                    "validate_employee
    *&      Form DEFINE_LIMITED_DATA_AREA
    To restrict the user view so that user can see/change table data
    corresponding to his employee ID. Here one internal table is
    getting populated with field name as u201CEMPNOu201D (Key field of the table)
    And value as given by user in Selection Screen and this is passed as
    Parameter in function module 'VIEW_MAINTENANCE_CALL'
    FORM define_limited_data_area.
      CLEAR wa_rangetab.
      wa_rangetab-viewfield  = c_field.
      wa_rangetab-operator  = 'EQ'.
      wa_rangetab-value       = p_empno.
      APPEND wa_rangetab TO itab_rangetab.
    ENDFORM.                    "define_limited_data_area
    *&      Form CALL_VIEW_MAINTENANCE.
    Displaying table maintenance view for a particular employee ID
    FORM call_view_maintenance.
      CALL FUNCTION 'VIEW_MAINTENANCE_CALL'      
        EXPORTING
          action           = c_action
          view_name   = c_viewname
        TABLES
          dba_sellist     = itab_rangetab.
    ENDFORM.                    "call_view_maintenance
    Regards,
    Joy.

  • Events in a maintenance view

    Hi,
    I am doing some validations in the "Before Save to Database" event of a maintenance view. I am accessing the <viewname>_total table in the event and it works fine.
    Now I am using this view in a view cluster. When I maintain the data through view cluster, this event gets triggered but the
    <viewname>_total comes empty. What could be the reason for this? Is there any other alternative?
    Thanks and regards,
    Pankaj
    Edited by: Pankaj on May 12, 2008 11:12 AM

    Hello Pankaj,
    In a View cluster, there are more than one view program being called by a common program. Hence, there is not a single TOTAL or EXTRACT structure for a single view, at any given point of time.
    Instead, you can make use of the form routine vcl_set_table_access_for_obj in your event calls, and read the TOTAL and global variables for your current view. The method interface is like -
      PERFORM vcl_set_table_access_for_obj  USING '(name of your view)'
                                         CHANGING lv_error_flag.
    You can further define local variables/internal tables of relevant structures to read the data into, and proceed to implement your logic.
    More info - [View Cluster Maintenance events|http://help.sap.com/saphelp_47x200/helpdata/en/91/ca9f32a9d111d1a5690000e82deaaa/frameset.htm]
    Best Regards,
    Rekha

  • Activate Delimit in Table maintenance view

    Hi,
    I am creating a maintenance view for a custom table which has begin and end dates as part of the key fields. I want to activate the Delimit functionality on SM31 so we can have a history of the changes. Do you know how to activate this option? Please help!
    Thanks, Chuong

    It is not possible via SE11 . in SAP HR you define u201Ctime constrain u201C in table u201CV_T582Au201D for all ITs . If I want to do something like this ,  I will probably look at  module pool logic of any IT .
    Thanks,
    Saquib Khan
    FYI
    Time Constraint
    A time constraint indicates whether more than one infotype record may be available at one time. The following time constraint indicators are permissible:
    o     1: An infotype record must be available at all times. This record may have no time gaps. You may not delete the record last stored on the database because all records of this infotype would otherwise be deleted.
    o     2: Only one record may be available at one time, but time gaps are permitted.
    o     3: Any number of records may be valid at one time, and time gaps are permitted.
    Other possible time constraint indicators are as follows:
    o     A: Only one record may ever exist for this infotype. It is valid from 01/01/1800 to 12/31/9999. Splitting is not permissible.
    View V_T582B Infotypes Which are Created Automically controls whether the system automatically creates the infotype record for an employee hiring or an applicant data entry action.
    Infotypes with time constraint A may not be deleted.
    o     B: Only one record may ever exist for this infotype. It is valid from 01/01/1800 to 12/31/9999. Splitting is not permissible.
    Infotypes with time constraint B may be deleted.
    o     T: The time constraint varies depending on the subtype.
    o     Z: Refers to time management infotypes. The time constraint for these infotypes depends on the time constraint class defined in view V_T554S_I Absence: General Control. Collision checks are defined in view V_T554Y Time Constraint Reaction.

  • [Maintenance View] Mass maintenance of Z-Table

    Hi,
    I was wondering what were the options when dealing with mass maintenance of Z-table entries.
    SM30 is OK for maintenance view but you cannot process more than a given number of lines (34 entries or so) per page.
    Ideally, it should be possible to enter data from Excel file of even clipboard.
    SE16N is great for this since it allows pasting of clipboard data but it does not work with maintenance views (it switches to the SM30 dynpro).
    Besides, if I create a database view, it is not possible to save entries because it joins several table together (even if I only need additional fields for display only).
    I tried the FM 'SE16_INTERFACE' but it dumps with an CX_SY_DYNAMIC_OSQL_SEMANTICS error (SAPSQL_NO_DBTAB_OR_VIEW). (you can only query table or database view but no maintenance view)
    Thanks in advance for your ideas/advice.
    Best regards,
    Guillaume

    Hi,
    Developing a generic tool won't take much time probably 6 hours at an experience level of 2+ years!!!
    Once you develop you can use it for ever.
    What all you need to do is create a field-symbol of type standard table. Get the table name and the file from the selection screen.
    Create a dynamic internal table with reference to the table name entered in the selection screen. Upload the data and update the database.
    Limitations in the design:
    1. File should be in correct format and with the correct data. (Specific validations can't be done)
    2. Table maintenance events can't be tackled.
    eg: On entering the material number, Material description should automatically come.
    Creating BDC for SM30 is ok. But this works only at a table level. We may not be able to make it generic as the screen field names changes based on table name.
    So think and choose the right approach!!!
    All the best:)
    Thanks,
    Vinod.

  • Table maintenance view -user exit

    Hello, as you all know, there is a program generated behind the table maintenance view. I want to add certain validation on the values entered in the table maintenance.
    I know that modifying the program is not the best practice.
    Is there any user exit which will permit me to do this?
    thx.

    Hi Antish,
        Try to go with the table events. For this goto the Table Maintenance Generator Screen --> Environment --> Modification --> Events. Here you can handle some events according to your requirement. Validations can be done only in this way.
    Regards,
    Swapna.

  • Check Table data in Maintenance View event

    Dear all, i created a maintenance view for a customer table and a must carry out a validation over the whole table when any record is created, modified or deleted.
    The table has a column with percentages and after save a modification I have to verify that the values in this columns make 1 (100%).
    For this, I created a routine in the event 01 (Before Saving the Data in the Database  ) of the maintenance view, but I can find the way to read all the records of the table.
    I tried with the tables TOTAL and EXTRACT, but these have '#####' as values in the percentages column.
    If someone need further information please let me know.
    I´d be grateful if someone lead me to a solution.
    Thanks in advance.
    Mariano.

    Hi, thx Madan Kochana .
    I prefer do not modify the screen.
    The column is defined as dec 3,2 and is filled with values like 0.25 or 0.10 in the view.
    Thanks for your help; i'll appreciate any kind of solution.
    Mariano.

  • Validate field in the pop up for a Table Maintenance View

    Hi,
    I have created a maintenance view for a Z table. Among the many fields the table, I needed to display the records based on a selection criterion. So, I have enabled a popup for sales org and customer no'.
    Now the sales org and cust no' are being validated individually at the pop up screen itself.
    The requirement is that I need to validate for presence of records for their combination.
    ( FYI: KNVV is the table with the combination of both)
    Kindly let me know how this requirement can be fulfilled.
    Thanks in Advance.

    Hi,
    Try like this..
    in the Table Maintenance Generator>Environment>Modification-->Events.
    in the event on_save(didn't remember exact name)
    select * from ztable into itab where kunnr in kunnr
                                              and    vkorg in vkorg..
    Regards,
    Nagaraj

  • Maintenance view field check.

    Hi,
    I want to insert new record into maintenance view and check some field that must be inserted.
    If i make them required so when i press "New Entries" all the redcord are ready for new entries and all the fields in each record are required so if the user insert only one record so he get msg that there are still required  fields to enter.
    Other problem is that i can save blank record in the maintenance view.
    Hope there is any good solution for those problem.
    I've tried coding abap in the flow logic of the screen but still it run on all the records.
    Thanks in advance.

    HI it very simple.
    Generate table maintanance generator screen for you maintanance view and wirte your validation in table maintance generator event.  create event new entry(05).
    *first create 05 event and give suroutine name as new_entry.
    form new_entry.
    *----here you have to put your validtion
    if ztable-f1 is not initial and
    ztable-f2 is initial and
    ztable-f3 is initial.
    message 'Enter value in all the fields' type 'E".
    endif.
    endform.
    for creating events in TMG refer below link
    To change top of page in Block ALV list display
    Regards,
    Peranandam
    Edited by: peranandam chinnathambi on Apr 2, 2009 11:18 AM
    Edited by: peranandam chinnathambi on Apr 2, 2009 11:19 AM

  • Maintenance View with Subset Fields

    Hi All,
    I have created a maintenance view based on a single DB table. Two key fields are defined to be as subset fields. No selection conditions are added to the view. I have used table maintenance genrator to define the screen (one step) along with the events.
    In SM30, i get the popup to fill the subset fields.
    I have created an event for AA (to replace default read). I am filling total attribute here.
    a) Is there some other attribute that i need to fill apart from total?
    I receive following dump
    " Exception condition "NO_VALUE_FOR_SUBSET_IDENT" is raised"
    When i set <status>-sbsid_rcvd = 'R' in read routine along with total, then the above exception doesn't appear.
    But filtering based on the subset values doesn't happen automatically.
    b) I also need have to have routines to perform insert, copy and validation.
    c) Would the contents displayed be automatically filtered based on the subset values or we need to process this in user routines for read and so on?
    As i find very limited documentation available for maintenance views with subset fields, could you suggest me some example to do the above?
    Thanks in Advance,
    Regards,
    Rekha

    Hello Rekha,
    Yes I've same idea, documentation for maintenance screens is inadequate.
    But there is way to find examples for all events,
    table TVIMF is storing the Table name - Event - Form name columns.
    For example when u want to  do something about  "creating a new entry"
    Just go se11 > Table maintenance generator and find related event : 05
    - Then go to TVIMF and display a record for event = 05
    - than go to function group of  maintenance screen of the TABLE in that record
    - find the subroutine form ( TVIMF-FORMNAME) in that function group
    This is a working example for that event, try or copy & use.
    I hope it helps you for the coding for all the events.
    Bulent
    Edited by: Bulent Balci on Aug 5, 2010 11:28 PM
    Edited by: Bulent Balci on Aug 5, 2010 11:29 PM

  • Maintenance View of Z table

    不知道什么原因,现在用SE55创建Z表的maintenance view的时候,在overview screen中,不能生成table control的形式。但是single screen是正确的。之前在同样的平台下,却可以做到。有什么原因会造成这种情况?
    找到问题了,原来是因为key的设置。
    Edited by: Amy Xie on Mar 16, 2010 7:49 AM

    Hi,
    Developing a generic tool won't take much time probably 6 hours at an experience level of 2+ years!!!
    Once you develop you can use it for ever.
    What all you need to do is create a field-symbol of type standard table. Get the table name and the file from the selection screen.
    Create a dynamic internal table with reference to the table name entered in the selection screen. Upload the data and update the database.
    Limitations in the design:
    1. File should be in correct format and with the correct data. (Specific validations can't be done)
    2. Table maintenance events can't be tackled.
    eg: On entering the material number, Material description should automatically come.
    Creating BDC for SM30 is ok. But this works only at a table level. We may not be able to make it generic as the screen field names changes based on table name.
    So think and choose the right approach!!!
    All the best:)
    Thanks,
    Vinod.

  • Codings in Maintenance View - Status ?

    Hi ... I am in a dilemma now.
    I try to trap the value before saving my data.
    So, I code in the maintenance view.
    It is a very simple process but I just can't figure how to get it work.
    Let's say, ... I have 4 columns in a table.
    Key1, Field1, Field2, Field3.
    Existing Data ( 3 records here )
    key1, f1, f2, f3
    key2, f4, f5, f6
    key3, f7, f8, f9
    Apart from the key, I need to make sure that the Field1, Field2, Field3 is unique.
    So, before I save the data, I will perform a COUNT via SQL.
    My problem is, it loops through all the record.
    Can I have a status like, only fields / record that updated go through the validation ?
    Any system variable in SAP that allow me to check whether it is UPDATE / INSERT status ?
    Thanks.
    PROCESS AFTER INPUT.
    MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
    MODULE LISTE_BEFORE_LOOP.
    LOOP AT EXTRACT.
       MODULE LISTE_INIT_WORKAREA.
       CHAIN.
    // .... all the codes here
        MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
       ENDCHAIN.
       FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
       CHAIN.
        FIELD ZTMPU_GEN_MATMAS-MATNR .
        MODULE LISTE_UPDATE_LISTE.
       ENDCHAIN.
    ENDLOOP.

    Something strange ...
    I coded the subroutine under event - 05 , inserting new record.
    When I SAVE it, the record created.
    But, when I exit, the message prompted.
    It seems like the validation didn't fire.
    Maybe I use the wrong message.
        IF var_total > 1.
            message e250(zmm) with 'The criterias you entered already exist'.
        ENDIF.
    Any ideas ? Thanks.

  • QUESTION on MAINTENANCE VIEW

    Hi gurus,
    I am not familiar with MAINTENANCE VIEW TABLE, can someone please tell me on how to create it and how can I use it for query or select.
    I hope someone can help me.
    Thanks in advance.

    hello gurus,
    im new to this community please help me out from this please explain what are different conditions are there for install and replace in this code pzzzzzzzzz its really urgent evening is my delivery
    THIS IS MIS SHOWS A LEAD TIME FOR DEVICES PERTAINING TO A SELECTION*
    CRITERIA FROM THE TIME OF ISSUE OF METER FROM THE DEPOT FOR NEW   *
    INSTALLATION / REPLACEMENT CONNECTION TO THE FIRST BILL          *
    Designer           : K SRIKANTH                                 *
    Programmer            : K SRIKANTH                                 *
    Programming Date      : 29/12/2004
    Change Tracking No     : D90K                                    *
    Program Title          : LEAD TIME REPORT FROM DEVICE * *
                        INSTALLATION/REPLACEMENT TO FIRST BILL *
    MODIFICATIONS                                                     *
    DATE       | BY      | DESCRIPTION       | Chg Trck No             *
    dd.mm.yy   | xxxxx   |                   |                         *
               |         |                   |                         *
               |         |                   |                         *
    ASSUMPTIONS:
    THE VALUES FROM THE TABLE V_EABL ARE SELECTED ONLY FOR METER       *
    READING REASON '01','02','03' & '22' FOR THE FIELD ABLESGR.
    THE VALUES FROM THE TABLE ETDZ ARE SELECTED ONLY FOR REGISTER
    CODE '01' FOR THE FIELD ZWKENN .
    THE NUMBER OF RECORDS FETCHED FROM TABLE EGERH, WHILE RUNNING IN   *
    FOREGROUND, DEPENDS UPON THE SELECTION CRITERIA. WHILE RUNNING IN  *
    BACKGROUND THIS CONDITION IS NOT APPLICABLE.                        *
    REPORT ZRDMD01A MESSAGE-ID ZS LINE-SIZE 150 .
    TYPE-POOLS : SLIS .
    TABLE DECLARATION*********************
    TABLES :
    IFLOT ,
    TE401 ,  "   Transactions reasons
    EGERH ,          " Historical Data of ISU Device Master Record
    EQUI ,           " Equipment master data
    EASTL,          " Billing data: Installation Structure at Device Level
    EANL ,          " Installation
    EVBS ,          " Premise
    EADRREGAREAA,   " Role-Spec. Allocation: Reg. Str. Area to Reg. StrGroup
    EHAUISU ,       " Connect. Obj.
    ILOA  ,          "  PM Object Location and Account Assignment
    EABLG ,         " MR Reasons in MR Document
    EABL  ,          "  MR Document
    EVER ,           " IS-U Cont.
    ERCH ,           "  Billing Doc. Data
    ERCHC    ,      "  Invoicing/Reversal History: ERCH
    ETYP ,
    ETDZ,
    EASTS ,
    V_EABL ,
    EADRREGAREAT .
    ***INTERNAL TABLE DECLARATION*****
    DATA : BEGIN OF ITCOM OCCURS 100,
             STATUS(50) TYPE C ,
            REGIOAREA LIKE EADRREGAREAA-REGIOAREA,
            DESCRIPT LIKE EADRREGAREAT-DESCRIPT ,
            V0_15 TYPE I,
            V16_30 TYPE I,
            V31_45 TYPE I,
            V46_60 TYPE I,
            V61_75 TYPE I,
            V76_90 TYPE I,
            V90 TYPE I,
            VNTAV TYPE I,
            TOTAL TYPE I ,
           REGIOGROUP LIKE EADRREGAREAA-REGIOGROUP ,
          END OF ITCOM .
    DATA : ITFLD TYPE SLIS_T_FIELDCAT_ALV ,
           SFLD TYPE  SLIS_FIELDCAT_ALV ,
           ITH  TYPE  SLIS_T_FIELDCAT_ALV ,
           STH  TYPE  SLIS_FIELDCAT_ALV ,
           SIT  TYPE  SLIS_FIELDCAT_ALV,
           ITA  TYPE  SLIS_T_FIELDCAT_ALV ,
           IEVENTS TYPE SLIS_T_EVENT ,
           ALV_T_EVENT TYPE SLIS_T_EVENT WITH HEADER LINE,
           ITEVENTS TYPE SLIS_ALV_EVENT ,
             EVENTS TYPE SLIS_T_EVENT ,
            EVNTS  TYPE SLIS_ALV_EVENT ,
            EVNTS1  TYPE SLIS_ALV_EVENT ,
            EVNTS2  TYPE SLIS_ALV_EVENT ,
            EVNTS3  TYPE SLIS_ALV_EVENT ,
            EVENTS_SUMM TYPE SLIS_T_EVENT ,
            EVENTS_DETAIL TYPE SLIS_T_EVENT ,
            EVENTS_SPL TYPE SLIS_T_EVENT .
    DATA : ITHD TYPE SLIS_T_LISTHEADER ,
            HD TYPE SLIS_LISTHEADER ,
           ITD TYPE SLIS_T_LISTHEADER ,
            TD  TYPE SLIS_LISTHEADER .
    DATA : BEGIN OF ITFIN OCCURS 0,
        EQUNR   LIKE EGERH-EQUNR ,   " EQUIPMENT NUMBER
        ANLAGE  LIKE EASTL-ANLAGE  , "INSTLLATION NUMBER
        VSTELLE LIKE EANL-VSTELLE,   "PREMISE
        LOGIKNR LIKE EGERH-LOGIKNR,  "LOGICAL DEVICE NUMBER
        SERNR   LIKE EQUI-SERNR,     "DEVICE NUMBER
        VKONTO  LIKE EVER-VKONTO,    "CONTRACT NUMBER
        REGIOAREA LIKE EADRREGAREAA-REGIOAREA,
        REGIOGROUP LIKE EADRREGAREAA-REGIOGROUP,
        LTPU(8)  TYPE C ,   "LEAD FROM PREMISE T UI
        LTUB(8)  TYPE C,    "LEAD FROM UTILITY INS TO BILLING INS
        LTBM(8)  TYPE C,    "LEAD FROM BI TO MR ORDER
        LTMA(8)  TYPE C,    "LEAD MR ORDER TO ACTUAL MR
        LTAB(8)  TYPE C,    "LEAD FROM ACTUAL MR TO SCHEDULE BILL ORDER
        LTBA(8)  TYPE C,    "LEAD TIME FROM SCHED BILL ORDER TO ACTUAL BILL
        SUM(8)  TYPE C ,    "TOTAL LEAD FROM UI TO ACTUAL BILL
        SERIAL  TYPE I ,
        BIS  LIKE  EGERH-BIS ,
           AB   LIKE  EGERH-AB,
           ZWGRUPPE LIKE EGERH-ZWGRUPPE ,
           EINBDAT LIKE EGERH-EINBDAT,
           AUSBDAT  LIKE EGERH-AUSBDAT,
           GERWECHS LIKE EGERH-GERWECHS,
           DEVLOC   LIKE EGERH-DEVLOC,
           SPARTE LIKE  EQUI-SPARTE,
            ANLART LIKE EANL-ANLART,
            HAUS  LIKE EVBS-HAUS,
            VBSART LIKE EVBS-VBSART,
            ABLBELNR LIKE EABLG-ABLBELNR,
           ABLESGR LIKE EABLG-ABLESGR ,
           ADAT LIKE V_EABL-ADAT ,
          VERTRAG LIKE EVER-VERTRAG,
              DESCRIPT(20) TYPE C, " LIKE EADRREGAREAT-DESCRIPT ,
             STATUS(40) TYPE C ,
         END OF ITFIN .
    DATA : ITAAA LIKE ITFIN OCCURS 100 WITH HEADER LINE ,
           ITBBB LIKE ITFIN OCCURS 100 WITH HEADER LINE .
    DATA : BEGIN OF ITTE4 OCCURS 100,
          GERWECHS LIKE TE401-GERWECHS,
          EAWKENNZE LIKE TE401-EAWKENNZE,
          EAWKENNZA LIKE TE401-EAWKENNZA,
          EAWKENNZW LIKE TE401-EAWKENNZW,
          GERWETXT  LIKE TE401T-GERWETXT ,
          END OF ITTE4 .
    DATA : BEGIN OF ITEAS OCCURS 100,
           ANLAGE LIKE EASTL-ANLAGE,
           LOGIKNR LIKE EASTL-LOGIKNR,
          BIS LIKE EASTL-BIS,
          AB LIKE EASTL-AB,
           ERDAT LIKE EASTL-ERDAT,
            END OF ITEAS .
    DATA : BEGIN OF ITDES OCCURS 0 ,
           LANGU LIKE EADRREGAREAT-LANGU,
           ROLE   LIKE EADRREGAREAT-ROLE ,
          REGIOAREA LIKE EADRREGAREAA-REGIOAREA ,
          DESCRIPT(20) type c ," LIKE EADRREGAREAT-DESCRIPT ,
          END OF ITDES .
    DATA : BEGIN OF ITMX1 OCCURS 0 ,
           EQUNR LIKE EGERH-EQUNR,
           BIS  LIKE  EGERH-BIS ,
           AB   LIKE  EGERH-AB,
           LOGIKNR LIKE EGERH-LOGIKNR,
           ZWGRUPPE LIKE EGERH-ZWGRUPPE ,
           EINBDAT LIKE EGERH-EINBDAT,
           AUSBDAT  LIKE EGERH-AUSBDAT,
           GERWECHS LIKE EGERH-GERWECHS,
           DEVLOC   LIKE EGERH-DEVLOC,
           MATNR LIKE EQUI-MATNR,
           SERNR LIKE EQUI-SERNR,
           SPARTE LIKE EQUI-SPARTE,
            ANLAGE LIKE EASTL-ANLAGE,
            ERDAT_EAS LIKE EASTL-ERDAT, "ERDAT_EAS
            VSTELLE LIKE EANL-VSTELLE,
            ANLART LIKE EANL-ANLART,
            ERDAT_EAN LIKE EANL-ERDAT, "ERDAT_EAN
             HAUS  LIKE EVBS-HAUS,
             VBSART LIKE EVBS-VBSART,
             ERDAT_EVB LIKE EVBS-ERDAT,  "ERDAT_EVB
            REGIOGROUP LIKE EADRREGAREAA-REGIOGROUP,
             REGIOAREA LIKE EADRREGAREAA-REGIOAREA ,
             DESCRIPT(20) type c ,
              ABLBELNR LIKE V_EABL-ABLBELNR ,
            ABLESGR LIKE V_EABL-ABLESGR ,
            ADAT LIKE V_EABL-ADAT ,
            ADATSOLL LIKE V_EABL-ADATSOLL ,
            VERTRAG LIKE EVER-VERTRAG,
           VKONTO LIKE  EVER-VKONTO,
            BELNR LIKE ERCH-BELNR,
          VKONT LIKE ERCH-VKONT,
          BEGABRPE LIKE ERCH-BEGABRPE,
          ENDABRPE LIKE ERCH-ENDABRPE,
          ABRDATS LIKE ERCH-ABRDATS,
          BUDAT LIKE ERCHC-BUDAT,
           LFDNR LIKE ERCHC-LFDNR,
          END OF ITMX1 .
    DATA : BEGIN OF ITMX2 OCCURS 0,
           EQUNR LIKE EGERH-EQUNR,
           BIS  LIKE  EGERH-BIS ,
           AB   LIKE  EGERH-AB,
          LOGIKNR LIKE EGERH-LOGIKNR,
           ZWGRUPPE LIKE EGERH-ZWGRUPPE ,
           EINBDAT LIKE EGERH-EINBDAT,
           AUSBDAT  LIKE EGERH-AUSBDAT,
           GERWECHS LIKE EGERH-GERWECHS,
           DEVLOC   LIKE EGERH-DEVLOC,
           MATNR LIKE EQUI-MATNR,
           SERNR LIKE EQUI-SERNR,
           SPARTE LIKE EQUI-SPARTE,
            ANLAGE LIKE EASTL-ANLAGE,
            LOGIKNR LIKE EGERH-LOGIKNR,
            ERDAT LIKE EASTL-ERDAT, "ERDAT_EAS
            END OF ITMX2 .
    DATA : BEGIN OF ITMX4 OCCURS 0 ,
            ANLAGE  LIKE EANL-ANLAGE ,
            VSTELLE LIKE EANL-VSTELLE,
             HAUS  LIKE EVBS-HAUS,
             VBSART LIKE EVBS-VBSART,
             ERDAT LIKE EVBS-ERDAT,  "ERDAT_EVB
            REGIOGROUP LIKE EADRREGAREAA-REGIOGROUP,
             REGIOAREA LIKE EADRREGAREAA-REGIOAREA ,
              DESCRIPT(20) type c ,
           ANLART LIKE EANL-ANLART,
             END OF ITMX4 .
    DATA : BEGIN OF ITEVE OCCURS 0 ,
            ANLAGE LIKE EVER-ANLAGE ,
             VKONTO LIKE  EVER-VKONTO,
            VERTRAG LIKE EVER-VERTRAG,
           SPARTE LIKE EVER-SPARTE ,
           END OF ITEVE .
    DATA : BEGIN OF ITMX3 OCCURS 0 ,
             EQUNR  LIKE V_EABL-EQUNR ,
            ABLBELNR LIKE V_EABL-ABLBELNR ,
            ABLESGR LIKE V_EABL-ABLESGR ,
            ADAT LIKE V_EABL-ADAT ,
            ADATSOLL LIKE V_EABL-ADATSOLL ,
             ANLAGE LIKE EVER-ANLAGE ,
             VKONTO LIKE  EVER-VKONTO,
            VERTRAG LIKE EVER-VERTRAG,
           SPARTE LIKE EVER-SPARTE ,
         VKONT LIKE ERCH-VKONT,
          BEGABRPE LIKE ERCH-BEGABRPE,
          ENDABRPE LIKE ERCH-ENDABRPE,
          ABRDATS LIKE ERCH-ABRDATS,
            BELNR LIKE ERCH-BELNR,
          LFDNR LIKE ERCHC-LFDNR,
           BUDAT LIKE ERCHC-BUDAT,
          SWERK LIKE ILOA-SWERK ,
            END OF ITMX3.
    data : BEGIN OF ITERC OCCURS 0 ,
          BEGABRPE LIKE ERCH-BEGABRPE,
          ENDABRPE LIKE ERCH-ENDABRPE,
          ABRDATS LIKE ERCH-ABRDATS,
          VERTRAG like ERCH-VERTRAG ,
          BELNR LIKE ERCH-BELNR,
          VKONT LIKE ERCH-VKONT ,
          LFDNR LIKE ERCHC-LFDNR,
           BUDAT LIKE ERCHC-BUDAT,
          END OF ITERC .
    DATA : BEGIN OF ITMX7 OCCURS 0,
          SRNO   TYPE I  ,
           STATUS(40) TYPE C ,
           REGIOAREA  LIKE EADRREGAREAA-REGIOAREA ,
           REGIOGROUP LIKE EADRREGAREAA-REGIOGROUP ,
           DESCRIPT(20) TYPE C ," LIKE  EADRREGAREAT-DESCRIPT  ,
           V0_15  LIKE ITCOM-V0_15 ,
           V16_30 LIKE ITCOM-V16_30 ,
           V31_45 LIKE ITCOM-V31_45 ,
           V46_60 LIKE ITCOM-V46_60 ,
          V61_75 LIKE ITCOM-V61_75 ,
          V76_90 LIKE ITCOM-V76_90 ,
          V90   LIKE ITCOM-V90 ,
          VNTAV LIKE ITCOM-VNTAV  ,
          TOTAL TYPE I ,
             END OF ITMX7 .
    DATA : BEGIN OF ITETD OCCURS 0,
          EQUNR LIKE ETDZ-EQUNR ,
          ZWNUMMER LIKE ETDZ-ZWNUMMER,
          ZWKENN  LIKE ETDZ-ZWKENN ,
          LOGIKZW LIKE ETDZ-LOGIKZW ,
          ANLAGE  LIKE EASTS-ANLAGE ,
         BIS     LIKE EASTS-BIS,
          ZWNABR  LIKE EASTS-ZWNABR ,
          END OF ITETD .
      DATA : BEGIN OF ITEAN OCCURS 100,
          ANLAGE LIKE  EASTL-ANLAGE,
         SPARTE LIKE  EQUI-SPARTE,
          VSTELLE LIKE EANL-VSTELLE,
          ANLART LIKE EANL-ANLART,
          ERDAT LIKE EANL-ERDAT ,
             HAUS  LIKE EVBS-HAUS,
             VBSART LIKE EVBS-VBSART,
             ERDAT_EVBS LIKE EVBS-ERDAT,  "ERDAT_EVB
            REGIOGROUP LIKE EADRREGAREAA-REGIOGROUP,
             REGIOAREA LIKE EADRREGAREAA-REGIOAREA ,
              DESCRIPT(20) type c ,
          END OF ITEAN .
    DATA : BEGIN OF ITSPL OCCURS 0 ,
            TPLNR LIKE IFLOT-TPLNR ,
            TPLMA LIKE IFLOT-TPLMA ,
            HAUS  LIKE EHAUISU-HAUS ,
            REGIOGROUP LIKE EADRREGAREAA-REGIOGROUP ,
            END OF ITSPL .
    DATA : BEGIN OF ITEGE OCCURS 0,
           EQUNR LIKE EGERH-EQUNR ,
           LOGIKNR LIKE EGERH-LOGIKNR,
           MATNR   LIKE EQUI-MATNR ,
           SERNR  LIKE EQUI-SERNR,
           SPARTE  LIKE EQUI-SPARTE,
           DEVLOC  LIKE EGERH-DEVLOC,
           END OF ITEGE .
    DATA : ITMOD LIKE ITMX2 OCCURS 0 WITH HEADER LINE ,
           WA_ITMX2 LIKE ITMX2 .
    DATA : WA-EQUNR LIKE EQUI-EQUNR ,
           WA-ANLAGE LIKE EASTL-ANLAGE .
      DATA : w_variant  like disvariant ,
             W_VARIANT_SAVE  TYPE C .
    DATA : REP-ID LIKE SY-REPID,
         W_REPID LIKE SY-REPID .
    DATA PUSH TYPE SSCRFIELDS-UCOMM .
    DATA  COUNT TYPE I .
    DATA : V13 TYPE I ,
           V17 TYPE  I.
    DATA CNT TYPE I .
    DATA VARIANT LIKE SY-TABIX .
    DATA :  SNT TYPE I ,
            PNT TYPE I ,
         V_COUNT TYPE I VALUE 1 .
    DATA: ylayout TYPE slis_layout_alv ,
         XLAYOUT TYPE SLIS_LAYOUT_ALV .
    DATA  KNT TYPE I VALUE 0  .
    DATA I_SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE .
    DATA : V_DATE LIKE SY-DATUM ,
          V_DATUM(10) TYPE C ,
          GX_VARIANT LIKE DISVARIANT,
          G_VARIANT LIKE DISVARIANT,
                G_SAVE(1) TYPE C VALUE 'A',
                G_EXIT(1) TYPE C,
                N TYPE I ,
                M TYPE I ,
                C TYPE I VALUE 0 .
    DATA  G_REPID LIKE SY-REPID .
    DATA: GT_PRINT TYPE SLIS_PRINT_ALV.
    DATA YREPID LIKE SY-REPID .
    DATA: X_LAYOUT TYPE SLIS_LAYOUT_ALV ,
          Y_LAYOUT TYPE SLIS_LAYOUT_ALV ,
          Z_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA : TITLE LIKE SY-TITLE .
    DATA : V_ENTER TYPE I ,
           V_MODIFY TYPE I .
    ******************SELECTION SCREEN ************************
    SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-001 .
    PARAMETERS P_SPART LIKE EQUI-SPARTE DEFAULT  '01' .
    SELECTION-SCREEN COMMENT 40(15)  TEXT-005 .
    SELECT-OPTIONS : S_SWERK FOR ILOA-SWERK DEFAULT  'M011',
                     S_RAREA FOR EADRREGAREAA-REGIOAREA ,
                     S_RGROUP FOR EADRREGAREAA-REGIOGROUP,
                     S_AB FOR EGERH-AB OBLIGATORY .
    SELECTION-SCREEN END OF BLOCK BL1 .
    SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-002 .
    SELECT-OPTIONS: S_SERNR FOR EQUI-SERNR ,
                    S_MATNR FOR EQUI-MATNR OBLIGATORY ,
                    S_VSTELL FOR EANL-VSTELLE ,
                    S_HAUS FOR EHAUISU-HAUS .
    SELECTION-SCREEN  END OF BLOCK BL2.
    SELECTION-SCREEN BEGIN OF BLOCK BL3 WITH FRAME TITLE TEXT-003 .
    SELECT-OPTIONS: S_VKONTO FOR EVER-VKONTO .
    SELECTION-SCREEN END OF BLOCK BL3 .
    SELECTION-SCREEN BEGIN OF BLOCK BL4 WITH FRAME TITLE TEXT-004 .
    PARAMETERS: P_INSTA RADIOBUTTON GROUP RAD1 DEFAULT 'X' ,
                P_REPLC RADIOBUTTON GROUP RAD1 ,
                P_IP RADIOBUTTON GROUP RAD1 .
    SELECT-OPTIONS : S_GERWE FOR EGERH-GERWECHS .
    SELECTION-SCREEN END OF BLOCK BL4 .
    SELECTION-SCREEN BEGIN OF BLOCK BL5 WITH FRAME TITLE TEXT-006.
    PARAMETERS  : P_VARI LIKE DISVARIANT-VARIANT ."DEFAULT '/ALL'.
    SELECTION-SCREEN COMMENT 47(40) varname FOR FIELD P_VARI .
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN PUSHBUTTON /5(25) BUT1 USER-COMMAND UCSS .
    PARAMETERS: P_FIXVAR LIKE KAEP_SETT-FIXVAR NO-DISPLAY,
                P_MAXSEL LIKE KAEP_SETT-MAXSEL NO-DISPLAY DEFAULT 1000.
    SELECTION-SCREEN END OF BLOCK BL5.
    *******INITIALIZATION************************
    INITIALIZATION .
    SET PF-STATUS 'INST' .
    G_REPID = SY-REPID.
    PERFORM VARIANT_INIT.
    Default variant
      GX_VARIANT = G_VARIANT.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                I_SAVE     = G_SAVE
           CHANGING
                CS_VARIANT = GX_VARIANT
           EXCEPTIONS
                NOT_FOUND  = 2.
      IF SY-SUBRC = 0.
        P_VARI = GX_VARIANT-VARIANT.
      ENDIF.
      MOVE 'Further Settings' TO BUT1 .
    AT SELECTION SCREEN EVENT******
    AT SELECTION-SCREEN .
      CASE SY-UCOMM .
        WHEN 'UCSS' .
          CALL FUNCTION 'K_LINE_ITEM_TECH_SETTINGS_SET'
               CHANGING
                    C_FIXVAR = P_FIXVAR
                    C_MAXSEL = P_MAXSEL.
      ENDCASE .
      IF NOT S_RAREA IS INITIAL .
        SELECT SINGLE * FROM EADRREGAREAA
         WHERE REGIOAREA IN S_RAREA .
        IF  SY-SUBRC <> 0 .
          MESSAGE E058(00) WITH S_RAREA-LOW S_RAREA-HIGH.
          LEAVE TO LIST-PROCESSING .
        ENDIF .
      ENDIF.
      IF NOT S_MATNR IS INITIAL .
        SELECT SINGLE * FROM ETYP
              WHERE MATNR IN S_MATNR
              AND KOMBINAT = 'Z'.
          IF SY-SUBRC <> 0 .
            MESSAGE E411(EG) .
            LEAVE TO  LIST-PROCESSING .
          ENDIF.
       ENDIF.
    IF NOT S_SWERK IS INITIAL .
        SELECT SINGLE * FROM ILOA
              WHERE SWERK IN S_SWERK .
          IF SY-SUBRC <> 0 .
            MESSAGE E412(I0) .
            LEAVE TO LIST-PROCESSING .
          ENDIF.
    ENDIF.
    IF NOT S_RGROUP IS INITIAL .
        SELECT SINGLE * FROM EADRREGAREAA
              WHERE REGIOGROUP IN S_RGROUP .
          IF SY-SUBRC <> 0 .
            MESSAGE E025(E7) .
            LEAVE TO LIST-PROCESSING .
          ENDIF.
    ENDIF.
    IF NOT  S_HAUS IS INITIAL .
      SELECT SINGLE * FROM EHAUISU
        WHERE HAUS IN S_HAUS .
        IF SY-SUBRC <> 0 .
          MESSAGE E011(E9) WITH 'Connection Object' S_HAUS-LOW S_HAUS-HIGH .
            LEAVE TO LIST-PROCESSING .
          ENDIF.
    ENDIF.
    IF NOT  S_VSTELL IS INITIAL .
      SELECT SINGLE * FROM EANL
        WHERE VSTELLE IN S_VSTELL .
        IF SY-SUBRC <> 0 .
            MESSAGE E011(E9) WITH 'Premise' S_VSTELL-LOW S_VSTELL-HIGH .
            LEAVE TO LIST-PROCESSING .
          ENDIF.
    ENDIF.
    IF NOT  S_VKONTO IS INITIAL .
      SELECT SINGLE * FROM EVER
        WHERE VKONTO IN S_VKONTO .
        IF SY-SUBRC <> 0 .
            MESSAGE E001(>3) .
            LEAVE TO LIST-PROCESSING .
          ENDIF.
    ENDIF.
    IF NOT S_GERWE IS INITIAL .
      SELECT SINGLE * FROM TE401
       WHERE GERWECHS IN S_GERWE .
        IF SY-SUBRC <> 0 .
          MESSAGE E058(00) WITH S_GERWE-LOW S_GERWE-HIGH .
          LEAVE TO LIST-PROCESSING .
        ENDIF.
    ENDIF.
    IF NOT P_SPART IS INITIAL .
    SELECT SINGLE * FROM EQUI
      WHERE SPARTE = P_SPART .
        IF SY-SUBRC <> 0 .
          MESSAGE E058(00).
           LEAVE TO LIST-PROCESSING .
        ENDIF.
    ENDIF.
    CASE SY-UCOMM .
    WHEN '&LFO'.
    WRITE:/ ' DOCUMENTATION' .
    ENDCASE .
    PERFORM VARIANT_EXISTENCE .
    AT SELECTION-SCREEN OUTPUT .
      LOOP AT SCREEN .
        IF SCREEN-NAME = 'P_SPART' .
          SCREEN-INPUT = 0 .
          MODIFY SCREEN .
        ENDIF .
      ENDLOOP .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI .
    PERFORM F4_FOR_VARIANT.
    ***************START OF SELECTION EVENT****************
    START-OF-SELECTION .
      IF P_INSTA = 'X' .
        PERFORM INSTALL .
      ELSEIF P_REPLC = 'X' .
        PERFORM REPLACE .
      ELSEIF P_IP = 'X' .
        PERFORM INS_REPL .
      ENDIF.
    IF SY-BATCH = ' ' .
      SELECT  A~EQUNR
             A~BIS
              A~AB
             A~LOGIKNR
              A~ZWGRUPPE
              A~EINBDAT
              A~AUSBDAT
              A~GERWECHS
              A~DEVLOC
              B~MATNR
              B~SERNR
              B~SPARTE
              D~ANLAGE
              D~LOGIKNR
              D~ERDAT  FROM ( ( EGERH AS A INNER JOIN EQUI AS B
                                    ON AEQUNR = BEQUNR )
                      INNER JOIN EASTL AS D ON ALOGIKNR = DLOGIKNR )
                                        AND   ABIS     = DBIS
                                        AND   AAB      = DAB )
              INTO TABLE ITMX2 UP TO P_MAXSEL ROWS
              FOR ALL ENTRIES IN ITTE4
              WHERE  A~GERWECHS = ITTE4-GERWECHS
              AND    A~BIS GE S_AB-LOW
              AND  A~AB IN S_AB
              AND A~KOMBINAT = 'Z'
              AND A~EINBDAT NE '00000000'
              AND A~AUSBDAT EQ '00000000'
              AND B~MATNR  IN S_MATNR
              AND B~SERNR IN S_SERNR
              AND B~SPARTE = P_SPART
              AND D~BIS GE S_AB-LOW .
             AND D~AB IN S_AB .
    ELSE.
        SELECT A~EQUNR
             A~BIS
              A~AB
             A~LOGIKNR
              A~ZWGRUPPE
              A~EINBDAT
              A~AUSBDAT
              A~GERWECHS
              A~DEVLOC
              B~MATNR
              B~SERNR
              B~SPARTE
              D~ANLAGE
              D~LOGIKNR
              D~ERDAT
              FROM ( ( EGERH AS A INNER JOIN EQUI AS B
                                    ON AEQUNR = BEQUNR )
                      INNER JOIN EASTL AS D ON ALOGIKNR = DLOGIKNR )
                                        AND   ABIS     = DBIS
                                        AND   AAB      = DAB )
              INTO  TABLE ITMX2
              FOR ALL ENTRIES IN ITTE4
              WHERE  A~GERWECHS = ITTE4-GERWECHS
              AND    A~BIS GE S_AB-LOW
              AND  A~AB IN S_AB
              AND A~KOMBINAT = 'Z'
              AND A~EINBDAT NE '00000000'
              AND A~AUSBDAT EQ '00000000'
              AND B~MATNR  IN S_MATNR
              AND B~SERNR IN S_SERNR
              AND B~SPARTE = P_SPART
              AND D~BIS GE S_AB-LOW .
             AND D~AB IN S_AB .
    ENDIF.
    SORT ITMX2 BY ANLAGE EQUNR .
    LOOP AT ITMX2 .
    IF ITMX2-ANLAGE =  WA_ITMX2-ANLAGE .
         MOVE-CORRESPONDING WA_ITMX2 TO ITMOD .
         APPEND ITMOD.
         CLEAR ITMOD .
        MOVE-CORRESPONDING ITMX2 TO ITMOD .
         APPEND ITMOD.
         CLEAR ITMOD .
    ENDIF.
    MOVE-CORRESPONDING ITMX2 TO WA_ITMX2  .
    ENDLOOP .
    SORT ITMOD BY ANLAGE EQUNR .
    DELETE ADJACENT DUPLICATES FROM ITMOD .
    IF NOT ITMOD[] IS INITIAL .
    SELECT A~EQUNR
           A~ZWNUMMER
           A~ZWKENN
           A~LOGIKZW
           B~ANLAGE
           B~ZWNABR
           FROM ( ETDZ AS A INNER JOIN EASTS AS B
                  ON ALOGIKZW = BLOGIKZW )
            INTO TABLE ITETD
            FOR ALL ENTRIES IN ITMOD
            WHERE A~EQUNR = ITMOD-EQUNR
            AND   A~BIS  GE S_AB-LOW
           AND   A~AB   IN S_AB
            AND   A~ZWNUMMER = 1
            AND   B~ZWNABR NE 'X' .
    SORT ITETD BY ANLAGE EQUNR .
    LOOP AT ITMX2 .
       LOOP AT ITETD WHERE ANLAGE EQ ITMX2-ANLAGE .
              V_ENTER =  1 .
            IF ITETD-EQUNR  EQ ITMX2-EQUNR .
               V_MODIFY =  1 .
               EXIT .
           ENDIF.
      ENDLOOP .
         IF V_ENTER = 1 AND V_MODIFY =  0 .
            DELETE ITMX2 .
         ENDIF.
         CLEAR : ITMX2 ,V_ENTER ,V_MODIFY .
    ENDLOOP .
    ENDIF.
    MESSAGE S015(ZS).
    IF NOT ITMX2[] IS INITIAL .
    SELECT  ANLAGE
             VSTELLE
             ANLART
             ERDAT
             FROM EANL INTO CORRESPONDING FIELDS OF TABLE ITEAN
             FOR ALL ENTRIES IN ITMX2
             WHERE ANLAGE = ITMX2-ANLAGE
             AND   SPARTE = P_SPART
             AND   VSTELLE IN S_VSTELL .
    ENDIF.
    SORT ITEAN BY ANLAGE .
    IF NOT ITEAN[] IS INITIAL .
    SELECT  E~ANLAGE
             E~VSTELLE
             F~haus
             F~VBSART
             F~ERDAT
             H~REGIOGROUP
             H~REGIOAREA
             L~DESCRIPT
         FROM ( ( ( ( EANL AS E INNER JOIN EVBS AS F
                           ON EVSTELLE = FVSTELLE )
                      INNER JOIN EHAUISU AS G ON FHAUS = GHAUS    )
                      INNER JOIN EADRREGAREAA AS H ON G~REGIOGROUP =
                                                            H~REGIOGROUP )
                      INNER JOIN EADRREGAREAT AS L ON H~REGIOAREA =
                                                           L~REGIOAREA   )
             INTO TABLE ITMX4
            FOR ALL ENTRIES IN ITEAN
             WHERE E~ANLAGE = ITEAN-ANLAGE
             AND   E~VSTELLE = ITEAN-VSTELLE
             AND   L~LANGU = SY-LANGU
             AND   H~REGIOGROUP IN S_RGROUP
             AND   H~REGIOAREA IN S_RAREA .
    ENDIF.
    *LOOP AT ITEAN .
    READ TABLE ITMX4 WITH KEY  VSTELLE = ITEAN-VSTELLE .
      IF SY-SUBRC EQ 0 .
         MOVE-CORRESPONDING ITMX4 TO ITEAN .
         ITEAN-ERDAT_EVBS = ITMX4-ERDAT .
         MODIFY ITEAN .
      ENDIF.
    *ENDLOOP .
    LOOP AT ITMX2 .
      ITMX1-ERDAT_EAS = ITMX2-ERDAT .
    MOVE-CORRESPONDING ITMX2 TO ITMX1 .
    READ TABLE ITEAN WITH KEY ANLAGE = ITMX2-ANLAGE .
       IF SY-SUBRC EQ 0 .
             ITMX1-ERDAT_EAN = ITEAN-ERDAT .
             MOVE-CORRESPONDING ITEAN TO ITMX1 .
       READ TABLE ITMX4 WITH KEY ANLAGE = ITMX2-ANLAGE .
        IF SY-SUBRC EQ 0 .
              ITMX1-ERDAT_EVB = ITMX4-ERDAT .
            MOVE-CORRESPONDING ITMX4 TO ITMX1 .
        ENDIF.
    WE WILL GET ONLY THOSE RECORDS THAT IS HAVING REGIO GROUP,DIVISON
        APPEND ITMX1.
        CLEAR ITMX1 .
      ENDIF.
    ENDLOOP .
    IF NOT ITMX4[] IS INITIAL .
    SELECT  EQUNR
             ABLBELNR
             ABLESGR
             ADAT
             ADATSOLL
             ANLAGE FROM V_EABL
             INTO TABLE ITMX3
             FOR ALL ENTRIES IN ITMX1
             WHERE ANLAGE = ITMX1-ANLAGE
            AND   EQUNR  = ITMX1-EQUNR
            AND  ADATSOLL GE S_AB-LOW
            ANd ( ABLESGR  EQ  '01'
            OR  ABLESGR  EQ  '02'
            OR  ABLESGR  EQ  '03'
            OR  ABLESGR  EQ  '22'  ) .
    SELECT  B~EQUNR
             A~ABLBELNR
             A~ABLESGR
             B~ADAT
             B~ADATSOLL
             A~ANLAGE
         FROM ( EABLG AS A INNER JOIN EABL AS B ON AABLBELNR = BABLBELNR
            INTO CORRESPONDING FIELDS OF TABLE ITMX3
            FOR ALL ENTRIES IN ITMX1
            WHERE A~ANLAGE = ITMX1-ANLAGE
            AND   B~EQUNR  = ITMX1-EQUNR
            AND  B~ADATSOLL GE S_AB-LOW
            AND  A~ABRDATS  GE S_AB-LOW
            AND ( A~ABLESGR EQ '01'
            OR  A~ABLESGR EQ '02'
            OR  A~ABLESGR EQ '03'
            OR  A~ABLESGR EQ '22'   ) .
    ENDIF.
    SELECT  ANLAGE
             VKONTO
             VERTRAG
             SPARTE
             FROM EVER INTO TABLE ITEVE
             FOR ALL ENTRIES IN ITMX1
             WHERE ANLAGE = ITMX1-ANLAGE
             AND   SPARTE = P_SPART .
    LOOP AT ITMX1 .
    READ TABLE  ITMX3 WITH KEY ANLAGE = ITMX1-ANLAGE
                                EQUNR  = ITMX1-EQUNR .
      IF SY-SUBRC EQ 0 .
       MOVE-CORRESPONDING ITMX3 TO ITMX1 .
       ENDIF.
      READ TABLE ITEVE WITH KEY ANLAGE = ITMX1-ANLAGE .
       IF SY-SUBRC EQ 0 .
          MOVE-CORRESPONDING ITEVE TO ITMX1 .
       ENDIF.
      MODIFY ITMX1 .
    ENDLOOP .
    SELECT J~BEGABRPE
             J~ENDABRPE
             J~ABRDATS
             J~VKONT
             j~vertrag
             K~BELNR
             K~LFDNR
             K~BUDAT
            FROM ( ERCH AS J INNER JOIN ERCHC AS K ON JBELNR = KBELNR )
            INTO CORRESPONDING FIELDS OF TABLE ITERC
             FOR ALL ENTRIES  IN ITMX1
             WHERE J~VERTRAG = ITMX1-VERTRAG
             AND   J~ADATSOLL GE S_AB-LOW .
    *SELECT BEGABRPE
            ENDABRPE
            ABRDATS
            VKONT
            vertrag
            K~BELNR
            K~LFDNR
            K~BUDAT
           FROM  ERCH     INTO CORRESPONDING FIELDS OF TABLE ITERC
            FOR ALL ENTRIES  in ITMX1
            WHERE VERTRAG = ITMX1-VERTRAG
            and   ADATSOLL GE S_AB-LOW .
    LOOP AT ITMX1 .
    READ TABLE ITERC WITH KEY VERTRAG = ITMX1-VERTRAG .
      IF SY-SUBRC EQ 0 .
        ITMX1-BEGABRPE = ITERC-BEGABRPE .
       ITMX1-ENDABRPE = ITERC-ENDABRPE .
       ITMX1-ABRDATS = ITERC-ABRDATS .
       ITMX1-BELNR = ITERC-BELNR .
       ITMX1-LFDNR = ITERC-LFDNR .
       ITMX1-BUDAT = ITERC-BUDAT .
       MODIFY ITMX1 TRANSPORTING BEGABRPE ENDABRPE ABRDATS  BELNR
          LFDNR BUDAT .
       ENDIF.
    ENDLOOP .
    MESSAGE S014(ZS) .
    LOOP AT ITMX1 .
    MOVE-CORRESPONDING ITMX1 TO ITFIN .
      ITFIN-LTPU = ITMX1-ERDAT_EAN - ITMX1-ERDAT_EVB .
      ITFIN-LTUB  = ITMX1-ERDAT_EAS - ITMX1-ERDAT_EAN .
    IF NOT ITMX1-ADATSOLL IS INITIAL AND ( NOT ITMX1-EINBDAT IS  INITIAL )
       ITFIN-LTBM  =  ITMX1-ADATSOLL - ITMX1-EINBDAT .
         ELSE .
             ITFIN-LTBM = 'NTAV'.
         ENDIF.
      IF NOT ITMX1-ADAT IS INITIAL  AND ( NOT ITMX1-ADATSOLL IS INITIAL ) .
        ITFIN-LTMA  =   ITMX1-ADAT - ITMX1-ADATSOLL .
      ELSE .
        ITFIN-LTMA = 'NTAV' .
      ENDIF.
      IF NOT ITMX1-ABRDATS IS INITIAL AND ( NOT ITMX1-ADAT IS INITIAL ) .
        ITFIN-LTAB  =   ITMX1-ABRDATS - ITMX1-ADAT .
      ELSE .
        ITFIN-LTAB =  'NTAV' .
      ENDIF.
      IF NOT ITMX1-BUDAT IS INITIAL AND ( NOT ITMX1-ABRDATS IS INITIAL ) .
           ITFIN-LTBA =   ITMX1-BUDAT - ITMX1-ABRDATS  .
    ELSE.
        ITFIN-LTBA = 'NTAV'.
      ENDIF.
      ITFIN-SUM = 0.
      IF ITFIN-LTPU NE 'NTAV' AND ITFIN-LTPU NE 'N/A'.
        ITFIN-SUM = ITFIN-SUM + ITFIN-LTPU.
      ENDIF.
      IF ITFIN-LTUB NE 'NTAV' AND ITFIN-LTUB NE 'N/A'.
        ITFIN-SUM = ITFIN-SUM + ITFIN-LTUB.
      ENDIF.
      IF ITFIN-LTBM NE 'NTAV' AND ITFIN-LTBM NE 'N/A'.
        ITFIN-SUM = ITFIN-SUM + ITFIN-LTBM.
      ENDIF.
      IF ITFIN-LTMA NE 'NTAV' AND ITFIN-LTMA NE 'N/A'.
        ITFIN-SUM = ITFIN-SUM + ITFIN-LTMA.
      ENDIF.
      IF ITFIN-LTAB NE 'NTAV' AND ITFIN-LTAB NE 'N/A'.
        ITFIN-SUM = ITFIN-SUM + ITFIN-LTAB.
      ENDIF.
      IF ITFIN-LTBA NE 'NTAV' AND ITFIN-LTBA NE 'N/A'.
        ITFIN-SUM = ITFIN-SUM + ITFIN-LTBA.
      ENDIF.
      APPEND ITFIN .
      CLEAR ITFIN .
    ENDLOOP .
    DELETE ADJACENT DUPLICATES FROM ITFIN .
    PERFORM SUMMARY .
    Message S013(ZS).
    PERFORM BACKGROUND .
    CLEAR: ITMX2[] ,ITSPL[],ITEGE[] ,ITTE4[],ITMX7[] .
    MESSAGE S017(ZS) .
    SUBROUTINES********************************
    FOR INSTALLATION********************************
    FORM INSTALL .
      SELECT GERWECHS
            EAWKENNZE
            EAWKENNZW
             FROM TE401 INTO CORRESPONDING FIELDS OF TABLE ITTE4
            WHERE GERWECHS IN S_GERWE
              AND  EAWKENNZE = 'X' .
    IF SY-SUBRC NE 0 .
       MESSAGE S002(ZS).
       LEAVE TO LIST-PROCESSING .
    ENDIF.
    ENDFORM .
    ************************REPLACE****************************
    FORM REPLACE .
      SELECT GERWECHS
             EAWKENNZE
             EAWKENNZW FROM TE401 INTO CORRESPONDING FIELDS OF TABLE ITTE4
        WHERE GERWECHS IN S_GERWE
        AND  EAWKENNZW = 'X' .
    IF SY-SUBRC NE 0.
       MESSAGE S003(ZS) .
       LEAVE TO LIST-PROCESSING .
    ENDIF.
    ENDFORM .
    ************************INSTALL/REPLACEMENT*********************
    FORM INS_REPL .
      SELECT GERWECHS
           EAWKENNZE
           EAWKENNZA
           EAWKENNZW FROM TE401 INTO CORRESPONDING FIELDS OF TABLE ITTE4
      WHERE GERWECHS IN S_GERWE
      AND ( EAWKENNZE = 'X'
      OR  EAWKENNZW = 'X'  ) .
    IF SY-SUBRC NE 0.
       MESSAGE S004(ZS) .
       LEAVE TO LIST-PROCESSING .
    ENDIF.
    ENDFORM .
    FIELD CATALOG FOR DETAILED REPORT ******************
    FORM FIELDCATALOG USING F_FIELDCAT .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'STATUS' .
      SFLD-SELTEXT_S = 'Details'.
      SFLD-SELTEXT_M = 'Details'.
      SFLD-JUST =   'L' .
      SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'EQUNR' .
      SFLD-SELTEXT_S = 'Equipment'.
      SFLD-SELTEXT_M = 'Equipment'.
      SFLD-JUST =   'L' .
      SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'ANLAGE' .
      SFLD-SELTEXT_S = 'Installat.'.
      SFLD-SELTEXT_M = 'Installation'.
      SFLD-JUST =   'L' .
      SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'SERNR' .
      SFLD-SELTEXT_S = 'Serial no.'.
      SFLD-SELTEXT_M = 'Serial number'.
      SFLD-JUST =   'L' .
    SFLD-KEY  = 'X' .
    SFLD-HOTSPOT = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'VKONTO' .
      SFLD-SELTEXT_S = 'Cont.Acct'.
      SFLD-SELTEXT_M = 'Contract Acct'.
      SFLD-JUST =   'L' .
    SFLD-KEY  = 'X' .
    SFLD-HOTSPOT = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'REGIOAREA' .
      SFLD-SELTEXT_S = 'Reg. area'.
      SFLD-SELTEXT_M = 'Reg. struc.area'.
      SFLD-JUST =   'L' .
      SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'REGIOGROUP' .
      SFLD-SELTEXT_S = 'RegStrGrp.'.
      SFLD-SELTEXT_M = 'Reg. Str. Grp.'.
      SFLD-JUST =   'L' .
      SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD  .
      SFLD-FIELDNAME = 'LTPU' .
      SFLD-SELTEXT_S = 'Prm-Util'.
      SFLD-SELTEXT_L = 'Premise to Utility installation in days'.
      SFLD-JUST =   'R' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'LTUB' .
      SFLD-SELTEXT_S = 'Util-BInst'.
      SFLD-SELTEXT_L = 'Utility to Billing installation in days'.
      SFLD-JUST =   'R' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'LTBM' .
      SFLD-SELTEXT_M = 'BInst-MRO'.
      SFLD-SELTEXT_L = 'Billing to Meter reading order in days'.
      SFLD-JUST =   'R' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'LTMA' .
      SFLD-SELTEXT_M = 'MRO-AcRead'.
      SFLD-SELTEXT_L = 'Meter reading order to actual reading in days'.
      SFLD-JUST =   'R' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'LTAB' .
      SFLD-SELTEXT_M = 'AcRead-BiOr'.
      SFLD-SELTEXT_L = 'Actual reading to Billing order in days'.
      SFLD-JUST =   'R' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'LTBA' .
      SFLD-SELTEXT_M = 'BiOr-AcBill'.
      SFLD-SELTEXT_L = 'Billing order to Actual billing in days'.
      SFLD-JUST =   'R' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'SUM' .
      SFLD-SELTEXT_M = 'TOTAL'.
      SFLD-SELTEXT_L = 'Total lead time in days'.
      SFLD-JUST =   'R' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'VSTELLE' .
      SFLD-SELTEXT_S = 'Premise'.
      SFLD-SELTEXT_M = 'Premise'.
      SFLD-JUST =   'L' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'LOGIKNR' .
      SFLD-SELTEXT_S = 'LogDev.no.'.
      SFLD-SELTEXT_M = 'Log. dev. no.'.
      SFLD-JUST =   'L' .
    SFLD-KEY  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'BIS' .
      SFLD-SELTEXT_M = 'Valid to'.
      SFLD-SELTEXT_L = 'Date at Which a Time Slice Expires'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'AB' .
      SFLD-SELTEXT_M = 'Valid from'.
      SFLD-SELTEXT_L = 'Date from which time slice is valid'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'ZWGRUPPE' .
      SFLD-SELTEXT_S = 'Reg. group'.
      SFLD-SELTEXT_M = 'Register group'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'EINBDAT' .
      SFLD-SELTEXT_S = 'Inst. date'.
      SFLD-SELTEXT_M = 'Install. date'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD.
      SFLD-FIELDNAME = 'AUSBDAT' .
      SFLD-SELTEXT_S = 'Remov.date'.
      SFLD-SELTEXT_M = 'Removal date'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'GERWECHS' .
      SFLD-SELTEXT_S = 'Reason'.
      SFLD-SELTEXT_M = 'Activity reason'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'DEVLOC' .
      SFLD-SELTEXT_S = 'Dev. loc.'.
      SFLD-SELTEXT_M = 'Device location'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'SPARTE' .
      SFLD-SELTEXT_S = 'Division'.
      SFLD-SELTEXT_M = 'Division'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'ANLART' .
      SFLD-SELTEXT_S = 'Inst. type'.
      SFLD-SELTEXT_M = 'Inst. type'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'HAUS' .
      SFLD-SELTEXT_S = 'Conn.obj.'.
      SFLD-SELTEXT_M = 'Connection obj.'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD .
      SFLD-FIELDNAME = 'VBSART' .
      SFLD-SELTEXT_S = 'Prem. type'.
      SFLD-SELTEXT_M = 'Premise type'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD.
      SFLD-FIELDNAME = 'ABBELNR' .
      SFLD-SELTEXT_S = 'Int.MRD ID'.
      SFLD-SELTEXT_M = 'Int. MR doc. ID'.
      SFLD-JUST =   'C' .
      SFLD-NO_OUT  = 'X' .
      APPEND SFLD TO ITFLD .
      CLEAR SFLD.
      SFLD-FIELDNAME = 'ABLESGR' .

Maybe you are looking for