Count of Data in the Internal Table

I have a internal table which has a field 'X'.
Now in this internal table i have couple of values with field 'X' as a key field.
I want the count of the rows against the key field.
For eg
Row   Field 'X'
1          A
2          A
3          A
4          B
5          B
6          C
Count of A = 3
Count of B = 2
Count of C = 1

loop at itab into is.
case is-f_x.
  when  'A'.
   c_a = c_a + 1.
  when 'B'.
   C_b = c_b + 1.
  when 'C'.
   c_c = c_c + 1.
endloop.
write /  : c_a, c_b, c_b.
c_a, c_b,c_c are type I.

Similar Messages

  • Validate the data in the internal table with the date in selection screen

    Hi all,
    I want to validate the data in the internal table and get only the records with the input date in the selection screen.
    The date is in the select options and please let me know how to get the records only if it satisfies the input date in the selection screen.
    Regards,
    Shalem

    For Ex.
    SELECT-OPTIONS: S_DATE FOR VBAK-VDATU
    If you want to read one INTERNAL TABLE record
    READ TABLE it_tab(internal table name) WHERE vdatu(date field name in the internal table) = s_date
    If you want to move more then one
    LOOP AT it_tab WHERE vdatu = s_date.
    Take the field values in another table and append it. then end loop.
    you will get the records which only have the date in select option..
    If you want detail code give me internal table name and select option name i will write you the code.
    regards
    Yuvaram

  • How to fetch the data to the internal table with out using mandt

    Hi all,
    Iam giving my code please observer... and give me the reasonable solution.
      t_mar LIKE STANDARD TABLE OF z_mar.
    SELECT  mandt
             werks                         " Plant
             lifnr                         " Vendor
        FROM z_mar
        INTO TABLE t_mar
    where sal = 2000.
    By removing MANDT from select query, it is going to dump.
    ex:
       SELECT 
              werks                         " Plant
              lifnr                         " Vendor
         FROM z_mar
         INTO TABLE t_mar
    where sal = 2000.
    > Now it is going to dump ( here i removed the mandt field ).
    Please give me a solution to fetch the data by removing mandt in select statement, with out chaning the internal table structure.
    Thanks,
    Ravi

    hi Ravi,
    i also had to avoid move-corresponding and the following is what i did...its extra work and goes around but it will
    do the needed work..............
    t_mar LIKE STANDARD TABLE OF z_mar.
    SELECT *
    FROM z_mar
    INTO TABLE t_mar
    where sal = 2000.
    the above gets you all the fields ...but if you still want to narrow it down to just two fields
    *****Declaring structure with 2 fields
    data:begin of fs_data.
    data:werks type z_mar-werks,
         lifnr type z_mar-lifnr ,
    data:end of fs_data.
    *******internal table of above
    data:int_data like fs_data occurs 0 with headerline.
    *****moving the only 2 required fields
    loop at t_mar.
    t_mar-werks  = int_data-werks.
    t_mar-lifnr  = int_data-lifnr.
    append int_data.
    endloop.
    Hope you found it useful...
    Regards
    Bx

  • Arranging the data in the internal table

    Hi all,
    I have data in my internal table in the fol format:
    PO number     Vendor Invoice no      Header total
    1000                122                            400
    1000                123                            500
    1001                125                            100
    1001                125                             100
    2001                126                             101
    2001                128                             102
    Now i need to arrange the data in the foll format and recalculate the total for every same  PO based on the different vendor invoice no as follows:
    PO number     Vendor Invoice no      Header total
    1000                122                            900
    1000                123                            900
    1001                125                             100
    2001                126                             203
    2001                128                             203
    As can be seen in the above table,the totals needs to be added for each PO with different vendor invoice no.
    Can someone explain me with sample code how to achieve the above?
    Thanks.

    >
    srm_tech wrote:
    PO number     Vendor Invoice no      Header total
    1000                122              400
    1000                123              500
    1001                125              100
    1001                125              100
    2001                126              101
    2001                128              102
    > Now i need to arrange the data in the foll format and recalculate the total for every same  PO based on the different vendor invoice no as follows:
    PO number     Vendor Invoice no      Header total
    1000                122              900 " Here you are getting 400 + 500 But Vendor Invoice is different ?
    1000                123              900
    1001                125              100 " Here when Both where Same PO Number and Vendor Invoice you are neglecting On Record ?
    2001                126              203 " Here you are getting 101 + 102 But Vendor Invoice is different ?
    2001                128              203
    Hi, Srm
    as i mention above i think your given example is wrong please check and explain about it.
    You can check for COLLECT and AT END OF with SUM in it These can Solve out your problem after a Little Search in the forum with these two key words:)
    Please Check and Reply Back if you requirements are rely like this.
    Faisal

  • Counting of values in the internal table.

    Hi experts,
                 kindly give the logic.
    i have 2 internal table, i_itab and itab2 and itab3. itab consists of different categorie form table "pa0233" say A,B,C.
    ITAB2 consists of gender frm pa0002 say F or M. itab3 contains no.of trainees.i have requirement to see for a particular categorie say A for which how many f has belongs to ... ie. my output should get.
    categorie  gender    no.of. trainees(total no. of trainees belongs to particular categorie for particular gender)
       A       -      f          -         7
       B       -       f           -        9
       A       -       m         -        16
       B       -        m         -       21
    Thanks,
    Priya.
    Edited by: Priyadharshini Veluswamy on Sep 17, 2008 9:03 AM

    Hi,
       Please find the code below I have framed it, as per my understanding of your requirement. Hope you will get valuable help to sove your problem from code below.
    REPORT  Z_COMP.
    data: begin of itab1 occurs 0,
          f1 type c,
          f2 type c,
          end of itab1.
    data: begin of itab2 occurs 0,
          f1 type c,
          *** type c,
          end of itab2.
    data: v_count1 type i,
          v_count2 type i.
    data: begin of itab3 occurs 0,
          f1 type c,
          *** type c,
          count type i,
          end of itab3.
    itab1-f1 = 'A'.
    itab1-f2 = 'Z'.
    append itab1.
    clear itab1.
    itab1-f1 = 'B'.
    itab1-f2 = 'Z'.
    append itab1.
    clear itab1.
    itab1-f1 = 'C'.
    itab1-f2 = 'Z'.
    append itab1.
    clear itab1.
    itab2-f1 = 'A'.
    itab2-*** = 'M'.
    append itab2.
    clear itab2.
    itab2-f1 = 'A'.
    itab2-*** = 'F'.
    append itab2.
    clear itab2.
    itab2-f1 = 'A'.
    itab2-*** = 'F'.
    append itab2.
    clear itab2.
    itab2-f1 = 'B'.
    itab2-*** = 'M'.
    append itab2.
    clear itab2.
    itab2-f1 = 'B'.
    itab2-*** = 'F'.
    append itab2.
    clear itab2.
    itab2-f1 = 'B'.
    itab2-*** = 'F'.
    append itab2.
    clear itab2.
    itab2-f1 = 'C'.
    itab2-*** = 'M'.
    append itab2.
    clear itab2.
    itab2-f1 = 'C'.
    itab2-*** = 'F'.
    append itab2.
    clear itab2.
    loop at itab1.
    clear v_count1.
    clear v_count2.
    AT NEW F1.
    loop at itab2 where f1 eq itab1-f1.
    if itab2-*** = 'F'.
    v_count1 = v_count1 + 1.
    else.
    v_count2 = v_count2 + 1.
    endif.
    endloop.
    itab3-f1 = itab1-f1.
    itab3-*** = 'F'.
    itab3-count = v_count1.
    append itab3.
    itab3-f1 = itab1-f1.
    itab3-*** = 'M'.
    itab3-count = v_count2.
    append itab3.
    ENDAT.
    ENDLOOP.
    loop at itab3.
    write:/ itab3-f1,
            itab3-***,
            itab3-count.
    endloop.
    With best wishes,
    Murthy.

  • Regarding spliting of the data in the internal table fields

    TYPES :BEGIN OF X_flat_file,
           banks LIKE lfbk-banks,
           bankl LIKE lfbk-bankl,
           bankn LIKE lfbk-bankn,
           koinh LIKE lfbk-koinh,
           bkont LIKE lfbk-bkont,
           END OF X_flat_file.
    DATA: t_itab TYPE STANDARD TABLE OF X_flat_file INITIAL SIZE 0,
          wa_itab TYPE X_flat_file,
    Now data in internal table is as follows:
    t_itab-banks is AD,DE, AB
    t_itab-bankl is 123456578,123456588,123456579
    t_itab-bankn is 12345666,12345677,12345688
    t_itab-koinh is vinod1,vinod2,vinod3
    t_itab-bkont is 01,01,01
    TYPES :BEGIN OF X_banks1,
           banks LIKE lfbk-banks,
           bankl LIKE lfbk-bankl,
           bankn LIKE lfbk-bankn,
           koinh LIKE lfbk-koinh,
           bkont LIKE lfbk-bkont,
           END OF X_banks1.
    DATA: T_BANKS1 TYPE STANDARD TABLE OF X_BANKS1 INITIAL SIZE 0,
          WA_BANKS1 TYPE X_BANKS1,
    Now i want internal table t_itab data should split at commas and transfered to internal table t_banks1.
    ex : t_itab-banks is AD,DE, AB should transfered to
    t_banks:   AD  ( 1 record)
                   DE  (2 record)
                   AB ( 3 record).
    I used following coding ......
       SPLIT wa_itab-BANKS AT ',' INTO  T_BANKS1-BANKS.
         SPLIT wa_itab-BANKL AT ',' INTO TABLE T_BANKS1-BANKL.
         SPLIT wa_itab-BANKN AT ',' INTO TABLE T_BANKS1-BANKN.
         SPLIT wa_itab-KOINH AT ',' INTO TABLE T_banks1-KOINH.
         SPLIT wa_itab-BKONT AT ',' INTO TABLE T_BANKS1-BKONT.
         SPLIT wa_itab-BANKA AT ',' INTO TABLE T_BANKA1-BANKA.
    But its not working.

    Dear Sarvesh,
    I have closed all the previous threads and only this one is open.
    My coding is like this.
    DATA:X(2),N(2) TYPE N.
    N = 0.
    LOOP AT T_BANKS INTO WA_BANKS.
    N = N + 1.
    ENDLOOP.
    X = 1.
    perform bdc_dynpro using 'SAPMF02K' '0130' 'X'.
    CNT = 1.
    DO N TIMES.
    IF CNT > 5.
    perform bdc_field using 'BDC_OKCODE' '=P+'. "*LOGIC FOR EXTENDING TABLE CONTROL
    perform bdc_field using 'BDC_OKCODE' '/00'.
    perform bdc_field using 'BDC_CURSOR' 'BANKNAM(01)'.
    CNT = 1.
    ENDIF.
    LOOP AT T_BANKS INTO WA_BANKS FROM X TO X.
    CONCATENATE 'LFBK-BANKS(' CNT ')' INTO FLD.
    perform bdc_field using FLD wa_BANKS-BANKS.
    ENDLOOP.
    LOOP AT T_BANKL INTO WA_BANKL FROM X TO X.
    CONCATENATE 'LFBK-BANKL(' CNT ')' INTO FLD.
    perform bdc_field using FLD wa_BANKL-BANKL.
    ENDLOOP.
    LOOP AT T_BANKN INTO WA_BANKN FROM X TO X.
    CONCATENATE 'LFBK-BANKN(' CNT ')' INTO FLD.
    perform bdc_field using FLD wa_BANKN-BANKN.
    ENDLOOP.
    LOOP AT T_KOINH INTO WA_KOINH FROM X TO X.
    CONCATENATE 'LFBK-KOINH(' CNT ')' INTO FLD.
    perform bdc_field using FLD wa_KOINH-KOINH.
    ENDLOOP.
    LOOP AT T_BKONT INTO WA_BKONT FROM X TO X.
    CONCATENATE 'LFBK-BKONT(' CNT ')' INTO FLD.
    perform bdc_field using FLD wa_BKONT-BKONT.
    ENDLOOP.
    perform bdc_field using 'BDC_CURSOR' 'LFBK-bkont'.
    perform bdc_field using 'BDC_OKCODE' '=BANK'.
    perform bdc_dynpro using 'SAPLBANK' '0100' 'X'.
    LOOP AT T_BANKA INTO WA_BANKA FROM X TO X.
    CONCATENATE 'BNKA-BANKA(' CNT ')' INTO FLD.
    perform bdc_field using FLD wa_BANKA-BANKA.
    ENDLOOP.
    perform bdc_field using 'BDC_CURSOR' 'BNKA-BANKA'.
    perform bdc_field using 'BDC_OKCODE' '=ENTR'.
    CNT = CNT + 1.
    X = X + 1.
    ENDDO.
    My problem is that first table control data is getting loaded in the table fields BANKS, BANKL, BANKN, KOINH, BKONT . But next screen ('SAPLBANK' '0100' 'X'.) is not getting called and BANKA data is not getting filled..
    Pls help.
    As per the recording, first BANKS, BANKL, BANKN, KOINH, BKONT table control data should be filled and next screen should be called and then BANKA  data should be filled and again cursor should come back to screen ('SAPMF02K' '0130' 'X'.).
    similarly second table control data.

  • How to pass the data of the dynamic table into internal table

    Hi all,
    I had designed an Dynamic table in my Online Interactive form.
    I am able to pass only the First row data into the internal table which i had created
    Now how can i pass  data of all the rows  into the  internal table.
    Needed some coding help
    Thanks
    Ajay

    Hello Ajay,
    If you have dynamic table in adobe and you want to capture all the added rows then you need to add corresponding element in the node bound to that table ui.
    when u add a row using java script in adobe form there is no corresponding element created in the backend that is ur wd node bound to the table ui. and so u only get 1 row of data back.
    try this,
    create a button in your view holding adobe form say "add rows" and on click of this button write the code to add one more element to the node bound to ur table ui of adobe form. when server side rendering occurs it will recreate the table in adobe with added row in the node and you will be able to get the data entered by user.
    Thanks,
    Abhishek

  • Passing data to different internal tables with different columns from a comma delimited file

    Hi,
    I have a program wherein we upload a comma delimited file and based on the region( we have drop down in the selection screen to pick the region).  Based on the region, the data from the file is passed to internal table. For region A, we have 10 columns and for region B we have 9 columns.
    There is a split statement (split at comma) used to break the data into different columns.
    I need to add hard error messages if the no. of columns in the uploaded file are incorrect. For example, if the uploaded file is of type region A, then the uploaded file should be split into 10 columns. If the file contains lesser or more columns thenan error message should be added. Similar is the case with region B.
    I do not want to remove the existing split statement(existing code). Is there a way I can exactly pass the data into the internal table accurately? I have gone through some posts where in they have made use of the method cl_alv_table_create=>create_dynamic_table by passing the field catalog. But I cannot use this as I have two different internal tables to be populated based on the region. Appreciate help on this.
    Thanks,
    Pavan

    Hi Abhishek,
    I have no issues with the rows. I have a file with format like a1,b1,c1,d1,e1, the file should be uploaded and split at comma. So far its fine. After this, if the file is related to region A say Asia, then it should have 5 fields( as an example). So, all the 5 values a1,b1..e1 will be passed to 5 fields of itab1.
    I also have region B( say Europe)  whose file will have only 4 fields. So, file is of the form a2,b2,c2,d2. Again data is split at comma and passed to itab2.
    If some one loads file related to Asia and the file has only 4 fields  then the data would be incorrect. Similar is the case when someone tries to load Europe file with 5 fields related data. To avoid this, I want to validate the data uploaded. For this, I want to count the no. of fields (seperated by comma). If no. of fields is 5 then the file is related to Asia or if no. of fields is 4 then it is Europe file.
    Well, the no. of commas is nothing but no. of fields - 1. If the file is of the form a1,b1..e1 then I can say like if no. of commas = 4 then it is File Asia.But I am not sure how to write a code for this.Please advise.
    Thanks,
    Pavan

  • Select data into deep internal table

    Dear Experts.
    I created a dynamiv deep internal table.
    while selecting data , into the internal table it is giving a dump. saying that deep structure.
    SELECT OBJTY OBJID ARBPL WERKS from crhd
    INTO CORRESPONDING FIELDS OF TABLE <f_tab>
    where WERKS = pr_werks.
    I used the field catalog also.even same error is comming.
    how to get data into deep internal table by select statement.
    Please help me,
    Regards,
    Rahul

    HI,
    Try creating dynamic internal table like:
    Field-symbols: <dyn_table> type standard table,
                                 <dyn_wa>   ,
                                 <dyn_field>.
      Data: dy_table      type ref to data,
                ifc                  type lvc_t_fcat ,
                xfc                 type lvc_s_fcat ,
               Count             type i          ,
               Count1           type i          ,
               Index              type i          ,
               dy_line           type ref to data.
             Data counter   type i.
      Data: line   type string       ,
                List    like table of line.
      Data: idetails           type abap_compdescr_tab,
                   xdetails           type abap_compdescr    .
      Data: ref_table_des type ref to cl_abap_structdescr.
    *Looping at field cat internal table to populate another field cat to be passed
    * In method used below for creating final dynamic internal table
      Loop at fieldcat into fieldcat1.
        Clear xfc.
           Xfc-fieldname            = fieldcat1-fieldname.
           Xfc-datatype              = fieldcat1-datatype.
           Xfc-intlen                    = fieldcat1-intlen.
         Append xfc            to ifc.
      endloop.
    Clear fieldcat1.
    *Method called to create dynamic internal table on the basis of field catalog created above
      Call method cl_alv_table_create=>create_dynamic_table
        Exporting
          it_fieldcatalog = ifc                     u201Cfield catalog appended above
        Importing
          ep_table        = dy_table.            u201CDynamic internal table which will be created
      Assign dy_table->* to <dyn_table>.
    *Create dynamic work area and assign to FS
      Create data dy_line like line of <dyn_table>.
      Assign dy_line->* to <dyn_wa>.
    Then use this dynamic internal table created from above method
    in the Select Query.
    Hope it helps
    Regards
    Mansi

  • How to get data  from an internal table in some other program

    I would like to get data from the internal table in the other program. When I using FM "LIST_FROM_MEMORY" to get the data, it doesn't work and the exception is not fount.
    If any special code need in the other program, like write data to memory .
    Many thx .
    From Ross Wang

    Hi
    <li>You need to have interaction if you want to use EXPORT/IMPORT statments.
    <li>The internal tables in both programs must be same
    <li>Program one ..Calling program
    REPORT ZTEST_NOTEPAD.
    DATA: BEGIN OF it_t001 OCCURS 0,
            bukrs TYPE t001-bukrs,
            butxt TYPE t001-butxt,
          END OF it_t001.
    START-OF-SELECTION.
      SUBMIT ztest_notepad1 AND RETURN.
      IMPORT it_t001 FROM MEMORY ID 'ZTEST_T100'.
      LOOP AT it_t001.
        WRITE:/ it_t001.
      ENDLOOP.
    <li>Program two ...Called program
    REPORT ztest_notepad1.
    DATA: BEGIN OF it_t001 OCCURS 0,
            bukrs TYPE t001-bukrs,
            butxt TYPE t001-butxt,
          END OF it_t001.
    START-OF-SELECTION.
      SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_t001 UP TO 10 ROWS.
      IF sy-dbcnt > 1.
        EXPORT it_t001 TO MEMORY ID 'ZTEST_T100'.
      ENDIF.
    I hope that it gets you some idea.
    Thanks
    Venkat.O

  • Number of entries in the internal table for perticular field value

    hi All,
    Is this possible to get the count of records from the internal table for a perticular field value.
    currently my requirement is to get the entries from the internal table which does not have two records for perticular field value (say a = 123) whose status is active (say b = 'X').
    also suggets should use LOOP or DELETE or DESCRIBE for a internal table to ful fill this requirement.
    Thanks in advance.
    Pradeep

    Try like this..
    Create another table itab2 with same structure as itab1 & move the contents of itab1 to itab2
    ITAB2[] = ITAB1[].
    Then delete entries from itab2
    Delete itab2 whete a = '123' and b = 'X'
    Then use Describe statement to get the no of entries
    Describe table itab2 lines v_lines.
    Hope this helps...

  • How to structure the internal table issue I want to download to excel

    Hi ,
    I am trying to download the data from the internal table whose structure was
    i HAVE ONE INTERNAL TABLE WHICH IS
    123 ABC MIKE
    123 ABC DALLAS
    123 ABC BOMBAY
    345 BCD MEENAL
    345 BCD SHINDE
    345 BCD UJWALA
    I want the output the i WANT THE INTERNAL TABLE TO STRUCTURE IN THIS WAY
    123 ABC  MIKE
                   DALLAS
                   BOMBAY
    345 BCD  MEENAL
                   SHINDE
                   UJWALA

    U have to fill internal table as ..
    Loop at ITAB. <-- contains all the values
      at new field2.
        itab1 = itab.
        append itab1.
        clear itab1.
        continue.
      endat.
      clear : itab-field1 , itab-field2.
      itab1 = itab.
      append itab1.
      clear itab1.
    endloop.
    Now download ITAB1.

  • Print data of an internal table to a printer.

    Hi,
    Requirement: The data from an excel file is the input for the program. This data is taken into an internal table using GUI_UPLOAD adn manipulated based on certain validations. The data which is validated is finally collected into an internal table.
    This data is being downloaded to the presentation server using GUI_DOWNLOAD.
    The client is asking to print the data in the internal table to the printer {SAP Scripts are generally printed}.
    Solution required for: How to print the data of an the internal table.
    Thanks in advance.
    Best Regards,
    Goutham.
    Edited by: Raghavendra Goutham on Oct 29, 2008 7:34 PM

    Try some like this way
    report zaRs.
    data: v_params type pri_params,
    start-of-selection.
      perform display_report.
    end-of-selection.
    form display_report .
      call function 'GET_PRINT_PARAMETERS'
        exporting
          immediately            = 'X'
          line_size              = 220
          release                = 'X'
          mode                   = 'CURRENT'
          no_dialog              = ' '
        importing
          out_parameters         = v_params
          valid                  = v_valid
        exceptions
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          others                 = 4.
      new-page print on parameters v_params no dialog.
      loop at itab.
        write :/ itab.
      endloop.
      new-page print off.
    endform. 

  • Read data from STATIC internal table during round trip in DO_PREPARE_OUTPUT

    Dear Gurus
    I have a requirement where I need to select some data from the database table BUT_HIER_NODE_D.
    After SELECTING this data to an internal table (say ITAB), I am displaying this data in a table view. I was able to achive this functionality by putting some code in the DO_PREPARE_OUTPUT method.
    Now according to my requirement, after the above data has been displayed on the screen initially, the user will click on any row. After clicking on a particular row, I need to capture the document number on that particular row and need to display all its child document numbers in a separate table. I am able to achive this functionality also.
    Initially I am not sure of how to READ the same internal table (ITAB) again and again by avoiding the SELECT query upon each round trip (between CRM and Web).
    After some research, I understand that I might have to use STATIC internal table to store the data during the
    initial SELECT. This way, upon each round trip, I can READ the data from the same internal table.
    My question: But now, when I tried to create a STATIC internal table in DO_PREPARE_OUTPUT, it is not allowing me to declare this table because DO_PREPARE_OUTPUT method is a INSTANCE method.
    I didn't find any STATIC methods in the IMPL class of the view.
    I would really appreciate if somebody can help me on how to proceed further.
    Thanks
    Raj

    Hi Bharathy / Adil / Masood
    Thank you very much for the replies. I declared a static method inside the IMPL class and I was calling this method inside the DO_PREPARE_OUTPUT method. Looks like it is working fine for me...will comeback if I had any further issues.
    Masood
    As per my requirement, I need to Select the data into the internal table during the very first step, then I need to continuosly read the data from this internal table upon every round trip. So I am not sure if I would be able to use the method DO_INIT_CONTEXT. Because I need a method which will trigger upon each round trip and will also hold the data of this internal table. So right now, the only option for me is DO_PREPARE_OUTPUT method.
    Plz let me know if am doing in the right way.
    Thanks
    Raj

  • Reg: Downloading the internal table into excel file.

    Hi,
    My requirement is i am collecting data in the internal table and i have to download the contents in an excel file and i have declared like this.
    PARAMETERS : x_test    TYPE string
                          DEFAULT 'C:\temp\file.txt'.
    I have given the default file path  like this and i am using the function module .
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                    =
          FILENAME                      = OUTPUT_PATH
          FILETYPE                      = 'DAT'
    IMPORTING
      FILELENGTH                      =
        TABLES
          DATA_TAB                        = INT_INPUT
      FIELDNAMES                      =
       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.
    My requirement is i dont want to change my extension as .txt from .exl to my parameter addition and in the function module the file type should be 'dat' only and in the runtime i want to change the file name which i have given in the .
    PARAMETERS : x_test    TYPE string
                          DEFAULT 'C:\temp\file.txt' this file.txt into datas.xls.
    it would be grateful if some one share some valuable views to wards this query
    Thanks and Regards,
    Keny

    Hi,
    Use this code.
    It will ask for the file name...there u can change.
      data : l_filename type string,
             l_filetype type char10,
             l_path type string,
             l_fullpath type string.
      l_filetype = 'DAT'.
    *Get the file name
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
        EXPORTING
          FILE_FILTER          = '*.DAT'
          INITIAL_DIRECTORY    = 'C:\'
        CHANGING
          FILENAME             = l_filename
          PATH                 = l_path
          FULLPATH             = l_fullpath
        EXCEPTIONS
          CNTL_ERROR           = 1
          ERROR_NO_GUI         = 2
          NOT_SUPPORTED_BY_GUI = 3
          others               = 4.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      check l_fullpath is not initial.
    *Download file
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        EXPORTING
          FILENAME                = l_fullpath
          FILETYPE                = l_filetype
        CHANGING
          DATA_TAB                = t_data_sum[]
        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
          NOT_SUPPORTED_BY_GUI    = 22
          ERROR_NO_GUI            = 23
          others                  = 24.
      IF sy-subrc NE 0.
        MESSAGE e398(00) WITH sy-subrc ' Error downloading file' '' ''.
      ENDIF.
    Regards
    Sandeep REddy

