07-03-2007 10:35 AM
Hi all,
I have one requirement where I want to pass select-options variable ( which contains one or more plants 'WERKS' ) to the function module <b> 'YBAPI_MATERIAL_AVAILABILITY' [b/] . How do I achieve this.
Please help.
Thank You.
07-03-2007 10:43 AM
Hi ,
Do one thing,
select * from <table> into it_plants where plants in so_option.
use then FM to pass plants it_plants.
Reward if useful!
07-03-2007 10:44 AM
Since it is a custom made BAPI you can include one more internal table of type as below.
You can create a Zstructure in R/3 and use it as the reference structure.
The strucute is like
DATA: BEGIN OF sel,
SIGN(1),
OPTION(2),
LOW LIKE f,
HIGH LIKE f,
END OF sel.
Rather than passing the user inputs to the FM, alternativly you can pass the values from the table based on the selection made form the user input.
07-03-2007 10:44 AM
Hi Premal,
I'm not sure if you mean the standard BAPI or a Custom Version.
Assuming that the BAPI must be called once for each plant in the list....
Define an internal table of plant codes.
then
SELECT WERKS
INTO TABLE IT_PLANTS
FROM T001W
WHERE WERKS IN S_WERKS.
This will build a table of all selected plants.
Then Loop through IT_PLANTS call the BAPI once for each value.
07-03-2007 10:45 AM
Hello Premal
Select-options are nothing else but internal tables with header line. Since you are apparently developing a customer BAPI have a look how this is solved in the standard BAPI <b>BAPI_MATERIAL_GETLIST</b>. This BAPI uses a TABLES parameter <b>MATNRSELECTION</b> having BAPIMATRAM as line type.
Assuming that you have defined your select-option like this:
SELECT-OPTIONS:
o_matnr FOR matnr.
Add a TABLES parameter MATNRSELECTION to your y-BAPI and call it like this:
CALL FUNCTION 'YBAPI_MATERIAL_AVAILABILITY'
EXPORTING
...
IMPORTING
...
TABLES
MATNRSELECTION = o_matnr
RETURN = gt_return.
Regards
Uwe