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

Development class

Former Member
0 Likes
1,495

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.

1 ACCEPTED SOLUTION
Read only

suresh_datti
Active Contributor
0 Likes
1,467

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

22 REPLIES 22
Read only

suresh_datti
Active Contributor
0 Likes
1,468

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

Read only

0 Likes
1,467

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.

Read only

0 Likes
1,467

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.

Read only

0 Likes
1,467

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.

Read only

0 Likes
1,467

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.

Read only

0 Likes
1,467

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.

Read only

former_member194669
Active Contributor
0 Likes
1,467

Please check your select statement , If the program in $TMP also select will work perfectly.

aRs

Read only

0 Likes
1,467

does the program has to be only in $TMP?

I have used my own customized dev.class.

Read only

0 Likes
1,467

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

Read only

0 Likes
1,467

its not the date format.

I tried this...it isnt working....

Read only

0 Likes
1,467

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

Read only

Former Member
0 Likes
1,467

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.

Read only

former_member194669
Active Contributor
0 Likes
1,467

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

Read only

Former Member
0 Likes
1,467

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

Read only

Former Member
0 Likes
1,467

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

Read only

0 Likes
1,467

The is of course a prerequisite ... and I hope it was done.

Read only

former_member194669
Active Contributor
0 Likes
1,467

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

Read only

0 Likes
1,467

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.

Read only

Former Member
0 Likes
1,467

solved

Read only

0 Likes
1,467

Glad to be of help, I guess that gives me the full points!!

Read only

0 Likes
1,467

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 !

Read only

0 Likes
1,467

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.