Wednesday, 6 August 2014

ISU_MASTERDATA_TEMPLATE_UPLOAD program

*****&---------------------------------------------------------------------*
*& Report  ZMDT_REPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZMDT_REPORT11.

TYPE-POOLS: TRUXS,SLIS.

DATA IT_CONTAINER TYPE CCMCONT_T.
DATA WA_CONTAINER LIKE LINE OF IT_CONTAINER.
DATA IT_NEW_KEYS_TAB TYPE ISU_PROD_NEWOBJECT_KEYS_TAB.
DATA WA_NEW_KEYS_TAB LIKE LINE OF IT_NEW_KEYS_TAB.
DATA IT_DONE_NODE_TAB TYPE ISU_EPDNODE_TAB.
DATA: IT_TEMP11 TYPE ISU_PROD_NEWOBJECT_KEYS_TAB,
      WA_TEMP11 LIKE LINE OF IT_TEMP11.

DATA: IT_RAW TYPE TRUXS_T_TEXT_DATA,
      IT_DATA TYPE TABLE OF ALSMEX_TABLINE.

DATA : LT_GRID TYPE REF TO CL_SALV_TABLE.
DATA : LT_FUNCTIONS TYPE REF TO CL_SALV_FUNCTIONS_LIST,
        LT_DISPLAY TYPE REF TO CL_SALV_DISPLAY_SETTINGS.
CONSTANTS :GC_TRUE TYPE SAP_BOOL VALUE 'X'.


PARAMETERS: P_FILE TYPE  RLGRAP-FILENAME.

DATA : L_LOGID TYPE GUID_32,
L_SCRIPT_INFO_TAB TYPE ISU_SCRIPT_INFO_TAB,
L_IDE_STARTED TYPE EBA_FLAG,
L_MDG_COMPLETED TYPE EBA_FLAG.

DATA:   LV_LOGNUM TYPE BALOGNR,
       LT_LOGKEYS TYPE  BAPIALF OCCURS 0 WITH HEADER LINE,
       LT_LOGDATA TYPE TABLE OF BAPIALG,
       WA_LOGDATA TYPE BAPIALG.
