‎2008 Jul 28 6:24 AM
Hi,
Can anybody tel me what is wrong with following code:
data: itab_tbtco type TBTCO occurs 0.
data: wa type itab_tbtco.
select * into table itab_tbtco from tbtco where jobname = p_jname
and authcknam = p_uname
and strttime in s_time.
loop at itab_tbtco into wa.
write:/ wa-jobname, itab-authcknam, itab-strttime.
endloop.
bcz internal is not get fill by using above query.
if any thing is wrong tel me correct one.
thanks in advance
‎2008 Jul 28 6:30 AM
Hi,
Instead of
data: itab_tbtco type TBTCO occurs 0.
Write-
data:itab_tbtco type table of TBTCO occurs 0.
Regards,
Sujit
‎2008 Jul 28 6:30 AM
Hi,
Instead of
data: itab_tbtco type TBTCO occurs 0.
Write-
data:itab_tbtco type table of TBTCO occurs 0.
Regards,
Sujit
‎2008 Jul 28 6:32 AM
Hi
the problem is here in the loop. As the Internal table doesn't have a header line you have to access the components using a work area. Please try the following code and check.
loop at itab_tbtco into wa.
write:/ wa-jobname, wa-authcknam, wa-strttime.
endloop.
Hope it helps.
Murthy
‎2008 Jul 28 6:40 AM
hi,
Declare the work area as follows
DATA: WA type TBTCO. Rest of the code is correct.
Thanks!!
rahul
‎2008 Jul 28 7:23 AM
Hi ,
As Rahul said above,
Declare the WA as follows and do the change in the LOOP.
Data: WA like line of itab_tbtco. (or)
Data: WA type tbtco.
*
loop at itab_tbtco into wa.
write:/ wa-jobname, wa-authcknam, wa-strttime.
endloop.
‎2008 Jul 28 7:49 AM
Priya,
There have been several complaints that you do not follow up on your questions.
Please do that, and indicate which answer you found to be helpfull or correct.
My advice to others is, simply ignore the question.
Cheers,
Julius
PS: If the rules are broken in the question already, the whole thread thread is deleted and points are removed anyway...
‎2008 Jul 28 11:11 AM
Hi,
I think you dont need to declare a work area here.I hope the below code will help you.
data: itab_tbtco type TBTCO occurs 0.
*data: wa like line of itab_tbtco.
select * into table itab_tbtco from tbtco where jobname = p_jname
and authcknam = p_uname
and strttime in s_time.
loop at itab_tbtco.
write:/ itab_tbtco-jobname, itab_tbtco-authcknam, itab_tbtco-strttime.
endloop.
Thanks,
Khushbu.
‎2008 Jul 28 12:05 PM
Use following code....
DATA: itab_tbtco TYPE STANDARD TABLE OF tbtco .
DATA: wa TYPE tbtco.
SELECT * INTO TABLE itab_tbtco FROM tbtco WHERE jobname = p_jname
AND authcknam = p_uname
AND strttime IN s_time.
LOOP AT itab_tbtco INTO wa.
WRITE:/ wa-jobname, WA-authcknam, WA-strttime.
ENDLOOP.
‎2008 Jul 28 12:16 PM
hi,
DATA: itab_tbtco TYPE STANDARD TABLE OF tbtco ,
wa TYPE tbtco.
SELECT * INTO TABLE itab_tbtco FROM tbtco WHERE jobname = p_jname
AND authcknam = p_uname
AND strttime IN s_time.
LOOP AT itab_tbtco INTO wa.
WRITE:/ wa-jobname, WA-authcknam, WA-strttime.
ENDLOOP.
ur using occurs that is good, but dont use '0' , use any number instead of '0', for performence issue
‎2008 Jul 28 12:18 PM
hi Priya ,
instead of writing
data: itab_tbtco type TBTCO occurs 0.
u can use
data: itab_tbtco type standard table of TBTCO .
Regards
Amit
‎2008 Jul 29 8:20 AM
Hi,
You can changed your code like this:
TABLES : tbtco.
"Define internal table itab_tbtco
DATA : itab_tbtco TYPE STANDARD TABLE OF tbtco.
"Define work area wa of internal table itab_tbtco
DATA : wa LIKE LINE OF itab_tbtco.
SELECTION-SCREEN BEGIN OF BLOCK b1.
PARAMETERS : p_jname TYPE tbtco-jobname,
p_uname TYPE tbtco-authcknam.
SELECT-OPTIONS : s_time FOR tbtco-strttime.
SELECTION-SCREEN END OF BLOCK b1.
SELECT *
INTO TABLE itab_tbtco
FROM tbtco
WHERE jobname = p_jname
AND authcknam = p_uname
AND strttime IN s_time.
LOOP AT itab_tbtco INTO wa.
WRITE:/ wa-jobname, wa-authcknam, wa-strttime.
ENDLOOP.
A little suggestion:
The syntax of "DATA-OCCURS" has exactly the same function as the following DATA statement for the declaration of a standard table and is replace by this also:
DATA itab { {TYPE STANDARD TABLE OF [REF TO] type}
| {LIKE STANDARD TABLE OF [REF TO] dobj} }
WITH NON-UNIQUE DEFAULT KEY
INITIAL SIZE n.
[WITH HEADER LINE].
So it is better not to use "OCCURS 0" in the program.
Besides that, "WITH HEADER LINE" is also not recommended, the best way is to define an internal table, and then an extra work area of that internal table.
Hope it will help.
Best Regards,
Stephanie
‎2008 Jul 29 8:57 AM
Since the select is done as an array fetch ,(as selection is directly been done in the internal table from the database table) so the internal table is being filled in a loop , so end the select statement with endselect.
Thanks and Regards ,
Debojyoti Chanda.
‎2008 Jul 29 8:57 AM
Since the select is done as an array fetch ,(as selection is directly been done in the internal table from the database table) so the internal table is being filled in a loop , so end the select statement with endselect.
Thanks and Regards ,
Debojyoti Chanda.
‎2008 Jul 29 3:19 PM
hi
you can rewrite the code like this,
DATA : wa type itab_tbtco.
select *
into WA
from tbtco where jobname = p_jname
and authcknam = p_uname
and strttime in s_time.
write:/ wa-jobname, wa-authcknam, wa-strttime.
ENDSELECT.
and occurs 0 is an obsolete statement.
Regards
Jose
Edited by: Jijo Jose on Jul 29, 2008 7:49 PM
‎2008 Jul 31 8:29 AM
Hi Priya,
you can do the same thing in the following way:
data: itab_tbtco type table of TBTCO occurs 0.
(above statement will create an internal table of type TBTCO)
data: wa like line of itab_tbtco.
(above statement will create a work area for itab_tbtco)
select * into table itab_tbtco from tbtco where
jobname = p_jname
and authcknam = p_uname
and strttime in s_time.
loop at itab_tbtco into wa.
write:/ wa-jobname, wa-authcknam, wa-strttime.
endloop.
i hope this will help u...
Thanks & Regards
Ashu Singh