Application Development and Automation 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: 
Read only

plz chk the code

Former Member
0 Likes
760

hi

plz help me..

SELECT vbeln "order number

FROM vbuk

INTO TABLE lt_order

FOR ALL ENTRIES IN lt_ztsd2marc

WHERE vbeln NE lt_ztsd2marc-ordnr

AND gbstk EQ 'A'.

IF sy-subrc NE 0.

MESSAGE i227(z2).

LEAVE LIST-PROCESSING.

ENDIF.

NE is not workin its takin the values from ztsd2marc table also.

5 REPLIES 5
Read only

Former Member
0 Likes
718

see this code ,its working on my custom tables ..copy this and change ur table names accordingly -

reward if helpfull.

data begin of itab occurs 0.

include structure zgill_main.

data end of itab.

data begin of itab1 occurs 0.

include structure zgill_details.

data end of itab1.

select * from zgill_main into table itab where pernr = '11111111'.

if not itab[] is initial.

select * from zgill_details into table itab1 for all entries in itab

where pernr ne itab-pernr.

endif.

loop at itab1.

write:/ itab1-pernr.

endloop.

Message was edited by:

Amit Tyagi

Message was edited by:

Amit Tyagi

Read only

0 Likes
718

i m not able to understand what is this..

can u just clear ur requirment littlebit.

Read only

SantoshKallem
Active Contributor
0 Likes
718

did u placed

<b>if not it_ztsd2marc[] is initial</b> before select statement.

reward if helpful.

Read only

Former Member
0 Likes
718

Hello Neha,

Whenever u r using for all entries then u need check the body of the itab using for all entries.

Use IF not lt_ztsd2marc[] is intiial.

SELECT vbeln "order number

FROM vbuk

INTO TABLE lt_order

FOR ALL ENTRIES IN lt_ztsd2marc

WHERE vbeln NE lt_ztsd2marc-ordnr

AND gbstk EQ 'A'.

IF sy-subrc NE 0.

MESSAGE i227(z2).

LEAVE LIST-PROCESSING.

ENDIF.

endif.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
718

Hi Neha,

In connection with SELECT ... FOR ALL ENTRIES the following problems occur:

1)You cannot have an empty internal driver table. If the driver table is empty, selection is not limited. In particular, WHERE clause conditions are not evaluated if they do not refer to the internal driver table.

2)Duplicate table entries should be deleted from the internal table before executing the SELECT... FOR ALL ENTRIES. If they are not deleted, identical data is read unnecessarily from the database.

3)The parameter rsdb/max_blocking_factor must be implemented according to SAP's database-specific recommendations.

4)The SELECT ... SELECT FOR ALL ENTRIES addition ensures that SQL statements are divided into several SELECT statements by the database interface. The individual SELECT statements are processed on the database and the results are buffered in the database interface. The database interface eliminates duplicate data records from the results set and transfers the results set to the ABAP program.

5)Each SELECT statement processed on the database is executed as a concatenation of individual accesses (for example, index range scans or index unique scans). Concatenation is performed over the entries in the internal driver table. Since the SELECT ... FOR ALL ENTRIES may be very complex, it should not be combined with RANGES tables.

6)The implementation of the WHERE clause for individual SELECT statements depends on the database and is realized by the database interface.

7)The profile parameter rsdb/max_blocking_factor controls the maximum number of individual WHERE conditions that can be concatenated. SAP pre-configures this parameter according to the database. For Oracle the setting is 15.

Regards,

Balaji Reddy G

**Rewards if answers are helpful.