TYPES : BEGIN OF TY_LOG,
       TYPE TYPE BAPI_MTYPE,
       MESSAGE TYPE BAPI_MSG,
      LINE_COLOR(4TYPE C,
     END OF TY_LOG.
DATA : IT_FINAL_LOG TYPE TABLE OF TY_LOG,
      WA_FINAL_LOG TYPE TY_LOG.

TYPES : BEGIN OF TY_MDATA,
AB  TYPE  CHAR255,
ABLEINH  TYPE   CHAR255,
ADDRNUMBER  TYPE  CHAR255,
AKLASSE  TYPE   CHAR255,
ANLAGE  TYPE  CHAR255,
CITY1  TYPE   CHAR255,
DATEFROM  TYPE  CHAR255,
DEVLOC  TYPE  CHAR255,
EADAT  TYPE   CHAR255,
EINZDAT  TYPE   CHAR255,
HAUS  TYPE  CHAR255,
HOUSE_NUM1  TYPE  CHAR255,
INT_UI  TYPE  CHAR255,
KOFIZ_SD  TYPE  CHAR255,
KONDIGRE  TYPE  CHAR255,
KTOKL  TYPE   CHAR255,
MATNR  TYPE   CHAR18,
NAME_FIRST  TYPE  CHAR255,
NAME_LAST  TYPE   CHAR255,
PARTNER  TYPE   CHAR255,
PERVERBR  TYPE  CHAR255,
POST_CODE1  TYPE  CHAR255,
SERNR  TYPE   CHAR18,
STREET  TYPE  CHAR255,
TARIFART  TYPE  CHAR255,
TARIFTYP  TYPE  CHAR255,
TYPE  TYPE  CHAR255,
VKBEZ  TYPE   CHAR255,
VKONT  TYPE   CHAR255,
VKTYP  TYPE   CHAR255,
VSTELLE  TYPE   CHAR255,
XSEXF  TYPE   CHAR255,
XSEXM  TYPE   CHAR255,
XSEXU  TYPE   CHAR255,
ZWNUMMERE  TYPE   CHAR255,
ZWSTANDCE  TYPE   CHAR255,
        END OF  TY_MDATA.

DATA : IT_MDATA TYPE TABLE OF TY_MDATA,
      WA_MDATA TYPE TY_MDATA.

*****************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

  PERFORM get_file.
  PERFORM excel_itab.





  PERFORM UPLOAD_DATA.
  PERFORM DISPLAY_LOG.

*&---------------------------------------------------------------------*
*&      Form  EXCEL_UPLOAD
*&---------------------------------------------------------------------*
*       text
*---------------------------  -------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
  " EXCEL_UPLOAD
*&---------------------------------------------------------------------*
*&      Form  UPLOAD_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM UPLOAD_DATA .

  LOOP AT IT_MDATA INTO WA_MDATA.

    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        DATE_EXTERNAL                  = WA_MDATA-AB
*       ACCEPT_INITIAL_DATE            =
     IMPORTING
       DATE_INTERNAL                  = WA_MDATA-AB.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'AB'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-AB .
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'ABLEINH'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-ABLEINH.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'ADDRNUMBER'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-ADDRNUMBER.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'AKLASSE'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-AKLASSE.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'ANLAGE'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-ANLAGE.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'CITY1'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-CITY1.
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        DATE_EXTERNAL                  = WA_MDATA-DATEFROM
*   ACCEPT_INITIAL_DATE            =
     IMPORTING
       DATE_INTERNAL                  = WA_MDATA-DATEFROM.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'DATEFROM'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-DATEFROM .
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'DEVLOC'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-DEVLOC.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        DATE_EXTERNAL                  = WA_MDATA-EADAT
*   ACCEPT_INITIAL_DATE            =
     IMPORTING
       DATE_INTERNAL                  = WA_MDATA-EADAT.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'EADAT'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-EADAT.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        DATE_EXTERNAL                  = WA_MDATA-EINZDAT
*   ACCEPT_INITIAL_DATE            =
     IMPORTING
       DATE_INTERNAL                  = WA_MDATA-EINZDAT.
    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'EINZDAT'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-EINZDAT.
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'HAUS'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-HAUS.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'HOUSE_NUM1'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-HOUSE_NUM1.
    APPEND WA_CONTAINER TO IT_CONTAINER.



    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'INT_UI'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-INT_UI .
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'KOFIZ_SD'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-KOFIZ_SD .
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'KONDIGRE'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-KONDIGRE.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'KTOKL'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-KTOKL.
    APPEND WA_CONTAINER TO IT_CONTAINER.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = WA_MDATA-MATNR
      IMPORTING
        OUTPUT = WA_MDATA-MATNR.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'MATNR'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-MATNR .
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'NAME_FIRST'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-NAME_FIRST .
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'NAME_LAST'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-NAME_LAST.
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'PARTNER'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-PARTNER. .
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'PERVERBR'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-PERVERBR.
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'POST_CODE1'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-POST_CODE1.
    APPEND WA_CONTAINER TO IT_CONTAINER.



    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT  = WA_MDATA-SERNR
      IMPORTING
        OUTPUT = WA_MDATA-SERNR.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'SERNR'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-SERNR.
    APPEND WA_CONTAINER TO IT_CONTAINER.



    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'STREET'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-STREET .
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'TARIFART'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-TARIFART.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'TARIFTYP'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-TARIFTYP.
    APPEND WA_CONTAINER TO IT_CONTAINER.



    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'TYPE'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-TYPE .
    APPEND WA_CONTAINER TO IT_CONTAINER.

****
    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'VKBEZ'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-VKBEZ.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'VKONT'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-VKONT .
    APPEND WA_CONTAINER TO IT_CONTAINER.



    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'VKTYP'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-VKTYP .
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'VSTELLE'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-VSTELLE.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'XSEXF'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-XSEXF.
    APPEND WA_CONTAINER TO IT_CONTAINER.

    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'XSEXM'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-XSEXM.
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'XSEXU'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-XSEXU .
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'ZWNUMMERE'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-ZWNUMMERE.
    APPEND WA_CONTAINER TO IT_CONTAINER.


    CLEAR WA_CONTAINER.
    WA_CONTAINER-ELEMENT = 'ZWSTANDCE'.
    WA_CONTAINER-ELEMLENGTH = '255'.
    WA_CONTAINER-TYPE = 'C'.
    WA_CONTAINER-VALUE = WA_MDATA-ZWSTANDCE .
    APPEND WA_CONTAINER TO IT_CONTAINER.

    REFRESH IT_NEW_KEYS_TAB.

    CALL FUNCTION 'ISU_PRODUCT_IMPLEMENT'
      EXPORTING
        X_PRODID              = 'ZNEWCUST_TC'
        X_CONTAINER           = IT_CONTAINER
        X_RAISE_NO_EVENT      = ' '
        X_NO_BPCONTACT        = ' '
        X_CONTRACTDATA        = ' '
        X_NO_ENV_SELECT       = ' '
        X_INDUSTRY            = ' '
      IMPORTING
        Y_LOGID               = L_LOGID
        Y_SCRIPT_INFO_TAB     = L_SCRIPT_INFO_TAB
        Y_IDE_STARTED         = L_IDE_STARTED
        Y_MDG_COMPLETED       = L_MDG_COMPLETED
      CHANGING
        XY_NEW_KEYS_TAB       = IT_NEW_KEYS_TAB
        XY_DONE_NODE_TAB      = IT_DONE_NODE_TAB
      EXCEPTIONS
        GENERAL_FAULT         = 1
        INPUT_ERROR           = 2
        AMBIGUOUS_ENVIRONMENT = 3
        OTHERS                = 4.

    LOOP AT IT_NEW_KEYS_TAB INTO WA_NEW_KEYS_TAB.
      CLEAR WA_TEMP11.
      MOVE-CORRESPONDING WA_NEW_KEYS_TAB TO WA_TEMP11.
      APPEND WA_TEMP11 TO IT_TEMP11.
    ENDLOOP.

    REFRESH IT_CONTAINER.
    REFRESH IT_DONE_NODE_TAB.



*  Fetching the log number from log id.
    SELECT SINGLE LOGNUMBER
    INTO LV_LOGNUM
    FROM BALHDR
    WHERE
    EXTNUMBER = L_LOGID.

    LT_LOGKEYS-LOGNUMBER = LV_LOGNUM.
    APPEND LT_LOGKEYS.

    CALL FUNCTION 'BAPI_APPLICATIONLOG_GETDETAIL'
      EXPORTING
        LANGUAGE   = SY-LANGU
        TEXTFORMAT = 'ASC'"gc_textformat
      TABLES
        LOGKEYS    = LT_LOGKEYS
        LOGDATA    = LT_LOGDATA.


  ENDLOOP.
   LOOP AT LT_LOGDATA INTO WA_LOGDATA.
      CLEAR WA_FINAL_LOG.
      WA_FINAL_LOG-TYPE = WA_LOGDATA-TYPE.
      WA_FINAL_LOG-MESSAGE = WA_LOGDATA-MESSAGE.

      IF  WA_FINAL_LOG-TYPE NE 'S'.
        WA_FINAL_LOG-LINE_COLOR = 'C310'.
      ENDIF.
      APPEND WA_FINAL_LOG TO IT_FINAL_LOG.
    ENDLOOP.
    REFRESH LT_LOGDATA.







ENDFORM.                    " UPLOAD_DATA
*&---------------------------------------------------------------------*
*&      Form  DISPLAY
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
" pushbutt
*&---------------------------------------------------------------------*
*&      Form  display_log
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM DISPLAY_LOG .
  DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
        GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
        GD_LAYOUT    TYPE SLIS_LAYOUT_ALV,
        GD_REPID     LIKE SY-REPID.
  FIELDCATALOG-FIELDNAME   = 'TYPE'.
  FIELDCATALOG-SELTEXT_M   = 'Message Type'.
  FIELDCATALOG-COL_POS     = 1.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.

  FIELDCATALOG-FIELDNAME   = 'MESSAGE'.
  FIELDCATALOG-SELTEXT_M   = 'Message'.
  FIELDCATALOG-COL_POS     = 2.
  APPEND FIELDCATALOG TO FIELDCATALOG.
  CLEAR  FIELDCATALOG.

  GD_LAYOUT-NO_INPUT          = 'X'.
  GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.



  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
     I_CALLBACK_PROGRAM                =  SY-REPID
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_USER_COMMAND           = ' '
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  =
*   I_BACKGROUND_ID                   = ' '
*   I_GRID_TITLE                      =
*   I_GRID_SETTINGS                   =
     IS_LAYOUT                         = GD_LAYOUT
     IT_FIELDCAT                       = FIELDCATALOG[]
        TABLES
      T_OUTTAB                          = IT_FINAL_LOG
* 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_log
*&---------------------------------------------------------------------*
*&      Form  get_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM get_file .
CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      FIELD_NAME = 'P_FILE'
    IMPORTING
      FILE_NAME  = P_FILE.
ENDFORM.                    " get_file
*&---------------------------------------------------------------------*
*&      Form  excel_itab
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM excel_itab .
 CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
*    I_FIELD_SEPERATOR        = ' '
      I_LINE_HEADER            =  'X'
      I_TAB_RAW_DATA           =  IT_RAW       " WORK TABLE
      I_FILENAME               =  P_FILE
    TABLES
      I_TAB_CONVERTED_DATA     = IT_MDATA "it_TEMP[]    "ACTUAL DATA
   EXCEPTIONS
      CONVERSION_FAILED        = 1
      OTHERS                   = 2.
ENDFORM.                    " excel_itab

No comments:

Post a Comment