Uploading from excel sheet

can anyone tel me how 2 upload data from a excel sheet ??
can it be done using gui_upload or os there any other funtion module ??

Hi Vignesh,
Steps to create a BDC program.
1. Create an internal table with fields same as Excel sheet fields.
2. Declare an internal table with BDCDATA table to store the BDC recording.
3. Declare an internal table with BDCMSGCOL to store the error messages after
the execution of the BDC.
4. Write the code using the fun. module ALSM_EXCEL_TO_INTERNAL_TABLE
to upload the data from the excel sheet.
5. loop that internal table and write the Subroutines to fill the internal table
BDCDATA with the recording of a specified Transaction Code.
6. Using Call Transaction execute the BDC recording.
7. Check Sy-subrc = 0 and store the error messages in the internal table.
8. If you want you can pass those error records to a session using the SESSION method.
Here is an example of a BDC program, but this program is from a text file. Change the function module WS_UPLOAD with ALSM_EXCEL_TO_INTERNAL_TABLE
to upload an excel and write the program with your BDC recording. You can do recording using t-code SHDB.
Sample Program:
REPORT ZRAJ_DATASET_XD01 NO STANDARD PAGE HEADING LINE-SIZE 132
LINE-COUNT 60
MESSAGE-ID Z00.
Table/Structure declarations. *
TABLES : KNA1. "Customer master
Constants declarations. *
CONSTANTS : C_MODE VALUE 'N',
C_UPDATE VALUE 'S',
C_X VALUE 'X',
C_SESS TYPE APQI-GROUPID VALUE 'ZCUSTOMER', "Session Name
C_XD01 LIKE TSTC-TCODE VALUE 'XD01'.
Variable declarations. *
DATA : V_FNAME(15) VALUE SPACE, " Name of file to be created
V_FAILREC TYPE I, " No of failed records
V_MSG(255), " Message Text
V_ERRREC TYPE I, " No of failed records
V_LINES TYPE I. " No of records
*-- FLAG DECLARATIONS
DATA : FG_DATA_EXIST VALUE 'X', " Check for data
FG_SESSION_OPEN VALUE ' '. " Check for Session Open
Structures / Internal table declarations *
*-- Structure to hold BDC data
TYPES : BEGIN OF T_BDCTABLE.
INCLUDE STRUCTURE BDCDATA.
TYPES END OF T_BDCTABLE.
*-- Structure to trap BDC messages
TYPES : BEGIN OF T_MSG.
INCLUDE STRUCTURE BDCMSGCOLL.
TYPES : END OF T_MSG.
*-- Structure to trap ERROR messages
TYPES : BEGIN OF T_ERR_MSG,
MESSAGE(255),
END OF T_ERR_MSG.
*--Internal table to store flat file data
DATA:BEGIN OF IT_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
KTOKD LIKE T077D-KTOKD,
NAME1 LIKE KNA1-NAME1,
SORTL LIKE KNA1-SORTL,
ORT01 LIKE KNA1-ORT01,
PSTLZ LIKE KNA1-PSTLZ,
LAND1 LIKE KNA1-LAND1,
SPRAS LIKE KNA1-SPRAS,
LZONE LIKE KNA1-LZONE,
END OF IT_KNA1.
*-- Internal table to hold BDC data
DATA: IT_BDCDATA TYPE STANDARD TABLE OF T_BDCTABLE WITH HEADER LINE,
*-- Internal Table to store ALL messages
IT_MSG TYPE STANDARD TABLE OF T_MSG WITH HEADER LINE,
*-- Internal Table to store error messages
IT_ERR_MSG TYPE STANDARD TABLE OF T_ERR_MSG WITH HEADER LINE.
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_FLNAME(15) OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R_LIST RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN COMMENT 5(20) TEXT-003.
PARAMETERS : R_SESS RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN COMMENT 30(20) TEXT-004.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
Event:Initialization *
INITIALIZATION.
AT Selection Screen. *
AT SELECTION-SCREEN.
Event: Start-of-Selection *
START-OF-SELECTION.
V_FNAME = P_FLNAME.
PERFORM GET_DATA.
PERFORM GENERATE_DATASET.
Event: End-of-Selection *
END-OF-SELECTION.
IF FG_DATA_EXIST = ' '.
MESSAGE I010 WITH TEXT-009.
EXIT.
ENDIF.
PERFORM GENERATE_BDCDATA.
PERFORM DISPLAY_ERR_RECS.
Event: top-of-page
TOP-OF-PAGE.
FORM DEFINITIONS *
*& Form get_data
Subroutine to get the data from mard
--> p1 text
<-- p2 text
FORM GET_DATA.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\XD01.TXT'
FILETYPE = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = IT_KNA1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 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.
IF IT_KNA1[] IS INITIAL.
FG_DATA_EXIST = ' '.
ENDIF.
ENDFORM. " get_data
*& Form GENERATE_DATASET
text
--> p1 text
<-- p2 text
FORM GENERATE_DATASET.
MESSAGE I010 WITH 'OPENING FILE IN APPLICATION SERVER'.
**--Creating a data set in application server
OPEN DATASET V_FNAME FOR OUTPUT IN TEXT MODE.
**---Transfering data from internal table to dataset
MESSAGE I010 WITH 'TRANSFERING DATA FROM INETERAL TABLE TO THE FILE'.
LOOP AT IT_KNA1.
TRANSFER IT_KNA1 TO V_FNAME.
ENDLOOP.
**--Closing the dataset
MESSAGE I010 WITH 'CLOSING THE FILE'.
CLOSE DATASET V_FNAME.
ENDFORM. " GENERATE_DATASET
*& Form BDC_DYNPRO
text
-->P_0467 text
-->P_0468 text
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
*& Form BDC_FIELD
text
-->P_0472 text
-->P_0473 text
FORM BDC_FIELD USING FNAM FVAL.
IF NOT FVAL IS INITIAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDIF.
ENDFORM.
*& Form GENERATE_BDCDATA
text
--> p1 text
<-- p2 text
FORM GENERATE_BDCDATA.
REFRESH IT_KNA1.
Opening dataset for reading
OPEN DATASET V_FNAME FOR INPUT IN TEXT MODE.
Reading the file from application server
DO.
CLEAR: IT_KNA1,IT_BDCDATA.
REFRESH IT_BDCDATA.
READ DATASET V_FNAME INTO IT_KNA1.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
Populate BDC Data for Initial Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0100',
BDC_FIELD USING 'BDC_CURSOR' 'RF02D-KUNNR',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'RF02D-KUNNR' IT_KNA1-KUNNR,
BDC_FIELD USING 'RF02D-KTOKD' IT_KNA1-KTOKD.
Populate BDC Data for Second Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0110',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NAME1',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'KNA1-NAME1' IT_KNA1-NAME1,
BDC_FIELD USING 'KNA1-SORTL' IT_KNA1-SORTL,
BDC_FIELD USING 'KNA1-ORT01' IT_KNA1-ORT01,
BDC_FIELD USING 'KNA1-PSTLZ' IT_KNA1-PSTLZ,
BDC_FIELD USING 'KNA1-LAND1' IT_KNA1-LAND1,
BDC_FIELD USING 'KNA1-SPRAS' IT_KNA1-SPRAS.
Populate BDC Data for Third Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0120',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-LZONE',
BDC_FIELD USING 'BDC_OKCODE' '=UPDA',
BDC_FIELD USING 'KNA1-LZONE' IT_KNA1-LZONE.
CALL TRANSACTION C_XD01 USING IT_BDCDATA
MODE C_MODE
UPDATE C_UPDATE
MESSAGES INTO IT_MSG.
IF SY-SUBRC <> 0.
*--In case of error list display
IF R_LIST = C_X.
V_ERRREC = V_ERRREC + 1.
PERFORM FORMAT_MESSAGE.
IT_ERR_MSG-MESSAGE = V_MSG.
APPEND IT_ERR_MSG.
CLEAR : V_MSG,IT_ERR_MSG.
ENDIF.
*--In case of session log
IF R_SESS = C_X.
*-- In case of transaction fails.
IF FG_SESSION_OPEN = ' '.
FG_SESSION_OPEN = C_X.
PERFORM BDC_OPEN_GROUP.
ENDIF. " IF FG_SESSION_OPEN = ' '.
*-- Insert BDC Data..
PERFORM BDC_INSERT_DATA.
ENDIF. " IF R_SESS = C_X.
ENDIF. " IF SY-SUBRC <> 0.
ENDIF. " IF SY-SUBRC <> 0.
ENDDO.
Closing the dataset
CLOSE DATASET V_FNAME.
*-- Close the session if opened
IF FG_SESSION_OPEN = C_X.
PERFORM BDC_CLOSE_GROUP.
CALL TRANSACTION 'SM35'.
ENDIF.
ENDFORM. " GENERATE_BDCDATA
*& Form BDC_OPEN_GROUP
text
--> p1 text
<-- p2 text
FORM BDC_OPEN_GROUP.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = C_SESS
HOLDDATE = FILLER8
KEEP = C_X
USER = SY-UNAME
RECORD = FILLER1
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
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. " BDC_OPEN_GROUP
*& Form BDC_INSERT_DATA
text
--> p1 text
<-- p2 text
FORM BDC_INSERT_DATA.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = C_XD01
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 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.
ENDFORM. " BDC_INSERT_DATA
*& Form BDC_CLOSE_GROUP
text
--> p1 text
<-- p2 text
FORM BDC_CLOSE_GROUP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 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. " BDC_CLOSE_GROUP
*& Form FORMAT_MESSAGE
text
--> p1 text
<-- p2 text
FORM FORMAT_MESSAGE.
CLEAR V_LINES.
DESCRIBE TABLE IT_MSG LINES V_LINES.
READ TABLE IT_MSG INDEX V_LINES.
CLEAR V_MSG.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MSG-MSGID
LANG = IT_MSG-MSGSPRA
NO = IT_MSG-MSGNR
V1 = IT_MSG-MSGV1
V2 = IT_MSG-MSGV2
V3 = IT_MSG-MSGV3
V4 = IT_MSG-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 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. " FORMAT_MESSAGE
*& Form DISPLAY_ERR_RECS
text
--> p1 text
<-- p2 text
FORM DISPLAY_ERR_RECS.
LOOP AT IT_ERR_MSG.
WRITE: / IT_ERR_MSG-MESSAGE.
ENDLOOP.
ENDFORM. " DISPLAY_ERR_RECS
And
To simply load Excel to Internal table follow this :
First of all , before you move your data from excel sheet to the internal table, you need to specify a location for uploading the excel sheet into your internal table.
for this u need to use two specific FM's .
the first one for file selection : WS_FILENAME_GET.
The second one for data upload : TEXT_CONVERT_XLS_TO_SAP.
After doing this the regular part of mapping comes and then we can run the session and then execute and release it.
Hope this resolves your query.
<b>Reward all the helpful answers.</b>
Regards

