03-12-2007 11:10 PM
Hello All,
I am new to ABAP. I want to test my "first" class that reads values from tables using select statement based on an imported key. I have no idea how to test. Can anybody guide me in testing.
Kind Regards.
Srinivas
03-12-2007 11:18 PM
03-12-2007 11:18 PM
03-12-2007 11:21 PM
I am a total newbie Rich. So you may have to be little slow and specific with your answer. Although ful points rewarded.
03-12-2007 11:25 PM
03-12-2007 11:34 PM
Hi Rich,
Where can I find information on basic coding in ABAP. Like I want to see if I am able to compile and print text to the console. Say hello world. Can you just briefly tell me what statement I need to use to print "hello world".
Regards.
03-13-2007 12:07 AM
03-13-2007 12:21 AM
Hi Rich,
When I activate the code, I am getting error:
"Class ZPOSITION_INFORMATION,Method EXTRACT_DATA
You may only define methods between "CLASS ... IMPLEMENTATION" and
"ENDCLASS"."
This is the source code:
data: emp_type char 50,
end_d date 8,
loc char 4,
pers_sub char 4,
pos_title char 40,
start_d date 8 .
method EXTRACT_DATA .
select single empneededby from hrp9007 into start_date
where OBJID = POSITION_NUMBER .
write start_date .
write "hello world"
endmethod.
Kind Regards.
Seenu
03-13-2007 12:50 AM
03-13-2007 12:53 AM
I used se24 and created the class ZPOSITION_INFORMATION and transported it later.
Now the code is the method ZEXTRACT_DATA. But when I looked in the class, it is empty. But when I activate the class I get "object(s) activated".
When I activate the method ZEXTRACT_DATA, I get
"Class ZPOSITION_INFORMATION,Method EXTRACT_DATA
You may only define methods between "CLASS ... IMPLEMENTATION" and
"ENDCLASS". "
Regards.
03-13-2007 12:58 AM
03-13-2007 12:59 AM
data: emp_type char 50,
end_d date 8,
loc char 4,
pers_sub char 4,
pos_title char 40,
start_d date 8 .
method EXTRACT_DATA .
select single empneededby from hrp9007 into start_date
where OBJID = POSITION_NUMBER .
write start_date .
write "hello world" .
endmethod.
PS: "Where POSITION_NUMBER is the imported parameter for this method."
03-13-2007 1:08 AM
You must be sure to include ALL coding within the METHOD.... ENDMETHOD statements.
method EXTRACT_DATA .
data: emp_type char 50,
end_d date 8,
loc char 4,
pers_sub char 4,
pos_title char 40,
start_d date 8 .
select single empneededby from hrp9007 into start_date
where OBJID = POSITION_NUMBER .
write start_date .
write "hello world" .
endmethod.
Regards,
RIch Heilman
03-13-2007 1:11 AM
Hi Rich,
Now am getting someother error. I copied and pasted your code. I get:
"Class ZPOSITION_INFORMATION,Method EXTRACT_DATA
Unable to interpret "CHAR". Possible causes: Incorrect spelling or
comma error."
03-13-2007 1:24 AM
You must make sure that you are using the corrent syntax when defining your DATA statements.
data: emp_type type char50,
end_d type sy-datum,
loc type char04,
pers_sub type char04,
pos_title type char40,
start_d type sy-datum .
or....
data: emp_type(50) type c,
end_d type sy-datum,
loc(4) type c,
pers_sub(4) type c,
pos_title(40) type c,
start_d type sy-datum .
Regards,
Rich Heilman
03-13-2007 1:30 AM
Thanks for bearing with me Rich. But I still get one more error
"Class ZPOSITION_INFORMATION,Method EXTRACT_DATA
Field "POSITION_NUMBER" is unknown. It is neither in one of the
specified tables nor defined by a "DATA" statement. "DATA" statement."
Because POSITION_NUMBER is the value being passed to this method as a parameter. But since I am never calling this method. I get this error. Can you please tell me how I should call this method with a dummy/default value.
Kind Regards.
03-13-2007 1:34 AM
03-13-2007 1:36 AM
I already did Rich and I am getting the error. Only I don't know how to give initial default value. Or even, is this the problem of not giving the initial value.
Regards.
Srinivas
03-13-2007 1:39 AM
You were right, I added it in import parameters. Now the error changed to:
Class ZPOSITION_INFORMATION,Method EXTRACT_DATA
Field "ENDMETHOD" is unknown. It is neither in one of the specified
tables nor defined by a "DATA" statement. "DATA" statement.
Kind regards.
Srinivas.