cancel
Showing results for 
Search instead for 
Did you mean: 

get a selected result from executed BAPIs

Former Member
0 Kudos

Hello Frnds,

I am looking for ur dynamic Ideas.My requirement is...

As after awe all do entering the mandatory import parameters for FM and then we execute the function module or Bapi..we get a list of RESULTs..

But I would like to write a FM ,where the the user can specify the exact PARAMETERS OR FIELDS he would like to see....in the Export or i mean as a result from the FM

Pls help me in achieving this..

All ur efforts will be greatly respected..

thx,

RAM.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

For this you can write a custom RFC which calls standard bapi inside... with this you will be able to write import and export parameters as per ur requirement.

Former Member
0 Kudos

hai....thx for the time...

yes.... but can u tell me in a bit detai..

i am thinking of assigning the standard bapi name as import parameter for the custom bapi and the export parameters will be varibles which will be passed by a external system...

but pls make me clear that how to do that first stpe calling standard bapi in inside the custom rfc

thx ram

Former Member
0 Kudos

Hi,

Say you want to check material existance for that you want to use your own parameres (import/Export) then u can use codes like this:

FUNCTION ZBAPI_MATERIAL_EXISTENCECHECK.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(ZMATERIAL) LIKE  BAPIMATALL-MATERIAL
*"     VALUE(ZMATERIAL_EVG) TYPE  BAPIMGVMATNR
*"  EXPORTING
*"     VALUE(ZRETURN) LIKE  BAPIRETURN1 STRUCTURE  BAPIRETURN1
*"----------------------------------------------------------------------

CALL FUNCTION 'BAPI_MATERIAL_EXISTENCECHECK'
  EXPORTING
    material            = zmaterial
*   MATERIAL_EVG        =
 IMPORTING
*   DELETION_FLAG       =
   RETURN              = zreturn.
          




ENDFUNCTION.

in above example i created a custom RFC ZBAPI_MATERIAL_EXISTENCECHECK which call standard BAPI BAPI_MATERIAL_EXISTENCECHECK.

Former Member
0 Kudos

sorry for late response...

but dear friend....

my requirement says i have to enter the function name dynamically and enter the import and export parameters also dynamically...

so here the problem is ..sometime the particular filed of aprticular table is to mentioned..and the number of export parameters are also more ..

all this is making a big confusing..

turmoll
Active Contributor
0 Kudos

Hi,

You can specify both the FM name and parameters dynamically:


TYPE-POOLS: abap.

DATA:
  l_name TYPE string VALUE 'BAPI_MATERIAL_EXISTENCECHECK',
  lt_par TYPE abap_func_parmbind_tab,
  ls_par TYPE abap_func_parmbind,
  ls_bapi TYPE bapireturn1,
  l_matnr TYPE matnr VALUE 'MATNR1'.


ls_par-name = 'MATERIAL'.
ls_par-kind = abap_func_exporting.
GET REFERENCE OF l_matnr INTO ls_par-value.
INSERT ls_par INTO TABLE lt_par.

ls_par-name = 'RETURN'.
ls_par-kind = abap_func_importing.
GET REFERENCE OF ls_bapi INTO ls_par-value.
INSERT ls_par INTO TABLE lt_par.

CALL FUNCTION l_name
  PARAMETER-TABLE
    lt_par.

Regards,

Jakub

Answers (0)