How to find last row in itab?

hi experts,
              How to find the last row or item in an itab.I am using if statement for which i have to check the last row and if it is the last row some set of statements should trigger.
thanks
mani

Just, find the last record :
* Standard table
  DESCRIBE TABLE itab LINES n.
  READ TABLE itab INDEX n.
Check on the table with special work at last record :
* Loop
  LOOP AT itab.
    MOVE itab TO wa_itab.
    AT LAST.
* here wa_itab is the last record (itab is *****)
    ENDAT.
  ENDLOOP.
Regards

Similar Messages

  • How To Find Last Row With Data +2, Then Format?

    I need to find the last row +2, select the range A:L, then format.
    Could someone please supply the code?  I can handle the format part.
    Thanks!
    A. Wolf

    Works great!
    I need to do 2 other things:
    1) Add a text value to r in A: & center over selection A:L
    Dim r As Long
        r = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
           USED THIS BUT ENDING UP IN MIDDLE OF L:!
        ActiveCell = Range("A" & r)
        ActiveCell.Value = "Estimated True Up Total"
    2) 2) Format a total in r as currency/2 decimels/aligned to right.
    THANKS AGAIN!!!
    A. Wolf

  • How to find last DML operation in oracle ADF

    how to find last DML operation in oracle ADF
    Please help me
    Thanks
    Damby

    In the base EntityIml class, just override doDML() method as I said.
    (see http://docs.oracle.com/cd/E16162_01/web.1112/e16182/appendix_mostcommon.htm
    "Methods for Creating Your Own Layer of Framework Base Classes")
    So, put a some flag in the session.
    You should not call doDML() method in backing bean, it will be called by framework.
    In the backing bean, you only have to get that information from the session, as follows:
    String last_dml_op = (String)ADFContext.getCurrent().getSessionScope().get("last_dml_op");And voila...

  • How to find last inserted record in the table.

    Version: Oracle 10g
    I have a table called "Manufacture" and 3 columns as mfno,itemname,quantity.
    How to find last inserted record in the table "Manufacture".
    As i come to know that Rowid is not result perfect results. Please provide your inputs.

    user13416294 wrote:
    Version: Oracle 10gThat is not a version. That is a product name. A version is 10.1.0.2 or 10.2.0.4, etc.
    I have a table called "Manufacture" and 3 columns as mfno,itemname,quantity.
    How to find last inserted record in the table "Manufacture".Not possible as your data model does not cater for it. That simple.
    If there is a need to determine some order or associate some time to an entity, then that should be part of the data model - and a relationship, or one or more attributes are needed to represent that information. Thus your data model in this case is unable to meet your requirements.
    If the requirements are valid, fix the data model. In other words - your question has nothing to do with Oracle and nothing to do with rowid, rowscn or other pseudo columns in Oracle. It is a pure data modeling issue. Nothing more.

  • Last row in itab

    i need to pick last row from itab with respect to each customer .
    customer             amount
    cust1                   10                  
    cust1                    250
    cust2                    50
    cust2                     100
    cust2                     150
    i need  i tab like this
    cust1              250
    cust2              150

    Hi,
    You can code like:
    Sort your Internal Table.
    Loop at Internal Table.
    AT END OF Customer.
    Move Your Required Field Into another
    Internal table field .
    Write: That field.
    ENDAT.
    Endloop.
    Hope it helps
    Regards
    Mansi

  • How to find last accessed/updated tables and the query text?

    I am using :
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
    With the Partitioning option
    JServer Release 8.1.7.4.0 - Production
    How to find last accessed/updated tables and the query text?
    Regards
    LEE1212

    Check DBA_TBALES view there you find one date column that indicate last update
    One option is as follows:
    (1) Turn the auditing on: AUDIT_TRAIL = true in init.ora
    (2) Restart the instance if its running.
    (3) Audit the table:
         AUDIT INSERT,SELECT,DELETE,UPDATE on TableName
         by ACCESS WHENEVER SUCCESSFUL
    (4) Get the desired information using :
         SELECT OBJ_NAME,ACTION_NAME ,to_char(timestamp,'dd/mm/yyyy , HH:MM:SS')
         from sys.dba_audit_object.
    Cheer,
    Virag Sharma
    http://virag.sharma.googlepages.com/
    http://viragsharma.blogspot.com/
    Message was edited by:
    virag_sh

  • How to find last executed query on database and or schema.

    hi,
    how to find last executed query on database and or schema.
    yours sincerely

    Sessionwise if you wanna see means use v$session.. Because it will show execution time also so you can analyze it easily and get sql based on SID and serial number ..
    Try :
    select * from v$session;
    Regards..

  • How to find last date of month

    Dear  All,
    Can anybody tell me how to find last date of month I need it to check some validations
    helpful answer will definatly rewarded
    Regards
    Shashikant

    Hi,
    RP_LAST_DAY_OF_MONTHS Determine last day of month
    HR-D: Payroll Germany code
    RP_LAST_DAY_OF_MONTHS
    HR-D: Determine last day of month
    DATE_CONVERT_TO_FACTORYDATE
    Returns factory calendar date for a date Calculates and returns factory calendar date for a date (if CorrectOption = '+');
    Checks if the date is work day (if CorrectOption = '-').
    HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.

  • How to find out row that was clicked in DataTable?

    Hi there,
    i have a dataTable component which renders a list from database. In the last column of this table you can click a link for further processing for this row.
    How to identify which row was clicked?
    <f:view>
         <h3>Subtitel</h3>
         <h:form>
           <h:dataTable      headerClass="tableheader"
                             var="list"
                             value="#{Uebersicht.uebersichtsliste}">
              <h:column>
                   <f:facet name="header">
                        <f:verbatim>KW</f:verbatim>
                            </f:facet>
                           <h:outputText value="#{list.cal.kw}" />
              </h:column>
              <h:column >
                   <f:facet name="header">
                        <f:verbatim>Bemerkung</f:verbatim>
                            </f:facet>
                   <h:outputText value="#{list.cal.feiertagNat}" />
              </h:column>
              <h:column >
                   <f:facet name="header">
                        <f:verbatim>Start</f:verbatim>
                            </f:facet>
                   <h:commandLink action="#{Uebersicht.start}" value="setzen"/>
              </h:column>
            </h:dataTable>
         </h:form>
    </f:view>How to identify the row to process in action methed "uebersicht.start"?
    Regards,
    ak

    the easiest way is you can send the parameters for the command link and the
    output link.this parameters will be the unique id of the rows ur r populating .
    get those parameters by:
    request.getParameter(keep the id u kept in the parameters list);
    I worked it out before ,its perfect.
    regards,
    raju reddy

  • HOW TO FIND LAST DOCUMENT DATE BASED ON MATERIAL NUMBER

    Hi,
           I want to know how to find the last document details based on material number.
    Is there any Functional modulle or BAPI programe?
    i,e, I want know last goods receipt details (MIGO)  based on material number.
    Can u please anybody tell me.
    Thanks,
    S.Muthu.
    Edited by: Subramaniyan Marimuthu on Jan 2, 2008 9:07 AM

    Hello.
    Check the BAPI_GOODSMVT_GETITEMS
    -example--
    Get GRs after a specific date for a specific plant/ storage location and movement types
      wa_budats-sign = 'I'.
      wa_budats-option = 'GE'.
      wa_budats-low = '20071201'.
      APPEND wa_budats TO budats.
      wa_plants-sign = 'I'.
      wa_plants-option = 'EQ'.
      wa_plants-low = '1000'.
      APPEND wa_plants TO plants.
      wa_stlocs-sign = 'I'.
      wa_stlocs-option = 'EQ'.
      wa_stlocs-low = '0001'.
      APPEND wa_stlocs TO stlocs.
      wa_mvts-sign = 'I'.
      wa_mvts-option = 'EQ'.
      wa_mvts-low = '101'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '901'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '123'.
      APPEND wa_mvts TO mvts.
      CALL FUNCTION 'BAPI_GOODSMVT_GETITEMS'
        TABLES
          plant_ra        = plants
          stge_loc_ra     = stlocs
          move_type_ra    = mvts
          pstng_date_ra   = budats
          goodsmvt_header = header
          goodsmvt_items  = item
          return          = return.
    Reward if helpful.
    Cheers,
    George

  • How to find Last Payment date for vendor

    Hi,
    I am working on ALV  Vendor report details.
    1) How to find the last payment date for the vendor.
    2) In input paramter field  
        PARAMETERS: L_FILE  LIKE  RLGRAP-FILENAME.
       I want to validate the user input in the selction screen for downloading the file in the presentation server..
      what is the validation I have to write for the path name.
    pl help me give details.
    Thanks in advance.
    sharma

    1) use table REGUH field ZALDT or VALUT
    2) use fm like EPS_GET_FILE_ATTRIBUTES
    A.

  • How to find duplicate row in sql query?

    Hi All,
    Please solve my query, find duplicate row and how to count its. your suggestion would be greatly appreciated.

    You can use group by and having.
    SQL> WITH t
      2       AS (SELECT       LEVEL id
      3                 FROM   DUAL
      4           CONNECT BY   LEVEL <= 5
      5           UNION ALL
      6           SELECT       LEVEL + 2
      7                 FROM   DUAL
      8           CONNECT BY   LEVEL <= 3)
      9  SELECT   *
    10    FROM   t;
            ID
             1
             2
             3
             4
             5
             3
             4
             5
    8 rows selected.
    SQL> WITH t
      2       AS (SELECT       LEVEL id
      3                 FROM   DUAL
      4           CONNECT BY   LEVEL <= 5
      5           UNION ALL
      6           SELECT       LEVEL + 2
      7                 FROM   DUAL
      8           CONNECT BY   LEVEL <= 3)
      9  SELECT     id, COUNT (*)
    10      FROM   t
    11  GROUP BY   id
    12    HAVING   COUNT (*) > 1;
            ID   COUNT(*)
             3          2
             4          2
             5          2
    SQL>

  • How to find Tuple(row) size in a Data Block

    hi,
    I want to find out the size of 1 row and total size of a table in a data block in Oracle 11g. For Example I've a Employee table with 300 rows. I want to find out how much space these rows are occupying in a data block (8192 default) and also the size of 1 individual row.
    I'll appreciate the valuable suggestions.
    Thanks alot.
    Regards,
    Kamran

    Hi,
    Welcome to the forum!
    See [Calculating Oracle average row length|http://www.dba-oracle.com/t_average_row_length.htm], I hope it helps
    Regards,

  • How to find selected rows in REUSE_ALV_GRID_DISPLAY

    HEllo All,
    In OO we have a method to find get_selected_rows but i am unable to what is the way to find selected rows in REUSE_ALV_GRID_DISPLAY.
    I am able to find a single row but i have to find multiple cleans in ALV. How can i do this.
    Please help me with some ideas or please post some sample codes.
    Regards,
    Lisa

    Hi,
    Check this code..
    REPORT  zdayatest1.
    TABLES :t247.
    TYPE-POOLS slis. "Type definitions for alv report
    TYPES: BEGIN OF ty_func_tab,
            fcode    TYPE rsmpe-func,
            END OF ty_func_tab.
    DATA: it_fieldcat TYPE  lvc_t_fcat,
          wa_fieldcat TYPE  lvc_s_fcat.
    DATA: is_lvc_s_glay TYPE lvc_s_glay.
    DATA: wa_layout TYPE lvc_s_layo.
    DATA: is_rxtab  TYPE ty_func_tab.
    DATA: BEGIN OF it_final OCCURS 0,
          check(1),
          mnr LIKE t247-mnr,
          ltx LIKE t247-ltx,
          END OF it_final.
    DATA: wa_final LIKE it_final.
    DATA: w_repid LIKE sy-repid.
    START-OF-SELECTION.
      w_repid = sy-repid.
      REFRESH it_final.
      SELECT mnr ltx
      FROM t247
      INTO CORRESPONDING FIELDS OF TABLE it_final
      WHERE spras EQ 'E'.
      wa_fieldcat-fieldname = 'CHECK'.
      wa_fieldcat-tabname   = 'IT_FINAL'.
      wa_fieldcat-checkbox  = 'X'.
      wa_fieldcat-edit      = 'X'.
      wa_fieldcat-outputlen = '3'.
      wa_fieldcat-col_pos   = '1'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname  = 'MNR'.
      wa_fieldcat-tabname    = 'IT_FINAL'.
      wa_fieldcat-outputlen  = '8'.
      wa_fieldcat-col_pos    = '2'.
      wa_fieldcat-coltext  = 'Month'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname  = 'LTX'.
      wa_fieldcat-tabname    = 'IT_FINAL'.
      wa_fieldcat-outputlen  = '20'.
      wa_fieldcat-col_pos    = '3'.
      wa_fieldcat-coltext  = 'Month Desc'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_layout-zebra = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_callback_program       = w_repid
          i_callback_pf_status_set = 'SUB_PF_STATUS'
          i_callback_user_command  = 'USER_COMMAND'
          i_grid_title             = 'TESTING'
          is_layout_lvc            = wa_layout
          it_fieldcat_lvc          = it_fieldcat
        TABLES
          t_outtab                 = it_final
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *&      Form  USER_COMMAND
    FORM user_command USING ucomm LIKE sy-ucomm
                            selfield TYPE slis_selfield.
      IF selfield-fieldname = 'CHECK'.
        DATA ref1 TYPE REF TO cl_gui_alv_grid.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref1.
        CALL METHOD ref1->check_changed_data.
        LOOP AT it_final WHERE check = 'X'.
          IF it_final-check IS INITIAL.
            it_final-check = 'X'.
          ELSE.
            CLEAR it_final-check.
          ENDIF.
          MODIFY it_final.
        ENDLOOP.
        selfield-refresh = 'X'.
      ENDIF.
    ENDFORM.                    "USER_COMMAND
    *&      Form  sub_pf_status
    *       text
    *      -->RT_EXTAB   text
    FORM sub_pf_status USING rt_extab TYPE slis_t_extab.        "#EC CALLED
      CLEAR is_rxtab.
      is_rxtab-fcode = 'TEST'.
      APPEND is_rxtab TO rt_extab.
      SET PF-STATUS 'PF_STATUS' ."EXCLUDING rt_extab.
    ENDFORM.                    "sub_pf_status

  • How to find last executed query

    Hello,
    I want to find the last executed query in the Oracle database.
    Can anybody help me, how can I find last fired query.
    I am using following query for it, but it gives me the same query as in the result.
    SELECT SQL_TEXT FROM V$SQL
    WHERE ADDRESS = (SELECT SQL_ADDRESS
    FROM V$SESSION
    WHERE AUDSID = USERENV('SESSIONID'))
    Please help me.Thanks.

    Hi,
    select sa.sql_text,ss.username
    from v$session ss, v$sqlarea sa
    where sa.hash_value = ss.prev_hash_value
    SQL> /
    SQL_TEXT
    USERNAME
    DELETE FROM T
    HR
    GRANT SELECT ON T TO
    HR
    SELECT COUNT(*) FROM HR.T
    SCOTT
    SQL_TEXT
    USERNAME
    select sa.sql_text,ss.username from v$session ss, v$sqlarea sa where sa.hash_val
    ue = ss.prev_hash_value
    SYSregards
    Taj
    Message was edited by:
    Mohammad Taj

Maybe you are looking for