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 statement is not fetching data???

Former Member
0 Likes
5,259

Dear ABAP'ers,

I have a written a select statement which is not fetching data from the table .

passing values in so_werk, so_budat, so_arbpl

SELECT a~werks a~budat a~qualf a~urcod a~arbpl a~katalogart a~urgrp a~urcod a~version

            a~iserh

     INTO   CORRESPONDING FIELDS OF TABLE itab1

     FROM   zctsi_pw AS a

     WHERE  a~werks IN so_werk

     AND    a~budat IN so_budat

     AND    a~arbpl IN so_arbpl

     AND    a~aufnr IN so_aufnr

     AND    a~urgrp IN so_urgrp

     AND    a~urcod IN so_urcod.

kindly guide me to solve the issue.

13 REPLIES 13
Read only

Former Member
0 Likes
2,885

If the table Zctsi_pw is maintained in SAP , then cross check the data thru se11 . or if this table is created during the program execution , try to debug the program and see the content of the 'z' table.

Read only

0 Likes
2,885

Thanks Anjali,

Its a data dic table, I checked thru se11, data is available. When i debug, the internal table itab1 is not getting filled.

Read only

0 Likes
2,885

Is there any field whose data requires padding zero in beginning .  i.e the  data length is  16 , but the actual data is for 10 and for which u have to pad six zeros.

Read only

0 Likes
2,885

Hi Suhale,

i don't getting why you have written like this, the syntax you have used are used when we used

join conditions.

Simply write your logic as shown below

SELECT werks budat qualf urcod arbpl katalogarturgrp urcod version

            iserh

     INTO   CORRESPONDING FIELDS OF TABLE itab1

     FROM   zctsi_pw

     WHERE  werks IN so_werk

     AND   budat IN so_budat

     AND   arbpl IN so_arbpl

     AND   aufnr IN so_aufnr

     AND    urgrp IN so_urgrp

     AND    urcod IN so_urcod.

One thing more have you used SELECT-OPTIONS or PARAMETERS

if parameters, then you have to change these declarations.

Read only

Former Member
0 Likes
2,885

hi

Don`t pass value to so_werk, so_budat, so_arbpl, will get data?

then one by one check.

regards,

Archer

Read only

harshsisodia31
Participant
0 Likes
2,885

Hi,

Go to se16n and put the select option data in the respective field and execute, check if u r getting the records.

Hope it helps.

Read only

ThangaPrakash
Active Contributor
0 Likes
2,885

Hello Suhale,

Write like below.

TYPES : BEGIN of strt.

Declare the fields werks budat qualf urcod arbpl katalogart urgrp urcod versio iserh.

END OF strt.

DATA: itab TYPE TABLE OF strt.

SELECT werks budat qualf urcod arbpl katalogart urgrp urcod versio iserh

     INTO   TABLE itab

     FROM   zctsi_pw

     WHERE  werks IN so_werk

     AND    budat IN so_budat

     AND    arbpl IN so_arbpl

     AND    aufnr IN so_aufnr

     AND    urgrp IN so_urgrp

     AND    urcod IN so_urcod.

Don't use table alias, it can be used only if you are using the JOINS.

Read only

Former Member
0 Likes
2,885

Issue Solved... Thanks for your help. issue is in IF statement.

Old Stmt:

---------------

IF so_werk = '1061'.      " Problem is here"

     SELECT a~werks a~budat a~qualf a~urcod a~arbpl a~katalogart a~urgrp a~urcod a~version

            a~iserh

     INTO   CORRESPONDING FIELDS OF TABLE itab1

     FROM   zctsi_pw AS a

     WHERE  a~werks IN so_werk

     AND    a~budat IN so_budat

     AND    a~arbpl IN so_arbpl

     AND    a~aufnr IN so_aufnr

     AND    a~urgrp IN so_urgrp

     AND    a~urcod IN so_urcod.

   ELSE.

***

***

ENDIF.



New Stmt:

----------------


IF so_werk-low = '1061'.

     SELECT a~werks a~budat a~qualf a~urcod a~arbpl a~katalogart a~urgrp a~urcod a~version

            a~iserh

     INTO   CORRESPONDING FIELDS OF TABLE itab1

     FROM   zctsi_pw AS a

     WHERE  a~werks IN so_werk

     AND    a~budat IN so_budat

     AND    a~arbpl IN so_arbpl

     AND    a~aufnr IN so_aufnr

     AND    a~urgrp IN so_urgrp

     AND    a~urcod IN so_urcod.

   ELSE.

***

***

ENDIF.

Read only

0 Likes
2,885

You never mentioned "IF" statement in your earlier ( first) mail. Any how  , as u solved it , it is good

close the thread

Read only

matt
Active Contributor
0 Likes
2,885

No he didn't. This really shows why it is so important to give full information when you have a problem. If he'd posted this in the first place, no-one's time would have been wasted. Very poor in my opinion.

Read only

0 Likes
2,885

Sorry Anjali,

I noticed only after the couple of debugging when it simple quit and moving to else part.

Thanks a lot.

Read only

ThangaPrakash
Active Contributor
0 Likes
2,885

Please mention the enough informations before posting in SCN.

Read only

0 Likes
2,885

Sure Thanga Prakash.... i will...