2013 Sep 04 4:27 PM
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
2013 Sep 04 8:04 PM
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
2013 Sep 04 6:14 PM
Hi Shivam,
Try passing s_name[] , instead of s_name to the method.
CALL METHOD ref-->selection
EXPORTING
s_matnam = s_name[].
BR,
Shankar.
2013 Sep 04 7:16 PM
try declaring the select options as
select-options s_name for zmaterial-matname
2013 Sep 04 8:04 PM
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
2013 Sep 04 11:32 PM
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.
2013 Sep 05 9:39 AM
Hi all,
Thanks for your reply. I missed '[]' while exporting. Issue solved now.
Regards,
Shivam
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |