Uploading multiple excel sheets

Dear All,
We are having 4 different excel sheets where data is stored regarding the quantity of laptops, desktops, printers & xerox machines. This data is to be loaded into the SAP tables with Co Code & BA Code as primary key which is there available in excel sheets.
Plz help me in code to upload all the 4 files in SAP tables based on a combination of CO Code & BA Code.
The selection screen will have 4 fields to specify the path of all the 4 excel sheets & all the fields are obligatory.
Thanks & Reg,
Nishant

Hi Satesh,
Thanks very much for your prompt reply.
I am attaching the code herewith, please guide me where to use FORM & PERFORM to upload the other 3 excel sheets of the same format.
REport nis1234.
TABLES: bseg,
        zfi_is_qty.
DATA:
        t_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE,
        l_nodata  TYPE c,
        l_excelfile(128) TYPE c.             " filename to be passed to excel file
DATA: BEGIN OF t_type,
        bukrs LIKE bseg-bukrs,
        gsber LIKE bseg-gsber,
        COUNT TYPE I,
      END OF t_type.
data: l_charlen1 type i,
      l_charlen2 type i.
DATA: t_type2 LIKE t_type OCCURS 0 WITH HEADER LINE.
DATA:  l_end_row TYPE i,
       l_endrow1 TYPE i,
       charlen type c.
DATA l_count TYPE I.
DATA : q_count TYPE i value 1.
PARAMETER :
           p_endrow TYPE i OBLIGATORY,
             p_file  TYPE rlgrap-filename OBLIGATORY.
****clearing the contents of database table before uploading a new file everytime
DELETE FROM ZFI_IS_QTY.
*****selection-screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      field_name = p_file
    CHANGING
      file_name  = p_file.
START-OF-SELECTION.
  l_excelfile = p_file.
l_endrow1 = p_endrow.
p_endrow = p_endrow + 1.
  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                = l_excelfile
      i_begin_col             = 5
      i_begin_row             = 2
      i_end_col               = 6
     i_end_row              = p_endrow
      i_end_row               = 4000
    TABLES
      intern                  = t_excel
    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.
    MESSAGE i010(zn) WITH 'Error in upload Please check the upload file'.
  ENDIF.
DESCRIBE TABLE T_EXCEL LINES L_ENDROW1.
L_ENDROW1 = L_ENDROW1 / 2.
  DO.
    LOOP AT t_excel WHERE row = q_count.
      IF t_excel-col = 1.
        t_type2-gsber = t_excel-value.
      ELSEIF t_excel-col = 2.
        t_type2-bukrs = t_excel-value.
  ENDIF.
    ENDLOOP.
    l_charlen1 = strlen( t_type2-bukrs ).
    l_charlen2 = strlen( t_type2-gsber ).
    if ( t_type2-bukrs <> ' ' and t_type2-gsber <> ' ' ).
       if ( l_charlen1 = 4 and l_charlen2 = 4 ).
        APPEND t_type2. CLEAR t_type2.
       endif.
    endif.
    q_count = q_count + 1.
    IF q_count > l_endrow1.
      EXIT.
    ENDIF.
  ENDDO.
  SORT T_TYPE2 BY BUKRS GSBER.
*****uploading data from internal table into database table
LOOP AT T_TYPE2.
MOVE-CORRESPONDING T_TYPE2 TO T_TYPE.
L_COUNT = L_COUNT + 1.
AT END OF GSBER.
  AT END OF BUKRS.
write:/  t_type-BUKRS,
          t_type-GSBER,
          L_COUNT.
zfi_is_qty-COMPANY_CODE = t_type-bukrs.
zfi_is_qty-BAREA = t_type-gsber.
zfi_is_qty-DT = l_count.
insert zfi_is_qty.
  CLEAR L_COUNT.
  ENDAT.
ENDAT.
ENDLOOP.
************to read the data from the database table.
data: itab like zfi_is_qty occurs 0 with header line.
select * from zfi_is_qty into corresponding fields of table itab.
ULINE.
loop at itab.
  WRITE:/ ITAB-COMPANY_CODE,
          ITAB-BAREA,
          ITAB-DT.
