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

How to export the select-option and import into method using Object Oriented ABAP?

Former Member
0 Likes
4,969

Hi Experts,

In OO Abap, I want to use one select-option (lets say for  vbak-vbeln, taken as a input from user) and export it to one method (that means, method should have import parameter), in which I have written a logic to fetch the sales order information from vbak table (i.e., all the sales order which falls under select-options).

Now my issue is, while declaring the method what should be the type of import parameter ?

I have tried creating a range table and given the type of import parameter (of method) of range table,but its not happening as desired.Its showing a type compatibility error.Please go through the similar code snippet as below :

Can anyone help me out to resolve the above scenario.

Best Regards,

Shivam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,493

Shivam,

Because select-options are tables with header lines, call your method like this:

CALL METHOD ref->selection

  EXPORTING

    s_matnam = s_name[].

Currently you are trying to pass the header line to the method, not the table.

Additionally, it would be clearer to move your data and selection-screen declarations to the top include or top of the program since there is no unique scope for the START-OF-SELECTION event block.

Best,

Eric

Shivam,

Because select-options are tables with header lines, call your method like this:

CALL METHOD ref->selection

  EXPORTING

    s_matnam = s_name[].

Currently you are trying to pass the header line to the method, not the table.

Additionally, it would be clearer to move your data and selection-screen declarations to the top include or top of the program since there is no unique scope for the START-OF-SELECTION event block.

Best,

Eric

5 REPLIES 5
Read only

former_member188251
Active Participant
0 Likes
2,493

Hi Shivam,

Try passing s_name[] , instead of s_name to the method.

CALL METHOD ref-->selection

     EXPORTING

          s_matnam = s_name[].

BR,

Shankar.

Read only

Former Member
0 Likes
2,493

try declaring the select options as

select-options s_name for zmaterial-matname

Read only

Former Member
0 Likes
2,494

Shivam,

Because select-options are tables with header lines, call your method like this:

CALL METHOD ref->selection

  EXPORTING

    s_matnam = s_name[].

Currently you are trying to pass the header line to the method, not the table.

Additionally, it would be clearer to move your data and selection-screen declarations to the top include or top of the program since there is no unique scope for the START-OF-SELECTION event block.

Best,

Eric

Read only

0 Likes
2,493

Also, since it appears you are writing a global class, you don't need to pass in the select-options to the methods if you don't want to.  They can be referenced as global variables.  Performance is not affected, so do whatever you think is more readable and maintainable.

Read only

Former Member
0 Likes
2,493

Hi all,

Thanks for your reply. I missed  '[]' while exporting. Issue solved now.

Regards,

Shivam