EvDRE: Refresh Active Sheet (for VBA)

Is there a routine I can use that's the equivalent to:
Right-click, EVDRE: Exand & Refresh...Active Sheet
I'm aware of the VBA routines like MNU_eTOOLS_EXPANDANDREFRESH and MNU_eTOOLS_EXPAND, and MNU_eTOOLS_REFRESH---but did not find any documentation on this calling this.
Edited by: Allison Jones on Mar 17, 2008 8:50 PM

Those may be internal calls to the addin that are accidently exposed.  You should not call anything that isn't documented.  All the MNU commands are documented in the eTools help file I referenced earlier.  Choose, [eTools] > [BPC for Office help] then search on [MNU] and choose [BPC menu commands].
You can either assign the macro to a form button or call them in a VBA routine as Joost mentioned.  If the goal is to just call the macro, the button works fine.  The only reason to call them from VBA is if you need to string together multiple operations in a single process.  Then you'd write your own macro and assign it to a button.
The function that is equal to Expand and refresh on a report template would be MNU_ETOOLS_EXPANDANDREFRESH.  This does both an expand of dynamic members and a data refresh.  If you just need to update the data, MNU_ETOOLS_REFRESH is all that's needed.

Similar Messages

  • EVMNU Macro to expand active sheet

    Hi all,
    I have a question regarding the EVMNU macros. Is there a EVMNU macro which allows us to expand only the active sheet? I know that it is possible to do this via the context menu but as far as I know there is no EVMNU macro with which this action can be customized to a button. Am I right or is there a EVMNU macro available? The MNU_eTOOLS_EXPAND-macro expands all sheets of a workbook. In my case I would like to avoid doing an expand of all sheets because an expand of the active sheet would result in a better performance.
    Thanks in advance for your help
    Christian

    On the Workbook options check the EVDRE: Refresh by Sheet option

  • Number of users logged in during cube refresh activity

    I am using Hyperion 11.1.2.1 and running  Planning cube refresh activity using \Hyperion\Planning\bin\CubeRefresh.cmd.
    Is there any way to find out total number of users logged in into a particular Planning Application during Cube refresh activity running for that application ?

    I don't think Planning repository has information about sessions.
    Let us know if you succeed.
    I was not talking about Essbase as in "Essbase", all users that are performing an activity in Planning (data refresh, data load, run business rule) will show up in EAS sessions so if you run the maxl display session against Planning application it'll give you all users.
    Now OP, you can perform a search for "line count windows cmd" will give you ideas on how to count the lines and that count is going to be the numbers of users (well it is not the number of users, but number of sessions)
    ORA-00001: Unique constraint violated: Count lines in multiple files using Windows command prompt
    Regards
    Celvin

  • Design pattern for unprotecting and reprotecting sheets with VBA?

    Many macros can't run when a worksheet is protected, so when I develop an Excel workbook that has protected worksheets, I have to unprotect worksheets when macros are called and then reprotect the worksheets once the macro has completed.
    The current design pattern I use for this is the following:
    I look at each procedure individually and consider which sheets need to be unprotected for it to run. Then in each procedure I write:
    Sub Test()
    Dim bSheet1Protected as boolean
    Dim bSheet2Protected as boolean
    bSheet1Protected = Sheet1.ProtectContents
    bSheet2Protected = Sheet1.ProtectContents
    bSheet1Protected.Unprotect
    bSheet2Protected.Unprotect
    '''The rest of my code
    if bSheet1Protected then Sheet1.Protect
    if bSheet2Protected then Sheet2.Protect
    End Sub
    But I imagine that maybe there are better ways of doing this. What is your preferred design pattern for unprotecting and reprotecting sheets with VBA?

    Hi JP3O,
    I think it is a good practice to unprotect the worksheet before execute some code and protect it back after the code execute finished.
    >>But I imagine that maybe there are better ways of doing this. What is your preferred design pattern for unprotecting and reprotecting sheets with VBA?<<
    I am not able to find a better way since we always need to unproect the worksheet if some code didn't not executed successful when the worksheet is proected.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Data transfer from sap r/3 into excel sheet for mi01

    hi gurus,
       as i  am a xi consultant i got requirement to write a program for data transfer from sap r/3 into excel sheet for MI01.can any body help me by giving sample code or example for this requirement.please help me.

    Hi Rohit,
    This is an upload program and it has used both function modules to upload from an excel to R3 and to download from R3 onto excel.
    GUI_UPLOAD
    GUI_DOWNLOAD
    are the function modules used.
    Hope this helps,
    *Output:        Downloads error records onto presentation server,
    *               Displays report with number of success and error records
    REPORT ZMCG047CONTR NO STANDARD PAGE HEADING
                                   LINE-SIZE 255
                                   MESSAGE-ID ZM.
    *&       Table declarations
    TABLES : T001W,     "Plants/Branches
             T024E,     "Purchasing Organizations
             T001.      "Company Codes
    *              TYPE-POOLS  DECLARATION
    TYPE-POOLS : SLIS.
    *                       Types  Declaration                            *
    TYPES: BEGIN OF T_RECORD,    "record storing contract info
            LIFNR(010),      "Vendor Number
            EVART(004),      "Agreement Type
            EKORG(004),      "Purchasing Organization
            EKGRP(003),      "Purchasing Group
            WERKS(004),      "Plant
            LGORT(004),      "Storage Location
            KDATB(010),      "Valid start Date
            KDATE(010),      "Valid End Date
            ZTERM(004),      "Payment Terms
            KTWRT(020),      "Target Value
            EPSTP(001),      "Item Category
            EMATN(018),      "Material Number
            KTMNG(017),      "Target Quantity
            NETPR(014),      "Net Price
            PEINH(006),      "Net Price Unit
            BPRME(003),      "Net Price Order Price Unit
            IDNLF(035),      "Vendor Material number
            WEBRE(001),      "GR Based-IV
            MEPRF(001),      "Pricing Date Category
            LTEX1(040),      "Info Text
            DATAB(010),      "Valid From
            DATBI(010),      "Valid To
            KSCHL(004),      "Condition Type
            KBETR(016),      "Condition Rate if scale is not given
            KONWA(005),      "Currency
            KPEIN(005),      "Condition Pricing Unit
            KMEIN(003),      "Condition Unit of Measure
            KSTBM(019),      "Scale
            KBETR_01(016),   "Scale Rate
            DEL_FLAG,        "Delete Flag Indicator
            ERR_MSG(100),    "Error Message
          END OF T_RECORD,
          BEGIN OF T_ERR_RECORD,   "to have error records stored
             LIFNR(010),      "Vendor Number
             EVART(004),      "Agreement Type
             EKORG(004),      "Purchasing Organization
             EKGRP(003),      "Purchasing Group
             WERKS(004),      "Plant
             LGORT(004),      "Storage Location
             KDATB(010),      "Valid start Date
             KDATE(010),      "Valid End Date
             ZTERM(004),      "Payment Terms
             KTWRT(020),      "Target Value
             EPSTP(001),      "Item Category
             EMATN(018),      "Material Number
             KTMNG(017),      "Target Quantity
             NETPR(014),      "Net Price
             PEINH(006),      "Net Price Unit
             BPRME(003),      "Net Price Order Price Unit
             IDNLF(035),      "Vendor Material number
             WEBRE(001),      "GR Based-IV
             MEPRF(001),      "Pricing Date Category
             LTEX1(040),      "Info Text
             DATAB(010),      "Valid From
             DATBI(010),      "Valid To
             KSCHL(004),      "Condition Type
             KBETR(016),      "Condition Rate if scale is not given
             KONWA(005),      "Currency
             KPEIN(005),      "Condition Pricing Unit
             KMEIN(003),      "Condition Unit of Measure
             KSTBM(019),      "Scale
             KBETR_01(016),   "Scale Rate
             DEL_FLAG,        "Delete Flag Indicator
             ERR_MSG(100),    "Error Message
          END OF T_ERR_RECORD,
          BEGIN OF T_LOEKZ,    "To have deletion indicators for materials
              LOEKZ(001),    "Deletion indicator in purchasing document
              EMATN(018),    "Material Number
              WERKS(004),    "Plant
              LGORT(004),    "Storage Location
              BSTYP(001),    "Purchasing document category
          END OF T_LOEKZ,
          BEGIN OF T_MATNR,  " Type definition to store details of materials
               MATNR(018),    "Material Number
          END OF T_MATNR,
          BEGIN OF T_T001,   " Type definition for company codes
              BUKRS(004),    " Company Code
          END OF T_T001,
          BEGIN OF T_ZMVXREF,   "Cross-Reference table type
              D_ALTKN(10),      "Legacy Vendor Number
              D_BUKRS(4),       "Legacy Company Code
              M_ALTKN(10),      "SAP Company Code
          END OF T_ZMVXREF,
          BEGIN OF T_LFA1,    "Master data of vendors
              LIFNR(10),      "Vendor Number
          END OF T_LFA1,
    *  Type Declaration for T024E (Company Codes)
           BEGIN OF T_T024E,
             EKORG   LIKE   T024E-EKORG,     "Purchasing organization
             BUKRS   LIKE   T024E-BUKRS,     "Company Code
           END OF T_T024E,
    *  Type Declaration for t001w (Plant)
           BEGIN OF T_T001W,
             WERKS  LIKE  T001W-WERKS,            "Plant
           END OF T_T001W,
    *  Type Declatation for String Line
           BEGIN OF T_STR1,                                     "#EC NEEDED
             SLINE(6000) TYPE C,
           END OF T_STR1.
    TYPES:  BEGIN OF T_BDCDATA.  "BDC Data
            INCLUDE STRUCTURE BDCDATA.
    TYPES:  END OF T_BDCDATA.
    *       Internal Tables  Declaration                                  *
    DATA:
    *      Internal table to store input file data
           I_RECORD TYPE STANDARD TABLE OF T_RECORD INITIAL SIZE 0,
    *      Internal table to capture errors
           I_ERR_REC TYPE STANDARD TABLE OF T_ERR_RECORD INITIAL SIZE 0,
    *      Internal table to check for deletion indicators
           I_LOEKZ TYPE STANDARD TABLE OF T_LOEKZ INITIAL SIZE 0,
    *      Internal table to check for material numbers
           I_MATNR TYPE STANDARD TABLE OF T_MATNR INITIAL SIZE 0,
    *      Internal table used for storing Cross-Reference data of Vendor
           I_ZMVXREF TYPE STANDARD TABLE OF T_ZMVXREF INITIAL SIZE 0,
    *      Internal table for holding Vendor Numbers from Master table
           I_LFA1 TYPE STANDARD TABLE OF T_LFA1 INITIAL SIZE 0,
    *      Internal table for holding Purchase Org and Company Codes
           I_T024E TYPE STANDARD TABLE OF T_T024E INITIAL SIZE 0,
    *      Internal table for holding Plants
           I_T001W TYPE STANDARD TABLE OF T_T001W INITIAL SIZE 0,
    *      Internal table for storing a list of Company Codes
           I_T001 TYPE STANDARD TABLE OF T_T001 INITIAL SIZE 0,
    *      Internal table used for ALV Reporting
           I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    *      Internal table used for holding List Header
           I_LISTHEADER TYPE SLIS_T_LISTHEADER,    "EC NEEDED
    *      Internal table to hold ALV Event
           I_ALV_EVENT TYPE SLIS_T_EVENT,
    *      Internal table to hold Sort Info for ALV Report
           I_SORT TYPE SLIS_T_SORTINFO_ALV,
    *      Internal table for BDC Data
           I_BDCDATA TYPE STANDARD TABLE OF T_BDCDATA INITIAL SIZE 0,
    *      Internal table for messages
           I_MESSTAB TYPE TABLE OF BDCMSGCOLL,
    *      Internal table for String line
           I_STR1 TYPE STANDARD TABLE OF T_STR1 INITIAL SIZE 0.
    *       Work Area Declaration                                         *
    DATA:
    *  Work Area to hold data for the Open Contract
          WA_RECORD TYPE T_RECORD,
    *  Work Area to hold previous record data
          WA_RECORDPREV TYPE T_RECORD,
    *  Work Area to hold errors
          WA_ERR_REC TYPE T_ERR_RECORD,
    *  Work Area to hold the Deletion Indicator of materials
          WA_LOEKZ TYPE T_LOEKZ,
    *  Work Area to hold Material numbers of required materials
          WA_MATNR TYPE T_MATNR,      "EC NEEDED
    *  Work Area to hold errors occured while performing BDC
          WA_MESSTAB TYPE BDCMSGCOLL,
    *  Work Area to hold field catalog for ALV Reports
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    *  Work Area to hold list header data for ALV reports
          WA_LISTHEADER TYPE SLIS_LISTHEADER,
    *  Work Area to hold ALV Event
          WA_ALV_EVENT LIKE LINE OF I_ALV_EVENT,  "EC NEEDED
    *  Work Area to hold Layout of ALV Report
          WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
    *  Work Area to hold Cross-Reference data of Vendor
          WA_ZMVXREF TYPE T_ZMVXREF,
    *  Work Area to hold Vendor Numbers from Master table
          WA_LFA1 TYPE T_LFA1,    "EC NEEDED
    *  Work Area to hold Purchase Org and Company Codes
          WA_T024E TYPE T_T024E,
    *  Work Area to hold Company Codes
          WA_T001 TYPE T_T001,
    *  Work Area to hold Plants
          WA_T001W TYPE T_T001W,
    *  Work Area to hold Sort Info for ALV Report
          WA_SORT TYPE SLIS_SORTINFO_ALV,
    *  Work Area to hold BDC Data
          WA_BDCDATA TYPE T_BDCDATA,
    *  Work Area for String line
          WA_STR1 TYPE T_STR1.
    *       Variables  Declaration                                        *
    DATA: V_ERRMSG(500),           "To temporarily store the error message
          V_CONV_DATE(10) TYPE C,  "To capture the converted date format
          V_DATE LIKE SY-DATUM,
          V_REPID LIKE SY-REPID,   "holds report id
          V_CROSS_REFERENCE_ERROR TYPE I,  " cross-reference error
          V_INPUTERROR_FLAG VALUE '',      " input error status
          V_FILENAME TYPE STRING,          " File Name
          VEN_FLAG(1),                       " at new status
          MAT_FLAG(1),                      " at new status
          V_IND(2) TYPE N,                 " index of table control
          V_IND2(2) TYPE N,                " index of table control
          V_IND3(2) TYPE N,                " index of table control
          V_EVRTP1(20),
          V_EPSTP1(20),
          V_EMATN1(20),
          V_KTMNG1(20),
          V_NETPR1(20),
          V_PEINH1(20),
          V_BPRME1(20),
          V_TCSELFLAG1(20),
          V_KSCHL2(20),
          V_KBETR2(20),
          V_KONWA2(20),
          V_KPEIN2(20),
          V_KMEIN2(20),
          V_SELKZ2(20),
          V_KBETR3(20),
          V_KSTBM3(20),
          V_LINE TYPE I,
          V_STR TYPE X VALUE '09',
          V_EXIST TYPE C,
          V_EXIST1 TYPE C,
          V_ISDIR TYPE C,
          V_ISDIR1 TYPE C.
    *       Constants  Declaration                                        *
    CONSTANTS: C_TCODE(5) VALUE 'ME31K', "Trx code - Open Contract Creation
               C_TRUE     VALUE 'X',       " Del_Flag indicator
               C_LOEKZ_MARKED VALUE 'X',   "Deletion indicator for material
               C_INPUTERROR_FLAG_YES VALUE 'X',  "Input File Indicator
               C_VEN_ERR1 VALUE 1,    "Error Indicator
               C_16(2)    VALUE '16',
               C_VEN_ERR2 VALUE 2,    "Error Indicator
               C_VEN_ERR3 VALUE 3,    "Error Indicator
               C_VEN_SUCS VALUE 0,    "Success Indicator
               C_SUCCESS  LIKE SY-SUBRC VALUE '0',
               C_STRUE    VALUE 'S',  "Del_flag for SAP Errors
               C_YTRUE    VALUE 'Y',  "Del_flag for Success Records
               C_MSGTYP_E VALUE 'E',  "holds error message type
               C_MSGTYP_S VALUE 'S',  "holds success message type
               C_BSTYP    VALUE 'K',  "Purchasing Document type is Contract
               C_BACKGROUND VALUE 'N', "Background mode
               C_FOREGROUND VALUE 'A', "All Screen mode
               C_ERRORS   VALUE 'E',   "Error screen mode
               C_WK(2)    VALUE 'WK'. "Value Contract
    *        Selection Screen                                             *
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-033.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS:
    *              Plant
                   S_WERKS FOR T001W-WERKS OBLIGATORY,
    *              Purchase Organization
                   S_EKORG FOR T024E-EKORG OBLIGATORY.
    *              Company Code
    PARAMETER      P_BUKRS LIKE T001-BUKRS OBLIGATORY.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN ULINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 3.
    PARAMETER RB_SERVE RADIOBUTTON GROUP RBX DEFAULT 'X' USER-COMMAND U1.
    SELECTION-SCREEN COMMENT 6(19)  TEXT-036.
    SELECTION-SCREEN POSITION 37.
    PARAMETER RB_LOCAL RADIOBUTTON GROUP RBX.
    SELECTION-SCREEN COMMENT 40(13) TEXT-035.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP.
    PARAMETERS:
    *    Parameter holding Input File name
              P_FILE LIKE RLGRAP-FILENAME
                     OBLIGATORY
                     LOWER CASE
                     DEFAULT 'C:\'
                     MODIF ID G1,
              P_FILE1 LIKE RLGRAP-FILENAME
                      OBLIGATORY
                      LOWER CASE
                      DEFAULT '/celestica/interface/corp/in/work/'
                      MODIF ID G2,
    *    Parameter specifying Mode of calling the Transaction.
              P_MODE DEFAULT 'N' OBLIGATORY,
    *    Check box used to test the input file.
              P_TEST AS CHECKBOX DEFAULT 'X',
    *    Parameter holding Filename for holding Input File Errors
              P_IPERR LIKE RLGRAP-FILENAME
                      OBLIGATORY
                      LOWER CASE
                      DEFAULT 'C:\'
                      MODIF ID G1,
              P_IPERR1 LIKE RLGRAP-FILENAME
                     OBLIGATORY
                     LOWER CASE
                     DEFAULT '/celestica/interface/corp/in/work/047_Err.txt'
                     MODIF ID G2.
    SELECTION-SCREEN END OF BLOCK B2.
    *        AT Selection Screen  Events                                  *
    *  Loop the screen to activate relative paths
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF RB_SERVE = C_TRUE AND SCREEN-GROUP1 = 'G1'.
          SCREEN-OUTPUT = 0.
          SCREEN-ACTIVE = 0.
          SCREEN-INPUT = 0.
        ELSEIF RB_LOCAL = C_TRUE AND SCREEN-GROUP1 = 'G2'.
          SCREEN-OUTPUT = 0.
          SCREEN-ACTIVE = 0.
          SCREEN-INPUT = 0.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    AT SELECTION-SCREEN ON BLOCK B2.
    *  Checking Access Authorization for the user
      CALL FUNCTION 'ZU_DATA_ACCESS_AUTH_CHECK'
           EXPORTING
                ACTVT        = C_16
                P_BUKRS      = P_BUKRS
           TABLES
                S_WERKS      = S_WERKS
                S_EKORG      = S_EKORG
           EXCEPTIONS
                BUKRS_FAILED = 1
                VKORG_FAILED = 2
                VTWEG_FAILED = 3
                EKORG_FAILED = 4
                WERKS_FAILED = 5
                LGNUM_FAILED = 6
                OTHERS       = 7.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    AT SELECTION-SCREEN ON P_BUKRS.
      IF NOT P_BUKRS IS INITIAL.
        SELECT SINGLE BUKRS INTO T001
                            FROM T001
                            WHERE BUKRS EQ P_BUKRS.
        IF SY-SUBRC NE 0.
          MESSAGE I000 WITH TEXT-089.
          STOP.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    * Search Help to select Input File path.
      PERFORM GET_FILE_NAME USING P_FILE.
    * Check for the existence of the file.
      IF RB_LOCAL EQ C_TRUE.
        CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
             EXPORTING
                  FNAME          = P_FILE
             IMPORTING
                  EXIST          = V_EXIST
                  ISDIR          = V_ISDIR
             EXCEPTIONS
                  FILEINFO_ERROR = 1
                  OTHERS         = 2.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        IF V_ISDIR IS INITIAL.
          IF V_EXIST IS INITIAL.
            MESSAGE I000 WITH TEXT-018.
            STOP.
          ENDIF.
        ELSEIF V_ISDIR EQ C_TRUE.
          MESSAGE I000 WITH TEXT-068.
          STOP.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_IPERR.
    * Search Help to select Input Error File path.
      PERFORM GET_FILE_NAME USING P_IPERR.
    AT SELECTION-SCREEN.
    * Validate Transaction Mode
      IF  P_MODE <> C_BACKGROUND AND
          P_MODE <> C_FOREGROUND AND
          P_MODE <> C_ERRORS.
        MESSAGE I000 WITH TEXT-034.
        STOP.
      ENDIF.
    START-OF-SELECTION.
    * Get the Input File Data
      V_FILENAME = P_FILE.
      PERFORM UPLOAD_FLATFILE_DATA TABLES I_RECORD
                                   USING V_FILENAME.
    * Sorting the data by all fields
      SORT I_RECORD.
    * Ensuring the padding of the empty spaces before the vendor No
      CLEAR WA_RECORD.
      LOOP AT I_RECORD INTO WA_RECORD.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  INPUT  = WA_RECORD-LIFNR
             IMPORTING
                  OUTPUT = WA_RECORD-LIFNR.
        MODIFY I_RECORD FROM WA_RECORD
                        INDEX SY-TABIX
                        TRANSPORTING LIFNR.
        CLEAR WA_RECORD.
      ENDLOOP.
    * Input file validation
      PERFORM VALIDATE_FLATFILE_DATA.
      IF P_TEST = C_TRUE.
        IF I_ERR_REC[] IS INITIAL.
          MESSAGE I000 WITH TEXT-032.
          STOP.
        ELSE.
    *  Display all the error records at the input level.
          PERFORM DISPLAY_INPERR_RECORDS.
    *  Download Error File
          PERFORM DOWNLOAD_ERROR_FILE.
        ENDIF.
      ELSE.
    * Build BDC Data
        PERFORM BUILD_BDC_DATA.
    * Download Error File
        PERFORM DOWNLOAD_ERROR_FILE.
    * Display the status report.
        PERFORM DISPLAY_PROCESSED_RECORDS.
      ENDIF.
    END-OF-SELECTION.
      REFRESH:  I_RECORD,
                I_ERR_REC,
                I_LOEKZ,
                I_MATNR,
                I_ZMVXREF,
                I_LFA1,
                I_T024E,
                I_FIELDCAT,
                I_LISTHEADER,
                I_ALV_EVENT,
                I_SORT,
                I_BDCDATA,
                I_MESSTAB,
                I_STR1.
      FREE: I_RECORD,
            I_ERR_REC,
            I_LOEKZ,
            I_MATNR,
            I_ZMVXREF,
            I_LFA1,
            I_T024E,
            I_FIELDCAT,
            I_LISTHEADER,
            I_ALV_EVENT,
            I_SORT,
            I_BDCDATA,
            I_MESSTAB,
            I_STR1.
    *&      Form  GET_file_name
    *       Fetches the file and path from the presentation system
    *  -->  p1        Path along with the file name
    FORM GET_FILE_NAME USING L_FILE LIKE RLGRAP-FILENAME.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                MASK             = ',*.TXT,*.txt.'
                MODE             = 'O'
                TITLE            = TEXT-011
           IMPORTING
                FILENAME         = L_FILE
           EXCEPTIONS
                INV_WINSYS       = 1
                NO_BATCH         = 2
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4
                OTHERS           = 5.
      CASE SY-SUBRC.
        WHEN 1.
          MESSAGE I000 WITH TEXT-084.
          STOP.
        WHEN 2.
          MESSAGE I000 WITH TEXT-085.
          STOP.
        WHEN 3.
          MESSAGE I000 WITH TEXT-086.
          STOP.
        WHEN 4.
          MESSAGE I000 WITH TEXT-087.
          STOP.
      ENDCASE.
    ENDFORM.                    " GET_file_name
    *&      Form  upload_flatfile_data
    *       Uploading data from Flat File
    FORM UPLOAD_FLATFILE_DATA
                          TABLES I_L_RECORD STRUCTURE WA_RECORD
                          USING L_FILENAME TYPE STRING.
      DATA WA_L_RECORD TYPE T_RECORD.
    * Upload the Flat file data
      IF RB_LOCAL EQ C_TRUE. "File is on the Local System
        CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
                  FILENAME                = L_FILENAME
                  FILETYPE                = 'ASC'
                  HAS_FIELD_SEPARATOR     = 'X'
             TABLES
                  DATA_TAB                = I_L_RECORD
             EXCEPTIONS
                  FILE_OPEN_ERROR         = 1
                  FILE_READ_ERROR         = 2
                  NO_BATCH                = 3
                  GUI_REFUSE_FILETRANSFER = 4
                  INVALID_TYPE            = 5
                  NO_AUTHORITY            = 6
                  UNKNOWN_ERROR           = 7
                  BAD_DATA_FORMAT         = 8
                  HEADER_NOT_ALLOWED      = 9
                  SEPARATOR_NOT_ALLOWED   = 10
                  HEADER_TOO_LONG         = 11
                  UNKNOWN_DP_ERROR        = 12
                  ACCESS_DENIED           = 13
                  DP_OUT_OF_MEMORY        = 14
                  DISK_FULL               = 15
                  DP_TIMEOUT              = 16
                  OTHERS                  = 17.
        CASE SY-SUBRC.
          WHEN 0.
            DESCRIBE TABLE I_L_RECORD LINES V_LINE.
            IF V_LINE EQ 0.
              MESSAGE I000 WITH TEXT-065.
              STOP.
            ENDIF.
          WHEN 1.
            MESSAGE I000 WITH TEXT-068.
            STOP.
          WHEN 2.
            MESSAGE I000 WITH TEXT-069.
            STOP.
          WHEN 3.
            MESSAGE I000 WITH TEXT-070.
            STOP.
          WHEN 4.
            MESSAGE I000 WITH TEXT-071.
            STOP.
          WHEN 5.
            MESSAGE I000 WITH TEXT-072.
            STOP.
          WHEN 6.
            MESSAGE I000 WITH TEXT-073.
            STOP.
          WHEN 7.
            MESSAGE I000 WITH TEXT-074.
            STOP.
          WHEN 8.
            MESSAGE I000 WITH TEXT-075.
            STOP.
          WHEN 9.
            MESSAGE I000 WITH TEXT-076.
            STOP.
          WHEN 10.
            MESSAGE I000 WITH TEXT-077.
            STOP.
          WHEN 11.
            MESSAGE I000 WITH TEXT-078.
            STOP.
          WHEN 12.
            MESSAGE I000 WITH TEXT-079.
            STOP.
          WHEN 13.
            MESSAGE I000 WITH TEXT-080.
            STOP.
          WHEN 14.
            MESSAGE I000 WITH TEXT-081.
            STOP.
          WHEN 15.
            MESSAGE I000 WITH TEXT-082.
            STOP.
          WHEN 16.
            MESSAGE I000 WITH TEXT-083.
            STOP.
        ENDCASE.
        CLEAR V_LINE.
      ELSEIF RB_SERVE EQ C_TRUE. "File is on the Application Server
        P_MODE = C_BACKGROUND.
        OPEN DATASET P_FILE1 FOR INPUT IN TEXT MODE.
        CHECK SY-SUBRC EQ C_SUCCESS.
        CLEAR WA_STR1.
        DO.
          READ DATASET P_FILE1 INTO WA_STR1.
          IF SY-SUBRC <> 0.      " NE SUCCESS.
            EXIT.
          ELSEIF SY-SUBRC EQ C_SUCCESS.
            APPEND WA_STR1 TO I_STR1.
            CLEAR WA_STR1.
          ENDIF.                  " ENDIF on SY-SUBRC 0 Check.
        ENDDO.                    " ENDDO
        DELETE I_STR1 WHERE SLINE EQ ' '.
        DESCRIBE TABLE I_STR1 LINES V_LINE.
        IF V_LINE EQ 0.
          MESSAGE S000 WITH TEXT-065.
          STOP.
        ENDIF.
        LOOP AT I_STR1 INTO WA_STR1.
          CLEAR: WA_L_RECORD.
          SPLIT WA_STR1-SLINE AT V_STR
          INTO WA_L_RECORD-LIFNR
               WA_L_RECORD-EVART
               WA_L_RECORD-EKORG
               WA_L_RECORD-EKGRP
               WA_L_RECORD-WERKS
               WA_L_RECORD-LGORT
               WA_L_RECORD-KDATB
               WA_L_RECORD-KDATE
               WA_L_RECORD-ZTERM
               WA_L_RECORD-KTWRT
               WA_L_RECORD-EPSTP
               WA_L_RECORD-EMATN
               WA_L_RECORD-KTMNG
               WA_L_RECORD-NETPR
               WA_L_RECORD-PEINH
               WA_L_RECORD-BPRME
               WA_L_RECORD-IDNLF
               WA_L_RECORD-WEBRE
               WA_L_RECORD-MEPRF
               WA_L_RECORD-LTEX1
               WA_L_RECORD-DATAB
               WA_L_RECORD-DATBI
               WA_L_RECORD-KSCHL
               WA_L_RECORD-KBETR
               WA_L_RECORD-KONWA
               WA_L_RECORD-KPEIN
               WA_L_RECORD-KMEIN
               WA_L_RECORD-KSTBM
               WA_L_RECORD-KBETR_01
               WA_L_RECORD-DEL_FLAG
               WA_L_RECORD-ERR_MSG.
          APPEND WA_L_RECORD TO I_L_RECORD.
          CLEAR: WA_L_RECORD,
                  WA_STR1.
        ENDLOOP.
        REFRESH I_STR1.
        CLOSE DATASET P_FILE1.
      ENDIF.
    ENDFORM.
    *&      Form  BDC_DYNPRO
    *       Data populated into i_bdcdata table for program
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR WA_BDCDATA.
      WA_BDCDATA-PROGRAM  = PROGRAM.
      WA_BDCDATA-DYNPRO   = DYNPRO.
      WA_BDCDATA-DYNBEGIN = C_TRUE.
      APPEND WA_BDCDATA TO I_BDCDATA.
    ENDFORM.
    *&      Form  BDC_FIELD
    *       Data populated into i_bdcdata table for fields
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR WA_BDCDATA.
      WA_BDCDATA-FNAM = FNAM.
      WA_BDCDATA-FVAL = FVAL.
      APPEND WA_BDCDATA TO I_BDCDATA.
    ENDFORM.
    *&      Form  convert_date
    *       Converting the data from the file format to mm/dd/yyyy format
    *      <--P_wa_record_kdatb  Source Date
    *      <--p_l_conv_date      Target Date
    FORM CONVERT_DATE USING L_DATE
                            L_TAR_DATE.
      CONCATENATE L_DATE+0(2)
                  L_DATE+3(2)
                  L_DATE+6(4)
                  INTO L_TAR_DATE.
    ENDFORM.                    " convert_date
    *&      Form  validate_flatfile_data
    *       Validating the input file
    FORM VALIDATE_FLATFILE_DATA.
      DATA: L_TODAY LIKE SY-DATUM,
            L_STARTDATE_C LIKE SY-DATUM,
            L_ENDDATE_C LIKE SY-DATUM,
            L_ENDDATE_C1 LIKE SY-DATUM,
            L_STARTDATE_C1 LIKE SY-DATUM,
            L_STARTDATE(8),
            L_ENDDATE(8).
    * Fetch indicator for all records on the material, plant & storage
    * location combination.
      IF NOT I_RECORD[] IS INITIAL.
        REFRESH I_LOEKZ.
        SELECT EMATN            " Material Number
               WERKS            " Plant
               LGORT            " Storage Location
               BSTYP            " Purchasing Document Category
               LOEKZ            " Deletion indicator
          INTO TABLE I_LOEKZ
          FROM EKPO
          FOR ALL ENTRIES IN I_RECORD
          WHERE EMATN = I_RECORD-EMATN
            AND WERKS = I_RECORD-WERKS
            AND LGORT = I_RECORD-LGORT
            AND BSTYP = C_BSTYP
            AND LOEKZ = C_LOEKZ_MARKED.
        IF SY-SUBRC EQ 0.
          SORT I_LOEKZ BY EMATN WERKS LGORT BSTYP LOEKZ.
        ENDIF.
    * Fetching Plants for all entries in the selection screen
        REFRESH I_T001W.
        SELECT WERKS  "Plant
            INTO TABLE I_T001W
            FROM T001W
            WHERE WERKS IN S_WERKS.
        IF SY-SUBRC EQ 0.
          SORT I_T001W BY WERKS.
        ENDIF.
    * Fetching materials for the plants listed in flat file
        REFRESH I_MATNR.
        SELECT MATNR          " Material Number
          INTO TABLE I_MATNR
          FROM MARC
          FOR ALL ENTRIES IN I_RECORD
          WHERE WERKS = I_RECORD-WERKS.
        IF SY-SUBRC EQ 0.
          SORT I_MATNR BY MATNR.
        ENDIF.
    * Fetching Company Codes for repective Purchase Organizations
        REFRESH I_T024E.
        SELECT EKORG       "  Purchase Organization
               BUKRS       "  Company Code
            INTO TABLE I_T024E
            FROM T024E
            WHERE EKORG IN S_EKORG.
        IF SY-SUBRC EQ 0.
          SORT I_T024E BY EKORG.
        ENDIF.
    * Fetching SAP Data using Legacy Data.
        REFRESH I_ZMVXREF.
        SELECT D_ALTKN
               D_BUKRS
               M_ALTKN
            INTO TABLE I_ZMVXREF
            FROM ZMVXREF
            FOR ALL ENTRIES IN I_RECORD
            WHERE D_ALTKN = I_RECORD-LIFNR.
        IF SY-SUBRC EQ 0.
          SORT I_ZMVXREF BY D_ALTKN D_BUKRS.
        ENDIF.
    * Fetching Vendors from LFA1
        IF NOT I_ZMVXREF[] IS INITIAL.
          REFRESH I_LFA1.
          SELECT LIFNR
             INTO TABLE I_LFA1
             FROM LFA1
             FOR ALL ENTRIES IN I_ZMVXREF
             WHERE LIFNR = I_ZMVXREF-M_ALTKN.
          IF SY-SUBRC EQ 0.
            SORT I_LFA1 BY LIFNR.
          ENDIF.
        ENDIF.
    * Start Validating the flat file
        CLEAR: WA_RECORD,
               WA_T024E,
               WA_ZMVXREF,
               WA_LFA1,
               WA_LOEKZ,
               WA_MATNR.
        LOOP AT I_RECORD INTO WA_RECORD.
          L_TODAY = SY-DATUM.
          L_STARTDATE = WA_RECORD-KDATB.
          L_ENDDATE = WA_RECORD-KDATE.
          IF WA_RECORD-DEL_FLAG IS INITIAL.
            READ TABLE I_T001W INTO WA_T001W
                               WITH KEY WERKS = WA_RECORD-WERKS
                               BINARY SEARCH.
            IF SY-SUBRC EQ 0.
    *   Cross-Reference check performed for the given Vendors
              READ TABLE I_T024E INTO WA_T024E
                                 WITH KEY EKORG = WA_RECORD-EKORG
                                 BINARY SEARCH.
              IF SY-SUBRC NE 0.
                V_CROSS_REFERENCE_ERROR = C_VEN_ERR3.
              ELSE.
                READ TABLE I_ZMVXREF INTO WA_ZMVXREF
                            WITH KEY D_ALTKN = WA_RECORD-LIFNR
                                     D_BUKRS = P_BUKRS
                            BINARY SEARCH.
                IF SY-SUBRC EQ 0.
                  READ TABLE I_LFA1 INTO WA_LFA1
                             WITH KEY LIFNR = WA_ZMVXREF-M_ALTKN
                             BINARY SEARCH.
                  IF SY-SUBRC EQ 0.
                    V_CROSS_REFERENCE_ERROR = C_VEN_SUCS.
                  ELSE.
                    V_CROSS_REFERENCE_ERROR = C_VEN_ERR2.
                  ENDIF.
                ELSE.
                  V_CROSS_REFERENCE_ERROR = C_VEN_ERR1.
                ENDIF.
              ENDIF.
    * Legacy Vendor could not be mapped
              IF V_CROSS_REFERENCE_ERROR EQ C_VEN_ERR1.
            V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES. "Inp.file err. occurd
                WA_RECORD-DEL_FLAG = C_TRUE.
                WA_RECORD-ERR_MSG = TEXT-007.
                MODIFY I_RECORD FROM WA_RECORD
                                TRANSPORTING DEL_FLAG
                                             ERR_MSG
                                WHERE LIFNR = WA_RECORD-LIFNR.
    * Legacy Vendor is mapped but the obtained SAP vendor doesn't exist.
              ELSEIF V_CROSS_REFERENCE_ERROR EQ C_VEN_ERR2.
    *           Inp.file err. occurd
                V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
                WA_RECORD-DEL_FLAG = C_TRUE.
                WA_RECORD-ERR_MSG = TEXT-008.
                MODIFY I_RECORD FROM WA_RECORD
                                TRANSPORTING DEL_FLAG
                                             ERR_MSG
                                WHERE LIFNR = WA_RECORD-LIFNR.
    * Purchase Organization doesn't exist in T024E.
              ELSEIF V_CROSS_REFERENCE_ERROR EQ C_VEN_ERR3.
    *             Inp.file err. occurd
                V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
                WA_RECORD-DEL_FLAG = C_TRUE.
                WA_RECORD-ERR_MSG = TEXT-014.
                MODIFY I_RECORD FROM WA_RECORD
                                TRANSPORTING DEL_FLAG
                                             ERR_MSG
                                WHERE EKORG = WA_RECORD-EKORG.
    * Vendor is mapped and validated successfully
              ELSEIF V_CROSS_REFERENCE_ERROR EQ C_VEN_SUCS.
    * Checking for the deletion indicator for that record
                CONCATENATE WA_RECORD-KDATB+6(4)
                            WA_RECORD-KDATB+3(2)
                            WA_RECORD-KDATB+0(2)
                            INTO
                            L_STARTDATE.
                MOVE L_STARTDATE TO L_STARTDATE_C.
                CONCATENATE WA_RECORD-KDATB+6(4)
                            WA_RECORD-KDATB+0(2)
                            WA_RECORD-KDATB+3(2)
                            INTO
                            L_STARTDATE_C1.
                CONCATENATE WA_RECORD-KDATE+6(4)
                            WA_RECORD-KDATE+3(2)
                            WA_RECORD-KDATE+0(2)
                            INTO
                            L_ENDDATE.
                MOVE L_ENDDATE TO L_ENDDATE_C.
                CONCATENATE WA_RECORD-KDATE+6(4)
                            WA_RECORD-KDATE+0(2)
                            WA_RECORD-KDATE+3(2)
                            INTO
                            L_ENDDATE_C1.
                READ TABLE I_LOEKZ INTO WA_LOEKZ WITH KEY
                                                 EMATN = WA_RECORD-EMATN
                                                 WERKS = WA_RECORD-WERKS
                                                 LGORT = WA_RECORD-LGORT
                                                 BINARY SEARCH.
                IF SY-SUBRC EQ 0.
    *             Inpfle err.occured
                  V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
                  WA_RECORD-ERR_MSG = TEXT-003.
                  WA_RECORD-DEL_FLAG = C_TRUE.    "marking the record
                  MODIFY I_RECORD FROM WA_RECORD
                                  TRANSPORTING DEL_FLAG
                                                ERR_MSG
                                  WHERE LIFNR = WA_RECORD-LIFNR
                                    AND EVART = WA_RECORD-EVART
                                    AND EKORG = WA_RECORD-EKORG
                                    AND EKGRP = WA_RECORD-EKGRP
                                    AND WERKS = WA_RECORD-WERKS
                                    AND LGORT = WA_RECORD-LGORT
                                    AND KDATB = WA_RECORD-KDATB
                                    AND KDATE = WA_RECORD-KDATE
                                    AND ZTERM = WA_RECORD-ZTERM
                                    AND KTWRT = WA_RECORD-KTWRT
                                    AND EPSTP = WA_RECORD-EPSTP
                                    AND EMATN = WA_RECORD-EMATN.
    * Validating the Purchasing Organization for Blank/Null
                ELSEIF WA_RECORD-EKORG IS INITIAL.
    *             Inpfle err.occured
                  V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
                  WA_RECORD-ERR_MSG = TEXT-010.
                  WA_RECORD-DEL_FLAG = C_TRUE.
                  MODIFY I_RECORD FROM WA_RECORD
                                  TRANSPORTING DEL_FLAG
                                               ERR_MSG
                                  WHERE LIFNR = WA_RECORD-LIFNR
                                    AND EVART = WA_RECORD-EVART
                                    AND EKORG = WA_RECORD-EKORG
                                    AND EKGRP = WA_RECORD-EKGRP
                                    AND WERKS = WA_RECORD-WERKS
                                    AND LGORT = WA_RECORD-LGORT
                                    AND KDATB = WA_RECORD-KDATB
                                    AND KDATE = WA_RECORD-KDATE
                                    AND ZTERM = WA_RECORD-ZTERM
                                    AND KTWRT = WA_RECORD-KTWRT
                                    AND EPSTP = WA_RECORD-EPSTP
                                    AND EMATN = WA_RECORD-EMATN.
    * Validating the Plant for Blank/Null
                ELSEIF WA_RECORD-WERKS IS INITIAL.
    *             Inpfle err.occured
                  V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
                  WA_RECORD-ERR_MSG = TEXT-039.
                  WA_RECORD-DEL_FLAG = C_TRUE.
                  MODIFY I_RECORD FROM WA_RECORD
                                  TRANSPORTING DEL_FLAG
                                               ERR_MSG
                                  WHERE LIFNR = WA_RECORD-LIFNR
                                    AND EVART = WA_RECORD-EVART
                                    AND EKORG = WA_RECORD-EKORG
                                    AND EKGRP = WA_RECORD-EKGRP
                                    AND WERKS = WA_RECORD-WERKS
                                    AND LGORT = WA_RECORD-LGORT
                                    AND KDATB = WA_RECORD-KDATB
                                    AND KDATE = WA_RECORD-KDATE
                                    AND ZTERM = WA_RECORD-ZTERM
                                    AND KTWRT = WA_RECORD-KTWRT
                                    AND EPSTP = WA_RECORD-EPSTP
                                    AND EMATN = WA_RECORD-EMATN.
    * Validating the Contract Validity Start Date
                ELSEIF L_STARTDATE_C1 GT L_TODAY.             "#EC PORTABLE
    *             Inpfle err.occured
                  V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
                  WA_RECORD-ERR_MSG = TEXT-004.
                  WA_RECORD-DEL_FLAG = C_TRUE.      "marking the record
                  MODIFY I_RECORD FROM WA_RECORD
                                  TRANSPORTING DEL_FLAG
                                               ERR_MSG
                                  WHERE LIFNR = WA_RECORD-LIFNR
                                    AND EVART = WA_RECORD-EVART
                                    AND EKORG = WA_RECORD-EKORG
                                    AND EKGRP = WA_RECORD-EKGRP
                                    AND WERKS = WA_RECORD-WERKS
                                    AND LGORT = WA_RECORD-LGORT
                                    AND KDATB = WA_RECORD-KDATB.
    * Validating the Contract Validity End Date
                ELSEIF L_ENDDATE_C1 LE L_TODAY.               "#EC PORTABLE
    *             Inpfle err.ocrd
                  V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
                  WA_RECORD-ERR_MSG = TEXT-005.
                  WA_RECORD-DEL_FLAG = C_TRUE.    "marking the record
                  MODIFY I_RECORD FROM WA_RECORD
                                  TRANSPORTING DEL_FLAG
                                               ERR_MSG
                                  WHERE LIFNR = WA_RECORD-LIFNR
                                    AND EVART = WA_RECORD-EVART
                                    AND EKORG = WA_RECORD-EKORG
                                    AND EKGRP = WA_RECORD-EKGRP
                                    AND WERKS = WA_RECORD-WERKS
                                    AND LGORT = WA_RECORD-LGORT
                                    AND KDATB = WA_RECORD-KDATB
                                    AND KDATE = WA_RECORD-KDATE.
    * Checking for Material under the Plant for Agreement Type 'WK'
                ELSEIF WA_RECORD-EVART = C_WK.
                  READ TABLE I_MATNR INTO WA_MATNR
                                     WITH KEY MATNR = WA_RECORD-EMATN
                                     BINARY SEARCH.
                  IF SY-SUBRC NE 0.
                 V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES. "Inpfle err.ocrd
                    WA_RECORD-ERR_MSG = TEXT-006.
                    WA_RECORD-DEL_FLAG = C_TRUE.   "marking the record
                    MODIFY I_RECORD FROM WA_RECORD
                                    TRANSPORTING DEL_FLAG
                                                 ERR_MSG
                                    WHERE LIFNR = WA_RECORD-LIFNR
                                      AND EVART = WA_RECORD-EVART
                                      AND EKORG = WA_RECORD-EKORG
                                      AND EKGRP = WA_RECORD-EKGRP
                                      AND WERKS = WA_RECORD-WERKS
                                      AND LGORT = WA_RECORD-LGORT
                                      AND KDATB = WA_RECORD-KDATB
                                      AND KDATE = WA_RECORD-KDATE
                                      AND ZTERM = WA_RECORD-ZTERM
                                      AND KTWRT = WA_RECORD-KTWRT
                                      AND EPSTP = WA_RECORD-EPSTP
                                      AND EMATN = WA_RECORD-EMATN.
                  ENDIF.
                ENDIF.  " checking of deletion indicator
              ENDIF.   " checking for success of vendor cross reference
            ELSE.
              V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES. "Inpfle err.ocrd
              WA_RECORD-ERR_MSG = TEXT-041.
              WA_RECORD-DEL_FLAG = C_TRUE.   "marking the record
              MODIFY I_RECORD FROM WA_RECORD
                              TRANSPORTING DEL_FLAG
                                           ERR_MSG
                              WHERE WERKS = WA_RECORD-WERKS.
            ENDIF. " Plant checked to selection screen
          ENDIF.  " the records for which del_flag is initial
          CLEAR: WA_RECORD,
                 WA_T024E,
                 WA_ZMVXREF,
                 WA_LFA1,
                 WA_LOEKZ,
                 WA_MATNR,
                 L_TODAY,
                 L_STARTDATE_C,
                 L_ENDDATE_C,
                 L_STARTDATE,
                 L_ENDDATE.
        ENDLOOP.
        LOOP AT I_RECORD INTO WA_RECORD.
          IF WA_RECORD-DEL_FLAG = C_TRUE.
            APPEND WA_RECORD TO I_ERR_REC.
            CLEAR WA_RECORD.
          ENDIF.
        ENDLOOP.
      ELSE.
        MESSAGE E000 WITH TEXT-013.  " no records in the flat file
        STOP.
      ENDIF.
    ENDFORM.                    " validate_flatfile_data
    *&      Form  DOWNLOAD_ERROR_FILE
    *       Downloads all records along with the records encountering the
    *       input file validation error
    FORM DOWNLOAD_ERROR_FILE.
      DATA L_ISDIR TYPE C.
      IF V_INPUTERROR_FLAG = C_INPUTERROR_FLAG_YES.
        V_FILENAME = P_IPERR.
    * Check for the existence of the file.
        IF RB_LOCAL EQ C_TRUE.
          CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
               EXPORTING
                    FNAME          = P_IPERR
               IMPORTING
                    ISDIR          = L_ISDIR
               EXCEPTIONS
                    FILEINFO_ERROR = 1
                    OTHERS         = 2.
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
          IF L_ISDIR EQ C_TRUE.
            MESSAGE I000 WITH TEXT-088.
            STOP.
          ENDIF.
        ENDIF.
        IF RB_LOCAL EQ C_TRUE.
    * Download the Input Error File.
          CALL FUNCTION 'GUI_DOWNLOAD'
               EXPORTING
                    FILENAME                = V_FILENAME
                    FILETYPE                = 'ASC'
                    WRITE_FIELD_SEPARATOR   = '#'
               TABLES
                    DATA_TAB                = I_ERR_REC
               EXCEPTIONS
                    FILE_WRITE_ERROR        = 1
                    NO_BATCH                = 2
                    GUI_REFUSE_FILETRANSFER = 3
                    INVALID_TYPE            = 4
                    NO_AUTHORITY            = 5
                    UNKNOWN_ERROR           = 6
                    HEADER_NOT_ALLOWED      = 7
                    SEPARATOR_NOT_ALLOWED   = 8
                    FILESIZE_NOT_ALLOWED    = 9
                    HEADER_TOO_LONG         = 10
                    DP_ERROR_CREATE         = 11
                    DP_ERROR_SEND           = 12
                    DP_ERROR_WRITE          = 13
                    UNKNOWN_DP_ERROR        = 14
                    ACCESS_DENIED           = 15
                    DP_OUT_OF_MEMORY        = 16
                    DISK_FULL               = 17
                    DP_TIMEOUT              = 18
                    FILE_NOT_FOUND          = 19
                    DATAPROVIDER_EXCEPTION  = 20
                    CONTROL_FLUSH_ERROR     = 21
                    OTHERS                  = 22.
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        ELSEIF RB_SERVE EQ C_TRUE.
          OPEN DATASET P_IPERR1 FOR OUTPUT IN TEXT MODE.
          CHECK SY-SUBRC EQ 0.
          CLEAR WA_ERR_REC.
          LOOP AT I_ERR_REC INTO WA_ERR_REC.
            IF WA_ERR_REC-DEL_FLAG = C_TRUE.
              TRANSFER WA_ERR_REC TO P_IPERR1.
            ENDIF.
            CLEAR WA_ERR_REC.
          ENDLOOP.
          CLOSE DATASET P_IPERR1.
        ENDIF.
      ENDIF.
    ENDFORM.                    " DOWNLOAD_ERROR_FILE
    *&      Form  BUILD_BDC_DATA
    * Populates BDC for all the fields neccessary for Open Contract Creation
    FORM BUILD_BDC_DATA.
      DATA: L_MAT_INDEX TYPE I,
            L_CON_INDEX TYPE I,
            L_SCA_INDEX TYPE I.
      CLEAR   WA_BDCDATA.
      REFRESH: I_BDCDATA,
               I_MESSTAB.
    * Processing the bdc
      CLEAR: WA_RECORD,
             WA_RECORDPREV,
             VEN_FLAG,
             MAT_FLAG.
      LOOP AT I_RECORD INTO WA_RECORD.
    *    Checks for the del_flag of the record.
        IF     WA_RECORD-DEL_FLAG EQ C_TRUE
            OR WA_RECORD-DEL_FLAG EQ C_STRUE.
          CLEAR WA_RECORD.
          CONTINUE.
        ELSE.
          IF  WA_RECORDPREV-LIFNR NE WA_RECORD-LIFNR
           OR WA_RECORDPREV-EVART NE WA_RECORD-EVART
           OR WA_RECORDPREV-EKORG NE WA_RECORD-EKORG
           OR WA_RECORDPREV-EKGRP NE WA_RECORD-EKGRP
           OR WA_RECORDPREV-WERKS NE WA_RECORD-WERKS
           OR WA_RECORDPREV-LGORT NE WA_RECORD-LGORT
           OR WA_RECORDPREV-KDATB NE WA_RECORD-KDATB
           OR WA_RECORDPREV-KDATE NE WA_RECORD-KDATE
           OR WA_RECORDPREV-ZTERM NE WA_RECORD-ZTERM
           OR WA_RECORDPREV-KTWRT NE WA_RECORD-KTWRT.
            PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0200'.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                          'RM06E-LGORT'.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '/00'.
    *   Cross-Reference check performed for the given Vendors
            CLEAR WA_T024E.
            READ TABLE I_T024E INTO WA_T024E
                               WITH KEY EKORG = WA_RECORD-EKORG
                               BINARY SEARCH.
            IF SY-SUBRC EQ 0.
              CLEAR WA_ZMVXREF.
              READ TABLE I_ZMVXREF INTO WA_ZMVXREF
                          WITH KEY D_ALTKN = WA_RECORD-LIFNR
                                   D_BUKRS = P_BUKRS
                          BINARY SEARCH.
              IF SY-SUBRC EQ 0.
                PERFORM BDC_FIELD   USING 'EKKO-LIFNR'
                                           WA_ZMVXREF-M_ALTKN.
              ENDIF.
              CLEAR WA_ZMVXREF.
            ENDIF.
            CLEAR WA_T024E.
            PERFORM BDC_FIELD       USING 'RM06E-EVART'
                                          WA_RECORD-EVART.
            PERFORM BDC_FIELD       USING 'EKKO-EKORG'
                                          WA_RECORD-EKORG.
            PERFORM BDC_FIELD       USING 'EKKO-EKGRP'
                                          WA_RECORD-EKGRP.
            PERFORM BDC_FIELD       USING 'RM06E-WERKS'
                                          WA_RECORD-WERKS.
            PERFORM BDC_FIELD       USING 'RM06E-LGORT'
                                          WA_RECORD-LGORT.
            PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0201'.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                          'EKKO-KTWRT'.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '=AB'.
            PERFORM CONVERT_DATE USING WA_RECORD-KDATB V_CONV_DATE.
            PERFORM BDC_FIELD       USING 'EKKO-KDATB'
                                          V_CONV_DATE.
            PERFORM CONVERT_DATE USING WA_RECORD-KDATE V_CONV_DATE.
            PERFORM BDC_FIELD       USING 'EKKO-KDATE'
                                          V_CONV_DATE.
            PERFORM BDC_FIELD       USING 'EKKO-ZTERM'
                                          WA_RECORD-ZTERM.
            PERFORM BDC_FIELD       USING 'EKKO-KTWRT'
                                            WA_RECORD-KTWRT.
            VEN_FLAG = 1.
            L_MAT_INDEX = 1. "index for table-control of material
          ENDIF.
    *          "first check for itemline
          IF  WA_RECORDPREV-EPSTP NE WA_RECORD-EPSTP
           OR WA_RECORDPREV-EMATN NE WA_RECORD-EMATN
           OR WA_RECORDPREV-KTMNG NE WA_RECORD-KTMNG
           OR WA_RECORDPREV-NETPR NE WA_RECORD-NETPR
           OR WA_RECORDPREV-PEINH NE WA_RECORD-PEINH
           OR WA_RECORDPREV-BPRME NE WA_RECORD-BPRME
           OR WA_RECORDPREV-IDNLF NE WA_RECORD-IDNLF
           OR WA_RECORDPREV-WEBRE NE WA_RECORD-WEBRE
           OR WA_RECORDPREV-MEPRF NE WA_RECORD-MEPRF
           OR WA_RECORDPREV-LTEX1 NE WA_RECORD-LTEX1
           OR VEN_FLAG EQ 1.
            V_IND = L_MAT_INDEX.
            IF V_IND GT 1.
              V_IND = 2.
            ENDIF.
            CONCATENATE 'RM06E-EVRTP(' V_IND ')' INTO V_EVRTP1.
            CONCATENATE 'RM06E-EPSTP(' V_IND ')' INTO V_EPSTP1.
            CONCATENATE 'EKPO-EMATN(' V_IND ')' INTO V_EMATN1.
            CONCATENATE 'EKPO-KTMNG(' V_IND ')' INTO V_KTMNG1.
            CONCATENATE 'EKPO-NETPR(' V_IND ')' INTO V_NETPR1.
            CONCATENATE 'EKPO-PEINH(' V_IND ')' INTO V_PEINH1.
            CONCATENATE 'EKPO-BPRME(' V_IND ')' INTO V_BPRME1.
            CONCATENATE 'RM06E-TCSELFLAG(' V_IND ')' INTO V_TCSELFLAG1.
            PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0220'.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '=NP'.
            PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0220'.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                          V_EVRTP1.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '=DETA'.
            PERFORM BDC_FIELD       USING V_EPSTP1
                                          WA_RECORD-EPSTP.
            PERFORM BDC_FIELD       USING V_EMATN1
                                          WA_RECORD-EMATN.
            PERFORM BDC_FIELD       USING V_KTMNG1
                                          WA_RECORD-KTMNG.
            PERFORM BDC_FIELD       USING V_NETPR1
                                          WA_RECORD-NETPR.
            PERFORM BDC_FIELD       USING V_PEINH1
                                          WA_RECORD-PEINH.
            PERFORM BDC_FIELD       USING V_BPRME1
                                          WA_RECORD-BPRME.
            PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0211'.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                          'EKPO-WEBRE'.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '=DETZ'.
            PERFORM BDC_FIELD       USING 'EKPO-IDNLF'
                                          WA_RECORD-IDNLF.
            TRANSLATE WA_RECORD-EVART TO UPPER CASE.
            IF WA_RECORD-EVART EQ C_WK.
              PERFORM BDC_FIELD       USING 'EKPO-WEBRE' 'X'.
            ENDIF.
            PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0212'.
            PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                          'EKPO-MEPRF'.
            PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                          '=TXP'.
            PERFORM BDC_FIELD       USING 'EKPO-MEPRF'
                                          WA_RECORD-MEPRF.
            IF NOT WA_RECORD-LTEX1 IS INITIAL. "NE space.
              PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0106'.
              PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                            'RM06E-SELKZ(02)'.
              PERFORM BDC_FIELD 

  • Regarding HR-abap Attendence Sheet for Employee

    Hello Friends,
    i am working on attendence sheet for employee please help me possible send me sample coding ASAP.
    Thanks
    REDDY.

    Check out this report we have created for the Attendence. Reward points if it is useful.
    REPORT  ZHR_ATTENDANCE_RPT MESSAGE-ID ZHR.
                     T Y P E    P O O L S                                *
    TYPE-POOLS : SLIS.
                          T A B L E                                     *
    TABLES : TEVEN,
             PA0000,
             PA0001,
             T503K,
             T500P.
              I N T E R N A L   T A B L E   D E C L A R A T I O N        *
    DATA : BEGIN OF IT_PA0001 OCCURS 0,
           PERNR TYPE PA0001-PERNR,
           ENDDA TYPE PA0001-ENDDA,
           WERKS TYPE PA0001-WERKS,
           BTRTL TYPE PA0001-BTRTL,
           ORGEH TYPE PA0001-ORGEH,
           PERSK TYPE T503T-PERSK,
           ENAME TYPE PA0001-ENAME,
           END OF IT_PA0001.
    DATA : BEGIN OF IT_PA0000 OCCURS 0,
           PERNR TYPE PA0000-PERNR,
           END OF IT_PA0000.
    DATA : BEGIN OF IT_TEVEN OCCURS 0,
           PERNR TYPE TEVEN-PERNR,
           LDATE TYPE TEVEN-LDATE,
           LTIME TYPE TEVEN-LTIME,
           SATZA TYPE TEVEN-SATZA,
           END OF IT_TEVEN.
    DATA : IT_TEVEN1 LIKE IT_TEVEN OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF IT_T527X OCCURS 0,
           ORGEH LIKE T527X-ORGEH,
           ORGTX LIKE T527X-ORGTX,
           END OF IT_T527X.
    DATA : BEGIN OF IT_T503T OCCURS 0,
           PERSK TYPE T503T-PERSK,
           PTEXT TYPE T503T-PTEXT,
           END OF IT_T503T.
    DATA : BEGIN OF IT_FINAL OCCURS 0,
           PERNR LIKE PA0001-PERNR,
           ENAME LIKE PA0001-ENAME,
           LDATE LIKE TEVEN-LDATE,
           TPROG LIKE PTPSP-TPROG,
           LTIMEI LIKE TEVEN-LTIME,
           LTIMEO LIKE TEVEN-LTIME,
           ORGTX LIKE T527X-ORGTX,
           PTEXT TYPE T503T-PTEXT,
           ATEXT TYPE ABWTXT,
           END OF IT_FINAL.
    DATA : IT_PTPSP LIKE PTPSP OCCURS 0 WITH HEADER LINE.
    *Table to get Holiday
    DATA : IT_ISCAL_DAY LIKE ISCAL_DAY OCCURS 0 WITH HEADER LINE.
    DATA : IT_T554T TYPE T554T OCCURS 0 WITH HEADER LINE.
    *ALV data declarations
    DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,
          X_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,
          GD_LAYOUT    TYPE SLIS_LAYOUT_ALV,
          GD_REPID     LIKE SY-REPID.
    *For ALV Events
    DATA : IT_EVENT1 TYPE SLIS_T_EVENT.
    *For ALV Events
    DATA : IT_EVENT TYPE SLIS_ALV_EVENT.
    *For ALV top of page
    DATA : IT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
    *For top of page heading
    DATA : IT_LINE TYPE SLIS_LISTHEADER.
    Variables declaration                                         *
    DATA : V_SHIFT LIKE PTPSP-TPROG,
           V_TEMP TYPE I,
           V_DATE TYPE DATUM,
           V_LDATE TYPE SY-DATUM,
           V_MODIF TYPE HIDENT,
           V_SUBTY TYPE PA2002-SUBTY,
           V_ENDDA TYPE CHAR10.
    SELECTION SCREEN                                              *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_PERNR FOR TEVEN-PERNR,
                     S_DATE  FOR TEVEN-LDATE,
                     S_ORGEH FOR PA0001-ORGEH,
                     S_WERKS FOR PA0001-WERKS,
                     S_BTRTL FOR PA0001-BTRTL,
                     S_PERSK FOR PA0001-PERSK,
                     S_STAT2 FOR PA0000-STAT2.
    SELECTION-SCREEN END OF BLOCK B1.
               A T   S E L E C T I O N   S C R E E N                     *
    *validatating Selection Screen
    AT SELECTION-SCREEN ON S_PERNR.
    *Validate the User entered year
      PERFORM VALIDATE_PERNR.
    AT SELECTION-SCREEN ON S_DATE.
    *Validate the User entered date
      PERFORM VALIDATE_DATE_LOW.
    AT SELECTION-SCREEN ON S_ORGEH.
    *Validate the User entered year
      PERFORM VALIDATE_ORGEH.
    AT SELECTION-SCREEN ON S_PERSK.
    *Validate the User entered year
      PERFORM VALIDATE_PERSK.
    AT SELECTION-SCREEN ON S_WERKS.
    *Validate the User entered Personnel area
      PERFORM VALIDATE_WERKS.
    START OF SELECTION                                             *
    START-OF-SELECTION.
    *Get data
      PERFORM GET_DATA.
    *Process data
      PERFORM PROCESS_DATA.
                  E N D    O F     S E L E C T I O N                    *
    END-OF-SELECTION.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM BUILD_LAYOUT.
    *For ALV Events
      PERFORM ALV_EVENTS.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  VALIDATE_YEAR
          Validating the year
    FORM VALIDATE_PERNR .
      IF NOT S_PERNR IS INITIAL.
        SELECT SINGLE * FROM PA0001 WHERE PERNR IN S_PERNR.     "#EC *
        IF SY-SUBRC <> 0.
          MESSAGE E000 WITH 'Enter valid Employee Number'(002).
        ENDIF.
      ENDIF.
    ENDFORM.                    " VALIDATE_pernr
    *&      Form  VALIDATE_YEAR
          Validating the year
    FORM VALIDATE_ORGEH .
      DATA: V_ORGEH LIKE T527X-ORGEH.
      IF NOT S_ORGEH IS INITIAL.
        SELECT SINGLE ORGEH FROM T527X INTO V_ORGEH WHERE ORGEH IN S_ORGEH.
        IF SY-SUBRC <> 0.
          MESSAGE E000 WITH 'Enter Valid Organization Unit'(003).
        ENDIF.
      ENDIF.
    ENDFORM.                    " VALIDATE_orgeh
    *&      Form  GET_DATA
          Get data
    FORM GET_DATA.
      SELECT PERNR
             FROM PA0000
             INTO TABLE IT_PA0000
             WHERE PERNR IN S_PERNR
             AND   ENDDA GE S_DATE-LOW
             AND   BEGDA LE S_DATE-HIGH
             AND   STAT2 IN S_STAT2.
      IF SY-SUBRC = 0.
        DELETE ADJACENT DUPLICATES FROM IT_PA0000 COMPARING PERNR.
        SORT IT_PA0000.
      ENDIF.
      IF NOT IT_PA0000[] IS INITIAL.
        SELECT PERNR
               ENDDA
               WERKS
               BTRTL
               ORGEH
               PERSK
               ENAME
               FROM PA0001
               INTO TABLE IT_PA0001
               FOR ALL ENTRIES IN IT_PA0000
               WHERE PERNR = IT_PA0000-PERNR
               AND   ENDDA GE S_DATE-LOW
               AND   BEGDA LE S_DATE-HIGH
               AND   ORGEH IN S_ORGEH
               AND   WERKS IN S_WERKS
               AND   PERSK IN S_PERSK
               AND   BTRTL IN S_BTRTL.
        IF SY-SUBRC = 0.
          SORT IT_PA0001 BY PERNR ENDDA DESCENDING.
          DELETE ADJACENT DUPLICATES FROM IT_PA0001 COMPARING PERNR.
          SORT IT_PA0001 BY PERNR.
        ENDIF.
      ENDIF.
      IF NOT IT_PA0001[] IS INITIAL.
        SELECT PERNR
               LDATE
               LTIME
               SATZA
               FROM TEVEN
               INTO TABLE IT_TEVEN
               FOR ALL ENTRIES IN IT_PA0001
               WHERE PERNR = IT_PA0001-PERNR
               AND   SATZA = 'P10'
               AND   LDATE IN S_DATE
               AND   STOKZ NE 'X'.
        IF SY-SUBRC = 0.
          SORT IT_TEVEN BY PERNR LDATE.
        ENDIF.
      ENDIF.
      IF NOT IT_PA0001[] IS INITIAL.
        SELECT PERNR
               LDATE
               LTIME
               SATZA
               FROM TEVEN
               INTO TABLE IT_TEVEN1
               FOR ALL ENTRIES IN IT_PA0001
               WHERE PERNR = IT_PA0001-PERNR
               AND   SATZA = 'P20'
               AND   LDATE IN S_DATE
               AND   STOKZ NE 'X'.
        IF SY-SUBRC = 0.
          SORT IT_TEVEN1 BY PERNR LDATE.
        ENDIF.
      ENDIF.
      IF NOT IT_PA0001[] IS INITIAL.
        SELECT ORGEH
               ORGTX
               FROM T527X
               INTO TABLE IT_T527X
               FOR ALL ENTRIES IN IT_PA0001
               WHERE ORGEH = IT_PA0001-ORGEH.
        IF SY-SUBRC = 0.
          SORT IT_T527X BY ORGEH.
        ENDIF.
      ENDIF.
      IF NOT IT_PA0001[] IS INITIAL.
        SELECT PERSK
               PTEXT
               FROM T503T
               INTO TABLE IT_T503T
               FOR ALL ENTRIES IN IT_PA0001
               WHERE PERSK = IT_PA0001-PERSK
               AND   SPRSL = 'E'.
        IF SY-SUBRC = 0.
          SORT IT_T503T BY PERSK.
        ENDIF.
      ENDIF.
      SELECT *
             FROM T554T
             INTO TABLE IT_T554T
             WHERE SPRSL = 'EN'
             AND   MOABW = '40'.
    ENDFORM.                    " GET_DATA
    *&      Form  PROCESS_DATA
          Process data
    FORM PROCESS_DATA .
      V_TEMP = S_DATE-HIGH - S_DATE-LOW.
      V_TEMP = V_TEMP + 1.
      LOOP AT IT_PA0001.
        V_DATE = S_DATE-LOW.
        DO V_TEMP TIMES.
    *Get employee work schedule
          IF IT_PTPSP[] IS INITIAL.
            PERFORM GET_SCHEDULE.
          ENDIF.
    *Get holiday calendar
          IF IT_ISCAL_DAY[] IS INITIAL.
            PERFORM GET_HOLIDAY.
          ENDIF.
          CLEAR : V_SUBTY.
          SELECT SINGLE SUBTY
                        FROM PA2001
                        INTO V_SUBTY
                        WHERE PERNR = IT_PA0001-PERNR
                        AND   ENDDA GE V_DATE
                        AND   BEGDA LE V_DATE.
          IF SY-SUBRC = 0.
            READ TABLE IT_T554T WITH KEY AWART = V_SUBTY.
            IT_FINAL-ATEXT = IT_T554T-ATEXT.
          ENDIF.
          IF V_SUBTY IS INITIAL.
            SELECT SINGLE SUBTY
                          FROM PA2002
                          INTO V_SUBTY
                          WHERE PERNR = IT_PA0001-PERNR
                          AND   ENDDA GE V_DATE
                          AND   BEGDA LE V_DATE.
            IF SY-SUBRC = 0.
              IF V_SUBTY = '1000' OR V_SUBTY = '2000'.
                IT_FINAL-ATEXT = 'Training'.
              ELSEIF V_SUBTY = '3000'.
                IT_FINAL-ATEXT = 'Tour'.
              ENDIF.
            ENDIF.
          ENDIF.
    *Get the employee shift schedule for that date
          CLEAR : V_SHIFT.
          READ TABLE IT_PTPSP WITH KEY DATUM = V_DATE.
          IF SY-SUBRC = 0.
            V_SHIFT = IT_PTPSP-TPROG.
            IF IT_PTPSP-TAGTY = '1'.
              V_SHIFT = 'NOFF'.
            ENDIF.
          ENDIF.
          IF V_SHIFT = ''.
            CLEAR IT_FINAL.
            CONTINUE.
          ENDIF.
    *Check for holiday
          IT_FINAL-TPROG = V_SHIFT.
          READ TABLE IT_ISCAL_DAY WITH KEY DATE = V_DATE.
          IF SY-SUBRC = 0.
            IT_FINAL-TPROG = 'H'.
          ENDIF.
          IT_FINAL-PERNR = IT_PA0001-PERNR.
          IT_FINAL-ENAME = IT_PA0001-ENAME.
          IT_FINAL-LDATE = V_DATE.
    *To get the organization unit
          READ TABLE IT_T527X WITH KEY ORGEH = IT_PA0001-ORGEH
                                       BINARY SEARCH.
          IF SY-SUBRC = 0.
            IT_FINAL-ORGTX = IT_T527X-ORGTX.
          ENDIF.
          CLEAR IT_T503T.
          READ TABLE IT_T503T WITH KEY PERSK = IT_PA0001-PERSK
                                       BINARY SEARCH.
          IF SY-SUBRC = 0.
            IT_FINAL-PTEXT = IT_T503T-PTEXT.
          ENDIF.
    *To get Punch-in.
          READ TABLE IT_TEVEN WITH KEY PERNR = IT_PA0001-PERNR
                                       LDATE = V_DATE
                                       BINARY SEARCH.
          IF SY-SUBRC = 0.
            IT_FINAL-LTIMEI = IT_TEVEN-LTIME.
    *To get Punch-out
            READ TABLE IT_TEVEN1 WITH KEY PERNR = IT_TEVEN-PERNR
                                          LDATE = IT_TEVEN-LDATE
                                          BINARY SEARCH.
            IF SY-SUBRC = 0.
              IF IT_TEVEN1-LTIME > IT_FINAL-LTIMEI.
                IT_FINAL-LTIMEO = IT_TEVEN1-LTIME.
              ELSE.
                SELECT SINGLE LTIME
                              FROM TEVEN
                              INTO IT_FINAL-LTIMEO
                              WHERE PERNR = IT_TEVEN-PERNR
                              AND   LDATE = IT_TEVEN-LDATE
                              AND   LTIME > IT_TEVEN1-LTIME
                              AND   SATZA = 'P20'
                              AND   STOKZ NE 'X'.
              ENDIF.
            ENDIF.
            IF IT_FINAL-LTIMEO IS INITIAL.
              IF V_SHIFT = 'NNIG' OR V_SHIFT = 'NAFT'..
                V_LDATE = IT_TEVEN-LDATE + 1.
                READ TABLE IT_TEVEN1 WITH KEY PERNR = IT_TEVEN-PERNR
                                              LDATE =  V_LDATE
                                              BINARY SEARCH.
                IF SY-SUBRC = 0.
                  IT_FINAL-LTIMEO = IT_TEVEN1-LTIME.
                ENDIF.
              ENDIF.
            ENDIF.
            APPEND IT_FINAL.
          ELSE.
    *If holiday or OFF or Tour or Absent
            IF V_SHIFT = 'NOFF' OR IT_FINAL-TPROG = 'H' .
              APPEND IT_FINAL.
            ELSEIF IT_FINAL-ATEXT IS NOT INITIAL.
              APPEND IT_FINAL.
            ELSE.
              IT_FINAL-ATEXT = 'Absent'.
              APPEND IT_FINAL.
            ENDIF.
          ENDIF.
          CLEAR : IT_FINAL.
          V_DATE = V_DATE + 1.
        ENDDO.
        CLEAR : IT_PTPSP[],
                IT_ISCAL_DAY[].
      ENDLOOP.
      SORT IT_FINAL BY PERNR LDATE.
      LOOP AT IT_FINAL.
        TRANSLATE IT_FINAL-ATEXT TO UPPER CASE.
        MODIFY IT_FINAL INDEX SY-TABIX.
      ENDLOOP.
    ENDFORM.                    " PROCESS_DATA
    *&      Form  GET_SCHEDULE
          Get employee work schedule
    FORM GET_SCHEDULE.
      CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'
        EXPORTING
          PERNR         = IT_PA0001-PERNR
          BEGDA         = S_DATE-LOW
          ENDDA         = S_DATE-HIGH
        TABLES
          PERWS         = IT_PTPSP
        EXCEPTIONS
          ERROR_OCCURED = 1
          ABORT_OCCURED = 2
          OTHERS        = 3.
      IF SY-SUBRC <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " GET_SCHEDULE
    *&      Form  build_fieldcatalog
    FORM BUILD_FIELDCATALOG .
      X_FIELDCATALOG-COL_POS     = 1.
      X_FIELDCATALOG-FIELDNAME   = 'PERNR'.
      X_FIELDCATALOG-SELTEXT_L   = 'Personnel No'(006).
      X_FIELDCATALOG-DDICTXT = 'L'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
      X_FIELDCATALOG-COL_POS     = 2.
      X_FIELDCATALOG-FIELDNAME   = 'ENAME'.
      X_FIELDCATALOG-SELTEXT_L   = 'Employee Name'(007).
      X_FIELDCATALOG-DDICTXT = 'L'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
      X_FIELDCATALOG-COL_POS     = 5.
      X_FIELDCATALOG-FIELDNAME   = 'LDATE'.
      X_FIELDCATALOG-SELTEXT_L   = 'Date'(008).
      X_FIELDCATALOG-DDICTXT = 'L'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
      X_FIELDCATALOG-COL_POS     = 6.
      X_FIELDCATALOG-FIELDNAME   = 'TPROG'.
      X_FIELDCATALOG-SELTEXT_L   = 'Planned Shift'(009).
      X_FIELDCATALOG-DDICTXT = 'L'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
      X_FIELDCATALOG-COL_POS     = 7.
      X_FIELDCATALOG-FIELDNAME   = 'LTIMEI'.
      X_FIELDCATALOG-SELTEXT_L   = 'Attended Time-In'(010).
      X_FIELDCATALOG-DDICTXT = 'L'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
      X_FIELDCATALOG-COL_POS     = 8.
      X_FIELDCATALOG-FIELDNAME   = 'LTIMEO'.
      X_FIELDCATALOG-SELTEXT_L   = 'Attended Time-Out'(011).
      X_FIELDCATALOG-DDICTXT = 'L'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
      X_FIELDCATALOG-COL_POS     = 3.
      X_FIELDCATALOG-FIELDNAME   = 'ORGTX'.
      X_FIELDCATALOG-SELTEXT_L   = 'Organization Unit'(005).
      X_FIELDCATALOG-DDICTXT = 'L'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
      X_FIELDCATALOG-COL_POS     = 4.
      X_FIELDCATALOG-FIELDNAME   = 'PTEXT'.
      X_FIELDCATALOG-SELTEXT_L   = 'Emp Subgroup'(016).
      X_FIELDCATALOG-DDICTXT = 'L'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
      X_FIELDCATALOG-COL_POS     = 9.
      X_FIELDCATALOG-FIELDNAME   = 'ATEXT'.
      X_FIELDCATALOG-SELTEXT_L   = 'Leaves/Tours'(015).
      X_FIELDCATALOG-DDICTXT = 'L'.
      X_FIELDCATALOG-OUTPUTLEN = '25'.
      APPEND X_FIELDCATALOG TO FIELDCATALOG.
      CLEAR  X_FIELDCATALOG.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  build_layout
    FORM BUILD_LAYOUT.
      GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      GD_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " build_layout
    *&      Form  ALV_EVENTS
          For ALV Events
    FORM ALV_EVENTS .
      IT_EVENT-NAME = 'TOP_OF_PAGE'.
      IT_EVENT-FORM = 'TOP_OF_PAGE'.
      APPEND IT_EVENT TO IT_EVENT1.
    ENDFORM.                    " ALV_EVENTS
    *&      Form TOP_OF_PAGE
          ALV TOP-OF-PAGE
    FORM TOP_OF_PAGE.                                           "#EC CALLED
      REFRESH : IT_LIST_TOP_OF_PAGE.
      CLEAR : IT_LINE.
      IT_LINE-TYP  = 'H'.
      IT_LINE-INFO = 'Attendance Report for the Period'(013).
      APPEND IT_LINE TO IT_LIST_TOP_OF_PAGE.
      CONCATENATE S_DATE-LOW6(2) '.' S_DATE-LOW4(2) '.' S_DATE-LOW+0(4)
           INTO IT_LINE-INFO.
      CONCATENATE S_DATE-HIGH6(2) '.'  S_DATE-HIGH4(2) '.' S_DATE-HIGH+0(4) INTO V_ENDDA.
      CONCATENATE IT_LINE-INFO '-' V_ENDDA INTO IT_LINE-INFO SEPARATED BY SPACE.
      APPEND IT_LINE TO IT_LIST_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_LIST_TOP_OF_PAGE.
    ENDFORM.                               "TOP_OF_PAGE
    *&      Form  display_alv_report
    FORM DISPLAY_ALV_REPORT.
      GD_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = GD_REPID
          IT_EVENTS          = IT_EVENT1
          IS_LAYOUT          = GD_LAYOUT
          IT_FIELDCAT        = FIELDCATALOG
        TABLES
          T_OUTTAB           = IT_FINAL
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "display_alv_report
    *&      Form  VALIDATE_PERSK
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE_PERSK .
      IF NOT S_PERSK IS INITIAL.
        SELECT SINGLE * FROM T503K WHERE PERSK IN S_PERSK.      "#EC *
        IF SY-SUBRC <> 0.
          MESSAGE E000 WITH 'Enter valid Employee subgroup'(012).
        ENDIF.
      ENDIF.
    ENDFORM.                    " VALIDATE_PERSK
    *&      Form  VALIDATE_WERKS
          Validate user Entered Personnel area
    FORM VALIDATE_WERKS .
      IF S_WERKS[] IS NOT INITIAL.
        SELECT SINGLE * FROM T500P WHERE PERSA IN S_WERKS.
        IF SY-SUBRC <> 0.
          MESSAGE E000 WITH 'Enter valid Personnel Area'(014).
        ENDIF.
      ENDIF.
    ENDFORM.                    " VALIDATE_WERKS
    *&      Form  VALIDATE_DATE_LOW
          Validate user Entered Date
    FORM VALIDATE_DATE_LOW .
      IF S_DATE-LOW IS INITIAL.
        MESSAGE E000 WITH 'Enter Date'(004).
      ENDIF.
      IF S_DATE-HIGH IS INITIAL.
        MESSAGE E000 WITH 'Enter Date'(004).
      ENDIF.
    ENDFORM.                    " VALIDATE_DATE_LOW
    *&      Form  GET_HOLIDAY
            Get Holiday
    FORM GET_HOLIDAY .
      CLEAR V_MODIF.
      SELECT SINGLE MOFID
                    FROM T001P
                    INTO V_MODIF
                    WHERE WERKS = IT_PA0001-WERKS
                    AND   BTRTL = IT_PA0001-BTRTL.
      CALL FUNCTION 'HOLIDAY_GET'
        EXPORTING
          HOLIDAY_CALENDAR           = V_MODIF
          DATE_FROM                  = S_DATE-LOW
          DATE_TO                    = S_DATE-HIGH
        TABLES
          HOLIDAYS                   = IT_ISCAL_DAY
        EXCEPTIONS
          FACTORY_CALENDAR_NOT_FOUND = 1
          HOLIDAY_CALENDAR_NOT_FOUND = 2
          DATE_HAS_INVALID_FORMAT    = 3
          DATE_INCONSISTENCY         = 4
          OTHERS                     = 5.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " GET_HOLIDAY
    Reward points if useful.

  • Balance sheet for company codes

    Hi ,
    Is it possible to get conslidated balance sheet for multiple company codes in ECC6.0 in NEW GL.we are already activated new gl and getting B/S on profit center level under single company code.
    But now we need to split our locations or profit centers as seperate company codes without creating them as legal entities,so we will do intercompany sale transactions where customer orders a product from company A, which doesnt have that product with them, so it will be shipped from Plant of company code B. then customer pays to company A directly and another intercompany  billing will be generated by company code B ,and company code A pay company code B internally.
    My questions is how can we get a consolidated B/S for company code A, company code B or comapny code C?
    Regards
    Shaun

    Hi,
    Using transaction code "F.01" you can draw consolidated balance sheet by selecting company codes to be included in the selection fields.
    Using the same transaction, you can draw individual property balance sheet also.  In this transaction, there is a provision for selecting specific profit center option.
    Sarma Bhamidipati

  • System refresh activity in Development Box

    Hi Guru's
    I have requirement for system refresh activity in development system and i would like to know what are pre-activity required for this other than when compared to normal system refresh and also please share me any link or snote related to this
    Regard
    Mohammed Sayeed

    Hi,
    This is SAP business one system administration forum. Please find correct forum and repost your question to get quick reply.
    Please close this thread here with helpful answer.
    Thanks & Regards,
    Nagarajan

  • Searching the correct "style.css" sheet for InfoView

    Hi guys,
    i have to customize the apperience of InfoView for a Customer. I did pretty good by using Firefox and "FireBug" PlugIn so i can see which *.css Files i need to edit.
    I hearbly cant find the "style.css" sheet for the Panel in the "Document List". I mean the Panel with the Buttons "Switch to Folder", "Switch to Categories", "Refresh", "New", and so on.
    I also need to customize the Background color, Font, etc. there.
    Firebug tells me the style.css lies here:
    SERVER:8080/InfoViewAppActions/ure/ure/dhtmllib/custom/skin_ure
    But on the OS side i only have:
    D:\Business Objects\Tomcat55\webapps\InfoViewAppActions\
    And even no "style.css" file under the whole Folder InfoViewAppActions.
    Anyone knows where i cant find this stylesheet ?
    Environment:
    Windows Server 2003 R2 SP2
    BOE XI 3.1 FP 1.4
    Default Tomcat 5.5
    Thanks in advance!
    -Seb.
    Edited by: Sebastian Wiefett on Aug 26, 2009 4:52 PM

    The file omni.jar is a ZIP archive in the Firefox installation folder that stores a lot of the extra (chrome) files that Firefox uses. In previous Firefox versions those files were separate files on disk, but those files were moved to one large ZIP archive that has an optimized file order to load the files in it as quickly as possible during the start up. If you want to inspect files in that archive and your file manager doesn't allow access directly than make a copy of the file and add a .zip file extension.
    You can open that archive file and browse to the /chrome/toolkit/res folder.

  • System Refresh activity

    Does any body have a clear explanation for the system refresh activity.
    and is System copy and  refresh one and the same
    if some one has steps please send them to me
    thank u

    Pavan ,
    when you are performing the client copy you are coping the tables and indexes.
    if your system have different patch level i way cause inconsistancy while client copy.
    Please check this forun to clear the situation
    Re: Error in Remote Client Copy
    thanks
    Rishi Abrol

  • Multiple Response Sheets for one form

    Hello,
    Can anyone tell me how to create multiple response sheets for the same form?
    For example, my sales team needs to send the form out to different companies, but needs their responses sepearted to analyze.
    Please Help!

    Hi,
    You can only have one active Response Sheet per form, this means that while you are using the same form for different companies, the responses that everyone submits will go to this one response sheet.
    However, if you just want to add other sheets in the 'View Responses' tab, for backing up data or other purposes, you can select Insert menu/Sheet in the 'View Responses' tab
    In your case, it sounds like you need a form per company or you can use one form and have a field requesting the user to enter the company name (or you can have a drop down for the user to select a predefined list of companies) and then once you received all the responses, you can sort or filter the responses in the table based on the company name, for example. Or export your responses in Excel format, and do the analysis there.
    thanks,
    Lucia

  • Different activity type for different capacity category in a work center

    Hello,
    Multiple capacity categories can be created in a work center like
    Engineer
    Sr. Engineer
    Architect
    Rates for all of them will be different (obviously) , however we can only have 1 activity type as default in a work center . We intend to 'HR assignment' corresponding to each capacity category . how can we have multiple activity type for different capacities (Engineer , architect etc).
    With regards,
    Mrinal

    Hi Paulo,
    thanks for your quick reply.
    Requirement is to assign all persons (Engineer, architect ) to 1 work center and to 1 activity , but to default different activity type (corresponding to capacity category) in worklist of time sheet .
    With regards,
    Mrinal

  • Anyone have the Photodon anti-glare sheet for imac?

    Friends,
    I just purchased the photodon antiglare sheet for my alu imac 24". I tried the little sample sheet first and I have to say, although it does reduce glare, it doesn't make a HUGE reduction (at least looking at the test sheet). Also, there appears to be almost a jewly, speckley appearance under the test sheet.
    Is this my imagination? When you get the whole sheet on, does the screen just look "good," albeit with less glare?
    Thanks!
    Steve

    This is almost like those awful "anti-radiation" screens they had back in the late 90's.
    They dealt with people's fears not the real problems. A very successful and lucrative idea because it solved nothing and lead to people spending even more money.
    The problem was the cheap PCs had a low refresh rate and the flickering gave you headaches. The term radiation had connotations of "nuclear", but was really just harmless light.
    Sticking something on top of the glossy glass screens only exacerbates the issues. You are adding multiple surfaces to the screen. The outer surface of the sheet, the boundary between sheet and adhesive and the boundary between the adhesive and the glass. Not counting all the inevitable bubbles.
    Each distorts, scatters and changes the tone and color of the light both shining onto the surface and shining from behind, plus the mix of the two. None of them improves anything.
    Just smear Vaseline all over the screen, it is what they did on movie camera lens for ageing Hollywood actresses, to blur and hide their wrinkles. Or if you wear glasses take them off, it'll do something similar and equally unproductive.

  • My apple is not activating,Asking for Apple ID &p.word, I have entered the apple ID which i was using to download all apps,but it wont work, Now system is saying that your apple Id is wrong, My question is Can there be two apple IDs?

    My apple is not activating,Asking for Apple ID &p.word, I have entered the apple ID which i was using to download all apps,but it wont work, Now system is saying that your apple Id is wrong, My question is Can there be two apple IDs? My apple ID is my Yahoo mail it self, but not able to log in to  Icloud, Can any body guide, Why, I can not.

    Hi dip_kinu,
    I apologize, I'm a bit unclear on exactly what device you are trying to set up and what is happening when you try to do so. If you are having issues remembering your Apple ID, or feel like you may have set up multiple Apple ID's, you may find the following page helpful:
    Apple - My Apple ID: Find your Apple ID
    https://iforgot.apple.com/appleid
    Regards,
    - Brenden

  • Trying to create a contact sheet for passport photos....HELP!

    Aperture 3 and iMac are both new to me and after a lot of research, I finally figured out how to make a contact sheet for my passport photo so that I don't have to pay 10.00 for a measly 2x2 photo at Walgreen's. I went to file>print>selected the 8x10 borderless size and adjusted the picture so that I would be able to print 20 2x2 photos on one sheet. PERFECT....but....I don't really want to print it myself ( I don't have any photo paper right now )...I want to SAVE the image I created and upload it to Walgreen's so that they can print it. Then, I will cut out the 2x2 photo that I need. The only problem right now is that I cannot figure out how to SAVE the image to my computer, either in iPhoto or Aperture 3. If anyone knows, can you please help me out with this. OR if there is another way to create the image in another area of Aperture 3 I would like to know how! 
    Thanks for any help you can provide

    Once in print after you have the layout you want select the Print button. This will bring up the  system print window (not actually print the image yet).
    At the bottom of the new window is a button PDF select that. From that pulldown you can elect to save the print image as a pdf or better yet for your need you can save  as a JPG (or TIFF)
    Once you have it saved as a JPG you can upload to Walgreen;s

Maybe you are looking for