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

Empty Internal table?

Former Member
0 Likes
789

Hi Guys,

I am having a problem while writing the code The code is below.

SELECT *

INTO TABLE lt_JEST

FROM JEST

FOR ALL ENTRIES IN lt_PROJ

WHERE OBJNR EQ lt_PROJ-OBJNR.

In the code above i want to keep a condition that if there is no data in PROJ internal table Then this Select Statement should not be executed.Can anybody tell me how to do it?

Thanks,

Gopi.

8 REPLIES 8
Read only

Former Member
0 Likes
758

IF NOT lt_PROJ[] IS INITIAL.
SELECT *
INTO TABLE lt_JEST
FROM JEST
FOR ALL ENTRIES IN lt_PROJ
WHERE OBJNR EQ lt_PROJ-OBJNR.
ENDIF.

Greetings,

Blag.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
758

Sure...

if not it_proj[] is initial.
SELECT *
INTO TABLE lt_JEST
FROM JEST
FOR ALL ENTRIES IN lt_PROJ
WHERE OBJNR EQ lt_PROJ-OBJNR.

endif.

Regards,

Rich Heilman

Read only

0 Likes
758

Or if you are on a newer version, you can do this too.

if lines( it_proj ) > 0.

SELECT *
INTO TABLE lt_JEST
FROM JEST
FOR ALL ENTRIES IN lt_PROJ
WHERE OBJNR EQ lt_PROJ-OBJNR.

Endif.

Regards,

RIch Heilman

Read only

former_member194669
Active Contributor
0 Likes
758

Hi,

If not lt_proj[] is initial.

SELECT *

INTO TABLE lt_JEST

FROM JEST

FOR ALL ENTRIES IN lt_PROJ

WHERE OBJNR EQ lt_PROJ-OBJNR.

endif,

aRs

Read only

Former Member
0 Likes
758

or

DESCRIBE TABLE lt_proj LINES g_rows.

IF g_rows <> 0.

SELECT *

INTO TABLE lt_JEST

FROM JEST

FOR ALL ENTRIES IN lt_PROJ

WHERE OBJNR EQ lt_PROJ-OBJNR.

Endif.

Read only

Former Member
0 Likes
758

Hello,

you can do this:

data: lines type i.

describe table lt_PROJ LINES lines.

if lines > 1.

SELECT *

INTO TABLE lt_JEST

FROM JEST

FOR ALL ENTRIES IN lt_PROJ

WHERE OBJNR EQ lt_PROJ-OBJNR.

endif.

regards

David

Read only

Former Member
0 Likes
758

Hi Gopi,

try this out.

IF NOT IT_PROJ[] IS INITIAL.

SELECT * from JEST

INTO TABLE IT_JEST

FOR ALL ENTRIES IN IT_PROJ

WHERE OBJNR = PROJ-OBJNR.

<b>(CHECK IF U WANT TO COMPARE WITH PROJ OR IT_PROJ, IF U R CHECKING IN IT_PROJ, THEN IT_PROJ-OBJNR. (<i>I THINK IT SHOULD BE IT_PROJ-OBJNR</i>)</b>

ELSE.

..

..

..

..

ENDIF.

REWARD POINTS IF USEFUL

THANKS

Sujay

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
758

describe table it_proj[].

if sy-tfill > 0.

execute the statement.

endif.