Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

refresh itab

Former Member
0 Kudos

Hi

refresh itab means

is it clear the workarea or body?

can u explain the lock modes?

how to get the number of entries in select option internal table suppose s_matnr-low value is 1 and s_matnr-high is 100 how to know the how many entries are there in internal table dynamically?

thanks and regards,

kiran.M

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Refresh itab will clear the body.

Locks:

Locks for Database Objects

Use

Multiple transactions can access the same database object, such as a table, at the same time. To isolate the transactions from one another, the database system sets locks for database objects.

Types of Locks

Name

Objects that Can Be Locked

Shared Lock (SHARE LOCK)

Tables, rows, database catalog

Exclusive Lock (EXCLUSIVE LOCK)

Tables, rows, database catalog

Optimistic Lock

Rows

Shared Lock

Use

When a transaction sets a shared lock on a database object, then other transactions can continue to gain read access to the database object, and other shared locks can be set for this database object. However, you cannot set an exclusive lock, or change the database object.

Shared locks can be set for the database catalog, tables, or a table row.

A shared lock is released implicitly at the end of the transaction by the database system or it is released explicitly by an UNLOCK Statement executed by the user.

A shared or read lock is also known as a SHARE lock.

Exclusive Lock

Use

When a transaction sets an exclusive lock on a database object, then the database object in question is available only to this transaction, and can only be changed by this transaction. Other transactions that check for exclusive locks or that want to set exclusive or shared locks conflict with the existing exclusive lock for this transaction (lock collision). They are permitted neither shared nor exclusive access to the locked object.

Exclusive locks can be set for the database catalog, tables, or table rows.

An exclusive lock is released by the database system at the end of the transaction in question. It can also be released with the UNLOCK statement by the respective user. However, this is only possible when the database object has not been changed. If the database object has been changed with an SQL statement (for example, using the INSERT, UPDATE or DELETE statement), the exclusive lock remains in place until the end of the transaction.

Refer Link:- http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/812640632cec01e10000000a155106/frameset.htm

Thanks and Regards,

Bharat Kumar Reddy.V

10 REPLIES 10

Former Member
0 Kudos

Hi,

Refresh itab will clear the body.

Locks:

Locks for Database Objects

Use

Multiple transactions can access the same database object, such as a table, at the same time. To isolate the transactions from one another, the database system sets locks for database objects.

Types of Locks

Name

Objects that Can Be Locked

Shared Lock (SHARE LOCK)

Tables, rows, database catalog

Exclusive Lock (EXCLUSIVE LOCK)

Tables, rows, database catalog

Optimistic Lock

Rows

Shared Lock

Use

When a transaction sets a shared lock on a database object, then other transactions can continue to gain read access to the database object, and other shared locks can be set for this database object. However, you cannot set an exclusive lock, or change the database object.

Shared locks can be set for the database catalog, tables, or a table row.

A shared lock is released implicitly at the end of the transaction by the database system or it is released explicitly by an UNLOCK Statement executed by the user.

A shared or read lock is also known as a SHARE lock.

Exclusive Lock

Use

When a transaction sets an exclusive lock on a database object, then the database object in question is available only to this transaction, and can only be changed by this transaction. Other transactions that check for exclusive locks or that want to set exclusive or shared locks conflict with the existing exclusive lock for this transaction (lock collision). They are permitted neither shared nor exclusive access to the locked object.

Exclusive locks can be set for the database catalog, tables, or table rows.

An exclusive lock is released by the database system at the end of the transaction in question. It can also be released with the UNLOCK statement by the respective user. However, this is only possible when the database object has not been changed. If the database object has been changed with an SQL statement (for example, using the INSERT, UPDATE or DELETE statement), the exclusive lock remains in place until the end of the transaction.

Refer Link:- http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/812640632cec01e10000000a155106/frameset.htm

Thanks and Regards,

Bharat Kumar Reddy.V

Former Member
0 Kudos

hi,

Refresh table clears teh body of the internal table

Lock modes :

you will get complete info in this link..

http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/content.htm

if you want some example:

http://help.sap.com/saphelp_nw04/helpdata/en/9a/49d91d498b4e489eef193e949db3f7/content.htm

select f1 f2
from table1 
into table itab 
where s_f in s_field_on_selection_scrn.
if sy-subrc = 0.
 describe table itab lines v_lines.
endif.

this describe command gives the number of entries in the internal table itab.

Regards,

Richa

Former Member
0 Kudos

hi,

welcome to SDn ../

it clears the body of internal table..

Regards,

Santosh

Former Member
0 Kudos

clear will clear the header line of hte ITAB.

Refresh will delete all the records in the ITAB.

Former Member
0 Kudos

Hi Kiran,

Refresh ITAB or Clear ITAB[] means clear the body of the internal table.

Clear ITAB means clear the workarea of the internal table.

Lock modes:

Exclusive lock

The locked data can be read or processed by one user only. A request for another exclusive lock or for a shared lock is rejected.

Shared lock

Several users can read the same data at the same time, but as soon as a user edits the data, a second user can no longer access this data. Requests for further shared locks are accepted, even if they are issued by different users, but exclusive locks are rejected.

Exclusive but not cumulative lock

Exclusive locks can be requested by the same transaction more than once and handled successively, but an exclusive but not cumulative lock can only be requested once by a given transaction. All other lock requests are rejected.

When s_matnr-low value is 1 and s_matnr-high is 100, then that means it is a range between 1 and 100.

Hope this helps.

Regards,

Vivek

PS: Award points if helpful

Former Member
0 Kudos

hi,

The <b>lock mode</b> controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table.

Access by more than one user can be synchronized in the following ways:

<b>

Exclusive lock:</b> The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected.

<b>Shared lock:</b> More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected.

<b>Exclusive but not cumulative:</b> Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not

cumulative locks can be called only once from the same transaction. All other lock requests are rejected.

Regards,

Sailaja.

former_member181962
Active Contributor
0 Kudos

To know how many entreis exist when s_matnr-low = 1 and s_matnr-high = 100, write this statement.

data: begin of it_mara occurs 0,

matnr type mara-matnr,

end of it_mara.

data v_lines type i.

select matnr

from mara

into it_mara

where matnr in s_matnr.

describe it_mara lines v_lines.

write:/ v_lines.

Regards,

Ravi

Former Member
0 Kudos

Hi Kiran,

as all other questions are answered already, remains the one on the select-options.

Function module <b>RS_REFRESH_FROM_SELECTOPTIONS</b> returns those.

Kind regards,

Silke

Former Member
0 Kudos

1. Refresh ITAB

It clears the body and not the header for header you need to use the CLEAR statement.

2. LOCK modes.

3. Entries in internal table...

As in your example do you wish to understand how many records are there in the the select-option internal table or between is high and low value ?

describe table itab lines lrec. -->can give you the number of lines in the table..for you case it is 1.

lrec = s_matnr-high - s_matnr-low. --> can give you the number of possible entries within the range but it would work only for numeric data.

Former Member
0 Kudos

Hi ,

It will clear just the body of internal table.

Go through this link..

I suppose you are talking about the lock modes associated with data dictionary.

There are 4 modes of locks.

Exclusive,shared, exclusive not cumulative and Optimistic

Refer these links...

http://help.sap.com/saphelp_nw2004s/helpdata/en/7b/f9813712f7434be10000009b38f8cf/content.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eeb2446011d189700000e8322d00/content.htm

<b>Award points if found useful.</b>

Regards,

SP.