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

Function Module to retrive conversion exit function module names based on conversion routine

Former Member
0 Likes
4,268

Hi All,

Can you people help me out in finding a function module, which takes conversion routine name as input and gives all the conversion exit function modules as output.

Thanks and Regards,

Shivaraj Naik.

15 REPLIES 15
Read only

Former Member
0 Likes
2,797

Hi Shivaraj,

Conversion exit function modules follow a general naming as CONVERSION_EXIT_XXXXX_INPUT / CONVERSION_EXIT_XXXXX_OUTPUT, where xxxxx is the conversion routine name.

So you can write code as follows to find the conversion exit fms;

CONCATENATE 'CONVERSION_EXIT_' lv_conv_routine '_INPUT' into lv_conv_inpfm.

CONCATENATE 'CONVERSION_EXIT_' lv_conv_routine '_OUTPUT' into lv_conv_outfm.

Hope this helps.

Regards,

Karthik D

Read only

0 Likes
2,797

Don't forget also optional range conversion exits whose names are CONVERSION_EXIT_<name>_RANGE_I and CONVERSION_EXIT_<name>_O. (Look at conversion routines like MATN1 or EAN11)

Regards,

Raymond

Read only

0 Likes
2,797

Well spotted Raymond

Read only

0 Likes
2,797

Hi Karthik,

Conversion exit function modules follow a general naming as CONVERSION_EXIT_XXXXX_INPUT / CONVERSION_EXIT_XXXXX_OUTPUT, where xxxxx is the conversion routine name.

So you can write code as follows to find the conversion exit fms;

  1. CONCATENATE 'CONVERSION_EXIT_' lv_conv_routine '_INPUT' into lv_conv_inpfm. 
  2. CONCATENATE 'CONVERSION_EXIT_' lv_conv_routine '_OUTPUT' into lv_conv_outfm. 

Hope this helps.

In response to the above code I am having doubt regarding the declaration of lv_conv_inpfm and

lv_conv_outfm.Can you tell how we can declare them in our program.

Regards,

Chakradhar.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,797

There is no function like that. As mentioned use 'concatenate' statement.

You can have a look at my wiki post if required http://wiki.sdn.sap.com/wiki/display/ABAP/Program+to+generalize+the+conversion+exits+dynamically.

Also you have a utility class CL_RSAN_UT_CONVERSION_EXIT available for conversion exit manipulations.

Read only

0 Likes
2,797

Thanks for the reply, actually i need to call it in remote system, so i need an RFC fm to get these values. Manually i cannot hardcode in remote system.

Read only

0 Likes
2,797

Hi Shivaraj,

Then you have to create a RFC function module in SAP which takes conversion routine as input and returns the conversion exit function modules using concatenate as i told.

After that you can access the RFC FM from the remote system.

Hope this helps.

Regards,

Karthik D

Read only

0 Likes
2,797

You can go ahead with creation of a custom RFC in the remote system and use the logic mentioned by Kesavadas for getting what you need.

Read only

0 Likes
2,797

Thanks all for the replies, Anyways, i want a fm which already exists as i cannot create it in remote system. Another thing is, to get conversion exit fm's, the logic what i would suggest you guys is, all conversion exit fm's follow a prefix of CONVERSION_EXIT_<con_routine>*        , pass this value to table V_FDIR which gives you all fm's related to conversion routine. no need to concatenate, as it wont be always for INPUT and OUTPUT only.

Read only

0 Likes
2,797

"as it wont be always for INPUT and OUTPUT only." - It will be always( other than the ranges mentioned by Raymond ).

Please let us know then how will you find the function for the field ATNAM from

the table VFDIR. It doesn't hold it, the function ATINN_INPUT must be used for

the field ATNAM. So, fetching the functions from table willot help you. Use a

describe statement on the field and get the mask from either input or output

fields, then cocacatenate as suggested.

ex:

* Determine the mask from the domain
   DESCRIBE FIELD input_value OUTPUT-LENGTH lfd_length
                              EDIT MASK     lfd_mask.
   IF lfd_mask IS INITIAL.
* This statement is included because its not necessary that all field
* will be having mask associated with it, for example: ATNAM. But to get the
* conversion exit of ATNAM the output variable type will be holding the respective mask
* for example: ATINN. So this works.
     DESCRIBE FIELD output_value OUTPUT-LENGTH lfd_length
                                 EDIT MASK     lfd_mask.
     IF lfd_mask IS INITIAL.
       IF output_value IS INITIAL.
         output_value = input_value.
       ENDIF.
       EXIT.
     ENDIF.
   ENDIF.

   REPLACE '==' IN lfd_mask WITH ` `.
   CONDENSE lfd_mask NO-GAPS.

As Raymond said, the RANGES are the exceptional cases.

Read only

0 Likes
2,797

Then use RFC_READ_TABLE on table TFDIR.

Regards,

Raymond

Read only

0 Likes
2,797

Thanks a ton raymond....

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,797

Curious, I looked for the way SAP do the job in SE11, and they also use the CONCATENATE option...

From Include LSD11F01 Form OBJ_GOTO

 

*&---------------------------------------------------------------------*

*       Objektspezifische Navigationsziele

*----------------------------------------------------------------------*

*      --> GOTOID   Kennung für Navigationsziele

*      --> DDNAME   Dictonary-Name

*----------------------------------------------------------------------*

form obj_goto using  gotoid type gotoid

                     ddname.

  case gotoid.

    when 'CNVE'.   "Konvertierungsexit zu Domäne

      data: wb_request type ref to cl_wb_request.

      data: fb_name like tfdir-funcname

                        value 'CONVERSION_EXIT_'.

      concatenate fb_name ddname '*' into fb_name.

      condense fb_name.

* Request für Infosystem erzeugen

      class cl_wb_infosystem definition load.

      call method cl_wb_infosystem=>create_request

        exporting

          p_object_type        = 'FF'

          p_object_name        = fb_name

          p_operation          = swbm_c_op_search

          p_suppress_selection = 'X'

          p_show_as_popup      = 'X'

        importing

          p_wb_request         = wb_request

        exceptions

          action_cancelled     = 1

          execute_in_batch     = 2

          error_occured        = 3.

Regards,

Raymond

Read only

0 Likes
2,797

I suggested concatenate only after debugging SE11. I expected something different but it seems like for SAP, Concatenate is all that required.

Read only

Former Member
0 Likes
2,797

Hi, I have tried using FM REPOSITORY_INFO_SYSTEM_F4, as follows.

DATA:
     lf_object_name           TYPE char40.

       CONCATENATE 'CONVERSION_EXIT_'
                   <name of desired conversion exit>
                   '*'
                   INTO lf_object_name.

       CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
         EXPORTING
           object_type           = 'FUNC'
           object_name           = lf_object_name
           suppress_selection    = abap_true
           without_personal_list = abap_true
           use_alv_grid          = abap_true
         EXCEPTIONS
           cancel                = 1
           wrong_type            = 2
           OTHERS                = 3.

When using e.g. 'MATN1' for <name of desired conversion exit> the result is an overview with 4 function modules.

Disadvantage is that the result is displayed, you do not get it into a return variable...

Kind regards,

René