How to get a block of data from internal table based on a criteria

Hi all,
          I have some records in the internal table t_int1. I want to retrieve some set records from that table and put them all in some other table, based on a single field which is not  a key. Can i use READ statement to achieve this.
Could you please let me know any simple way of doin this.
Regards,
Vishnu

I have some records in the internal table t_int1. I want to retrieve some set records from that table and put them all in some other table, based on a single field which is not a key. Can i use READ statement to achieve this.
Could you please let me know any simple way of doin this.
Answer :
data:
itab2 like standard table of  t_int1 with header line.
Loop at t_int1.
read table t_int1 with index 1.
check ur condition----
check each line and insert it ---work out the syntax for this
IF t_int1-xyz = data1
append  line of t_int1 to itab2. or try insert
cnt = cnt + 1   -
u will get no. of records added to next itab.
else.
cnt1 = cnt1 + 1 -
u will get no. of records not added to next itab.
endif.
end loop.

Similar Messages

  • How can get back my backup data from an external element ?

    How can get back my backup data from an external element ?

    See the section titled "restoring data from Time Machine backups" in this Apple support article; that should get you going.
    http://support.apple.com/kb/ht1427
    Regards.

  • How to send data from internal table to the shared folder in ABAP

    Hi experts,
             My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is  "
    xxx\y\z....".
    I do not have any idea on how to send data from internal table to the shared folder path.
    can anybody please help me out how to do this?
    Thanks & Regards
    Sireesha.

    Where that folder is located, its on presentation server i.e. desktop or application server.
    If its on presentation server, use FM GUI_UPLOAD.
    If its on application server, then use DATASET functions. Have a look at below link.
    [File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
    I hope it helps.
    Thanks,
    Vibha
    Please mark all the useful answers

  • How can i extract the particular data from Base tables

    Hi
    I have some Base R/3- Tables . I need to exact the data from these base tables.
    But i need to select some type of datarecords(eg: select Material Documents from MSEG and MKPF tables based on movement types 261,262).
    Something like that . So how can i select the particular category datarecords from base tables. Anyway im going to create the Custom DataSource.
    So please let me know . how can i extarct tha particular data from base tables
    kumar

    Hi Venkat
    See i have some 5-tables . I need to extarct from these tables.
    first i need to extract the data from one table fully.
    Then i need to extarct the data from second table based on profict centers, company codes of first table.
    Then i need to extract the data from third table based on profict centers of first table and movement type = 2p,2n,2s condition.
    So how can i extarct like this data from multiple tables.
    Please let me know
    kumar

  • Downloading data from internal table to xls file leading zeros are not disp

    Hai abap gurus,
    when i am downloading data from internal table to excle file. some field values in a column are with leading zeros and some others dont have leading zeros.but in the output it is showing without leading zeros. then how to get with exact values.
    Ex:
    <b>ECC Code.</b>
    045234
      88567
    098456 
    but output is giving like this:
    45234
    88567
    98456
    how to get the actual values.....
    plz help me in this matter.

    Dear Kiran,
    Those field in the internal table having Leading Zeroes, make those fields' datatype as character.
    Then use the function module to download the content of the internal table to the excel file.
    Regards,
    Abir
    Don't forget to Reward Points  *

  • Gui_download for transferring the data from internal table to excel sheet.

    hi all,
    i am using gui_download for transferring the data from internal table to excel sheet.
    I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
    Thanks in advance.

    Hi Venkata,
    plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
      call function 'SAP_CONVERT_TO_XLS_FORMAT'
        exporting
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
          i_filename                 = p_file
    *   I_APPL_KEEP                = ' '
        tables
          i_tab_sap_data             = t_mbew
    * CHANGING
    *   I_TAB_CONVERTED_DATA       =
    * 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.
    Hope this helps,
    Erwan

  • How to get the field name of an internal table during runtime?

    How to get the field name of an internal table during runtime?

    Hi  Sudhir,
    Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
    Example Code:
        <b>  DATA: v_field(60).                        " Insert this code.
         GET CURSOR FIELD v_field.        " Insert this code.</b>
         <b>CHECK v_field = 'ITAB-KUNNR'.    " Insert this code. (or)
    Write: v_field.</b>
    Regards,
    Ramganesan K.

  • Download data from internal table to flat file.

    I need to download the data from Internal table to Flat file. can any one suggest how to do it? i suppose WS_Download OR GUI_DOWNLOAD.
    but if it is please guide me how to use this.
    is thre any other F.M. please provide the information.
    Thanks in advance

    Hi,
    Try this,
    * File download, uses older techniques but achieves a perfectly
    * acceptable solution which also allows the user to append data to
    * an existing file.
      PARAMETERS: p_file like rlgrap-filename.
    * Internal table to store export data  
      DATA: begin of it_excelfile occurs 0,
       row(500) type c,
       end of it_excelfile.
      DATA: rc TYPE sy-ucomm,
            ld_answer TYPE c.
      CALL FUNCTION 'WS_QUERY'
           EXPORTING
                query    = 'FE'  "File Exist?
                filename = p_file
           IMPORTING
                return   = rc.
      IF rc NE 0.                       "If File alread exists
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
    *          TITLEBAR              = ' '
    *          DIAGNOSE_OBJECT       = ' '
               text_question         = 'File Already exists!!'
               text_button_1         = 'Replace'
    *          ICON_BUTTON_1         = ' '
               text_button_2         = 'New name'
    *          ICON_BUTTON_2         = ' '
    *          DEFAULT_BUTTON        = '1'
    *          DISPLAY_CANCEL_BUTTON = 'X'
    *          USERDEFINED_F1_HELP   = ' '
    *          START_COLUMN          = 25
    *          START_ROW             = 6
    *          POPUP_TYPE            =
          IMPORTING
               answer                = ld_answer
    *     TABLES
    *         PARAMETER              =
          EXCEPTIONS
              text_not_found         = 1
              OTHERS                 = 2.
    * Option 1: Overwrite
        IF ld_answer EQ '1'.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
    *            BIN_FILESIZE            =
                 filename                = p_file        "File Name
                 filetype                = 'ASC'
    *       IMPORTING
    *            FILELENGTH              =
            TABLES
                data_tab                = it_excelfile   "Data table
            EXCEPTIONS
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                OTHERS                  = 5.
          IF sy-subrc <> 0.
            MESSAGE i003(zp) WITH
                     'There was an error during Excel file creation'(200).
            exit. "Causes short dump if removed and excel document was open 
          ENDIF.
    * Option 2: New name.
        ELSEIF ld_answer EQ '2'.
          CALL FUNCTION 'DOWNLOAD'
            EXPORTING
                 filename            = p_file          "File name
                 filetype            = 'ASC'           "File type
    *             col_select          = 'X'            "COL_SELECT
    *             col_selectmask      = 'XXXXXXXXXXXXXXXXXXXXXXXXXX'
    *                                                   "COL_SELECTMASK
                 filetype_no_show    = 'X'     "Show file type selection?
    *       IMPORTING
    *             act_filename        = filename_dat
            TABLES
                 data_tab            = it_excelfile    "Data table
    *            fieldnames          =
            EXCEPTIONS
                 file_open_error     = 01
                 file_write_error    = 02
                 invalid_filesize    = 03
                 invalid_table_width = 04
                 invalid_type        = 05
                 no_batch            = 06
                 unknown_error       = 07.
        ENDIF.
      ELSE.                               "File does not alread exist.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
    *          BIN_FILESIZE            =
               filename                = p_file         "File name
               filetype                = 'ASC'          "File type
    *     IMPORTING
    *          FILELENGTH              =
          TABLES
               data_tab                = it_excelfile   "Data table
          EXCEPTIONS
               file_write_error        = 1
               no_batch                = 2
               gui_refuse_filetransfer = 3
               invalid_type            = 4
               OTHERS                  = 5.
        IF sy-subrc <> 0.
          MESSAGE i003(zp) WITH
                   'There was an error during Excel file creation'(200).
          exit. "Causes short dump if removed and excel document was open 
        ENDIF.
      ENDIF.
    Regards,
    Raghav

  • Convert data from internal table to XML file.

    Hi All,
    I am selecting data from database into one internal table.
    Now I want to convert data from internal table to xml file format and save in to my desktop. Please suggest me how I can achieve my requirement.
    Kindly reply me ASAP.

    Use this FM. SAP_CONVERT_TO_XML_FORMAT
    Check this link too -
    Re: Data Export in XML format
    XML files from ABAP programs

  • Reading Data from Internal Table

    Hi,
    Can anyone please tell me how to read data from Internal Tables in the Event Handler without using the Select statement OnInitialization?
    Thanks,
    Gaurav

    Hi Siddhartha,
    Can you tell me the problem in my code. I tried to work on the way you suggested. Though I have not finished with the coding, I just wanted to know whether I am going in the direction or not.
    I have declared the the structure in Type Defination as
    TYPES: BEGIN OF TEST_STRUC,
             BEGDA TYPE BEGDA,
             ENDDA TYPE ENDDA,
           END OF TEST_STRUC.
    TYPES: TEST_TAB_TYPE TYPE TABLE OF TEST_STRUC.
    In the Event Handler, I have added the following code on OnInputProcessing:
    event handler for checking and processing user input and
    for defining navigation
    DATA TEST_INFO LIKE LINE OF TEST_TAB.
    DATA: MYTAB6 TYPE TABLE OF PA0006,
          MYTAB6_WA LIKE LINE OF MYTAB6.
    REFRESH TEST_TAB.
    CLEAR TEST_INFO.
    MYTAB6_WA-BEGDA = REQUEST->GET_FORM_FIELD( STARTDATE ).
    MYTAB6_WA-ENDDA = REQUEST->GET_FORM_FIELD( ENDDATE ).
    IF EVENT->NAME EQ 'button'
       AND EVENT->SERVER_EVENT EQ 'click'.
      LOOP AT MYTAB6 INTO MYTAB6_WA.
        TEST_INFO-BEGDA = MYTAB6_WA-BEGDA.
        TEST_INFO-ENDDA = MYTAB6_WA-ENDDA.
      ENDLOOP.
      APPEND TEST_INFO TO TEST_TAB.
      CLEAR TEST_INFO.
      NAVIGATION->SET_PARAMETER( NAME = 'test_tab'
      VALUE = 'begda' ).
      NAVIGATION->SET_PARAMETER( NAME = 'test_tab'
      VALUE = 'endda' ).
      NAVIGATION->GOTO_PAGE( 'MyBSP2.htm').
    ENDIF.
    P.S. MyBSP2.htm is my next page.
    Thanks,
    Gaurav

  • Upload data from Internal table to text file with  '~' separator

    can anyone help me to download data from internal table to flat file with  ''  separator. GUI_DOWNLOAD is not working in my case ....like for ''  separator

    Here it is
    REPORT  zkb_test1.
    TYPE-POOLS: truxs.
    DATA: i_scarr TYPE TABLE OF scarr,
    i_conv_data TYPE truxs_t_text_data.
    SELECT * FROM scarr INTO TABLE i_scarr.
    CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
      EXPORTING
        i_field_seperator    = '~'
      TABLES
        i_tab_sap_data       = i_scarr
      CHANGING
        i_tab_converted_data = i_conv_data
      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.
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename                = 'C:\Test1.txt'
        filetype                = 'ASC'
      CHANGING
        data_tab                = i_conv_data
      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 <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Regards
    Kathirvel

  • Hash lookup or Binary search to fetch data from internal table

    Hi All,
    I want to know Which is faster, Hash lookup or Binary search to fetch data from internal tables?
    Thanks,
    Mahesh
    Moderator Message: Duplicate post
    Edited by: kishan P on Oct 14, 2010 4:22 PM

    type mod* .the the sign would change to pattern.try and see.i checked.reward if works.

  • How to get large no of records from adf table

    Hi All,
    I'm working on adf.I'm using jdeveloper 11.1.1.5 version.In my adf application i have 1000 records in my adf table.I want to get the 500 selected records from that table at a time.But im not able to get huge number of records.How can i get the records from adf table.Please give me ur valuable suggestions.
    Thanks!

    Hi.
    for large record check the oficial doc.
    http://docs.oracle.com/cd/E24382_01/web.1112/e16182/bcadvvo.htm#CEGDBJEJ
    PAGE_RANGING is the best option for large tables.
    and these maybe will help you
    Re: Performance scrolling large ADF tables
    Re: Expert opinion needed: Best practices to handle huge rowsets on UI

  • How to fetch data from CDHDR Table based on Order Number

    Hi,
    I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the  last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
    HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
    PARAMETER : S_OBJECT FOR  /BEV1/RBVBAK-AUFNR  OBLIGATORY.
    DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
                 WA_CDHDR LIKE LINE OF IT_CDHDR,
                 S_OBJECT1 LIKE CDHDR-OBJECTID.
    CONCATENATE  sy-mandt  '30'  S_OBJECT INTO S_OBJECT1.
    SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.

    P838355 wrote:>
    > Hi,
    >  I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the  last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
    >
    > HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
    >
    >
    > PARAMETER : S_OBJECT FOR  /BEV1/RBVBAK-AUFNR  OBLIGATORY.
    >
    > DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
    >              WA_CDHDR LIKE LINE OF IT_CDHDR,
    >              S_OBJECT1 LIKE CDHDR-OBJECTID.
    >
    > CONCATENATE  sy-mandt  '30'  S_OBJECT INTO S_OBJECT1.
    >
    > SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.
    You need to loop through the select option and concatenate with required data then select using 'in' instead of equal or select one by one.
    or
    select sales order numbers from VBAK for the selection into internal table then loop through the internal table and concatenate then select from CDHDR.
    for better performance use objectclass in where clause. the value for sales order for objectclass is VERKBELEG.
    in my system the object id is just an order number there is no other additions to it but in CDPOS the tabkey contains the order number with client and other information also.
    the 30 may be your item number... check it
    go ahead and change sales order and see what you can find in CDHDR
    Good luck
    Edited by: Sampath Kumar on Oct 21, 2009 9:02 AM

  • Mapping data from internal table to SAPSCRIPT Box.

    Hi Gurus,
    I have to create a sapscript where in I should get data from standard tables and display the data in box (table format) in sapscript. I know how to get a field (perform in zprogram) into sapscript form zprogram. I dont know how I can get data (internal table) from my zprogram into sapscript and display in a box.
    Your help is highly appreciated.

    Hi David,
        consider the below example say if your zprogram having the internal table table loop and you want to print the contents line by line or in a box,
    LOOP AT tj_1irg23d.
    header line
            CALL FUNCTION 'WRITE_FORM'
              EXPORTING
                element = 'ITEM_HEADER1'
              EXCEPTIONS
                OTHERS  = 1.
    endloop.
    then in your sap script main window or where ever you want to print just straight away give your internal table fileds as follows(just for example)
    I2           ,,&J_1IRG23D-ZEILE(Z)&,,&J_1IRG23D-MATNR&,,&J_1IRG23D-CHAPID&,,
    =           &J_1IRG23D-MENGE(Z)&,,&J_1IRG23D-MEINS&,,0.0,,
    then it will bring the values of your internal table in the form.

Maybe you are looking for

  • Store only displays 150 songs???  I must not be doing this right!

    Ok, Christmas Fiend that I am, I wanted to buy some more Christmas songs for my IPOD. So I could get the most choices, I simply chose by genre. And it gave me 150 songs. I was shocked that they only had 150 songs. So, out of curiosity, I did a genre

  • Using vision VIs from earlier VDM version

    I need to support some applications that have LV2010 with the Vision Development Module 2010 while my development PC has VDM 2012.  The VDM developers are frequently making new versions of the IMAQ functions AND  for some reason changing the name of

  • Bug's found in fullscreen mode.

    Hello i have discovered a bug in flash or in iexplorer the fullscreen mode. Problem 1: onMouseUp event fails in fullscreen mode (when published in html mode). First of all, when i placed a button on the stage to go fullscreen the onMouseUp event will

  • How can I create Service Request ?

    Hi, I registered oracle account in order to create a service request. And the Customer User Administrator responsived 'Approved'. But now I can't see 'Create SR' button. I'm just able to access SR List. How can I access 'Create SR' button ? Help me !

  • Batch processing problem: Seeing the primary key (id) in the test cases...

    Another problem we seem to be having is how to read the primary key into a base attribute of an entity. In batch processing, we may define the "id" as the primary key on the table. We need to get that id and the foreign key ids into the base attribut