‎2007 Mar 21 8:19 PM
hi,
I am trying to fetch the data from table MARA using select stmt. It is not able to fetch the data thought it is correct syntactically, and table also has data.
while creation of the driver program for the same, i used the development class created by me. Is this the reason that its not fetching data from MARA?
am i supposed to use the Dev.class which has table mara? If this is the case how will i know the dev.class of table MARA in se11.
Any help is apprecitated.
thanks.
‎2007 Mar 21 8:22 PM
The Dev calss has nothing to do with the SELECT statement. It only helps to group similar Objects together & useful while migration to other systems. Pl post your code to help loacte the error.
~Suresh
‎2007 Mar 21 8:22 PM
The Dev calss has nothing to do with the SELECT statement. It only helps to group similar Objects together & useful while migration to other systems. Pl post your code to help loacte the error.
~Suresh
‎2007 Mar 21 8:24 PM
tables: mara.
Data: var1 type i.
data: begin of itab occurs 0,
ersda like mara-ersda,
ernam like mara-ernam,
end of itab.
var1 = 1234.
write: / 'The digit is' color 2, var1 color 1.
uline.
select ersda ernam into (itab-ersda, itab-ernam) from mara where
ersda = '03/02/1998'.
write:/ itab-ersda,itab-ernam.
endselect.
‎2007 Mar 21 8:30 PM
My variation:
*****
data: lt_mara type table of mara,
lw_mara type mara.
select ersda ernam into corresponding fields of table lt_mara
from mara
where ersda = '19980203'.
If sy-subrc EQ 0.
loop at lt_mara into lw_mara.
write:/ lw_mara-ersda,lw_mara-ernam.
endloop.
*****
Remeber reward points when it helped.
endif.
‎2007 Mar 21 8:48 PM
It is the date. When you are selecting from the database tables, you have to send values in the internal format, not external format. So you have to pass the date as 19980302 (assuming your date is MM/DD/YYYY).
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
ersda LIKE mara-ersda,
ernam LIKE mara-ernam,
END OF itab.
SELECT matnr ersda ernam INTO TABLE itab
FROM mara
WHERE ersda = '19980302'.
LOOP AT itab.
WRITE:/ itab-matnr, itab-ersda, itab-ernam.
ENDLOOP.
‎2007 Mar 21 8:55 PM
its done.
Thanks guys for all ur help.
Its the date like srinivas mentioned. It has taken the internal format....and eventually data is fetched.
‎2007 Mar 21 9:06 PM
I exactly had the same switch in my code.
Two options: Selection screen field, the conversion will be done automatic.
Or, use the write statment.
data: lw_10 type char10 value '02/03/2007',
lv_date type ersda.
write lw_10 to lv_date.
Select [see above]
where ersda EQ lv_date.
This is a so standard case. Enter value in se16 and debug select on database to check how it looks like.
‎2007 Mar 21 8:24 PM
Please check your select statement , If the program in $TMP also select will work perfectly.
aRs
‎2007 Mar 21 8:26 PM
does the program has to be only in $TMP?
I have used my own customized dev.class.
‎2007 Mar 21 8:29 PM
it could be the date format for ersda..
try this..
select ersda ernam into (itab-ersda, itab-ernam) from mara where
ersda = '19980203'.
if it works use fm to convert date into internal format nefore passing it to the SELECT.
~Suresh
‎2007 Mar 21 8:38 PM
‎2007 Mar 21 8:52 PM
Hi Alchemi,
The issue is the way you have entered the date. SAP stores the dates as 8 charaters in the database, in the format 'YYYYMMDD'. if you are hard coding the date in your program you have to use '19980302'. '03/02/1998' is not considered as a valid date in SAP.
If you accept the date from an input field that referes to date field, the user should enter '03/02/1998' and SAP internally converts it into '19980302'.
-kalyan
‎2007 Mar 21 8:25 PM
I agree. Development class is even already the old specification (lower 4.7) is is a package now.
Nothing to do with selects and syntax, just with grouping your development.
‎2007 Mar 21 8:27 PM
Hi,
change the select statement
data : v_date like sy-datum.
move '03021998' to v_date.
select ersda ernam into (itab-ersda, itab-ernam) from mara where
ersda eq v_date..
aRs
‎2007 Mar 21 8:30 PM
Hi,
Please try this.
tables: mara.
data: var1 type i.
data: begin of itab occurs 0,
ersda like mara-ersda,
ernam like mara-ernam,
end of itab.
data: wa_ersda like mara-ersda.
var1 = 1234.
write: / 'The digit is' color 2, var1 color 1.
uline.
wa_ersda(4) = '1998'. <--- year
wa_ersda+4(2) = '02'. <--- month
wa_ersda+6(2) = '03'. <--- day
select ersda ernam
into (itab-ersda, itab-ernam)
from mara
where ersda = wa_ersda.
write:/ itab-ersda, itab-ernam.
endselect.
Regards,
Ferry Lianto
‎2007 Mar 21 8:31 PM
Hi,
The prob is not with dev class something else. Did u try to fetch data using se11/se16 with same input parameter ? Check that if data is there??
Cheers
‎2007 Mar 21 8:34 PM
‎2007 Mar 21 8:43 PM
Check your user profiles how u have defined the date format.
ie SU3 --> go to default tab
Make sure that date format in select will be same ,
aRs
‎2007 Mar 21 8:51 PM
i checked in user profiles.
Its as MM/DD/YYYY.
i passed the same in select stmt. its not fetching again..
i tried all the other ways suggested here.
thanks guys. its something else.
‎2007 Mar 21 9:01 PM
‎2007 Mar 21 9:04 PM
‎2007 Mar 21 9:11 PM
I would say in my code that was already in the previous page because of the same guess ... but that was really basic SAP, sorry guys !
‎2007 Mar 21 9:16 PM
The issue is with the assumption of how the date is. Even though you pointed the person in the right direction, you assumed that the date is in DD/MM/YYYY whereas I put my assumption as MM/DD/YYYY and it was on target.
But yes, everyone pointed to the same thing.