Endloop.
Thanks in advance,
nishu

Similar Messages

  • How to uplaod multiple excel sheets in a program

    Hi gurus,
    Can anyone suggest me
    how to upload multiple excel sheets in program.( not in OOPS)
    my excel sheets has 5 sheets like sheet1, sheet2, sheet3 ....like this..
    Thanks & Regards
    kalyan.

    swc_container it_event_container.                       
    swc_create_container it_event_container.                 
    CALL FUNCTION 'SWW_WI_CONTAINER_READ'
                EXPORTING
                  wi_id                    = wd_id
                TABLES
                  wi_container             = it_event_container
                EXCEPTIONS
                  container_does_not_exist = 1
                  read_failed              = 2
                  OTHERS                   = 3.
    if sy-subrc = 0.
    READ TABLE it_event_container WITH KEY element = 'name of your workflow container element'.
                IF sy-subrc = 0.
                  w_variable= it_event_container-value.
                ENDIF.
    endif.
    Regards
    Kedar

  • Export in multiple excel sheets

    Hi,
    I am using crystal XI and need to export in multiple excel sheets from crystal. How can I do that, please help me.
    Thanks,
    Sagarika.

    One of the 3rd-party Crystal Reports desktop schedulers listed at http://kenhamady.com/bookmarks.html allows you to burst a report so that each group level 1 becomes a separate excel worksheet in a single workbook.  It also allows you to export a report to a worksheet inside an existing workbook.

  • How to spool data into multiple Excel sheet if result is more then 65k rows

    Hi all,
    Wann spool data into multiple excel sheet bocz my resultant no of rows are more then 65k.
    Thanks to all in advance.....

    many choices
    1) migrate to a newer version of Excel
    2) split the files after spooling
    for instance with split
    split -l65000 file.txtor with perl, java, vb or what-so-ever
    3) do more than one report by using rownum
    spool f1
    select empno,ename  from (select rownum r,empno,ename from emp order by empno) where r<6 ;
    spool off
    spool f2
    select empno,ename  from (select * from (select rownum r,empno,ename from emp order by empno) where r<11) where r>5 ;
    spool off
    spool f3
    select empno,ename  from (select rownum r,empno,ename from emp order by empno) where r>10 ;
    spool off

  • Adding Multiple excel sheets

    Hi Experts,
    How i want to add multiple excel sheet in Xcelsius using liveoffice in single canvas.Hope i will expect good from you
    Regards,
    surigs

    Hi Surigs,
    Could you clarify what exactly you need? Do you mean adding multiple sheet? If yes, you can insert multiple sheet in the excel and add live office document.
    Thanks,
    Amit

  • Error in importing multiple excel sheets to SQL Server

    I have a package which imports multiple excel sheets to SQL server using a For each Container. However I am getting the following error message "Excel Source failed validation and returns validation status "VS-NEEDSNEWMETADATA".
    Can you please advise me of the steps to potentially resolve this issue ?
    Many thanks
    Scott

    Hi Scott,
    Based on your scenario, you need to implement dynamic columns mapping which is not natively supported by managed source/destination adapters. To achieve dynamic columns mapping, we need to make use of Script Component to parse the input columns and dynamically
    map them to the destination columns.
    References:
    http://munishbansal.wordpress.com/2009/06/09/dynamic-columns-mapping-%E2%80%93-script-component-as-destination-ssis/ 
    http://blog.quasarinc.com/ssis/best-solution-to-load-dynamically-change-csv-file-in-ssis-etl-package/ 
    http://stackoverflow.com/questions/13836874/script-task-in-dft-doesnt-get-excecuted 
    Regards,
    Mike Yin
    TechNet Community Support

  • Download to multiple excel sheets in the backgraoud

    Hi,
    I am trying to download data into multiple excel sheets in the background. I was able to create comma delimited csv file in the server, which can be opened as excel file. This is good when it does not have more that one worksheets.
    I have three internal table and to send these internal tables in different worksheets in the same excel file.
    Is it possible to have multiple sheets excel file from the csv file?

    Check the following thread !!
    Re: Downloading data into excel
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • Loading Multiple excel sheets in to different tables in a DB

    Hi All,
    I have problem in loading multiple excel sheets data in to according to that excelsheets tables in a DB.
    All the excel sheets are in a folder,from that folder i have to  acces all excel sheets.
    For this i am unsing script task and one dataflow task.
    But the error is coming in script task i am not able to put the path in the script..
    Is this the correct way to do like this? Or any other way?
    Can u please tell me the solution for this..Thanks in advance who are responding to this mail...
    Maruthi..

    Hi Vipin,
    Here you go with this requirement
    How to Load Multiple Sheets From Multiple Excel Files to Different Tables in SSIS Package?
    ttps://www.youtube.com/watch?v=1WXKpkwjhX8&feature=youtu.be
    I have other videos as well where you want to load all the sheets from file/s to same table 
    https://www.youtube.com/watch?v=F3sYO-S9icc&feature=youtu.be
    Check out the last links on below links all related to Excel
    http://sqlage.blogspot.com/search/label/SSIS%20Videos
    How to Create Excel file with Date-time on Each Package Execution in SSIS Package?
    How to Load Multiple Sheets to a SQL Server Table in SSIS Package?
    How to Load Data Excel File to SQL Server Table and Solve Data Conversion Issues?
    How to Load Multiple Sheets From Multiple Excel Files to Different Tables in SSIS Package?
    How to Load Data to Pre-Formatted Excel Sheet (Excel Report) in SSIS Package?
    All the best!
    http://sqlage.blogspot.com/

  • Export to Multiple Excel Sheets

    I would like to be able to export a report (or analysis) to multiple excel sheets.
    I have 2 options, 'Answers' and 'BI Publisher'. Ideally I would like to use answers, but will use Publisher if necessary.
    Is there an easy way to export reports to multiple excel sheets?

    Hi jitapong,
    When a Web Intelligence document is exported to a Microsoft Excel Workbook, the export is handled by the Web Intelligence report engine. Excel is not required to be installed on the machine to execute the export. So, regardless of whether Excel 2003 , Excel 2007, or no Excel is installed, the export is performed using the parameters built into the report engine. This export is done in the Excel 97-2003 format.
    A limitation of pre-2007 Excel is the inability to create a worksheet greater than 65,535 rows long. Excel 2007 overcomes that inability thus allowing users to create worksheets of much greater length.
    Resolution:
    Web Intelligence 3.1 versions overcome the 65,000 row limitation by exporting the document to multiple worksheets within the Excel Workbook. Each worksheet will be 65,535 rows long. For example, if a query returns 150,000 rows of data the resultant export to Microsoft Excel would produce a single workbook with 3 worksheets. 2 worksheets of 65,535 rows and 1 worksheet of 18,930 rows. This export is compatable with Excel 2003 and 2007.
    Regards,
    Chirag

  • 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

  • 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

  • Uploading to excel sheet

    hi all,
       I just want to know that how a data can be uploaded to excel sheet with zeroes..
      question in detail.
    i have data with field : pos(4) character...i cant use type n...
    now pos is havin data suppose...
      0765
    0987
    7891
    so the o/p is comin in excel as:
    765
    987
    7891...but i need
    0765
    0987..
    in excel sheet ...so gurus help me out...thanks in advance..
    bob.

    Hi
    PARAMETER P_file like RLGRAP-FILENAME
    data : begin of int_head occurs 0,
    Filed1(20) type c,                     " Header Data
    end of int_head.
    int_head-Filed1 = 'PLTNY'.
    APPEND int_head.
    CLEAR int_head.
    int_head-Filed1 = 'WERKS'.
    APPEND int_head.
    CLEAR int_head.
    int_head-Filed1 = 'KTEXT'.
    APPEND int_head.
    CLEAR int_head.
    Select plnty werks ktext from plko into CORRESPONDING FIELDS OF TABLE itab
    Where plnty = 'Q' .
    v_filetype = '.xls'. "I just manipulate the file name using XLS file type.
    v_filename = p_file.
    CONCATENATE p_file v_filetype INTO lv_filename.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename                = lv_filename
    filetype                = 'ASC'
    write_field_separator   = 'X'
    TABLES
    data_tab                = ITAB
    FIELDNAMES              = int_head
    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.
    ENDIF.
    ENDFORM.

  • Upload multiple excel files into tables using APEX

    Hi folks,
    I'm wondering if anyone has ever uploaded multiple .csv files simultaniously and store the data into the database using APEX XE before.
    I can browse for a single file, and execute that okay and a good example of doing that can be found at http://advait.wordpress.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    This works fine when the user browses to a specific file on their network and then uploads the data from that one file.
    However I need the ability to 'grab' every file in a specific directory one after the other to process rather than having to specify which one to load everytime, and wondered if anyone has come across this before.
    Many thanks
    Graham.

    Just for completeness ...
    Got this to work, but it's a pl/sql issue as opposed to an APEX issue.
    Anyway, if anyone needs to have the ability to read multiple files then a quick easy way to do it (as lomg as they know the file names that will be read), is to create a directory on the database which points to the actual harddrive on your PC, then create a table (called an external table) and read from that external table as if it was an actual database table ...
    1 - Log on as sys and grant CREATE ANY DIRECTORY to whatever user you are logging in as (assuming you are not using sys to create apps)
    2 - Create a directory e.g....CREATE OR REPLACE DIRECTORY GB_TEST AS 'c:\gbtest';
    3 - Create an external table as ...
    CREATE TABLE gb_test
    (file_name varchar2(10),
    rec_date date
    rec_name VARCHAR2(20),
    rec_age number,
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY GB_TEST
    ACCESS PARAMETERS
    RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    LOCATION ('data1.csv','data2.csv','data3.csv','data4.csv')
    PARALLEL 5
    REJECT LIMIT 20000;
    That's it then ...
    select * from gb_test
    where file_name = 'xxx'
    will return all the data where the file_name = 'xxx'
    very easy to use.

  • Upload  in Excel Sheet for Mid Year Go Live

    Hi Friends,
    How to upload T558 B & C tables in Excel Sheet for  Mid Year Go Live.
    Awaiting for your reply
    Regards
    Praveen P

    Hi,
    t558c template here between postingdate and amount two blank tab is there
    client     pernr     period     country     wagetype     postingdate               amount
    t558b template here between period and posting date two blank tab is there
    client     pernr     period               postingdate     periodparameter     year     period     monthstartrdate     enddate month
    and the date format is YYYYMMDD
    Edited by: BALAPANI on Oct 13, 2009 12:19 PM

  • 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

Maybe you are looking for

  • How can I restore deleted file attachments from further back than the history tool will let me go?

    I have a open form that collects registration information from customers, including documents and images that they can upload using file attachment fields.  Back on 2/24 I inadvertently deleted the several hundree responses that the form had collecte

  • Warning-Variable If automatically Converted

    Friends, I am executing a Bw report through Portal.I changed name of Variable .When i run the report through it is giving the warning message 'variable if automatically Converted'  I did try with RSRT and also Supress warnings from Server.Still warin

  • EJBQL, MIN and java.sql.Timestamp

    I am trying to create a new finder method for a cmp bean which returns me the date of the oldest bean available. the ejbql query looks like this: select MIN (a.receiveDate) from AssetSchema as a receiveDate is defined as a java.sql.Timestamp field in

  • OT:  The Document Contains No Data

    anybody getting this when trying to access the discussions? hate to post off topic, but there is no way to communicate with anyone at Apple to troubleshoot the issue. also others experiencing interminable waits with broadband to load a page?

  • /usr/sap/ccms is above the threshold value

    Hi, Can you guide me with this one, what are the files should be deleted with this directory? Where I can find those files? Hoping for your immediate response. Regards,