Search in internal table utility

Hi Experts,
As per my requirement we need a utlity i.e a  class or F.M  which search for a "Word" or "Phrase" in fields of internal table and display the internal table output  based on there ranking.
For example:
Search term in internal table is:          Novartis  Global  
My Internal table has records like this:
ITAB
FIELD1                                FIELD2                                   FIELD3                  LINE
Novartis Global                   xyz                                        Global                    1
ABC                                  Novartis                                   DXY                       2
Novartis Global                Novartis Global                        Novartis Global       3
1020                                  EWR                                       Globaling                 4
My O/p should be
FIELD1                                FIELD2                                   FIELD3                    LINE
Novartis Global                Novartis Global                        Novartis Global         3
Novartis Global                   xyz                                        Global                       1
ABC                                  Novartis                                   DXY                          2
1020                                  EWR                                      Globaling                     4
For achieving this i used command
FIND ALL OCCURRENCES OF Novartis  Global     IN TABLE ITAB  RESULTS IT_RESULTS  IN CHARACTER MODE .
Since all records in my internal table have the search term already it retunrs all the records but i want to RANK these records
based on my search term
1.Records which exactly match the keyword in all fields should be first
2.Records which have the key word in atleast 1 field should be second
3.Records which have one word of 2 should be third
and so on RANKING BASED on search term.
Please suggest how should i go about it ? I am not sure what kind of logic is required here.
Any suggestions will be appreciated.
Thanks
Bhanu

TYPES: BEGIN OF ty_data,
        f1 TYPE char30,
        f2 TYPE char30,
        f3 TYPE char30,
        line TYPE i,
       END OF ty_data.
DATA:
lt_data TYPE TABLE OF ty_data,
wa_data TYPE ty_data,
mcnt TYPE i,
moff TYPE i,
mlen TYPE i,
lv_f1 TYPE i,
lv_f2 TYPE i,
lv_f3 TYPE i.
LOOP AT lt_data INTO wa_data.
  lv_f1 = 0.
  lv_f2 = 0.
  lv_f3 = 0.
  FIND ALL OCCURRENCES OF wa_phrase IN wa_data-f1 IN CHARACTER MODE
  RESPECTING CASE MATCH COUNT  mcnt
  MATCH OFFSET moff
  MATCH LENGTH mlen.
  IF sy-subrc = 0.
    lv_f1 = 1.
  ENDIF.
  FIND ALL OCCURRENCES OF wa_phrase IN wa_data-f2 IN CHARACTER MODE
  RESPECTING CASE MATCH COUNT  mcnt
  MATCH OFFSET moff
  MATCH LENGTH mlen.
  IF sy-subrc = 0.
    lv_f2 = 1.
  ENDIF.
  FIND ALL OCCURRENCES OF wa_phrase IN wa_data-f3 IN CHARACTER MODE
  RESPECTING CASE MATCH COUNT  mcnt
  MATCH OFFSET moff
  MATCH LENGTH mlen.
  IF sy-subrc = 0.
    lv_f3 = 1.
  ENDIF.
  lv_f1 = lv_f1 + lv_f2 + lv_f3.
  IF lv_f1 = 3.
    wa_data-line = 1.
  ELSEIF lv_f1 > 0.
    wa_data-line = 2.
  ELSE.
    wa_data-line = 3.
  ENDIF.
  MODIFY lt_data FROM wa_data TRANSPORTING line.
ENDLOOP.
SORT lt_data BY line.
LOOP AT lt_data INTO wa_data.
  WRITE:/ wa_data-f1, wa_data-f2, wa_data-f3, wa_data-line.
ENDLOOP.
CLEAR wa_data.
Hi,
The above code will sort the table for 1st and 2nd Rank properly. There is still logic to be added for 3rd Rank. The phrase should be split in words and then each word should be searched in each field of internal table and thus derive if its for 3rd Rank or not.
Thanks,
Murtuza

