‎2013 Dec 13 11:46 AM
Hello Experts,
I am a BW consultant and an ABAP learner
Currently I am creating a class in which two methods
Method 1: Reading a master data and Exporting in a Table.
Table RD_DETVERS is declared in Parameter as EXPORTING, Typing method is TYPE and Associated with ZDETVERSION (Master infoObject)
In the method I have given SELECT statement which reads data from master data and exporting to table RD_DETVERS
Method 2:
I am trying to IMPORT the values of table TB_DETVERS (from method 2) into LT_DETVERS (in method 1)
Below are the codes
********************************************************
LT_DETVERS = ZCL_IM_DECISION_CUSTOM=>READ_EDETVERS( 'RD_DETVERS' ).
IF SY-SUBRC EQ 0.
READ TABLE LT_DETVERS INTO LS_DETVERS WITH TABLE KEY
ZDETVERS = '10' ZBWVERS = 'I'.
IF SY-SUBRC EQ 0.
E_STATUS = 'X'.
RETURN.
ENDIF.
ENDIF.
*********************************************************************
Table RD_DETVERS is declared in Parameter as IMPORTING, Typing method is TYPE and Associated with ZDETVERSION (Master infoObject)
But I am getting below error
Class ZCL_IM_DECISION_CUSTOM,Method C_DETVERS_FUNC
You can only omit the parameter name if the method only has a
non-optional parameter or an optional IMPORTING parameter that is
identified by "PREFERRED PARAMETER". by "PREFERRED PARAMETER".
Can anyone please correct me.
Thanks in advance,
Gopi R
‎2013 Dec 13 12:02 PM
Hi,
what error says. Your method call C_DETVERS_FUNC is wrong.
I guess it is first method? Which parameters you have in that method? Only one?
try call it like:
...C_DETVERS_FUNC( nameOfParameter = RD_DETVERS ).
‎2013 Dec 13 12:20 PM
Class ZCL_IM_DECISION_CUSTOM,Method C_DETVERS_FUNC has more then one parameter. You've only supplied one. Look at the signature (parameters) of c_detvers_func.
‎2013 Dec 13 12:32 PM
Hello Gopi,
to make work of above method call. you need to make the parameter of method READ_EDETVERS as MANDATORY or PREFFERED.
when you open the class in se 24, place the cursor on method name and press on parameters.
check there you willl get the corresponding settings.
Other way around is in method calling should be as follow
Call Method ZCL_IM_DECISION_CUSTOM=>READ_EDETVERS importing RD_DETVERS = LT_DETVERS .
Regards,
Bhaskar
‎2013 Dec 13 12:33 PM
Hi,
you have to set the Option "Preferred" for the parameter.
(the prerequisites are that you only have optional importing parameters (or maximum one not optional one) and your result comes as a returning parameter)
Regards,
Amadeus