Application Development 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: 

how to use Select-Option values in SAP Standard Function Module

former_member15804
Participant

HI

I want to know how to pass select option as import parameter in any SAP standard function module..

select option : s_matnr for matnr.

CALL FUNCTION 'Standard FM'

Import parameter = s_matnr

5 REPLIES 5

sergei-u-niq
Active Contributor

s_matnr is basically a range table type. But you may need to convert it.

try a function module with input variable of type MD_RANGE_T_MATNR

tanaya_das
Explorer

Hello,

It is not possible to send the select option structure in the input of the standard BAPI unless the BAPI import structure allows range table.

If you call the standard BAPI then there are different approach based on the BAPI import structure :

  • If the BAPI import parameter has the structure type , then loop on the select options and call the standard BAPI inside the loop by populating the import structures
  • If the BAPI import parameter has table type, then loop on the select options and populate an internal table which matches the BAPI's import parameter type and then call the BAPI with this internal table outside the loop.

Thanks and Regards,

Tanaya Das

former_member15804
Participant
0 Kudos

Hi,

Thank u..

The parameter in bapi is a simlle like parameter... Eg. Mantr like marc-matnr..

Then how to do...

Can u pls help

T_Ket
Explorer

Hi,

You can do as the following:

1. Convert s_matnr to a range table.

2. LOOP that range table.

3. CALL FUNCTION 'Standard FM'.

Example for step 2 & 3:

LOOP AT itab_range_matnr INTO DATA(wa_matnr).

CALL FUNCTION 'Standard FM'

Import parameter = wa_matnr-matnr.

ENDLOOP.

Regards,

Sandra_Rossi
Active Contributor
0 Kudos

ak6155 I doubt that "The parameter in bapi is a simlle like parameter... Eg. Mantr like marc-matnr.." because BAPI don't have short names like MATNR, they have long names like MATERIAL_NUMBER. Or maybe you mean a RFC-enabled function module? (not a BAPI). What BAPI is it, what parameter is it?

To complete nguyenthanhket9398 answer, in step 1 you may also determine the list of all material numbers directly from the table MARA:

SELECT matnr FROM mara WHERE matnr IN s_matnr INTO TABLE @DATA(matnr_s).
LOOP AT matnr_s INTO DATA(matnr).
  CALL FUNCTION 'BAPI_...'
    EXPORTING
      material_number = matnr
      ...