Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sytax error in simple oops concept

Hi Experts,

I am getting the following error

" You can only omit the parameter name if the method has a single parameter. This must be an IMPORTING parameter."

when executing the following code.

DATA: acct1 type ref to zaccount01.

DATA: bal type i.

create object: acct1.

selection-screen begin of block a.

parameters: p_amnt type dmbtr,

p_dpst type dmbtr,

p_wdrw type dmbtr.

selection-screen end of block a.

start-of-selection.

call method acct1->set_balance( p_amnt ).

write:/ 'Set balance to ', p_amnt.

bal = acct1->deposit( p_dpst ).

write:/ 'Deposited ', p_dpst ,' bucks making balance to ', bal.

bal = acct1->withdraw( p_wdrw ).

write:/ 'Withdrew ', p_wdrw ,' bucks making balance to ', bal.

Please say me where i have to change the code.

Advance thanks.

Regards,

Nani

Tags:
replied

then withdraw has mote then one non optional parameter. Double click on the method an look at the signature, there must be more then one importing or exporting parameters.

Your call should look like this:;

bal = acct1->withdraw( par1 = p_wdrw par2 = 'p_something' ).

Without knowledge about the signature of the method i cant give you a more detailed answer.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question