Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Execute BAPI using Import Parameters

Friends,

I have a requiement to develope a report which displays the result of given BAPI. In which I used FUNCTION_GET function. In this function i am passing the BAPINAME so it will give me the Import,Export and Return Parameters of that BAPI. This will be stored in one ITAB.

Now if i want to set the Input Parameters of that particular BAPI and want to execute it and stores the result of it in another ITAB.

Can u tell me how to do that.

I have written following code..

REPORT ZGETBAPI_NAME line-size 132.

Parameters: bapiname like TFDIR-FUNCNAME default'BAPI_CREDITOR_GETDETAIL'.

Data: rtrbapi_itab like CATFU occurs 0 with header line.

Data: pName(30) Type C.

Data: Name(30) Type C.

CALL FUNCTION 'FUNCTION_GET'

EXPORTING

FUNCNAME = bapiname

TABLES

PRMTAB = rtrbapi_itab

EXCEPTIONS

FM_NOT_FOUND = 1

NAMETAB_FAULT = 2

REF_FIELD_MISSING = 3

REF_STRUCTURE_MISSING = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Loop At rtrbapi_itab.

Write: / rtrbapi_itab-PARAMTYPE,

07 rtrbapi_itab-NAME,

38 rtrbapi_itab-TABNAME,

68 rtrbapi_itab-FIELDNAME,

98 rtrbapi_itab-DATATYPE,

102 rtrbapi_itab-INTTYPE,

106 rtrbapi_itab-DDLEN,

110 rtrbapi_itab-INTLEN.

EndLoop.

Thanks,

Hitesh Shah

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question