11-26-2007 10:07 AM
TABLES:PA0000.
data:begin of itable occurs 0,
pernr type pa0000-pernr,
massn type pa0000-massn,
stat1 type pa0000-stat1,
stat2 type pa0000-stat2,
end of itable.
parameters:p_pernr type pa0000-pernr.
select pernr,massn,stat1,stat2 from pa0000 into table itable where pernr = p_pernr.
write itable-massn.
the output is always
EMP-PA0000 1
-
I dont know why,it is not picking correct massn from the table.why?
11-26-2007 10:09 AM
11-26-2007 10:09 AM
11-26-2007 10:12 AM
thanks for your prompt reply.i think that is correct,let me check.Why should we loop it?Why cannot we display directly?any idea?
11-26-2007 10:14 AM
Bcoz, your itable is an internal table and while u r using
write itable-massn it will print the last headerline massn .
bcoz while fetching records, there may be much records and your code will only write the last output massn.
Regs
Manas
11-26-2007 10:15 AM
if loop is not specified than it will print the only value which is in header which is the last record.
so to print all entries we hav to use loop concept
11-26-2007 10:18 AM
Hi ,
u cant write the contents directly bcoz u r using an internal table
and u can only print the contents of the internal table one by one which is done
through looping , otherwise only the last record stored in the work area will get
displayed.
11-26-2007 10:11 AM
Hi,
There may be multiple entries (histories) in table pa0000. Specify the endda and begda ranges correctly. Since u have nt give the date ranges, by default its picking the first record.
Regards,
Vani.
11-26-2007 10:12 AM
TABLES:PA0000.
data:begin of itable occurs 0,
pernr type pa0000-pernr,
massn type pa0000-massn,
stat1 type pa0000-stat1,
stat2 type pa0000-stat2,
end of itable.
parameters:p_pernr type pa0000-pernr.
start-of-selection.
select pernr,massn,stat1,stat2 from pa0000 into table itable where pernr = p_pernr.
end-of-selection.
loop at itable.
write itable-massn.
endloop.
regs
Manas
11-26-2007 10:15 AM
Hi,
Try like this.
TABLES:PA0000.
data:begin of itable occurs 0,
pernr type pa0000-pernr,
massn type pa0000-massn,
stat1 type pa0000-stat1,
stat2 type pa0000-stat2,
end of itable.
select-options : p_pernr for pa0000-pernr.
select pernr,massn,stat1,stat2 from pa0000 into table itable where pernr in p_pernr.
Loop at itable.
write itable-massn.
endloop.
Regards,
Prashant
11-26-2007 10:20 AM
Hai,
Just check in the table pa0000 whther the other values exists for massn
As u have declared itable as a table with header line ,it will only write the record that is in the header as u are only writing itable-massn .For writing ather values u need to give
LOOP AT itable.
WRITE : / itable-massn.
ENDLOOP.
Neeraj
11-26-2007 10:47 AM
thanks everyone,the problem is solved.I have put the content in sapscript and it is printing too.I had a problem with my last sapscript program where i dont use internal table,but unable to print it.I tried many ways,but in vain.