Maybe you are looking for

  • Error - "Exception during parsing of upload document"

    Hi, I am getting following error when trying to upload data with my custom integrator: "The upload process has completed with errors. Press Close to return to the document and fix the errors. Upload processing did not complete Exception during parsin

  • Show region if field in recordset is NOT empty

    Hi Ive been using dreamweaver's built in "show region if recordset is not empty," but now i need to change the code so that it "shows the region if a field in the recordset is empty" Does anyone know how to do this ? below is my code for "show region

  • Warning in oracle 10g installation

    During i'm installing oracle 10g 10.2.0.4.0 (downloaded test version) in Microsoft server 2008R2 64 bit version it gives an error .. ERROR............. Enterprise manager configuration faild due to the following error- Error starting database control

  • Virtual hostname already assigned to another system on the network

    Sorry for the cross-post... I just want to make sure I get this in the right forum: I am having trouble getting past the cluster configuration setup in Clusterware 10.2.0.1.0 on SLES9 -i386. The following error explains it all: The virtual hostname(s

  • Lotus Notes Traveler sync issues and problems

    No device Hello I could connect my Palm Pre2 to our company's Lotus Notes Traveler successfully. It is not as straight as on iPhone as my colleagues, the only point is to indicate completely the path to the Microsoft Exchange link, like: https://myco