07-06-2018 8:25 AM
Hello Experts,
I have created two select-options, one for product and another for location. My internal table contains three fields- product,location and location type. Location type is a parameter. I want to get multiple products and locations from the user and pass it to the internal table to be used in BAPI. I tried looping on both select options one by one and appended the value to internal table in each cases but the problem is appending will append the product value first and then the location value. It will be helpful for me if you provide an optimized solution.
07-06-2018 8:43 AM
I think you really need to read the ABAP keyword help on SELECT-OPTIONS and try looking at some demo programs on how they're used.
Hint: loop at a select option generally is not a useful activity. What if it contains Sign = I, Option = CP, Low = *
Furthermore, it's very unclear what you're actually trying to achieve. Maybe you could add some examples of what you've got and where you want to end up, perhaps with screen shots. For example, which BAPI are you planning on using?
07-06-2018 9:26 AM
Hi Matt,
Below are the select options I am using:
SELECT-OPTIONS: s_prod FOR lcl_apo_to_apo=>v_prod,
s_loc FOR lcl_apo_to_apo=>v_loc.
Users can provide multiple values on the selection screen.
The internal table must contain product and location that user has passed.
The internal table I am using is mentioned below:
DATA: it_prod_loc_keys TYPE STANDARD TABLE OF bapi_prodloc_key.
The BAPI I am trying to call is BAPI_POSRVAPS_GETLIST3 that needs it_prod_loc_keys as one of the table parameter.
07-06-2018 9:59 AM
sry but i dont know what you want to do... sounds like you want some sort of mapping of select-Options. could you describe it more in Detail?
07-06-2018 10:09 AM
First, for your question i understand that you want to move data from 2 selection option into corresponding column of final internal table.
You are looping each selection option seperately then ofcourse you dont get what you want. You have to do nest loop like this:
LOOP AT product.
APPEND product-low to final ASSIGNING <curr_line>.
LOOP AT location.
<curr_line>-loc = location-low.
ENDLOOP.
ENDLOOP.
But you must see that there are n^m records would be appended to internal table since product and location dont have any relationship that could influence program performance. Beside, selection option is range input which mean FROM ... TO... so if you only set data from selection option it wont be enough. You need to get full list of product and location first.
07-06-2018 10:28 AM
I ask you again: What if the select option contains Sign = I, Option = CP, Low = *
What will you do then?