Application Development and Automation 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: 
Read only

How to search/scan the sourcecode of Function Module

Former Member
0 Likes
3,539

Hi,

How to search / scan the Source code of Function module for any function modules used in it.

Scenario :

    There is a Function module called ztestfm. In the source code of ztestfm, if it is using other fucntion module

    ( Ex : CONVERSION_EXIT_ALPHA_INPUT).

Like scan-abap ....  is there any logic to find in the source code of Funciton module for a statement

Scan-abap  , CODE_SCANNER is not working in this case


Thanks

12 REPLIES 12
Read only

dibyajeeban_jena
Active Participant
0 Likes
2,569

Hi ,

Use   Program - RS_ABAP_SOURCE_SCAN.

Regards

DJ

Read only

0 Likes
2,569

It's working .

can you please let me know how to capture the values..

Read only

Former Member
0 Likes
2,569

TFDIR Contains PNAME which is the main program of the Function Group.

For CONVERSION_EXIT_ALPHA_INPUT, PName is SAPLALFA.

In SAPLALFA, you see an include ending in XX.  LALFAUXX.

This gives the include for each FM in the FG.

Looking in LALFAUXX, you see:

INCLUDE LALFAU01.   "CONVERSION_EXIT_ALPHA_INPUT

So LALFAU01 is where the code of CONVERSION_EXIT_ALPHA_INPUT is.

Obviously, you can write the code to traverse all of that.  Then all you have to do is to scan LALFAU01.

Neal

Read only

0 Likes
2,569

Hi Neal,

The scenario is :

For example:    a  function module ( Ztestfm_1 ) is using another Function module ( ztestfm_2 ).

How can I search programatically that Function module Ztestfm_1 is using the  ztestfm_2.
I got the solution by using RS_ABAP_SOURCE_SCAN.

But , how can i capture the value ??

Read only

0 Likes
2,569

You'll have to tell us what values you are trying to capture.

Neal

Read only

0 Likes
2,569

Honestly, I wouldn't do it this way.  It is going to generate a report that you are then going to have to parse.  It will be at best difficult...

I refer you back to my previous answer for a more reasonable path to a programmatic solution.

On the other hand, you really haven't told us what you are really after.  What is the general problem that you are trying to solve?  That might help us to give you better direction...

Neal

Read only

0 Likes
2,569

values are the names of  Function modules which are found in the list

Read only

0 Likes
2,569

The report that you are using returns a spool file.  You therefore have to open the spool file.  Import it into an itab. Loop through its lines looking for lines that start with Call Function.  take the next sub string between the single quotes.  That list is your associated FM's.

Neal

Read only

0 Likes
2,569

I am able to pass data to the selection screen

   DATA : gv_string TYPE tuchk3-object.
             

              gv_string = 'CALL FUNCTION'.

  SUBMIT rpr_abap_source_scan USING SELECTION-SCREEN 1000
         WITH repname = zget_fm

         WITH sstring = gv_string
         WITH plusminu = '0'.

I can see the result.

Could you please let me know , how to get that spool file, so that i can loop it for that result

function modules.

Read only

0 Likes
2,569

I found

CALL 'RSPOARSD'

Here: 

And it refers to this:

RSPO_IRETURN_RAW_DATA

Neal

Read only

0 Likes
2,569

Hi Neal,

i am able to get those nested Function modules by using FM   'FUNCTION_INCLUDE_INFO'

Thanks

Read only

0 Likes
2,569

Thanks!  That's important to know.

Neal