Sy-tabix,sy-index,sy-dbcnt

what is the difference between sy-tabix,sy-index,sy-dbcnt explain with example, please.

Hi Murali,
sy-tabix -> the index of internal table
sy-index -> loop counter (used within DO statements to check the no. of times the loop is being executed)
sy-dbcnt -> no. of database lines processed after an open SQL statement
Regards
Nadarajah Pratheb

Similar Messages

  • What the Initial value for sy-tabix & sy-index

    Hi Folks
       I have a small doubt.
    What the Initial value for sy-tabix & sy-index?
    Can anyone please clarify me?
    Regards,
    Sree

    hi sree,
    both values are initialized to 0 before processing and after processing values are changed according to used scenarios.
    if helpful reward some points.
    with regards,
    suresh babu aluri.

  • What is the diff b/n sy-tabix,sy-subrc,sy-dbcnt

    hi
    experts can u help me for this

    Hi
    - SY-TABIX is the index (record number) of a record of an internal table: while looping or reading an internal table it means the current record:
    LOOP AT ITAB.
      WRITE: SY-TABIX.
    ENDLOOP.
    READ TABLE ITAB WITH KEY FIELD = <...>
    WRITE SY-TABIX.
    - SY-SUBRC is the rEsult of a certain command: if it's done succeffully its value is 0:
    SELECT SINGLE * FROM T001 WHERE BUKRS = <....>
    IF SY-SUBRC = 0.
      WRITE: 'Table T001 is read succeffully".
    ENDIF.
    - SY-DBCNT is the number of records got out by a SELECT:
    SELECT * FROM BKPF INTO TABLE T_BKPF WHERE BUKRS = <...>
                                                                              AND GJAHR = '2007'.
    WRITE: 'Extracted', SY-DBCNT, 'records'.
    Max

  • Sy-tabix & sy-index

    hi all,
    what is the basic difference between sy-tabix & sy-index

    hi shantanu,
    SY-TABIX:
    Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables. 
    it can be set by using  the following:
    1.append
    2.collect
    3.loop at
    4. read
    5.search
    APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table. 
    COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.
    LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE. 
    READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry. 
    SEARCH <itab> FOR sets SY-TABIX to the index of the table line in which the search string is found.
    SY-INDEX:
    SY-INDEX is used to describe the number of iteration with in the DO..ENDDO, WHILE ...ENDWHILE....
    for example,
    DO.
    WRITE SY-INDEX.
      IF SY-INDEX = 3.
        EXIT.
      ENDIF.
    ENDDO.
    it gives output as:
    1   2  3
    rewards points if useful.
    regards,
    sandhya

  • ABAP-- diff between sy-sy-tabix and sy-index

    Hi Guru's,
    Pleae can anybody expalins me what is the difference between sy-tabix and sy-index(Loop Index) ?
    Because in one case i am Modifyimg the internal table inside the do loop by giving sy-index ((Index of Internal Tables)(MODIFY scarr_tab INDEX sy-index FROM scarr_wa TRANSPORTING currcode. )  in the syntax and in other case inside loop statement i am modifyng same record by giving sy-tabix MODIFY scarr_tab INDEX  sy-tabix FROM scarr_wa TRANSPORTING currcode.) in the syntax.
    in both cases its working fine but i am not getting which one i have to use  where to modify the internal table?
    regards
    SATYA

    Hi Henry,
    SY-INDEX is the value of the current iteration. It is applicable for the following programming constructs in ABAP -
    DO...ENDDO.
    WHILE...ENDWHILE.
    SY-TABIX (TABle IndeX) is applicable to internal tables. If you scroll down in the link which Eddie has given, you will find a more detailed explanation for sy-tabix and which statements affect its value.
    Regards,
    Anand Mandalika.

  • What is difference between sy-index and sy-tabix and where both are using ?

    what is difference between sy-index and sy-tabix and where both are using ?

    hi nagaraju
    sy-tabix is in Internal table, current line index. So it can only be used while looping at the internal table.
    sy-index is in Loops, number of current pass. This you can use in other loop statements also (like do-enddo loop, while-endwhile)
    SY-INDEX is a counter for following loops: do...enddo, while..endwhile
    SY-TABIX is a counter for LOOP...ENDLOOP, READ TABLE...
    Here is an example from which you can understand the difference between sy-tabix and sy-index.
    Itab is an internal table with the following data in it.
    id Name
    198 XYZ
    475 ABC
    545 PQR.
    loop at itab where id > 300.
    write :/ itab-id, itab-name , sy-tabix, sy-index.
    endloop.
    My output will be :
    475 ABC 2 1
    545 PQR 3 2
    Sy-tabix is the index of the record in internal table.
    sy-index gives the no of times of loop passes.
    So, for the first record in the output (475 ABC), 2 is the index of the record in internal table and as it is first time loop pass occured, sy-index value is 1.
    Regards,
    navjot
    award points

  • Sy-tabix in relation to LOOP AT and READ TABLE

    Hi All,
    As per SAP documentation,
    1) While looping through an internal table (LOOP AT), sy-tabix contains the index number of current row(for standard and sorted tables)
    2)When successfully reading from an internal table(READ TABLE), sy-tabix is set to the index of the result row.
    But what happens when READ TABLE is used while looping through another internal table?
    i.e. Loop at TAB1...
    write sy-tabix.
    READ TABLE TAB2...
    write sy-tabix.
    endloop.
    If we are looping through 1st row of TAB1 and the result of read statement is found in 3rd row of TAB2, I expected that sy-tabix before READ would be 1 and after the READ be 3.
    But, I found that sy-tabix remains unchanged at 1. Can someone expalin why?
    Thanks,
    Jagan

    Hi
    If after reading the table TAB2 the system variable SY-TABIX has still the previous value, that menas the READ TABLE fails or it was read the first record of TAB2.
    After READ TABLE TAB2 try to check the SY-SUBRC:
    LOOP AT TAB1.
       WRITE: / 'TAB1 index:', SY-TABIX.
       READ TABLE TAB2 .........
       IF SY-SUBRC = 0.
         WRITE: 'TAB2 index:', SY-TABIX.
    Try this:
    DATA: BEGIN OF ITAB OCCURS 0,
            FIELD1,
          END   OF ITAB.
    DATA: BEGIN OF ITAB2 OCCURS 0,
            FIELD1,
          END   OF ITAB2.
    DATA: INDEX TYPE I.
    DO 10 TIMES.
      APPEND ITAB.
    ENDDO.
    DO 10 TIMES.
      APPEND ITAB2.
    ENDDO.
    LOOP AT ITAB.
      WRITE: / 'ITAB:', SY-TABIX.
      INDEX = SY-TABIX + 2.
      READ TABLE ITAB2 INDEX INDEX.
      IF SY-SUBRC = 0.
        WRITE:  'ITAB2:', SY-TABIX.
      ENDIF.
    ENDLOOP.
    Max

  • Sy-tabix issue

    What is the difference between the sy-tabix & sy-index ?

    sy-tabix & sy-index
    /message/4752267#4752267 [original link is broken]
    sy-index & sy-tabix
    Reward points..

  • Diff  b/n sy-tabix and sy-indx

    diff  b/n sy-tabix and sy-indx ?

    Hi Henry,
    SY-INDEX is the value of the current iteration. It is applicable for the following programming constructs in ABAP -
    DO...ENDDO.
    WHILE...ENDWHILE.
    SY-TABIX (TABle IndeX) is applicable to internal tables. If you scroll down in the link which Eddie has given, you will find a more detailed explanation for sy-tabix and which statements affect its value.
    Regards,
    Anand Mandalika.

  • Dump : Runtime Errors         DBIF_RSQL_INVALID_RSQL

    Hi Experts,
    I got a dump at the select statement in the production during the excution.The Details of the program are :
    DATA : BEGIN OF it_ekko OCCURS 0.
            INCLUDE STRUCTURE ekko.
    DATA : END OF it_ekko.
    START-OF-SELECTION.
    SELECT * FROM ekko            
               INTO TABLE it_ekko
               WHERE ebeln IN p_ebeln
                 AND aedat IN p_aedat 
                 AND bsart IN p_bsart 
                 AND lifnr IN p_lifnr.
    In ST22, the description of dump details is as follows.
    <b><u>What happened?</u></b>
    Error in ABAP application program.
    The current ABAP program "ZMMRP126_1" had to be terminated because one of the statements could not be executed.
    This is probably due to an error in the ABAP program.
    <b><u>Error analysis</u></b>
    An exception occurred. This exception will be dealt with in more detail
    below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not
    caught, which                                                         
    led to a runtime error. The reason for this exception is:             
    The SQL statement generated from the SAP Open SQL Statement violates a 
    restriction imposed by the database system used in R/3.                                                                               
    Possible errors:                                                       
    o The maximum size of an SQL statement has been exceeded.             
    o The statement contains too many input variables.                    
    o The space needed for the input data exceeds the available memory.   
    o ...                                                                               
    You can usually find details in the system log (SM21) and in the       
    developer trace of the work process (ST11).                            
    If an error occurs the developer trace often informs you about the     
    current restrictions.                                                  
    <b><u>Source Code Extract</u></b>
    001830                                                                          
    >     SELECT * FROM ekko                   "read through purchase orders   
    001850              INTO TABLE it_ekko                                          
    001860              WHERE ebeln IN p_ebeln      "for order number               
    001870                AND aedat IN p_aedat      "created date                   
    001880                AND bsart IN p_bsart     "document type                   
    001890                AND lifnr IN p_lifnr.                                     
    001900                                                                          
    001910     LOOP AT it_ekko INTO ekko.                                           
    001920       PERFORM process_items.             "read, check and save line items
    001930     ENDLOOP.                                                             
    <b><u>Contents of system fields</u></b>
    SY field contents..................... SY field contents.....................                                                                               
    SY-SUBRC 0                             SY-INDEX 0                            
    SY-TABIX 1                             <b>SY-DBCNT 69682</b>                        
    SY-FDPOS 0                             SY-LSIND 0                            
    SY-PAGNO 0                             SY-LINNO 1                            
    SY-COLNO 1                             SY-PFKEY                              
    SY-UCOMM                               SY-TITLE Purchase Order Receipt Status
    SY-MSGTY I                             SY-MSGID SF                           
    SY-MSGNO 616                           SY-MSGV1 5000098347                   
    SY-MSGV2                               SY-MSGV3                              
    SY-MSGV4                                                                     
    Kindly help me to solve out this issue.
    Thanks & Regards,
    Krishna Kishore .K

    hi,
    I think you declared p_ebeln as parameter and used in where condition with IN operator.
    Could you change with EQ operator.
    Or If p_ebeln is select-oprions means check you are giving high range in the selection screen for the input values.
    try to check by giving 1 purchase order i.e p_ebeln = 'XXXX' only.
    dont give range.
    If output is big range means program goes to dump.
    are you trying to modify EKKO table in the program?
    Please reward if its useful.
    Thanks
    Sivaparvathi
    Or

  • Report for open orders and amount of product confirmed

    Hi All,
    Can some one give me an idea on a report which shows open orders and also shows amount of product confirmed against these open orders?
    Thanks,
    Neelima.

    Hi Veni,
    Incomplete order are the order's in which some data is missing so that particular order can't be further processed, that is what you could check through "Incompletion Log". Whereas Open orders are the orders which are open for further processing viz. deliver billing(but open order is a complete order i.e. no data missing).
    Check this program:
    *& Report ZGM_OPENPO *
    REPORT ZGM_OPENPO NO STANDARD PAGE HEADING LINE-SIZE 132 LINE-COUNT 36(2).
    TABLES: t001w, "Plants/Branches
    ekko, "Purchasing Document Header
    ekpo, "Purchasing Document Item
    marc, "Plant Data for Material
    mara. "General Material Data
    DATA:
    BEGIN OF itab OCCURS 0,
    matnr LIKE marc-matnr,
    werks LIKE marc-werks,
    beskz LIKE marc-beskz,
    mmsta LIKE marc-mmsta,
    END OF itab.
    DATA: BEGIN OF iekpo OCCURS 0,
    ebeln LIKE ekpo-ebeln,
    menge LIKE ekpo-menge,
    aedat LIKE ekpo-aedat,
    wemng LIKE eket-wemng,
    END OF iekpo.
    DATA: BEGIN OF iekko OCCURS 0,
    ebeln LIKE ekko-ebeln,
    lifnr LIKE ekko-lifnr,
    bedat LIKE ekko-bedat,
    ekgrp LIKE ekko-ekgrp,
    END OF iekko.
    selection-screen:begin of block b1 with frame title text001.
    SELECT-OPTIONS werks FOR ekpo-werks OBLIGATORY.
    SELECT-OPTIONS matnr FOR ekpo-matnr.
    SELECT-OPTIONS beskz FOR marc-beskz.
    SELECT-OPTIONS bsart FOR ekko-bsart.
    selection-screen:end of block b1.
    INITIALIZATION.
    AT SELECTION-SCREEN ON werks. "Validate for werks
    SELECT SINGLE * FROM t001w WHERE werks IN werks.
    IF sy-subrc 0. MESSAGE e429(mo). ENDIF.
    AT SELECTION-SCREEN ON matnr.
    SELECT SINGLE * FROM mara WHERE matnr IN matnr.
    IF sy-subrc 0. MESSAGE e429(mo).ENDIF.
    START-OF-SELECTION.
    SELECT * FROM marc INTO CORRESPONDING FIELDS OF TABLE itab WHERE werks IN werks AND beskz IN beskz AND
    matnr IN matnr.
    SELECT ebeln FROM ekpo INTO CORRESPONDING FIELDS OF TABLE iekpo
    FOR ALL ENTRIES IN itab WHERE matnr = itab-matnr AND loekz EQ space.
    SELECT ebeln lifnr bedat ekgrp FROM ekko INTO CORRESPONDING FIELDS OF
    TABLE iekko
    FOR ALL ENTRIES IN iekpo WHERE ebeln = iekpo-ebeln AND bsart IN bsart.
    SELECT ebeln menge aedat FROM ekpo INTO CORRESPONDING FIELDS OF iekpo
    FOR ALL ENTRIES IN iekpo WHERE ebeln = iekpo-ebeln. MODIFY iekpo INDEX sy-dbcnt.
    ENDSELECT.
    SORT iekpo BY aedat.
    DELETE ADJACENT DUPLICATES FROM iekpo COMPARING ebeln.
    SELECT wemng FROM eket INTO CORRESPONDING FIELDS OF iekpo FOR ALL ENTRIES IN iekpo WHERE ebeln = iekpo-ebeln.
    MODIFY iekpo INDEX sy-dbcnt.
    ENDSELECT.
    END-OF-SELECTION.
    DATA : file_name TYPE string.
    file_name = 'c:\pay_det\open_po1.xls'.
    DATA : BEGIN OF it_join_fields OCCURS 0,
    field_name(20),
    END OF it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'ebeln'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'menge'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'aedat'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    it_join_fields-field_name = 'wemng'.
    APPEND it_join_fields.
    CLEAR it_join_fields.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    filename = file_name
    filetype = 'ASC'
    APPEND = 'X'
    write_field_separator = 'X'
    TABLES
    data_tab = iekpo
    FIELDNAMES = it_join_fields
    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 iekpo.
    IF iekpo-menge NE iekpo-wemng.
    WRITE:/4 iekpo-ebeln,21 iekpo-menge ,46 iekpo-aedat, 56 iekpo-wemng.
    ENDIF.
    ENDLOOP.
    if sy-subrc 0. write / 'no data exist for this plant'. endif.
    TOP-OF-PAGE.
    uline 1(80).
    WRITE :/ sy-vline, 20 ' OPEN purchase ORDERs report' color 5,
    80 sy-vline.
    uline 1(80).
    WRITE:/ sy-vline , 4 'PURSCHASE ORDER' COLOR COL_HEADING,
    20 sy-vline, 21 'ORDER QUANTITY' COLOR COL_HEADING,
    45 sy-vline, 46 'item change' color col_heading, 55 sy-vline,
    56 'RECIEVED QUANTITY' COLOR COL_HEADING, 80 sy-vline.
    uline 1(80).
    END-OF-PAGE.
    WRITE :/ 'PAGE NUMBER' ,SY-PAGNO.
    Hope this helps you.
    Regards,
    Chandra Sekhar

  • Urgent....!!!

    Dear all,
    Pls let me know diff b/w sy-tabix & sy-index?
    Hoping for your Response...!!!

    hi ,
    1. SY-INDEX is used to describe the number of iteration with in the DO..ENDDO, WHILE ...ENDWHILE....
    SY-TABIX is used to define the iteration with in the internal table like between LOOP AT & ENDLOOP.
    2. SY-TABIX : gives the Current line of an internal table
    example
    SEARCH T FOR 're'.
    READ TABLE T INDEX SY-TABIX.
    SY-INDEX : gives the Number of loop passes.
    example
    DO 5 TIMES.
    WRITE: SY-INDEX.
    ENDDO.
    3. Sy-tabix is used to find the current line in the internal table; it’s a current line index, Table Index. This signifies the number of table index. Each row of a table has certain index or counter. The value of sy-tabix for the last entry would be equivalent to number of table entries.
    SY-INDEX is the number of Iterations for a loop. bascially DO - ENDO .
    SY-INDEX is not equal to SY-TABIX.
    some more info.............
    SY-TABIX:
    Current line in an internal table. With the following statements SY-TABIX is set for index tables. With hashed tables, SY-TABIX is not filled or it is set to 0.
    reagrds,
    venkat.

  • Few doubts

    dear experts
    1. what is the exact difference between sy-tabix and sy-index. explain in detail.
    2.diference between sm36 and sm37.
    3. on which server we exactly do UTP(unit test planning)  what is the procedure.
    thankx
    baleeq

    Hi,
    Here is an example from which you can understand the difference between sy-tabix and sy-index.
    Itab is an internal table with the following data in it.
    id   Name
    198   XYZ
    475   ABC
    545   PQR.
    loop at itab where id > 300.
      write :/ itab-id, itab-name , sy-tabix, sy-index.
    endloop.
    My output will be :
      475 ABC 2 1
      545 PQR 3 2
    Sy-tabix is the index of the record in internal table.
    sy-index gives the no of times of loop passes.
    So, for the first record in the output (475 ABC), 2 is the index of the record in internal table and as it is first time loop pass occured, sy-index value is 1.
    Regards,
    sailaja.

  • Regarding dictionary

    hi,
      can u please tell me how sy-tabix,sy-index works in a loop.what is the difference between them.
    thanks in advance,
    shekar

    Hi Shekar,
    <b>In simple terms.....</b>
    1. Remember SY-TABIX always points to internal table index.
        i.e., when you want to insert,read or delete a record into the internal table,you need this  index and 
    LOOP AT itab.
    ENDLOOP.
    2.SY-INDEX contains the number of loop passes in DO and WHILE loops, including the current loop pass(Ordinary  definition).
    Simple example of a DO loop :
    DO.
    WRITE SY-INDEX.
      IF SY-INDEX = 3.
        EXIT.
      ENDIF.
    ENDDO.
    The output is:
             1          2          3
    The loop is processed three times. Here, the processing passes through the loop three times and then leaves it after the EXIT statement.
    <b>In this second example you know how exactly this SY-INDEX is working in loop include nested loops <b>(VERY IMPORTANT)</b></b>
    Example of two nested loops with the TIMES addition:
    DO 2 TIMES.
      WRITE SY-INDEX.
      SKIP.
      DO 3 TIMES.
        WRITE SY-INDEX.
      ENDDO.
      SKIP.
    ENDDO.
    The output is:
             1
             1          2          3
             2
             1          2          3
    <b>
    Reward all helpful answers</b>
    Regards,
    V.Raghavender.

  • Regarding upload from excel to alv.

    Hi
    here is my code:
    TABLES
    TABLES: ioheader,        " IOC Communication structure
            ioitem,          " IOC Communication structure
            klah,            " Class and Class type
            ksml,            " Characteristic Keys for Class and Type
            cabn,            " Characteristics
            cabnt,           " Characteristic Descriptions
            vbap,            " SAles details
            sscrfields.
    Includes
    INCLUDE rvreuse_global_data.  " ALV Types etc
    DATA - INTERNAL TABLES AND FIELD LISTS
    Types
    TYPE-POOLS: ibco2.           " Characteristic types
    DATA - CONSTANTS
    CONSTANTS: c_true(1)    TYPE c             VALUE 'X',
               c_false(1)   TYPE c             VALUE ' ',
               c_zioheader  TYPE dd02l-tabname VALUE 'ZIOHEADER',
               c_command    TYPE slis_formname VALUE 'USER_COMMAND',
               c_backhoe(7) TYPE c             VALUE 'BACKHOE',
               c_300(3)     TYPE c             VALUE '300',
               c_no_data(7) TYPE c             VALUE 'No Data',
               c_save(1)    TYPE c             VALUE 'A'.
    Internal Tables
    Main IO Table
    DATA: i_header LIKE zioheader OCCURS 0 WITH HEADER LINE.
    Characteristic Values
    DATA: i_config TYPE ibco2_instance_tab2.
    Characteristics Keys
    DATA: BEGIN OF i_imerk OCCURS 0,
            imerk LIKE ksml-imerk,
          END OF i_imerk.
    ALV Grid Control
    DATA: i_grid TYPE sd_alv.
    Catalogues
    DATA: wa_cat LIKE LINE OF i_grid-fieldcat.
    Structures
    Structure for layout variant
    DATA: s_variant LIKE disvariant.
    DATA : filename TYPE string.
    DATA - WORKING VARIABLES
    DATA - FIELD GROUPS
    *field-groups:
    SELECTION SCREEN
    Variant control
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t02.
    PARAMETERS: p_var LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK b1.
    Printer Control
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
    PARAMETERS: rad1 RADIOBUTTON GROUP rad USER-COMMAND radio,
                rad2 RADIOBUTTON GROUP rad,
                rad3 RADIOBUTTON GROUP rad.
    PARAMETER p_floc(128) DEFAULT '/usr/tmp/testfile.dat'
                             LOWER CASE.
    SELECTION-SCREEN END OF BLOCK b3.
    MAIN PROGRAM *************************
    INITIALIZATION.
      PERFORM initialise.             " Set up program defaults
    move 'Report Only' to rad1.
    move 'Export Sequence List' to s_but2.
    move 'Import Sequence List' to S_but3.
    Selection Screen Options
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
      PERFORM get_variant CHANGING p_var.             " ALV Layout
    DATA :   l_no_of_lines TYPE i,
              la_matnr LIKE s_matnr.
    DESCRIBE TABLE s_matnr LINES l_no_of_lines.
    IF l_no_of_lines > 1.
       MESSAGE e000(z1) WITH 'Enter only one product'.
    ENDIF.
    READ TABLE s_matnr INTO la_matnr WITH KEY sign = 'I'
                               option = 'EQ'.
    IF sy-subrc NE 0.
       MESSAGE e000(z1) WITH 'Enter only one product'.
    ENDIF.
    AT SELECTION-SCREEN.
      DATA :   l_no_of_lines TYPE i,
                la_matnr LIKE s_matnr.
      DESCRIBE TABLE s_matnr LINES l_no_of_lines.
      IF l_no_of_lines > 1.
        MESSAGE e000(z1) WITH 'Enter only one product'.
      ENDIF.
    READ TABLE s_matnr INTO la_matnr WITH KEY sign = 'I'
                                option = 'EQ'.
      IF sy-subrc NE 0.
        MESSAGE e000(z1) WITH 'Enter only one product'.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR  p_floc.
    data : pname type syst-repid.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
       PROGRAM_NAME        = pname
       DYNPRO_NUMBER       = SYST-DYNNR
       FIELD_NAME          = 'P_FLOC'
      STATIC              = ' '
      MASK                = ' '
      CHANGING
        FILE_NAME           = p_floc
    EXCEPTIONS
      MASK_TOO_LONG       = 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.
    START-OF-SELECTION.
      PERFORM set_catalogue.          " Set up basic headings from Itab
      PERFORM get_char_keys.          " Get the characteristic keys
      PERFORM modify_catalogue_key.   " Amend headings for char keys
    IOC Logical Database Event
      GET ioheader.
      PERFORM get_subsequent_data.    " Retrieve additional data
    END-OF-SELECTION.
    PERFORM modify_catalogue_title. " Place correct titles for AVL
    PERFORM alv_display.            " Display in ALV Grid
    if rad1 = 'X' .
      PERFORM modify_catalogue_title. " Place correct titles for AVL
      PERFORM alv_display.            " Display in ALV Grid
    elseif rad2 = 'X' .
    *if p_floc is initial .
    MESSAGE e000(z1) WITH
       ' Enter the file location'.
    *else.
       PERFORM download.               " Export sequence list to excel
    PERFORM modify_catalogue_title. " Place correct titles for AVL
      PERFORM alv_display.            " Display in ALV Grid
    *endif.
    elseif rad3 = 'X' .
    if p_floc is initial .
    MESSAGE e000(z1) WITH
        ' Enter the file location'.
    else .
         PERFORM upload.
    endif.
    endif.
    *AT SELECTION-SCREEN OUTPUT.
    *TOP-OF-PAGE.
    *END-OF-PAGE.
    *AT USER-COMMAND.
    perform PF_STATUS_SET.
    SUBROUTINES *******************************
          FORM get_variant                                              *
          Retrieve ALV display variant                                  *
    -->  X_VAR Variant                                                 *
    FORM get_variant CHANGING x_var.
      PERFORM f4_alv_layout(ppio_entry) USING i_grid-program
                                     CHANGING x_var.
    ENDFORM.
          FORM get_subsequent_data                                      *
          Retrieve additional data and place into I_HEADER Itab         *
    FORM get_subsequent_data.
    Prime extended table
      i_header = ioheader.
      PERFORM get_serial_number. " Get Sales Order Serial No
      PERFORM get_char_values.   " Get Characteristic Values
      PERFORM build_char_entries." Put Char Values into I_HEADER
    Add to extended table
      APPEND i_header.
    ENDFORM.
          FORM get_serial_number                                        *
          Retrieve the serial number                                    *
    FORM get_serial_number.
      SELECT SINGLE zuonr submi
        INTO (i_header-zuonr,i_header-submi)
        FROM vbak
       WHERE vbeln EQ i_header-kdauf_aufk.
    ENDFORM.
          FORM get_char_values                                          *
          Retrieve the characteristic values for the production order   *
    FORM get_char_values.
    Get Ready
      REFRESH i_config.
    Get Object key
      SELECT SINGLE cuobj
      FROM vbap
      INTO vbap-cuobj
      WHERE vbeln EQ i_header-kdauf_aufk
        AND matnr EQ i_header-plnbez.
    Get characteristic config values
      CALL FUNCTION 'CUCB_GET_CONFIGURATION'
           EXPORTING
                instance                     = vbap-cuobj
           IMPORTING
                configuration                = i_config
           EXCEPTIONS
                invalid_input                = 1
                invalid_instance             = 2
                instance_is_a_classification = 3
                OTHERS                       = 4.
    Not found, no config values will be pulled through
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.
          FORM build_char_entries                                       *
          For each character value. Find the relevent "slot" in the     *
          table by checking the characteristic key against the catalogue*
          stored key
    FORM build_char_entries.
      DATA: la_config LIKE LINE OF i_config,       " i_config header line
            li_values TYPE ibvalue0 OCCURS 0,      " Charact'ic Values Itab
            la_values LIKE LINE OF li_values,      " li_values header line
            l_atwrt LIKE la_values-atwrt,          " Characteristic Value
            l_atinn LIKE la_values-atinn,          " Characteristic Key
            l_key(20),                             " Working built key
            l_entry(20),                           " FieldName to be updated
            l_len LIKE sy-tabix,                   " Length of string
            l_tabix LIKE sy-tabix.                 " Index position of Itab
      FIELD-SYMBOLS: <f_field>.       " This will be the field to update
    Loop on characteristics
      LOOP AT i_config INTO la_config.
    Extract the characteristic values imbedded table
        MOVE la_config-values TO li_values.
    Loop on the characteristics values
        LOOP AT li_values INTO la_values.
    We now have the charecteristic key la_values-atinn
    and the value in la_values-atwrt. However, there may be
    Multiple values for key la_values-atinn
    So if they are the same append to one long string.
    Is it a new value
          IF la_values-atinn EQ l_atinn.
            CONCATENATE l_atwrt '|' la_values-atwrt INTO l_atwrt.
            CONTINUE.
          ENDIF.
    New Value (and not first pass) so save built values
          IF NOT l_atinn IS INITIAL.
    Find the correct field to place the value in.
    This is done by finding the Itab field description in the AVL display
    field Catalogue called "No Data|nnnnnn" where nnnn is the
    characteristic Key
    Build the key
            CONCATENATE c_no_data '|' l_atinn INTO l_key.
    Loop till we find it. This gives us the field name
            LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l = l_key.
    Set up the field name to be amended
              CONCATENATE wa_cat-tabname '-' wa_cat-fieldname INTO l_entry.
              ASSIGN (l_entry) TO <f_field>.
    Update field with the Char value
              MOVE l_atwrt TO <f_field>.
    No need to continue this loop
              EXIT.
            ENDLOOP.
          ENDIF.
    Prime for next value
          l_atinn = la_values-atinn.
          l_atwrt = la_values-atwrt.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.
          FORM alv_display                                              *
          Display data in ALV grid                                      *
    FORM alv_display.
    Set up Variant
      i_grid-variant-variant = p_var.     " Variant
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
        i_callback_program             = i_grid-program
       I_CALLBACK_PF_STATUS_SET       =  i_grid-pf_status_set
        i_callback_user_command        = i_grid-user_command
      i_structure_name               = i_grid-structure
      is_layout                      = i_grid-layout
        it_fieldcat                    = i_grid-fieldcat
      IT_EXCLUDING                   = i_grid-excluding
      IT_SPECIAL_GROUPS              = i_grid-special_groups
      IT_SORT                        = i_grid-sort
      IT_FILTER                      = i_grid-filter
      IS_SEL_HIDE                    = i_grid-sel_hide
      I_DEFAULT                      = i_grid-default
        i_save                         = I_grid-save
        is_variant                     = i_grid-variant
      IT_EVENTS                      = i_grid-events
      IT_EVENT_EXIT                  = i_grid-event_exit
      IS_PRINT                       = i_grid-print
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = i_grid-start_column
      I_SCREEN_START_LINE            = i_grid-start_line
      I_SCREEN_END_COLUMN            = i_grid-end_column
      I_SCREEN_END_LINE              = i_grid-end_line
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        = i_grid-exit
      ES_EXIT_CAUSED_BY_USER         = i_grid-user_exit
        TABLES
         t_outtab                      = i_header
       EXCEPTIONS
        program_error                  = 1
        OTHERS                         = 2.
    ALV Failed.
      IF sy-subrc <> 0.
        WRITE: / 'Failed with',sy-subrc.
      ENDIF.
    ENDFORM.
          FORM initialise                                               *
          Set up basic report details                                   *
    FORM initialise.
    ALV controls
      i_grid-program = sy-repid.          " Program Name
      i_grid-user_command = c_command.    " ALV user FORM
      i_grid-save = c_save.               " Save Options
    ALV Variant Details for saved report layouts
      i_grid-variant-report = i_grid-program.
      i_grid-variant-username = sy-uname.
    ENDFORM.
          FORM user_command                                             *
          Routine called by ALV                                         *
    -->  X_UCOMM    Function selected                                  *
    -->  X_SELFIELD Selection field Itab                               *
    FORM user_command USING x_ucomm    LIKE sy-ucomm
                            x_selfield TYPE slis_selfield.
      DATA: l_answer(1).        " Answer returned from popup box
    Only allow drill down on Order number
      CHECK x_selfield-fieldname = 'AUFNR'.
    Get option for display or modify
      CALL FUNCTION 'POPUP_TO_DECIDE'
           EXPORTING
                textline1    = 'Please Choose'
                text_option1 = 'Display'
                text_option2 = 'Modify'
                titel        = 'Production Order'
           IMPORTING
                answer       = l_answer.
    Did they cancel
      CHECK l_answer NE 'A'.
    Set up parameters.
      SET PARAMETER ID 'ANR' FIELD x_selfield-value.
    Display
      IF l_answer = '1'.
        CALL TRANSACTION 'CO03' AND SKIP FIRST SCREEN.
    Modify
      ELSEIF l_answer = '2'.
        CALL TRANSACTION 'CO02' AND SKIP FIRST SCREEN.
      ENDIF.
    *IF rad2 = 'X'.
    If sy-ucomm ='%PC'.
    IF sy-subrc <> 0.
        WRITE: / 'Failed with',sy-subrc.
      else.
      CALL FUNCTION 'POPUP_TO_INFORM'
        EXPORTING
          TITEL         = 'File Transfer Status'
          TXT1          = 'File transfered to location:'
          TXT2          = filename
        TXT3          = ' '
        TXT4          = ' '
        ENDIF.
    endif.
    ENDFORM.
          FORM set_catalogue                                            *
          Retrieve the title and field information from the             *
          Data Dictionary. This will then be amended to the correct     *
          Characteristic titles during the end-of-selection event       *
    FORM set_catalogue.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name         = i_grid-program
                i_internal_tabname     = 'I_HEADER'
                i_structure_name       = c_zioheader
                i_client_never_display = 'X'
           CHANGING
                ct_fieldcat            = i_grid-fieldcat.
    ENDFORM.
          FORM get_char_keys                                            *
          Retrieve the list of characteristic keys                      *
          template of BACKHOE class 300                                 *
    FORM get_char_keys.
      DATA : la_inob TYPE inob.
      SELECT SINGLE * FROM inob INTO la_inob
                     WHERE objek = s_matnr-low.
      IF sy-subrc NE 0.
        MESSAGE e000(z1) WITH
        ' Could not get INOB table for ' s_matnr-low.
      ENDIF.
    Get Major Object key
      SELECT SINGLE clint
        FROM klah
        INTO klah-clint
       WHERE klart = la_inob-klart
         AND class = s_matnr-low.
      IF sy-subrc NE 0.
        MESSAGE e001(z296) WITH c_backhoe c_300.
      ENDIF.
    Use Major key to retrieve Characteristics keys
    This is the template for the headings
      SELECT imerk
        FROM ksml
        INTO TABLE i_imerk
       WHERE clint EQ klah-clint    " Objct Key
         AND lkenz EQ space         " Delete Indicator
         AND datuv LE sy-datum.     " Validity to
      IF sy-subrc NE 0.
        MESSAGE e002(z296) WITH klah-clint.
      ENDIF.
    ENDFORM.
          FORM modify_catalogue_key                                     *
          Change the default "No Data" titles with the characteristic   *
          key values in the form "No Data|nnnnnnn" where nnnnnn is      *
          the characteristic key. This is used as a method of allocating*
          characteristic values to the I_HEADER Itab positions          *
          CHAR_001 to CHAR_100                                          *
    FORM modify_catalogue_key.
      DATA: l_index LIKE sy-tabix,              " Table Index for Read
            l_tabix LIKE sy-tabix,              " Table Index Position
            l_seltext_l LIKE dd03p-scrtext_l.   " Heading Text
    Get into Key Sequence
      SORT i_imerk.
    Loop on catalogue for dummy titles
      LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l(7) = c_no_data.
        l_tabix = sy-tabix.
    Get the next characteristic
        l_index = l_index + 1.
        READ TABLE i_imerk INDEX l_index.
    No Characteristic, No display
        IF sy-subrc NE 0.
          wa_cat-no_out = c_true.
          wa_cat-tech = c_true.
          MODIFY i_grid-fieldcat FROM wa_cat INDEX l_tabix.
          CONTINUE.
        ENDIF.
    Place the char key against the "No Data" title
    so that later we know what values to place against the keys
    the title will become "No Data:nnnnnnnnnn" (nnn = Key)
        CONCATENATE c_no_data '|' i_imerk-imerk INTO wa_cat-seltext_l.
        MODIFY i_grid-fieldcat FROM wa_cat INDEX l_tabix.
      ENDLOOP.
    ENDFORM.
          FORM modify_catalogue_title                                   *
          At this stage the catalogue titles for the characteristics    *
          are in the form "No Data|nnnnn" Where nnnn is the             *
          characteristic key. Using the Key, replace this text with     *
          the real characteristic title
    FORM modify_catalogue_title.
      DATA: l_key(20),                 " Characteristic Key in Alpha form
            l_len LIKE sy-tabix.       " Length of string
    Loop on the characteristic keys
      LOOP AT i_imerk.
    Get the real title
        SELECT SINGLE atbez
          FROM cabnt
          INTO cabnt-atbez
         WHERE atinn EQ i_imerk-imerk.
    Not found, leave alone
        CHECK sy-subrc EQ 0.
    Place key into char form for comparison in loop
        l_key = i_imerk-imerk.
    Now loop on the catalogue to get the key
        LOOP AT i_grid-fieldcat INTO wa_cat WHERE seltext_l+8 = l_key.
    Place the title into the catalogue
          wa_cat-seltext_l = cabnt-atbez.
          wa_cat-seltext_m = cabnt-atbez.
          wa_cat-seltext_s = cabnt-atbez.
          wa_cat-reptext_ddic = cabnt-atbez.
    And update
          MODIFY i_grid-fieldcat FROM wa_cat.
        ENDLOOP.
      ENDLOOP.
    IF rad2 = 'X'.
    LOOP AT i_grid-fieldcat INTO wa_cat.
    *IF wa_cat-fieldname = 'AUFNR'.
    *wa_cat-col_pos = '10'.
    *endif.
    case wa_cat-fieldname.
    when 'AUFNR'.
    wa_cat-fix_column = 'X'.
    when 'CY_SEQNR'.
    wa_cat-fix_column = 'X'.
    when 'ZOUNR'.
    wa_cat-fix_column = 'X'.
    when 'GLTRP'.
    wa_cat-fix_column = 'X'.
    when 'SUBMI'.
    wa_cat-fix_column = 'X'.
    endcase.
    modify  i_grid-fieldcat FROM wa_cat.
    endloop.
    endif.
    ENDFORM.
    *SELECT z099seqno z099heading
          INTO table i_header
          FROM z099 join z100 ON
          z099seqno = z100seqno WHERE
    z100~product = s_matnr.
    *&      Form  download
          Download file to excel
    *FORM download.
    *filename = p_floc .
    *CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  =
       FILENAME                      = filename
       FILETYPE                      = 'ASC'
       APPEND                        = 'X'
      WRITE_FIELD_SEPARATOR         = ','
      HEADER                        = 'l_seltext_l'
      TRUNC_TRAILING_BLANKS         = ' '
      WRITE_LF                      = 'X'
      COL_SELECT                    = ' '
      COL_SELECT_MASK               = ' '
      DAT_MODE                      = ' '
    IMPORTING
      FILELENGTH                    =
    TABLES
       DATA_TAB                      = i_header
    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.
       WRITE: / 'Failed with',sy-subrc.
    else.
    CALL FUNCTION 'POPUP_TO_INFORM'
       EXPORTING
         TITEL         = 'File Transfer Status'
         TXT1          = 'File transfered to location:'
         TXT2          = filename
        TXT3          = ' '
        TXT4          = ' '
       ENDIF.
    *ENDFORM.                    " download
    *&      Form  upload
          text
    -->  p1        text
    <--  p2        text
    FORM upload.
    *DATA : i_upload TYPE STANDARD TABLE OF alsmex_tabline.
    **data : i_upload like zioheader occurs 0 with header line.
    data file like RLGRAP-FILENAME.
    file = p_floc .
    DATA: BEGIN OF i_upload OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF i_upload.
    DATA: BEGIN OF i_upload1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF i_upload1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    DATA: tind(4) TYPE n.
    FIELD-SYMBOLS: <fs1>.
    DATA: zwfeld(19).
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      EXPORTING
        FILENAME                      = file
        I_BEGIN_COL                   = '1'
        I_BEGIN_ROW                   = '1'
        I_END_COL                     = '200'
        I_END_ROW                     = '6500'
      TABLES
        INTERN                        = i_upload.
    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 i_upload.
        i_upload1 = i_upload.
        CLEAR i_upload1-row.
        APPEND i_upload1.
      ENDLOOP.
      SORT i_upload1 BY col.
      LOOP AT i_upload1.
        AT NEW col.
          t_col-col = i_upload1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( i_upload1-value ).
        READ TABLE t_col WITH KEY col = i_upload1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
                             Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT i_upload BY row col.
    IF kzheader = 'X'.
        LOOP AT i_upload.
          fieldnames-title = i_upload-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
    ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
    ENDIF.
      SORT i_upload BY row col.
      LOOP AT i_upload.
       IF kzheader = 'X'
        i_upload-row = 1.
          CONTINUE.
       ENDIF.
        tind = i_upload-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = i_upload-value.
        AT END OF row.
          APPEND i_upload.
          CLEAR i_upload.
        ENDAT.
      ENDLOOP.
    if sy-subrc = 0.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                =
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = i_grid-program
      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                         =
       IT_FIELDCAT                       = i_grid-fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = i_save
       IS_VARIANT                        = i_grid-variant
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_ADD_FIELDCAT                   =
      IT_HYPERLINK                      =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = i_upload.
    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.
    endif.
    when i execute the program i am getting a short dump
    GETWA_NOT_ASSIGNED
    what might be the problem.
    this is a very urgent question.
    pls suggest me the clear way to over come this problem.

    HI
    use this code for uploading the excel file to internal table....
    data: begin of itab_string occurs 0,
          record type char255,
          end of itab_string.
    data:  L_FILETABLE TYPE FILETABLE,
    L_FILETAB_H TYPE FILETABLE WITH HEADER LINE.
    data: p_file1 type string.
    selection screen .
    PARAMETERS: P_FILE TYPE LOCALFILE.
    initialization.
    at selection-screen on value-request for P_FILE.
    IF THE USER SELECT EXTENTION BUTTON IT WILL OPEN THE LOCAL DIRECTORY FOR SELECTING THE FILE LOCATION.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    EXPORTING
       WINDOW_TITLE            =
       DEFAULT_EXTENSION       = 'CSV'
       DEFAULT_FILENAME        = 'C:\Documents and Settings\196093\Desktop\STATUS.csv'
       FILE_FILTER             =
       INITIAL_DIRECTORY        = 'C:\Documents and Settings\196093\Desktop\'
       MULTISELECTION          =
       WITH_ENCODING           =
      CHANGING
        FILE_TABLE              = L_FILETABLE
        RC                      = RC
       USER_ACTION             =
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF SY-SUBRC <> 0.
    ELSE.
    LOOP AT l_filetable INTO L_FILETAB_H.
    P_FILE = L_FILETAB_H-FILENAME.
    move p_file to p_file1.
    EXIT.
    ENDLOOP.
    ENDIF.
    passing the selected file name to gui_upload for loading the data
    into internal table
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = p_file1
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = itab_string
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE I000(Z00) WITH 'PLEASE PROVIDE CORRECT FILE NAME'.
    ENDIF.
    reward points to all helpful answers
    kiran.M

Maybe you are looking for

  • Creation of new object link for DMS

    i have searched a lot  about Creation of new object link for DMS on internet . and all replies  focus on that documentation : 1.     Program two screens for the following module pools for the SAP object that is to be linked additionally: u2013 SAPLCV

  • Disconnecting built-in monitor - will external VGA allow higher resolution?

    I want to connect an external monitor to an iMac 17" FP G4. I was told that if I disconnect the built-in monitor (on the logic board), then I can get more than 1024x768 on the external mini-VGA port. I'm hoping that someone in the forums has done thi

  • Table where attachments are stored....

    Hi, I have created an attachment table for attaching the files to a particular entity. However I am not abel to find the tabel where these attachments are stored in the database??? :(( Need some assistance on this... Regards Jujaar Singh

  • Can't Install Photoshop CS6 Trial?

    Hello, I'm having trouble installing the trial mode for Photoshop CS6. I have already logged in through the installer then clicked the download link again, but it asks me to log in again (the installer) instead of installing it. Please help me out! T

  • No sound on my hp pavilion pc

    i have no sound whatsoever on my hp pavilion pc, i think the product code is "Pavilion p7-1235" i have tried many other solutions online and on other forums however none of them have worked. All my speakers and audio devices are plugged in correctly