Similar Messages

  • Problems in uploading from excel sheet to internal table

    hi experts,
    i got one problem regarding uploading data from excel sheet to int.table. I used FM ALSM_EXCEL_TO_INTERNAL_TABLE but in that the value is char of 50. but i need a case where i have to send value more than 50 characters. please suggest me any other FM to overcome this problem.
    advanced thanks
    vijay

    Hi,
    >
    Vijay Krishna Arvapalli wrote:
    > hi tarun,
    >
    > thank you for your reply
    >
    > but when i tried to use FM TEXT_CONVERT_XLS_TO_SAP it is giving error actually that 'Error generating the test frame'.
    >
    > so can you suggest me with some other option where i can upload the field with more than 50 character length.
    >
    > thank you
    > regards
    > vijay
    Yes, when you execute the FM from SE37, then it displays a message.
    Just copy the below code and paste it in a report (SE38) and execute.
    Create a file in C:/ with name test.xls and execute it will display the records even with more than 50 characters of length.
    I have tested and its working.
    I have taken three fields in the excel file empid, name and doj.
    TYPE-POOLS : truxs.
    PARAMETERS : p_file TYPE rlgrap-filename DEFAULT 'C:\TEST.XLS'.
    DATA : BEGIN OF itab OCCURS 0,
             empid(150) TYPE c,
             name(150) TYPE c,
             doj(150) TYPE c,
           END OF itab.
    DATA: it_raw TYPE truxs_t_text_data.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM f4_file_process USING p_file.
    AT SELECTION-SCREEN.
      PERFORM validate_file_path USING p_file.
    START-OF-SELECTION.
      PERFORM upload_data.
    END-OF-SELECTION.
      PERFORM display_data.
    *&      Form  F4_FILE_PROCESS
    *       text
    *      -->P_FILE_PATH  text
    FORM f4_file_process USING p_file.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = 'P_FILE'
        IMPORTING
          file_name     = p_file.
      IF sy-subrc NE 0.
        MESSAGE e000(zsd).
      ENDIF.
    ENDFORM.                    " F4_FILE_PROCESS
    *&      Form  VALIDATE_FILE_PATH
    *       text
    *      -->P_FILE  text
    FORM validate_file_path USING p_file.
      DATA : lv_dir TYPE string,
             lv_file TYPE string,
             lv_result(1) TYPE c.
      DATA : lv_filename TYPE string.
      lv_filename = p_file.
      CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
        EXPORTING
          full_name     = p_file
        IMPORTING
          stripped_name = lv_file
          file_path     = lv_dir
        EXCEPTIONS
          x_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.
      CALL METHOD cl_gui_frontend_services=>directory_exist
        EXPORTING
          directory            = lv_dir
        RECEIVING
          result               = lv_result
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          wrong_parameter      = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
      IF lv_result IS INITIAL.
        MESSAGE 'Invalid Directory' TYPE 'E'.
      ENDIF.
      CLEAR lv_result.
      CALL METHOD cl_gui_frontend_services=>file_exist
        EXPORTING
          file                 = lv_filename
        RECEIVING
          result               = lv_result
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          wrong_parameter      = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
      IF lv_result IS INITIAL.
        MESSAGE 'Invalid File' TYPE 'E'.
      ENDIF.
    ENDFORM.                    " VALIDATE_FILE_PATH
    *&      Form  UPLOAD_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM upload_data .
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
          i_field_seperator    = 'X'
          i_line_header        = 'X'
          i_tab_raw_data       = it_raw
          i_filename           = p_file
        TABLES
          i_tab_converted_data = itab[]
        EXCEPTIONS
          conversion_failed    = 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.                    " UPLOAD_DATA
    *&      Form  DISPLAY_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display_data .
      LOOP AT itab.
        WRITE : / itab-empid, itab-name, itab-doj.
      ENDLOOP.
    ENDFORM.                    " DISPLAY_DATA
    Hope this helps you.
    Regards,
    Tarun

  • Error in uploading from excel sheet

    i am working on sap crm so i am not able 2 use the fm ALSM_EXCEL_TO_INTERNAL_TABLE . i tried using gui_upload . it exists . wats should i give to the value for 'HAS_FIELD_SEPERATOR' in order to read from the excel file ?? i tried giving a tab space and it dumped my prog saying type conflict erroe while calling function module

    Hi Vignesh,
    Plz use this function module.
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
        I_FIELD_SEPERATOR        =
          i_line_header            =  'X'
          i_tab_raw_data           =  it_raw
          i_filename               =  p_file1
        TABLES
          i_tab_converted_data     = it_itab
       EXCEPTIONS
          conversion_failed        = 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.
    Rewords some points .
    Rgds,
    P.Naganaja Reddy

  • Creation of material from excel sheet

    Hi All,
    Can we create material by uploading from excel sheet.
    I have created all necessary product categories in system.
    I want to create 20 materials in one product category from excel sheet.
    Abdul Raheem

    Hi Abdul,
    have you tried to import the data via Import Data (System Administration --> Import and Export Tools --> Import Data).
    Also did you use the correct template; to access the correct template, please follow these steps:
    Go to Import Data
    Insert a dummy .xls file
    From the dropdown list, choose Materials
    On the next screen, download the template.csv file
    Populate the fields as required on that spreadsheet
    Repeat the import.
    Hope this helps, if it solves your question, please mark this answer as solved.
    Thanks,
    Armin

  • Upload data from excel sheet into md61

    Hi Gurus,
                    Can anybody please tell me the solution like how to upload the data from excel sheet into the MD61
    if u suggest me to write an ABAP code then its fine or any other way would be great
    and can u also send me the abap code i would be thankful to all

    Hi,
    I can be done in 2 ways.
    1. Using LSMW you can upload your MD61 demand thru Excel sheet.
    2. You can use BDC to upload the demand from Excel. For this you need to take help from the ABAP. You need to record the macro usinf SHDB and the table maintenance will be taken care by the developer.
    For LSMW you need not depend on your developer, as a functional consultant you can do it yourself.
    Regards,
    V. Suresh

  • Uploading data from excel sheets through BDC's into sap system

    hi guys,
    can you please help me with this. As we use gui_upload to upload data from flat file to sap system, which function module you use to upload data from Excel sheet to sap system through bdc's

    hello pavan,
    welcome to SDN
    check the below program
    REPORT ZEXCEL_TO_INTERNAL .
    data: begin of itab occurs 0,
          name(20) type c,
          addre(20) type c,
          end of itab.
    DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
    DATA : B1 TYPE I VALUE 1,
           C1 TYPE I VALUE 1,
           B2 TYPE I VALUE 100,
           C2 TYPE I VALUE 9999.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                   =
        'C:\Documents and Settings\administrator\Desktop\ppcon001bd_24.xls'
        I_BEGIN_COL                   = B1
        I_BEGIN_ROW                   = C1
        I_END_COL                     = B2
        I_END_ROW                     = C2
      TABLES
        INTERN                        = itab1
    EXCEPTIONS
       INCONSISTENT_PARAMETERS       = 1
       UPLOAD_OLE                    = 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.
    loop at itab1.
    write:/ itab1.
    Endlop.
    Regards,
    Naveen

  • FM for uploading data into internal table from Excel sheet

    Hi,
    I have a slight problem in one of the function modules that I have created. Actually it has been copied from a standard SAP function module “KCD_EXCEL_OLE_TO_INT_CONVERT”. Now my created function module is throwing me a dump suggesting “Data objects in a Unicode program are not convertible”. Can anybody help me out in removing the error .
    Actually the need of copying the standard FM to a ZFM is to increase the length of the column which can be uploaded thru this FM. The standard FM has a restriction of being able to upload 32 characters whereas my requirement is to upload data having at least 150 characters. So in order to care the need I made a ZStructure ZAKHIL_CELLS taking the Value parameters as 150 characters instead of 32 characters.
    Well this is all done because I wanted to upload a excel sheet into an internal table and not use a tab delimited file. Can anybody help in this regard or suggest some other function module which can upload more than 150 characters from a excel sheet .
    ‘m also attaching structure of my ZStructure for ur reference .
    STRUCTURE ZAKHIL_CELLS1 .
    ROW KCD_EX_ROW_N NUMC 4 Flexible Excel upload: row number
    COL KCD_EX_COL_N NUMC 4 Column
    VALUE KCD_VALUE CHAR 150 External Data Transfer: Values of Parameters or Variables
    Thanks & Rgds,
    Akhil

    hi,
    sample excel sheet.
    coloumn 1 is name and column 2 is age
    name age
    A     8
    C     13
    D     55
    DATA : int_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    data : record like db_name_age occurs 0 with header line.
    DATA : v_start_col TYPE i VALUE '1', "starting col
           v_start_row TYPE i VALUE '1', " starting row
           v_end_col   TYPE i VALUE '2', " total columns
           v_end_row   TYPE i VALUE '10'. "total no of record
    FORM f_upload .
      CLEAR : int_excel, int_excel[].
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = wf_filename
          i_begin_col             = v_start_col
          i_begin_row             = v_start_row
          i_end_col               = v_end_col
          i_end_row               = v_end_row
        TABLES
          intern                  = int_excel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
    *Message is 'Unable to upload data from  '  wf_filename.
        MESSAGE e169(zm050) WITH wf_filename.
      ELSE.
        SORT int_excel BY row col.
        REFRESH : record.
        CLEAR   : record.
        LOOP AT int_excel.
          CASE int_excel-col. "go thru each column.
            WHEN 1.
              record-name  = int_excel-value.
            WHEN 2.
              record-age = int_excel-value.     
          ENDCASE.
          AT END OF row.
            APPEND record.
            CLEAR record.
          ENDAT.
        ENDLOOP.
    *inserting into table
      ENDIF.
    if this helped pld rewrd points,
    rgrds
    anver

  • Uploading data from excel sheet

    HI,
         Can anyone provide me the details to upload vendor data from excel sheet to database through bdc?
    Thankyou.

    upload the excel file in your internal table and then use BDC to updated the database table.
    FM's to upload Excel:
    GUI_UPLOAD
    KCD_EXCEL_OLE_TO_INT_CONVERT
    ALSM_EXCEL_TO_INTERNALTABLE
    refer to the link:
    http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table-2/
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    With luck,
    Pritam.

  • How to get data from excel sheet present in the client(local) system?

    hi,
    I have to upload the data from an excel sheet present in the local system(not on the server) to the table using webdynpro.
    i donot want to upload the excel file
    if it is necessary to upload the file then it should be on temporary basis and it should be deleted automatically.
    i can get the data from excel sheet which is present in the km using HSSF api but how to do the same if it is in local system?
    if anyone has the sample application of this type please give me the link.
    thanks

    You can use the FM ALSM_EXCEL_TO_INTERNAL_TABLE with Web Dynpro ABAP.

  • Getting short dumps while reading bulky data from excel sheet

    Hi all,
    We have converted our non-unicode based sap system (R/3 4.7, Windows 2003,
    SQL 2000) into a unicode based system recently. We are facing two peculiar
    problems for last few days.
    *Problem 1 - *Whenever we want to upload the data from excel sheet, the
    system throws a dump after reading about 400 entries, while last week the
    same system used to read about 8000 entries in a single go.
    *Problem 2 - *Also, whenever we realease a transport requst from development
    containing a lot of changes, the request will reach the quality system but
    without the changes. but if i ll try to import the changes into quality
    system after generating more than one request containing small small
    changes, they get reflected in QAS immediately. Is there any size
    constraint in transporting a request fro DEV->QAS->PRD.
    Please suggest some ways.
    I am pasting the dump (that I am getting while data uploading from Excel).
    ~~~~~~~~~~~~~~~~~~
    Runtime errors
    MESSAGE_TYPE_X*
    Occurred on
    22.02.2008 at
    13:21:02*
    The current application triggered a termination with a short dump.
    What happened?
    The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X).
    What can you do?
    Print out the error message (using the "Print" function)
    and make a note of the actions and input that caused the
    error.
    To resolve the problem, contact your SAP system administrator.
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer
    termination messages, especially those beyond their normal deletion
    date.
    Error analysis
    Short text of error message:
    Control Framework : Error processing control
    Technical information about the message:
    Diagnosis
    An error occurred when the system tried to process the commands
    from the Automation Queue on the presentation server.
    There are several possible reasons for this:
    - The installation of the SAP GUI on the presentation server is
    faulty or obsolete.
    - There is an error in the application program
    - There is an error in the SAPGUI or an integrated control
    Procedure
    1. Make sure that you have imported the appropriate Support
    Package, the current kernel, and GUI patch for the release of your
    System
    2. Check whether the error occurs locally on one or a few PCs, or
    generally on all PCs. Note whether the error only occurs for some
    users, for example because of a specific Customizing setting.
    If it only occurs locally, this suggests an installation problem
    with the PC. Check the installation; if necessary, reinstall the
    software. In the dump, search for the SY-MSGLI field, since it may
    point to the cause of the error.
    3. Activate the Automation Trace (in accordance with SAP Note
    158985).
    4.Start the transaction and continue until the screen immediately
    before the dump.
    5. From the System -> Utilities menu, choose Autom. Queue,
    Synchronous Processing.
    The status bar of the GUI displays the text:
    "Automation synchron flush mode on"
    6. If you now proceed with the application, the short dump will
    display the ABAP call that caused the error; the Automation Trace
    will contain the error on the presentation server.
    7. If necessary, load the short dump and trace files on to
    sapservX, so that SAP can analyze them.
    Message classe...... "CNDP"
    Number.............. 006
    Variable 1.......... " "
    Variable 2.......... " "
    Variable 3.......... " "
    Variable 4.......... " "
    Variable 3.......... " "
    Variable 4.......... " "
    How to correct the error
    Probably the only way to eliminate the error is to correct the program.
    You may able to find an interim solution to the problem
    in the SAP note system. If you have access to the note system yourself,
    use the following search criteria:
    "MESSAGE_TYPE_X" C
    "SAPLOLEA" or "LOLEAU02"
    "AC_SYSTEM_FLUSH"
    If you cannot solve the problem yourself, please send the
    following documents to SAP:
    1. A hard copy print describing the problem.
    To obtain this, select the "Print" function on the current screen.
    2. A suitable hardcopy prinout of the system log.
    To obtain this, call the system log with Transaction SM21
    and select the "Print" function to print out the relevant
    part.
    3. If the programs are your own programs or modified SAP programs,
    supply the source code.
    To do this, you can either use the "PRINT" command in the editor or
    print the programs using the report RSINCL00.
    4. Details regarding the conditions under which the error occurred
    or which actions and input led to the error.
    System environment
    SAP Release.............. "620"
    Application server....... "nhbho930"
    Network address.......... "192.168.0.30"
    Operating system......... "Windows NT"
    Release.................. "5.2"
    Hardware type............ "4x Intel 801586"
    Character length......... 16 Bits
    Pointer length........... 32 Bits
    Work process number...... 0
    Short dump setting....... "full"
    Database server.......... "NHBHO930"
    Database type............ "MSSQL"
    Database name............ "DEV"
    Database owner........... "dev"
    Character set............ "C"
    SAP kernel............... "640"
    Created on............... "Aug 17 2007 00:18:58"
    Created in............... "NT 5.0 2195 Service Pack 4 x86 MS VC++ 13.10"
    Database version......... "SQL_Server_8.00 "
    Patch level.............. "196"
    Patch text............... " "
    Supported environment....
    Database................. "MSSQL 7.00.699 or higher, MSSQL 8.00.194"
    SAP database version..... "640"
    Operating system......... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2,
    Windows NT 6.0"
    User, transaction...
    Client.............. 300
    User................ "NHBABAP"
    Language key........ "E"
    Transaction......... "SE38 "
    Program............. "SAPLOLEA"
    Screen.............. "SAPMSDYP 0010"
    Screen line......... 0
    Information on where terminated
    The termination occurred in the ABAP program "SAPLOLEA" in
    "AC_SYSTEM_FLUSH".
    The main program was "ZBDC_CONTRACT ".
    The termination occurred in line 29 of the source code of the (Include)
    program "LOLEAU02"
    of the source code of program "LOLEAU02" (when calling the editor 290).
    ~~~~~~~~~~~~~~~~~~~~~
    Thank you all.
    Cheers.
    Mitra __.____._

    for the 50 millionth time: Excel spreadsheets are NOT databases, you should NOT try to use them as such and NEVER access them using JDBC.
    You should also under NO condition use the JDBC-ODBC bridge driver (that was actually the 78 millionth time that was told someone).

  • How to delete the Junk Data From Excel Sheet

    Dear ABAPers,
                I am uploading the Excel sheet from the Desktop to the SAP System. In the Internal table i am getting Unwanted Junk data's for Example '##########'.I am not getting this Junk data for all the times. i am getting it for Some times.How to ignore these junk data.
    Thanks & Regards,
    Ashok.

    Dear Friends,
                I communicated wrongly.I am very sorry for that.The Problem is I am getting All the Data into the internal table in addition to that lines i am getting the Junk data in the internal table at the end of the internal table.
    Excel Sheet
    L-1     21.10.2008     1110     888555444676001
    L-1     21.10.2008     1110     888555444676002
    L-1     21.10.2008     1110     888555444676003
    L-1     21.10.2008     1110     888555444676004
    Internal table
    L-1     21.10.2008     1110     888555444676001
    L-1     21.10.2008     1110     888555444676002
    L-1     21.10.2008     1110     888555444676003
    L-1     21.10.2008     1110     888555444676004
    Thanks & Regards,
    Ashok.

  • Pasting data from Excel sheet to Table in web dynpro View

    Hii All,
    Is it possible to copy data ( some rows) from Excel sheet and paste in table in a view?
    I tried doing this, but only first element is getting pasted..
    Does anybody know how to do this?
    Is there any way to perform similar thing?
    Pls help.
    regards,
    Amey

    Hi,
    Copy paste may work if you have that many rows in your table(not sure).
    One thing you can do is upload the excel and then populate the context of the node bound to the table by fetching data from the excel
    For this you can make use of JXL or APACHE POI.
    Regards
    Ayyapparaj

  • Import of activity list from Excel sheet.

    Dear all,
    I have configered PS module and is working fine.
    I have some existing data of activities in Excel sheets. Which are around 2000 activies for every project.
    I want to directly imports these activiteis from Excel sheet to SAP activity list.
    IS there any method by with I can upload these activities from Excel file directly.
    Regards
    SCSharma

    first create a BDC (or record LSMW) and rearrange your excel sheet as per BDC requirement and upload...!

  • Sales Order From Excel sheet

    Upload Data From Excel sheet to VA01(Creating Sales ORder).I m using BDC for tat......but after putting all the data & when i press enter button it shows me Partner List(in the form of ALV screen),from which i have to chose the partner......now m not able to do tat while using bdc......please help me in this matter......its vry urgent.Or if thr is any other technique by which it becomes vry easy,thn plz tell me OR can i know from which table this ALV is taking data.

    Hi Dheeraj,
    Pls. refer this thread for example of BAPI BAPI_SALESORDER_CREATEFROMDAT2  :
    Re: BAPI_SALESORDER_CREATEFROMDAT2
    Re: BAPI_SALESORDER_CREATEFROMDAT2
    Best regards,
    Prashant
    Pls. mark points for helpful answers

  • Upload the excel sheet in table maintenance

    Hi,
    I have a requirement to add a button in the application toolbar of the table maintenance screen of a custom table. This button should upload the excel sheet data into the maintenance screen online.
    I have created the button in the table maintenance generator. Also, uploaded the data into the internal table from the excel sheet.
    The problem is I am unable to populate the data from the internal table to the maintenance screen online.
    Any pointers in this regards will be appreciated.
    Thanks,
    Best regards,
    Ajith

    Hi Mukul,
      I created a custom table ZHEDGERES. Then in the table maintenance -> environment -> modification -> user interface I selected Individual interface.
      Then, in the Menu painter for the program SAPLZHEDGERES, modified the PF status EULG and added the additional button in the Application toolbar. This application toolbar needs to be used to trigger the upload of excel into the custom table.
      Below is the standard code which is generated in the screen painter of the custom table.
    PROCESS BEFORE OUTPUT.
    MODULE LISTE_INITIALISIEREN.
    LOOP AT EXTRACT WITH CONTROL
      TCTRL_ZHEDGERES CURSOR NEXTLINE.
       MODULE LISTE_SHOW_LISTE.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
    MODULE LISTE_BEFORE_LOOP.
    LOOP AT EXTRACT.
       MODULE LISTE_INIT_WORKAREA.
       CHAIN.
        FIELD ZHEDGERES-HDATE .
        FIELD ZHEDGERES-CHAIN .
        FIELD ZHEDGERES-HEDGE_VALUE .
        FIELD ZHEDGERES-CURRENCY .
        MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
       ENDCHAIN.
       FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
       CHAIN.
        FIELD ZHEDGERES-HDATE .
        MODULE LISTE_UPDATE_LISTE.
       ENDCHAIN.
    ENDLOOP.
    MODULE LISTE_AFTER_LOOP. 
      Need to add logic to extract the values from the excel sheet to an internal table and append the values from the internal table to the table control of the table maintenance.
    Thanks,
    Best regards,
    Ajith

Maybe you are looking for