Similar Messages

  • Search in Internal Table Utility -- Need Pointers

    Hi Experts,
    As per my requirement i need to search for words in internal table and arrange internal table based on ranking i.e record which has maximum no. of hits should come first.
    Example: search for a string 'media rent'.
    Incoming internal table records.
    row1------>   col1: rent                    col::xyz 
    row2 -
    >   col1:media rent          col2:media
    row3 -
    >  col1: rent                     col2:media  media
    I need to compare each word in col1 and col2 and arrange the rows based on ranking like this:
    final internal table
    row2 because it has maximum no. of search term
    row3
    row1
    I found out 2 ways to do the above but facing some issues and need your suggestions:
    Solution 1:
    By using regualr expression i am searching as OR expression on itab.
    and using FIND ALL OCCURRENCES OF REGEX command on each column of internal table
    Issue: when row3 is scanned for 'media rent' it will give 3 counts i which will lead to move row3  on top in final table due to maximum no of counts.
    Is there a way to neglect 2nd occurence in the word ? I cn't use find first occurence here.
    Solution 2:
    Split search sting 'media rent' into internal table
    itab1
    media
    rent
    and search for each word in each row of internal table and make use of counter something like this.i am unable to proceed further here
    I am stucked with what kind of logic should be here ?
    Looking for your suggestions here.

    Hi fried,
    Try the code below it works fine.
    TYPES : BEGIN OF ty_text,
            text1 type char11,
            text2 TYPE char11,
            count TYPE i,
            END OF ty_text.
    data : t_text TYPE TABLE OF ty_text,
           x_text TYPE ty_text.
    DATA : v_count TYPE i.
    x_text-text1 = 'rent'.
    x_text-text2 = 'xyz'.
    append x_text to t_text.
    x_text-text1 = 'media'.
    x_text-text2 = 'media'.
    append x_text to t_text.
    x_text-text1 = 'rent'.
    x_text-text2 = 'media media'.
    append x_text to t_text.
    loop at t_text INTO x_text.
    if x_text-text1 eq 'media' or x_text-text1 eq 'rent'.
      v_count = v_count + 1.
    endif.
    if x_text-text2 eq 'media' or x_text-text2 eq 'rent'.
      v_count = v_count + 1.
    endif.
    x_text-count = v_count.
    MODIFY t_text INDEX sy-tabix FROM x_text.
    clear v_count.
    ENDLOOP.
    SORT t_text DESCENDING by count.
    If you face any issues please revert back to me i will help you.
    Thanks,
    Sri Hari

  • 'Search' internal table - sy-tabix question

    I realize there are many questions out there on sy-tabix but non that answer my question. 
    I have an internal table that will be filled with material numbers (among other things).  I need to loop through the internal table to see if the material number already exists in the table.  If so I need to store the index of the material number.  What is the best way to go about doing this?
    Regards,
    Davis

    Thanks Ravi, I guess instead of
    WRITE: / sy-tabix I can have something like
    LineIndex = sy-tabix.  is that correct?
    I wasn't sure if I could do something like
    READ TABLE itab WITH KEY matnr....
    I thought that I had to include a string that was searched through the whole table like the example in the online help.  Thanks again!
    Davis.
    I'm keeping this question open to see what other suggestions I receive.

  • Populate and display internal table results using search help exit...

    I have copied F4IF_SHLP_EXIT_EXAMPLE and made changes. I want this search help exit to populate and display contents related to 'FIELD1' when the user enters a specific value for it in the search help screen, meaning when the user restricts the search by that value.  For field2, field3, field4, field5, field6, field7, and field8 I am using a custom view.
    Following is the code:
    TYPES:  BEGIN OF t_search,
                   field2 TYPE field2,
                   field3 TYPE field3,
                   field4 TYPE field4,
                   field5 TYPE field5,
                   field6 TYPE field6,
                   field7 TYPE field7,
                   field8 TYPE field8,
                   field1 TYPE field1,
                END OF t_search.
      DATA: it_itab TYPE TABLE OF t_search,
            wa TYPE t_search,
         wa_selopt TYPE ddshselopt,
            wa_fielddescr TYPE dfies.
    ranges: r_field1 for std_table1-field1
    STEP SELECT    (Select values)
        FREE: r_field1.
    **Get the value entered for FIELD1 in search help
        LOOP AT shlp-selopt INTO wa_selopt.
          CASE wa_selopt-shlpfield.
            WHEN 'FIELD1'.
              r_field1-sign = wa_selopt-sign.
              r_field1-option = wa_selopt-option.
              r_field1-low = wa_selopt-low.
              r_field1-high = wa_selopt-high.
              APPEND r_field1.
              CLEAR: r_field1.
          ENDCASE.
        ENDLOOP.
    **Select 'ID' and 'FIELD1' from table into lt_itab
        SELECT id field1
              INTO TABLE lt_itab
                FROM std_table1
                  WHERE field1 IN r_field1.
        IF sy-subrc = 0.
    **Now, based on the particular IDs from lt_itab, I need to select other values
    from other tables which also have 'ID' as the key.
           SELECT std_table2~field2
                std_table2~field3
                std_table3~field4
                std_table3~field5
                std_table3~field6
                std_table4~field7
                std_table4~field8
                std_table1~field1
              INTO CORRESPONDING FIELDS OF TABLE it_itab
              FROM std_table2
                         INNER JOIN std_table3 ON
                                std_table3mandt = std_table2mandt AND
                                std_table3id = std_table2id
                         INNER JOIN std_table4 ON
                                std_table4mandt = std_table2mandt AND
                                std_table4id = std_table2id
                         INNER JOIN std_table1 ON
                                std_table1mandt = std_table2mandt AND                                           std_table1id = std_table2id
              WHERE
                    std_table1~field1 IN r_field1.
    'id' is common in all the std_tables --> std_table1, std_table2, std_table3, std_table4.
    STEP DISP     (Display values)
    **Then I need to gather all the results in my internal table it_itab and display
    in search help results for the value of FIELD1 entered by the user in the search help.
        CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'
          EXPORTING
            parameter   = 'FIELD1'
            fieldname   = 'FIELD1'                          
          TABLES
            shlp_tab    = shlp_tab                                   
            record_tab  = record_tab
            source_tab  = it_itab
          CHANGING
            shlp        = shlp
            callcontrol = callcontrol.
    I am not getting all the data in my internal table and wanted to know if there is anyting wrong in my select statement.
    Any guidance will be appreciated and awarded appropriate points.
    Thanks.

    the webdynpro fieldname and the search help input parameter name were made same.

  • Search for a (sub)workarea in an internal table

    Hi all gurus,
    quite a simple question: I have an internal table made up of 100+ fields, and a workarea of the same type which is filled with some data.
    I'd like to know what's the best, effective way to search if there's a line in the internal table which is equal to the above cited workarea.
    I could compare specific fields:
    READ TABLE itab WITH KEY f1 = workarea-f1 f2 = workare-f2 ....
    IF sy-subrc = 0.
      OK.
    ELSE.
      KO
    ENDIF
    and so on. But it's quite terrible to write such a statement when there are a lot of fields!
    A refinement of the above request; I'd like to perform the above explained search EXCLUDING some specific fields from the comparizon, e.g. ,comparing fields from f3 to f98, ignoring f1, f2 and f99....
    Is there a simple way to obtain the desiderata? Please provide example as in documentation I've read about a COMPARING ALL FIELDS clause, but didn't understand how to use it w.r.t. the READ TABLE statement.
    Thanks!

    Hi,
    In my opinion, practically I don't see such a table that needs to combine hundreds of fields to be key fields.
    However, to meet your requirement, I guess there are several ways. But I just can think of one way that sounds a little bit workaround.
    Here is the pseudo code:
    data: itab_1 with fields from f1 to f99,
             itab_2 with fields from f3 to f98,
            wa_1 like line of itab_1,
            wa_2 like line of itab_2.   
    *there some time you fill data for your itab_1
    now assume itab_1 has been filled with data.
    now fill content for itab_2, which contain fields from f3 to f98 of itab_1
    loop at itab_1 into wa_1.
      move-corresponding fields of wa_1 to wa_2.
    append wa_2 to itab_2.
    endloop.
    clear wa_2.
    clear work area 2.
    suppose you have the work area you want to compare its content with the itab
    copy it to wa_2
    now wa_2 has value.
    *now use Read command to compare the needed data
    Read table itab_2 into wa_2 comparing all fields.
    if sy-subrc = 0.
      ok
    else.
    not ok.
    endif.
    The option Comparing all fields in Read command will compare content of all fields of the work are with all fields in itab.
    This is the output that you need.
    Regards,
    paul
    Edited by: paul the octopus on Dec 15, 2011 6:18 PM

  • How to search for a field and its value in an internal table

    Hi,
    I want to search for a field(which i dont know whether it exists or not) in an internal table and on finding that field, I have to update the value of that field. How do I do it? I think its similar to how SEARCH works but i wanted to know the internal table eqivalent of it.

    Hi Sujay,
    this code will help ful to u, just gi through it,
    TABLES : KNA1,VBAK,VBAP.
    ***********INTERNAL TABLE DECLARATIONS****************
    DATA : IT_KNA1 TYPE TABLE OF KNA1,
           WA_KNA1 TYPE KNA1.
    DATA : IT_VBAK TYPE TABLE OF VBAK,
           WA_VBAK TYPE VBAK.
    DATA : IT_VBAP TYPE TABLE OF VBAP,
           WA_VBAP TYPE VBAP.
    START-OF-SELECTION.
      SELECT * FROM KNA1
      INTO TABLE IT_KNA1
      WHERE KUNNR = P_CUST.
      IF NOT IT_KNA1 IS INITIAL.
        SELECT * FROM VBAK
        INTO TABLE IT_VBAK
        FOR ALL ENTRIES IN IT_KNA1
        WHERE KUNNR = IT_KNA1-KUNNR.
        IF NOT IT_VBAK IS INITIAL.
          SELECT * FROM VBAP
          INTO TABLE IT_VBAP
          FOR ALL ENTRIES IN IT_VBAK
          WHERE VBELN = IT_VBAK-VBELN.
        ELSE.
          WRITE : / 'Customer',P_CUST,'does not exist ......'.
        ENDIF.
      ELSE.
        WRITE: / 'sales order does not exist for',P_CUST.
      ENDIF.
    Rewards points plz if useful
    Ganesh.

  • How can I search the last line in an internal table?

    How can I search the last line in an internal table?
    With a describe?? If it is , how can I do that?
    Thanks!!

    Hi shilpa,
    it seems to be you are NEW to SDN. welcome. if you want to get solutions to your Questions, you have to post a NEW thread.dont use the existing thread to post your question.
    any way i am giving you the solution for your question
    LOOP AT ITAB WHERE F1 = <SOME VALUE>
                       F2 = <SOME VALUE>.
    ENDLOOP.
    IF SY-SUBRC = 0.
      ITAB WILL HAVE THE LAST RECORD which satisfying the given criteria in WHERE clause of LOOP.
      write itab <--this ITAB will have the last record.
    ENDIF.
    regards,
    Srikanth.
    Message was edited by: Srikanth Kidambi

  • Search Help values to Internal table

    Dear Friends,
    Is it possible to export Search Help values to Internal table?
    On screen, when user click on Search button, the SAP standard search help will call (Customer Search). After entering values, some result get displayed and this result need to export to the internal table.
    Thanks in stack
    Nilesh

    Hi:
    try this:
    DATA : wa_shlp TYPE shlp_descr,
               it_records LIKE ddshretval OCCURS 0 WITH HEADER LINE.
    wa_shlp-SHLPNAME = 'MAT0M'.   "one of elementary search help name from mara-matnr.
    wa_shlp-SHLPTYPE = 'SH'.
    CALL FUNCTION 'F4IF_SELECT_VALUES'
         EXPORTING
           shlp                   = wa_shlp
      MAXROWS                = 0
      SORT                   = ' '
      CALL_SHLP_EXIT         = ' '
    IMPORTING
      MAXROWS_EXCEEDED       =
        TABLES
      RECORD_TAB             =
      RECDESCR_TAB           =
          return_tab            = it_records
    LOOP AT it_records.
      WRITE:/ it_records.
    ENDLOOP.
    Follows is how to get the search help name:
    CALL FUNCTION 'DD_SHLP_GET_HELPMETHOD'
      EXPORTING
        tabname                 = 'MARA'
        fieldname               = 'MATNR'
        langu                   = sy-langu
      NO_CHKTAB_MAPPING       =
      GET_ENTITYTAB           = ' '
       CHANGING
         shlp                    = wa_shlp
      callcontrol             = callcontrol
      EXCEPTIONS
        field_not_found         = 1
        no_help_for_field       = 2
        OTHERS                  = 3
    CALL FUNCTION 'F4IF_EXPAND_SEARCHHELP'
       EXPORTING
         shlp_top = wa_shlp
       IMPORTING
         shlp_tab = shlps.
    好运,
    启明星

  • A utility program to send the content of a spool OR an internal table in

    Hello Guys,help me.
    A utility program to send the content of a spool / an internal table in various formats like HTML, PDF, TXT etc.
    can u explain wht is this completely
    Thank you
    Santhosh.

    Please check below links for better understanding of sending data from SAP to various formats...
    internal table to an XML file
    http://www.erpgenie.com/abap/code/abap27.htm
    Report Output to a PDF File
    http://www.erpgenie.com/abap/code/abap51.htm
    HTML EMail from ABAP
    http://www.erpgenie.com/abap/code/abap20.htm
    Spool from SAP to Acrobat format
    http://www.erpgenie.com/abap/pdf_creation.htm

  • Search help - Display only 500 entries at one time from Internal Table

    Hi,
    I have an internal table with 1000000 entries. And when I use F4IF_INT_TABLE_VALUE_REQUEST function module to display the search help with internal table, it gives me dump. Can somebody help me - how to display limited values when we process search help?
    Thanks,
    Sheel

    Hi Sheel
    u have a variable callcontrol-maxrecords in search help exit to limit the number of records.. check my weblog for more help: https://wiki.sdn.sap.com/wiki/x/du0

  • 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.

  • Search Help doesn't work with a dynamically created internal table

    Hi Gurus,
    I have a custom report that will display the output through edittable ALV.
    My issue is, even though I've already did the FOREIGN KEY assisgnment to each fields of my custom table,
    when I run my report,some fields F$ functionality aint working.
    In my report, I've declared the table to be passed to ALV display dynamically as below:
    *_Create dynamic internal tables for the Final INTERNAL TABLE
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = gt_fldcatfin
        IMPORTING
          ep_table                  = gp_fintab
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
        ASSIGN gp_fintab->* TO <i_xfintab>.
    Where gt_fldcatfin is a modified fieldcatalog (combination of the cutom table fields and 1 column for CELLCOLOR)
    Please help me with this. Thanks a lot.

    This is one way.
    Import photo into illustrator.
    Draw box around photo, no fill ,no stroke colour and place on top of photo.
    Menu - Object - Envelope Distort - Make with Warp - (warp option will appear)
    Use ‘Direct Selection Tool’ (white arrow)
    Select/click on anchor points to alter, you can also use the rotation tool to turn to required position.
    Hope this info' is of help.

  • FM????? Text file to Internal table in Background

    Hi,
    I need to execute my prog in background and as per my req i need to dwnload a file from prsentation server to internal table for processing. I'm not sure whch FM to use to dwnload from text file to internal table. I cannot use GUI_UPLOAD FM for background runs.....pls help
    Thanks in advance

    Chesat,
    You can not work for this requirement.You will have an idea on it.
    Introduction
    The use of FTP from ABAP seems to have been a hot topic on the ABAP Forums of late. I thought I might sit down and document whatever I could find on this subject and share it as a weblog.
    Over the years I have seen lots of different solutions for moving files on and off of a SAP system. I have seen external FTP scripts written in OS shell languages. I have seen full blown custom applications that are made to interface to the SAP system. However I think you will find that most of the technology you need to perform a simple FTP from ABAP is already contained in the standard system. All of my examples and screen shots will be coming from a 46C system.
    SAP's Solution
    If you have ever taken a look at the kernel directory of your SAP system, you might have noticed an interesting little executable: sapftp.exe (the name of the file on Windows SAP Kernels). It is this part of the Kernel that exposes FTP functionality to the ABAP Programming language.
    So you have a suspicion that there is FTP functionality in ABAP, but you’re not quite sure how to use it. Where do you start? I always turn to the Service Marketplace first. A quick search on SAPFTP reveals there is an entire component (BC-SRV-COM-FTP) on the subject. The most general note and our starting place is OSS Note 93042. This note starts off with a nice description of what SAPFTP is: A client RFC application that is accessed via RFC from ABAP. But we also find out that in addition to SAPFTP being part of the kernel, it is also part of the SAPGui. That means that we can perform FTP commands originating from our R/3 Server or from a Client Workstation.
    Well if this solution is accessed via RFC, then we must have to setup some RFC destinations. In fact we have two that we need; SAPFTP for Front-end FTP and SAPFTPA for access on the application server. Luckily we don't even have to mess with setting these RFC destinations up in SM59. SAP has supplied a program, RSFTP005, to generate the destinations for us.
    Now before we go off and start written code on our own to hit these FTP functions, why don't we make sure everything is setup and working. Once again SAP has helped us out by providing us with a test program, RSFTP002. (In case you are wondering the FTP functionality and many other test programs are all contained in SAP Development Class SFTP). When we run this test, we get a set input parameters for the server, username password, etc. We want to start out simple and just make sure we are getting a connection. Therefore we will just execute the pwd command (Print Working Directory).
    Your answer back should look something like this:
    If you are wanting to see a list of FTP commands, try using the command HELP in place of PWD:
    If something did go wrong during the test, I suggest that you active the trace option in SM59 for the FTP Destination. You can then use program RSFTP001 to display the current trace file.
    Programming the FTP
    Not only does the RSFTP002 program give us a test environment, but it also provides us with a programming example. We can see that the FTP functionality is really provided by a set of function modules all within the SFTP Function Group. We have the basic commands such as FTP_CONNECT, FTP_COMMAND, and FTP_DISCONNECT that can be strung together to create a complete file operation action. The FTP_COMMAND Function allows you to issue arbitrary FTP commands as long as the SAPFTP function, the Host, and the Destination server all support the command. Then you have the specialized functions such as FTP_R3_TO_SERVER, FTP_R3_TO_CLIENT, and FTP_CLIENT_TO_R3. This lets you take some data in memory and transfer it someplace else. This has the advantage of not having to write the data to the file system first and not to have to issue any FTP commands. However these functions are also limited to the scope described.
    If you are already familiar with FTP in general, working with these function modules should not seem to difficult. The Connect, Command, Disconnect actions would seem somewhat self explanatory. So instead of looking at the entire program in detail let's focus on two things that may be unfamiliar. First the program starts off with an ABAP Kernel System call to AB_RFC_X_SCRAMBLE_STRING. Well we don't want to pass a potentially sensitive password openly. Therefore the FTP_CONNECT function module requires that the password be encrypted before it receives it. It is this System call that performs that one-way encryption. Now I checked a 620 SP42 system and in this example, SAP has replace the AB_RFC_X_SCRAMBLE_STRING with a function call to HTTP_SCRAMBLE. Unfortunately HTTP_SCRAMBLE doesn't even exist in my 46C system. The only other thing that I wanted to point out about these function calls is the exporting parameter on the FTP_CONNECT. It passes back a parameter called handle. This handle then becomes an importing parameter to all subsequent calls: FTP_COMMAND and FTP_CLOSE. This handle is the pointer to the instance of FTP that we started with the FTP_CONNECT. This assures that we get reconnected to the same FTP session with each command we issue.
    FTP Development
    I thought I would share a few of the things that can be built using this FTP functionality. First off I didn't want a bunch of ABAP programs directly working with the SAP FTP Function modules. As you can see there is already a difference in the examples for encrypting the password between 46C and 620. Therefore I thought it would be best to encapsulate all the FTP function in one custom ABAP OO Class. Not only did I get the opportunity to hid the inner SAP functionality and make it easy to switch out during upgrades, but I also get consistent error handling as well. I accept the User Name, Password, Host, and RFC Destination in during the Constructor of the class. I then store these values away in Protected Attributes. Each function module is then implemented as a Instance Method. The Password encryption functionality is then all tucked away nicely in the class. Also the calling program doesn't have to worry about keeping track of the FTP handle either since it is an instance attribute as well.
    Next I got really carried away. I wanted a way to record entire FTP scripts that could be filled with values at runtime and ran as a step in a background job. My company used to have many interfaces that ran frequently sending files all over the place. We needed a mechanism to monitor and support these file moves. This was really the root of this tool, but it also gives you an idea of how powerful these functions can be.
    Closing
    I hope that anyone interested in FTP from ABAP will find this resource useful. If anyone has any other resources that should be included here, feel free to post them.
    Thomas Jung is an Application Developer for Kimball Electronics Group (www.kegroup.com) and a huge fan of ABAP.
    Comment on this weblog
    Showing messages 1 through 7 of 7.
    Titles Only
    Main Topics
    Oldest First
         New to SAP/ABAP-4
    2005-02-24 13:03:06 Thomas Godfrey Business Card [Reply]
    I've been in IT for over 30 years as a mainframe contract programmer/analyst. Recently a company hired me for my legacy knowledge of there business to become a developer on SAP for these same systems.
    My first task is to develop a generalized ftp application to send data to the mainframe and then on to financial institutions. I have created an ABAP/4 test program with literals for the dest/host etc. And it works fine. I need more detail/guidance in creating the Class/Method/Function you have described to make this parameter driven and callable by other programs. I know this is a lot to ask, any help in pointing me in the right direction would be greatly appreciated. When I mention class creation to the existing staff they all say "Oh, we don't use or know anything about that object oriented stuff, we just right programs."
    Thanks,
    Tom
         New to SAP/ABAP-4
    2005-02-24 13:13:33 Thomas Jung Business Card [Reply]
    "we don't use or know anything about that object oriented stuff" That's something I might have expected to hear 4 years ago. That's kind of like saying that you only want to use half of the programming lanuage (the old half at that).
    However it is true that you have to learn to walk before you run. There are some fundamentals to ABAP that are usefull to have down before you start in with ABAP OO. But I wouldn't let that hold you back for long.
    I'm afraid that I wouldn't be able to teach you everything you would need to know to create a function module or a class in this posting. There was a nice weblog that was just posted the other day that had the steps to create your first simple class. I suggest you start there.
    As far as my FTP class goes, I don't mind sending you the code for the class. My email address is already all over SDN (and spammers' lists) so just send me the address that you want the details sent to. My email is [email protected].
         New to SAP/ABAP-4
    2005-02-24 13:05:42 Thomas Godfrey Business Card [Reply]
    I just read what I typed, I meant "write programs" not "right programs" ... duh
         Good suggestions - now...
    2004-11-24 09:15:27 Jacques Claassen Business Card [Reply]
    ...any chance you've used FTP via an HTTP proxy?
    Any help using the HTTP* functions in the ZFTP function group will be greatly appreciated. Any one?
    Thx
         Good suggestions - now...
    2004-11-24 09:59:11 Thomas Jung Business Card [Reply]
    I'm afraid I haven't done either. However I have used the HTTP client functionality in the WebAS 620 (if_http_client) along with an HTTP proxy. I have an example of this in another weblog.
         Pretty insightful
    2004-11-15 19:27:26 Subramanian Venkateswaran Business Card [Reply]
    Thanks for this weblog, and I can be pretty sure there are some(many) more weblogs in the waiting.
    Regards,
    Subramanian V.
         I have been using a local include ...
    2004-11-15 16:29:39 Swapan Sarkar Business Card [Reply]
    On the other hand I have been using a local include of ZCL_FTP_BASE in my programs for some time. Here's the signature:
    <quote>
    *& Include ZHR9_FTP_CLASSES
    *& Utility class ZCL_FTP_BASE having all the
    functions to upload and download files from an
    FTP server.
    CLASS zcl_ftp_base DEFINITION.
    PUBLIC SECTION.
    Output file type
    TYPES: BEGIN OF t_scratch,
    data(1024) TYPE c,
    END OF t_scratch,
    t_str_tab TYPE STANDARD TABLE OF t_scratch.
    CONSTANTS: co_crlf(2) TYPE x VALUE '0D0A'.
    DATA: status TYPE c VALUE space.
    METHODS: constructor IMPORTING im_user TYPE string im_pwd TYPE string
    im_server TYPE string,
    send_table_data IMPORTING im_file TYPE string
    im_table TYPE t_str_tab,
    get_table_data IMPORTING im_file TYPE string
    EXPORTING ex_table TYPE t_str_tab,
    send_string_data IMPORTING im_file TYPE string
    im_string TYPE string,
    get_string_data IMPORTING im_file TYPE string
    EXPORTING ex_string TYPE string,
    disconnect.
    PRIVATE SECTION.
    DATA: v_user(64) TYPE c,
    v_pwd_clear(30) TYPE c,
    v_pwd(64) TYPE c,
    v_server(30) TYPE c,
    v_filename TYPE rlgrap-filename,
    v_handle TYPE i.
    METHODS: pwd_scramble IMPORTING im_pwd TYPE c.
    ENDCLASS. "ZCL_FTP_BASE DEFINITION
    </quote>
    Showing messages 1 through 7 of 7.
    Pls. mark if this doc. is useful

  • Add record through pop to search view criteria table?

    Hi,
    I am trying to add data from pop to search view criteria table but i am strukked at inserting data through popup...
    i got nullpointer exception like this
    <RegionRenderer> <encodeAll> The region component with id: pt1:r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.
    <RowGatherCallback> <processComponent> Illegal child component ("javax.faces.component.html.HtmlOutputText@17cc21b" id="j_id256") detected inside parent component ("panelGridLayout" with clientId="pt1:r1:1:pgc1:pt_pgl3"). The child component must instead be of type "gridRow" instead.
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: java.lang.NullPointerException
    java.lang.NullPointerException
        at oracle.jbo.server.QueryCollection.getRowSetRefs(QueryCollection.java:2675)
        at oracle.jbo.server.ViewObjectImpl.notifyRowUpdated(ViewObjectImpl.java:12174)
        at oracle.jbo.server.ViewObjectImpl.afterRowUpdate(ViewObjectImpl.java:13921)
        at oracle.jbo.server.ViewObjectImpl.sourceChanged(ViewObjectImpl.java:14224)
        at oracle.jbo.server.EntityCache.sendEvent(EntityCache.java:1566)
        at oracle.jbo.server.EntityCache.deliverEntityEvent(EntityCache.java:1582)
        at oracle.jbo.server.EntityCache.notifyColumnAndBlgChange(EntityCache.java:1640)
        at oracle.jbo.server.EntityImpl.notifyAttributesChanged(EntityImpl.java:7426)
        at oracle.jbo.server.EntityImpl.notifyAttributesChanged(EntityImpl.java:7407)
        at oracle.jbo.server.ViewRowImpl.setAttributeValues(ViewRowImpl.java:1827)
        at oracle.adf.model.binding.DCDataControl.setAttributesInRow(DCDataControl.java:2447)
        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeValuesInRow(JUCtrlValueBinding.java:997)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.setTargetAttrsFromLovRow(JUCtrlListBinding.java:2813)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.updateTargetFromSelectedValue(JUCtrlListBinding.java:2941)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.setAttributeFromValueList(JUCtrlListBinding.java:2886)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.setSelectedIndex(JUCtrlListBinding.java:1752)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.setInputValueInRow(JUCtrlListBinding.java:3541)
        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2926)
        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2889)
        at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.setInputValue(FacesCtrlListBinding.java:458)
        at oracle.jbo.uicli.binding.JUCtrlValueBinding.put(JUCtrlValueBinding.java:2546)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.put(JUCtrlListBinding.java:3437)
        at javax.el.MapELResolver.setValue(MapELResolver.java:229)
        at com.sun.faces.el.DemuxCompositeELResolver._setValue(DemuxCompositeELResolver.java:255)
        at com.sun.faces.el.DemuxCompositeELResolver.setValue(DemuxCompositeELResolver.java:281)
        at com.sun.el.parser.AstValue.setValue(Unknown Source)
        at com.sun.el.ValueExpressionImpl.setValue(Unknown Source)
        at org.apache.myfaces.trinidad.component.UIXEditableValue.updateModel(UIXEditableValue.java:361)
        at org.apache.myfaces.trinidad.component.UIXEditableValue.processUpdates(UIXEditableValue.java:311)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:1269)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1259)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:1012)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:1269)
        at oracle.adf.view.rich.component.fragment.UIXRegion.updateChildrenImpl(UIXRegion.java:669)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1259)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:1012)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$UpdateModelValuesCallback.invokeContextCallback(LifecycleImpl.java:1561)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1670)
        at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:625)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1693)
        at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:625)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:222)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at oracle.adf.view.rich.component.fragment.UIXInclude.invokeOnComponent(UIXInclude.java:161)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXDocument.invokeOnComponent(UIXDocument.java:106)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1321)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:382)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
        at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
        at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
        at java.security.AccessController.doPrivileged(Native Method)
        at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
        at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
        at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
        at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
        at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    can any body help me out this?..
    ThankYou

    HI,
    I think you have created form using two view objects ...recheck one of the value is null before commit ..
    Thanks
    Nitesh

  • Std Internal Tables

    Hi, what are Standard Internal Tables and Standard reports, and can I have names of some 'Standard Internal Tables' and  'Standard Reports' plz ?
    Thnx.

    these are some of the standard reports\
    REKH0004
       SAP demo program that shows how to do  2d        3D, and 4D graphics.
    RGUGBR00 
    Substitution/Validation utility
    RHGEN00
         Regen PD and PA inconsistencies
    RHGRENZ0  
       Delimit IT1000 and related 1001s. Program                     will            delete any 1001 infotypes whose start date is after the delimit date.
    RHGRENZ1
    Extend the end date on delimited records. Very useful when you delimit a bunch of records incorrectly, and need to change the end date.
    RHGRENZ2
    Delimit IT1001 only.
    RKCTSEAR
    Search source code for up to two strings. Also see RSRSCAN1 and RPR_ABAP_SOURCE_SCAN.
    RPDTRA00
    List all HR transactions.
    RPR_ABAP_SOURCE_SCAN
    Search ABAP code for a string. Has many more options for selecting the ABAPs to search than RSRSCAN1 or RKCTSEAR.
    RPUAUD00
    HR Report to list all logged changes for an employee. Uses the PCL4 Audit Cluster.
    RPUAUDDL
    HR Report to delete audit data from the PCL4 Audit Cluster.
    RPUDELPN
    Delete all info for an employee number, including cluster data and infotypes
    RPUP1D00/10
    View/Delete data from PCL1 Cluster
    RPUP2D00/10
    View/Delete data from PCL2 Cluster
    RPUP3D00/10
    View/Delete data from PCL3 Cluster
    RPUP4D00/10
    View/Delete data from PCL4 Cluster
    RSABAPIV
    Mass print/display of ABAP/4 help text
    RSAVGL00
    Table adjustment across clients
    RSBDCBTC
    Submit a BDC job with an internal batch number and wait for the end of the batch input session.
    RSBDCDRU
    Prints the contents of a Batch Input session. No options for error transactions only.
    RSBDCOS0
    Execute UNIX commands. Looks similar to the old SAPMSOS0 program that disappeared in 3.0
    RSBDCSUB
    Release batch input sessions automatically
    RSBTCDEL
    Clean the old background job records
    RSSDOCTB
    R/3 Table Manual - prints a list of all fields in the selected tables with the field name and the field documentation.
    RSCLTCOP
    Copy tables across clients
    RSDBCREO
    Clean batch input session log
    RSINCL00
    Extended program list
    RSNASTED
    Process message control output for entries in the NAST table
    RSORAREL
    Get the Oracle Release
    RSPARAM
    Display all instance parameters
    RSPO0041
    Removing old spooling objects
    RSRSCAN1
    Search source code for a given string. Will also search includes. Also see RKCTSEAR and RPR_ABAP_SOURCE_SCAN.
    RSSNAPDL
    Clean the old ABAP error dumps
    RSTBSERV
    Compare a contents of a table between clients
    RSTXFCON
    Converts SAPScript page formats
    RSTXSCRP
    Save a SAPScript layout set to disk, and load it back into SAP.
    RSTXSCRP
    Transport SAPscript files across systems
    RSTXSCRP
    Upload and download SAPScript layout sets
    RSTXTPDF4
    Pass the spool number of a report's output to this program to have the output converted to PDF format.
    RSTXTRAN
    Add standard texts to a transport so they can be moved between systems.
    RSUSR003
    Check the passwords of users SAP* and DDIC in all clients
    RSUSR006
    List users last login
    RSWBO052
    Change development class of a sapscript (provided by Alan Cecchini)
    RSWBO060
    put objects into a request and transport it to any other system
    inernal tables
    INTERNAL TABLES IN ABAP:
    There are two ways of accessing the records in an internal table:
    By copying individual records into a work area. The work area must be compatible with the line type of the internal table.
    You can access the work area in any way, as long as the component you are trying to access is not itself an internal table. If one of the components is an internal table, you must use a further work area, whose line type is compatible with that of the nested table.
    When you change the internal table, the contents of the work area are either written back to the table or added as a new record.
    By assigning the individual data records to an appropriate field symbol. Once the system has read an entry, you can address its components directly via its address. There is no copying to and from the work area. This method is particularly appropriate for accessing large or complex tables.
    If you want to read more than one record, you must use a LOOP... ENDLOOP structure. You can then change or delete the line that has just been read, and the system applies the change to the table body. You can also change or delete lines using a logical condition.
    When you use the above statements with sorted tables, you must ensure that the sort sequence is maintained.
    Within a loop, the INSERT statement adds the data record before the current record in the table. If you want to insert a set of lines from an internal table into another index table, you should use the INSERT LINES OF variant instead.
    When you read single data records, you can use two further additions:
    In the COMPARING addition, the system compares the field contents of a data record with those in the work area for equality.
    In the TRANSPORTING addition, you can restrict the data transport to selected fields.
    Other statements for standard tables
    SORT [ASCENDING|DESCENDING]
    [BY [ASCENDING|DESCENDING] ..
    [ASCENDING|DESCENDING]][AS TEXT] [STABLE].
    These statements sort the table by the table key or the specified field sequence. If you do not use an addition, the system sorts ascending. If you use the AS TEXT addition, character fields are sorted in culture-specific sequence. The relative order of the data records with identical sort keys only remain constant if you use the STABLE addition.
    APPEND INTO SORTED BY .
    This statement appends the work area to the ranked list in descending order. The ranked list may not be longer than the specified INITIAL SIZE, and the work area must satisfy the sort order of the table.
    The statements listed here can be used freely with both standard and sorted tables.
    When you change a single line, you can specify the fields that you want to change using the TRANSPORTING addition. Within a loop, MODIFY changes the current data record.
    If you want to delete a set of lines from an index table, use the variant DELETE FROM... TO.. or WHERE... instead of a loop. You can program almost any logical expression after WHERE.
    The only restriction is that the first field in each comparison must be a component of the line structure (see the corresponding Open SQL statements). You can pass component names dynamically.
    If you want to delete the entire internal table , use the statement CLEAR .
    In the LOOP AT... ENDLOOP structure, the statements within the loop are applied to each data record in turn. The INTO addition copies entries one at a time into the work area.
    The system places the index of the current loop pass in the system field sy-tabix. When the loop has finished, sy-tabix has the same value that it had before the loop started.
    Inserting and deleting lines within a loop affects the following loop passes.
    Access to a hashed table is imple mented using a hash algorithm. Simplified, this means that the data records are distributed randomly but evenly over a particular memory area.. The addresses are stored in a special table called the hashing table .
    There is a hash function, which determines the address at which the pointer to a data record with a certain key can be found. The function is not injective, that is, there can be several data records stored at a single address. This is implemented internally as a chained list. Therefore, although the system still has to search sequentially within these areas, it only has to read a few data records (usually no more than three). The graphic illustrates the simplest case, that is, in which there is only one data record stored at each address.
    Using a hash technique means that the access time no longer depends on the total number of entries in the table. On the contrary, it is always very fast. Hash tables are therefore particularly useful for large tables with which you use predominantly read access.
    Data records are not inserted into the table in a sorted order. As with standard tables, you can sort hashed tables using the SORT statement:
    SORT [ASCENDING|DESCENDING]
    [BY [ASCENDING|DESCENDING] ..
    [ASCENDING|DESCENDING]][AS TEXT].
    Sorting the table can be useful if you later want to use a loop to access the table.
    You can use the statements listed here with tables of all three types. Apart from a few special cases, you can recognize the statements from the extra keyword TABLE. The technical implementation of the statements varies slightly according to the table type.
    As a rule, index access to an internal table is quickest. However, it sometimes makes more sense to access data using key values. A unique key is only possible with sorted and hashed tables. If you use the syntax displayed here, your program coding is independent of the table type (generic type specification, easier maintenance).
    With a standard table, inserting an entry has the same effect as appending. With sorted tables with a non-unique key, the entry is inserted before the first (if any) entry with the same key.
    To read individual data records using the first variant, all fields of that are key fields of must be filled. and can be identical. If you use the WITH TABLE KEY addition in the second variant, you must also specify the key fully. Otherwise, the system searches according to the sequence of fields that you have specified, using a binary search where possible. You can force the system to use a binary search with a standard table using the BINARY SEARCH addition.
    In this case, you must sort the table by the corresponding fields first. The system returns the first entry that meets the selection criteria.
    Similarly to when you read entries, when you change and delete entries using the key and a work area, you must specify all of the key fields.
    You can prevent fields from being transported into the work area during loop processing by using the TRANSPORTING NO FIELDS addition in the WHERE condition. (You can use this to count the number of a particular kind of entry.)
    Other statements for all table types
    DELETE ADJACENT DUPLICATES FROM
    [COMPARING .. | A L L F I E L }|ALL FIELDS}].
    The system deletes all adjacent entries with the same key field contents apart from the first entry. You can prevent the system from only comparing the key field using the COMPARING addition. If you sort the table by the required fields beforehand, you can be sure that only unique entries will remain in the table after the DELETE ADJACENT DUPLICATES statement.
    Searches all lines of the table for the string . If the search is successful, the system sets the fields sy-tabix and sy-fdpos.
    FREE .
    Unlike CLEAR, which only deletes the contents of the table, FREE releases the memory occupied by it as well.
    If you want to access your data using the index and do not need your table to be kept in sorted order or to have a unique key, that is, when the sequence of the entries is the most important thing, not sorting by key or having unique entries, you should use standard tables. (If you decide you need to sort the table or access it using the key or a binary search, you can always program these functions by hand.)
    This example is written to manage a waiting list.
    Typical functions are:
    Adding a single entry,
    Deleting individual entries according to certain criteria,
    Displaying and then deleting the first entry from the list,
    Displaying someone's position in the list.
    For simplicity, the example does not encapsulate the functions in procedures.
    The first thing we do in the example is to declare line and table type, from which we can then declare a work area and our internal table. We also require an elementary field for passing explicit index values.
    This example omits the user dialogs and data transport, assuming that you understand the principles involved. We really only want to concentrate on the table access:
    Adding new entries
    The data record for a waiting customer is only added to the table if it does not already exist in it. If the table had a unique key, you would not have had to have programmed this check yourself.
    Deleting single entries according to various criteria
    The criterion is the key field. However, other criteria would be possible - for example, deleting data records older than a certain insertion date reg_date.
    Displaying and deleting the first entry from the list
    Once a customer comes to the top of the waiting list, you can delete his or her entry. If the waiting list is empty, such an action has no effect. Consequently, you do not have to check whether there are entries in the list before attempting the deletion.
    Displaying the position of a customer in the waiting list
    As above, you do not need to place any data in the work area. We are only interested in the values of sy-subrc and sy-tabix. If the entry is not in the table, sy-tabix is set to zero.
    At this stage, let us return to the special case of the restricted ranked list:
    DATA {TYPE|LIKE} STANDARD TABLE OF ... INITIAL SIZE . ... APPEND INTO SORTED BY .
    When you choose to use a sorted table, it will normally be because you want to define a unique key.
    The mere fact that the table is kept in sorted order is not that significant, since you can sort any kind of internal table. However, with sorted tables (unlike hashed tables), new data records are inserted in the correct sort order. If you have a table with few entries but lots of accesses that change the contents, a sorted table may be more efficient than a hashed table in terms of runtime.
    The aim of the example here is to modify the contents of a database table. The most efficient way of doing this is to create a local copy of the table in the program, make the changes to the copy, and then write all of its data back to the database table. When you are dealing with large amounts of data, this method both saves runtime and reduces the load on the database server. Since the internal table represents a database table in this case, you should ensure that its records have unique keys.
    This is assured by the key definition. Automatic sorting can also bring further advantages.
    When you change a group of data records, only the fields price and currency are copied from the work area.
    This means that, with larger tables, the access time is reduced significantly in comparison with a binary search. In a loop, however, the hashed table has to search the entire table (full table scan). Since the table entries are stored unsorted, it would be better to use a sorted table if you needed to run a loop through a left-justified portion of the key.
    It can also be worth using a hashed table but sorting it. A typical use for hashed tables is to buffer detailed information that you need repeatedly and can identify using a unique key. You should bear in mind that you can also set up table buffering for a table in the ABAP Dictionary to cover exactly the same case. However, whether the tables are buffered on the application table depends on the size of the database table.
    Buffering in the program using hashed tables also allows you to restrict the dataset according to your own needs, or to buffer additional data as required.
    In this example, we want to allow the user to enter the name of a city, and the system to display its geographical coordinates.
    First, we fill our "buffer table" city_list with values from the database table sgeocity. Then, we read an entry from the hashed table, specifying the full key.
    The details are displayed as a simple list. At this point, it is worth repeating that you should only use this buffering technique if you want to keep large amounts of data locally in the program. You must ensure that you design your hashed table so that it is possible to specify the full key when you access it from your program.
    You can define internal tables either with (WITH HEADER LINE addition) or without header lines. An internal table with header line consists of a work area (header line) and the actual table body. You address both objects using the same name. The way in which the system interprets the name depends on the context. For example, the MOVE statement applies to the header line, but the SEARCH statement applies to the body of the table.
    To avoid confusion, you are recommended to use internal tables without header lines. This is particularly important when you use nested tables. However, internal tables with header line do offer a shorter syntax in several statements (APPEND, INSERT, MODIFY, COLLECT, DELETE, READ, LOOP).
    hope this is helpful
    do reward

