Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

This small prog helps to upload a XL file to an internal table & further updates the DDIC table. 

Error rendering macro 'code': Invalid value specified for parameter 'lang'
*&---------------------------------------------------------------------*
*& Report  YKC_XL_UPLOAD
*&
*&---------------------------------------------------------------------*
*&:prog to upload from XL to DDIC Table
*& Created By Krishna on 5 Jan 2008
*&---------------------------------------------------------------------*
REPORT  YKC_XL_UPLOAD.
TYPE-POOLS TRUXS.
TABLES : MARA.
* Selection screen
PARAMETER P_FILE TYPE RLGRAP-FILENAME DEFAULT
'C:\Kris\TEST_UPLOAD.xls'.
DATA:   BEGIN OF IT_TAB OCCURS 0,
        MATNR  LIKE MARA-MATNR,
        ERSDA  LIKE MARA-ERSDA,
        ERNAM  LIKE MARA-ERNAM,
        END OF IT_TAB.
DATA :  IT_RAW TYPE TRUXS_T_TEXT_DATA.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME  = SYST-CPROG
      DYNPRO_NUMBER = SYST-DYNNR
      FIELD_NAME    = 'P_FILE'
    IMPORTING
      FILE_NAME     = P_FILE.
  .
START-OF-SELECTION.
* Uploading the data in the file into internal table
  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
  EXPORTING
*   I_FIELD_SEPERATOR =
*   I_LINE_HEADER  = 'X'
    I_TAB_RAW_DATA = IT_RAW
    I_FILENAME     = P_FILE
  TABLES
    I_TAB_CONVERTED_DATA = IT_TAB[]
  EXCEPTIONS
    CONVERSION_FAILED = 1
    OTHERS            = 2.
  IF SY-SUBRC NE  0.
    MESSAGE ID SY-MSGID
            TYPE SY-MSGTY
            NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
END-OF-SELECTION.
* Uploading the data into the database table
  LOOP AT IT_TAB.
    MARA-MATNR = IT_TAB-MATNR.
    MARA-ERSDA = IT_TAB-ERSDA.
    MARA-ERNAM = IT_TAB-ERNAM.
    INSERT  ZMARA.
  ENDLOOP.