04-12-2012 12:56 PM
Dear Experts,
I want to find out the list of custom BAPI in system. In thread http://scn.sap.com/thread/81493 Rich Heilman Sir has mentioned that
BAPI can be named as Z* as well as BAPI* and that he is not sure which is correct. If BAPI* naming convention is followed by customer
then how can I track down the difference between SAP provided BAPI starting as BAPI* and customer created BAPI starting with BAPI*.
Please share your valuable inputs.
- Bharath
04-12-2012 6:50 PM
Bharath,
You'll have to hit both tfdir and trdir at the very least. Below is some quick code that will list any function module with "BAPI" in the name (both customer prefixed and not) where the last modified username is not "SAP." Hope this will get you what you need. It should be satisfactory, I would think.
report zbapitest.
types:
begin of t_include,
include(40),
fname TYPE tfdir-funcname,
end of t_include.
data:
it_tfdir type table of tfdir,
it_trdir type table of trdir,
it_include type table of t_include,
wa_include type t_include,
wa_tfdir type tfdir,
wa_trdir type trdir.
select * from tfdir into table it_tfdir where funcname like '%BAPI%'.
loop at it_tfdir into wa_tfdir.
clear wa_include.
concatenate wa_tfdir-pname+3 'U' wa_tfdir-include into wa_include-include.
wa_include-fname = wa_tfdir-funcname.
append wa_include to it_include.
endloop.
select * from trdir into table it_trdir for all entries in it_include
where name = it_include-include and unam ne 'SAP'. "you can include additional logic here
loop at it_trdir into wa_trdir.
READ TABLE it_include INTO wa_include WITH KEY include = wa_trdir-name.
IF sy-subrc EQ 0.
write:/ wa_include-fname,
wa_trdir-unam,
wa_trdir-udat.
ENDIF.
endloop.
04-12-2012 1:52 PM
BAPI should be named with customer prefix, but as with standard function modules, someone could name it without prefix.
But you can still find all customer bapis, because they had to be included in customer function group - so check whether BAPIxxx function is included in Zxxx function group.
04-12-2012 1:56 PM
Hi Aspire,
You can create with out z or y.You can try that.Get the custom bapi from your package.
Regards,
Madhu.
04-12-2012 2:50 PM
Hi Jacek & Madhu,
Thanks a lot for your replies. I have a system wherein earlier developers have already created many custom BAPI. I have to generate the list. From BAPI Tcode I can find out Z* custom bapi. Also I can see a big list of BAPIs starting with BAPI*. Among these BAPI how can I filter standard and custom BAPI. In my case I have not created custom function groups. I can go to SE80 and go to each and every custom func group and find out the BAPI included in them. Is there any other table or FM from which I can directly get the whole list in one go.
- Bharath
04-12-2012 5:38 PM
Hi Bharath,
In which package you are saving custom objects.
Regards,
Madhu.
04-12-2012 6:05 PM
You know BAPI methods are RFC function modules, if you mean this you can check table TFDIR which is for function modules.
If TFDIR-MODE is 'R', it means it is RFC function module. All BAPI* function modules are R(emote).
04-12-2012 6:50 PM
Bharath,
You'll have to hit both tfdir and trdir at the very least. Below is some quick code that will list any function module with "BAPI" in the name (both customer prefixed and not) where the last modified username is not "SAP." Hope this will get you what you need. It should be satisfactory, I would think.
report zbapitest.
types:
begin of t_include,
include(40),
fname TYPE tfdir-funcname,
end of t_include.
data:
it_tfdir type table of tfdir,
it_trdir type table of trdir,
it_include type table of t_include,
wa_include type t_include,
wa_tfdir type tfdir,
wa_trdir type trdir.
select * from tfdir into table it_tfdir where funcname like '%BAPI%'.
loop at it_tfdir into wa_tfdir.
clear wa_include.
concatenate wa_tfdir-pname+3 'U' wa_tfdir-include into wa_include-include.
wa_include-fname = wa_tfdir-funcname.
append wa_include to it_include.
endloop.
select * from trdir into table it_trdir for all entries in it_include
where name = it_include-include and unam ne 'SAP'. "you can include additional logic here
loop at it_trdir into wa_trdir.
READ TABLE it_include INTO wa_include WITH KEY include = wa_trdir-name.
IF sy-subrc EQ 0.
write:/ wa_include-fname,
wa_trdir-unam,
wa_trdir-udat.
ENDIF.
endloop.
04-13-2012 8:37 AM
Hi,
Thanks a lot for your replies.
@Tuncay - Field in TFDIR table is FMODE. If I pass 'R' in that field I am getting all BAPI which are developed by SAP as well as custom BAPI starting as BAPI*. Since its just filtering all remote enabled FM this option is not much helpful to me.
@Madhu - As mentioned earlier, some developers have already created the BAPIs. I have to generate the list of custom BAPI alone. So to find package I would have to put Z/Y* in SE80 & get the whole list. Then dig into each one to find out the BAPI. This will take more time.
@Case Ahr: Thanks a lot. Your solution helped me out correctly. You have suggested to exclude BAPI which have created by as SAP and then easily find the remaining custom BAPI.
- Bharath