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

CALL METHOD

VenuAnumayam
Participant
0 Likes
731

Hello Experts,

I have never worked on ABAP Objects before. Now I have been assigned to modify an existing Z-report which was developed using Classes and Methods. I have add some extra logic to an existing method.

The existing method is like this:

loop at me->i_info into l_info

CALL METHOD ME->CHANGE_BELNR    
    EXPORTING
      ACCNT    = L_INFO-SAKNR
      CCODE   = L_INFO-BUKRS
    CHANGING
      BELNR   = L_INFO-BELNR.

Now I have to modify the method by adding 2 more fields (gjahr, koart) like this.

CALL METHOD ME->CHANGE_BELNR    
    EXPORTING
      ACCNT    = L_INFO-SAKNR
      CCODE   = L_INFO-BUKRS
      gjahr       = l_info-gjahr --------->
      koart       = l_info-koart --------->
    CHANGING
      BELNR   = L_INFO-BELNR.

When I modify like this it is giving me an error message that "Formal parameters GJAHR and KOART do not exist". I am trying to find where "ACCNT" and "CCDOE" were declared so that I can add GJAHR and KOART to that. I did not find them in "I_INFO". Can you please let me know how can I correct this error?

Thanks much.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
680

Hello,

you need to change the definition of method CHANGE_BELNR. By now, it does not have the paramters GJAHR and KOART. You need to add them to the method's parameter list as you would do in a function module.

If the class is a global class, use transaction SE24 to add the parameters. Click on the Methods tab, select the method and use the Parameters button edit the parameter definition.

If the class is a local class, find the class definition in the source code. The definition looks like this:


CLASS zz_classname DEFINITION.

* ...

* The definition of the method you want to change:
  METHODS change_belnr
    EXPORTING accnt TYPE accnt
              ccode TYPE ccode
                          " <-- insert additional params here
    CHANGING  belnr TYPE belnr.

* ...

ENDCLASS.

Use forward navigation to find out if it is a global or a local class.

If you change the method's parameter list, please remember that other calls of this method in the source code might have to be adapted (especially if it is a global class you are changing).

Best regards

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
680

Yes, go to the CHANGE_BELNR method of that class. You should see it in the "methods" tab. Put your cursor in the row where this method is listed, and click the "Parameters" button. Here you will see the signature of the method. Add the new fields here.

Once you add these to the signature you will still need to do something with the parameters inside of this method.

Regards,

Rich Heilman

Read only

0 Likes
680

Hi Rich,

Thanks a lot for the quick reply. However, the method "CHANGE_BELNR" is called inside a Public Method. When I go to the "Method" tab, I can not see the method "CHANGE_BELNR" in that.

The main method is "ZREP~MAIN". In that the method "CHANGE_BELNR" is declared like this:

method ZIF_REPORT~MAIN.

*To get initial data
CALL METHOD ME->QUERY_SUMMARIZED_DATA( ).

*Misc data
CALL METHOD ME->CHANGE_BELNR.

How can I see the "parameters" of "CHANGE_BELNR"? I have checked the "parameters" of "ZREP~MAIN" also.

Thanks.

Read only

Former Member
0 Likes
681

Hello,

you need to change the definition of method CHANGE_BELNR. By now, it does not have the paramters GJAHR and KOART. You need to add them to the method's parameter list as you would do in a function module.

If the class is a global class, use transaction SE24 to add the parameters. Click on the Methods tab, select the method and use the Parameters button edit the parameter definition.

If the class is a local class, find the class definition in the source code. The definition looks like this:


CLASS zz_classname DEFINITION.

* ...

* The definition of the method you want to change:
  METHODS change_belnr
    EXPORTING accnt TYPE accnt
              ccode TYPE ccode
                          " <-- insert additional params here
    CHANGING  belnr TYPE belnr.

* ...

ENDCLASS.

Use forward navigation to find out if it is a global or a local class.

If you change the method's parameter list, please remember that other calls of this method in the source code might have to be adapted (especially if it is a global class you are changing).

Best regards

Read only

0 Likes
680

I found it in Goto->Private Section, Thanks to your help.