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

SELECT where COND query

Former Member
0 Likes
1,946

I would like to take first 9 digit from a table column where input match with 9 digit.

for e.g PROJ table , column ZUONR(9).

How to do in the select statement where cond?

Select * from PROJ into IT_TAB where ZUONR(9) = input ZUONR.

Any suggestion

11 REPLIES 11
Read only

Former Member
0 Likes
1,883

Field ZUONR in PROJ not exist.

Reframe your question with right information and good language.

Read only

Former Member
0 Likes
1,883

I have an internal table with zvalue - containing 9 digit values only .

I'm using this value in a select statement of PROJ Where PSPID = intab value.

There are some cases where pspid has 10 digits so i need to compare only 9 digits of PSPID with my internal table value.

SELECT * FROM WHERE PSPID = ITAB-ZVALUE.

this select will retrieve only values where pspid has 9 digits.

but if proj-pspid has 10 digits i need to check the 9 digits of PSPID with my itab value.

Any suggestion

Edited by: Prabha on Dec 26, 2008 11:00 AM

Read only

0 Likes
1,883

Press F1 on SELECT WHERE and look at wildcards.

Rob

Read only

GuyF
Active Participant
0 Likes
1,883

Hi,

Try Select * from PROJ into IT_TAB where PSPID(9) LIKE '%xxx'.

Guy.

Read only

0 Likes
1,883
tables:proj."This is must
data:it_itab TYPE STANDARD TABLE OF proj WITH HEADER LINE.
Select * from PROJ. 
  IF proj-PSPID(9) = xxx.
APPEND proj to it_itab.
  ENDIF.
  ENDSELECT.
Read only

0 Likes
1,883

>

> Hi,

>

> Try Select * from PROJ into IT_TAB where PSPID(9) LIKE '%xxx'.

>

> Guy.

This Will Syntax Error.

Read only

GuyF
Active Participant
0 Likes
1,883

I didn't mean "Try" as in the command, but as in "attempt the following code".

Read only

0 Likes
1,883

Yes,I know every one gives here some Code snippet(only idea,Not exact code ).

But your basic suggestion( PSPID(9) with Select query ) would give syntax error.We cannot use Offsets with select queries.

Read only

0 Likes
1,883

Without if condition is it possible in select statement?becoz i'm joining two table, other table has only 9 digit in the table coumn?

Read only

0 Likes
1,883
LOOP AT itab.
           SELECT * FROM prpj.
    
if prpj-PSPID(9) = itab-pspid.
                      APPEND prpj TO itab2 .
endif.
      ENDSELECT.
    ENDLOOP.

With select query we cannot use Offsets anyway.So you may need to do work some around this only.

Read only

0 Likes
1,883

Thanks for the help.