Maybe you are looking for

  • What is the best practice for using exceptions ?

    hello I would like to know when to do I have to use 1: myMethod () throws Exception2: myMethod () throws MyException3: myMethod () { try {} catch(SQLException sqlException){} }4 : myMethod () throws MyException { try{} catch (ClassNotFoundException e

  • Need to delete the SPAM requests from the import queue

    Dear all, There were some issues with my QA system SAP patch application and we were forced to do a DB refresh from our production system. Now our QA system ABAP stack is having an issue with the  STMS import queue which shows 4 old patches(witch wer

  • Oracle 8i and Win XP

    Hi, This goes to anyone who can help. I just installed Ora81 on WinXP. Installed developer 6.0 as well. I copied the tnsnames.ora from 8i to dev 6.0 tnsnames.ora file. When I try to log into formbuilder or any other app, it does not recognize the ser

  • OCS package  does not match the current software component vector

    Hello TECHIES,                         Please help me with following error   it is very emergency We had developed an ADD-ON in CRM7.0  and when we try to Install in  it into  CRM EHP1 server we get the following error: OCS package  does not match th

  • Iphone 5 - SIM card and contacts

    Are new contacts stored on the SIM card and how do you see what is on the SIM card?  Also, why does an old contact name and number (one that is no longer in my contacts app) appear when i start to enter the name of the person i am sending the text to