Application Development 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: 

creating tcode for method in local class , hot to get the parameters option

Former Member
0 Kudos

hello everybody,

I created a transaction code for a instance method which i used in my local class ,

but if that method contains exporting and importing parameters , the program is leading to short dump.

and getting an run time error "CALL_METHOD_PARMS_ILLEGAL".{not catchable}

how can make my end user to give some input parameters before the output.

before the output i want the selection screen enable for the user for that method only?

please let me know in detail.

thank you all.

3 REPLIES 3

MarcinPciak
Active Contributor
0 Kudos

Well, you can create a separate selection screen and call it within your local class method only. This way it will only show when you call this method


SELECTION-SCREEN BEGIN OF SCREEN 0200.
PARAMETERS p TYPE c.
SELECTION-SCREEN END OF SCREEN 0200.


CLASS lcl DEFINITION.
  PUBLIC SECTION.
    METHODS start.
ENDCLASS.              


CLASS lcl IMPLEMENTATION.
  METHOD start.
    CALL SELECTION-SCREEN 0200.
  ENDMETHOD.                   
ENDCLASS.                 

START-OF-SELECTION.
  DATA r_lcl TYPE REF TO lcl.

  CREATE OBJECT r_lcl.
  r_lcl->start( ).

There are some things to consider however:

- how you would call local method from OO transaction, there is only an option of calling method of global class, so please share how you could do that

- this obviously violates encapsulation, as you create definition of object (selection screen) outside the class, and using its instance (by calling it) inside that class. To avoid that you would have to embed screen definition into class body, which is of course not possible. So we have bad design here.

Regards

Marcin

0 Kudos

hi marcin,

while creating the tcode u should uncheck the oo transaction then u can see one more check box appears which says local in program,that is the place you give ur local program name.

and if i create the selection screen and place it in the method it wont work coz,,i want to give the importing parameters to the method i created.

first of all if i give the importing parameters to the method and if i create the tcode for that method,directly it is giving dump..

as far as i know i we cant create a tcode for the method that is having import parameters.if u know any other option please let me know.

0 Kudos

I think the dump message is quite self-explanatory

The system called method "START", but you may only call methods

that do not have any parameters at this point.

We cannot start OO transaction which calls method with parameters.

Checked on ECC 6.0 - SAP NetWeaver App. Serv. 7.01

Regards

Marcin