Application Development 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: 

reg Conversion Exits

Former Member
0 Kudos

hi folks,

In select query to table EQUI, i'm retrieving 'Equipment numbers' where I referred to standard data element, EQUNR which is having Conversion exit, ALPHA. Here the problem is, in the internal table where i got the multiple Equipment nos - for the only first record, i'm getting EQUNR with leading zeroes and starting from second record, no zeroes were adding !!

I used Conversion_exit_alpha_input but of no use.

Please help me out.

Regards,

Suseel.

13 REPLIES 13

archanapawar
Contributor
0 Kudos

Hi Suseel,

Are you using Conversion_exit_alpha_input in a loop. You need to pass each EQUNR value to FM to convert it with appending zero.

PeterJonker
Active Contributor
0 Kudos

Can you show us a code snippet, because I have used this function module a million times and it Always worked. Must be something wrong in the way you are calling this conversion exit.

0 Kudos

Hi,

here is my code,

  IF lt_asset[] IS NOT INITIAL.
    LOOP AT lt_asset INTO ls_asset.
      CALL FUNCTION 'CONVERSION_EXIT_EQUNR_OUTPUT'
        EXPORTING
          input  = ls_asset
        IMPORTING
          output = ls_asset_out.
     APPEND ls_asset_out TO lt_asset_out.
     CLEAR: ls_asset_out, ls_asset.
    ENDLOOP.
   SUBMIT zmr_oneems_equipment_extract WITH so_equnr IN lt_asset
                                        WITH pa_xml = 'X'.
   REFRESH: lt_asset_out.
  ENDIF.

/* in submit program, where so_equnr refers to same data element, equnr

/*here for first record, i can see value appending with leading zeroes (char18), from second value, it's not appending !!

Awaiting your response, TIA

Regards,

Suseel

0 Kudos

Hi,

Dont pass entire work area ls_asset to FM, just pass only the equipment number for that FM.

CALL FUNCTION 'CONVERSION_EXIT_EQUNR_OUTPUT'

        EXPORTING

          input  = ls_asset-equnr

        IMPORTING

          output = ls_asset-equnr.

Thanks,

Sree

0 Kudos


Hi,

If IT_asset is an equnr selection internal table then use below logic in loop.

CALL FUNCTION 'CONVERSION_EXIT_EQUNR_OUTPUT'

        EXPORTING

          input  = ls_asset-low

        IMPORTING

          output = ls_asset-low

Thanks

Sree

0 Kudos

hi Sree,

You can see, i referred /passed only equnr field in the work area.

0 Kudos

Hi Suseel,

Even if you have single field in your work area, you need to provide field name to FM to get that value converted.


CALL FUNCTION 'CONVERSION_EXIT_EQUNR_OUTPUT'

        EXPORTING

          input  = ls_asset-equnr

        IMPORTING

          output = ls_asset_out-equnr.

0 Kudos

Hi,

Thanks for your reply.

Also, please clarify me on this point:

SUBMIT zmr_oneems_equipment_extract WITH so_equnr IN lt_asset

                                        WITH pa_xml = 'X'.

in above statement, lt_asset refers to char45 (as per buss req - will get input values of char45), but in the called program, so_equnr refers to data element, EQUNR (char18)...

Because of this, i'm getting zeroes (for char45) more than the required char18, could you please let me know how to maintain this length conflict.

Input is char45

Output is char18

Regards,

Suseel

0 Kudos

Why do you need to use char45 for equnr? you need to pass char18 only as that is the standard data element length for EQUNR.

Also, the program that you are using for submit that is also Z program.

SUBMIT zmr_oneems_equipment_extract WITH so_equnr IN lt_asset.

So, you can edit that program(select option so_equnr) as well if you are unable to fulfill it afterall.

0 Kudos

Hi,

Use converison exits for input value.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

        EXPORTING

          input  = equnr

        IMPORTING

          output = equnr.

it will remove the leading zeros.

for ex: your input is 00000000000076

then output is: 76

Thanks,

Sree

0 Kudos

Hi Archana,

Actually, the input values to the internal table, lt_asset is declared with char45 (as per business request) and calling program is the existing one in the system (no right to change data declarations as this program is used in many interfaces)

And strange thing here is, without using 'conversion exits' - the first record in SO_EQUNR is coming with char18 (000000000012345678) and select query is working fine, and from second record, the values are coming only in char8(12345678) which resulting in fail !!

Any suggestions please?

Regards,

Suseel

0 Kudos

Hi,

Thanks for your inputs, it's working fine now.

/* i declared (ls_asset_out type range of equnr)

  IF lt_asset[] IS NOT INITIAL.
    LOOP AT lt_asset INTO ls_asset.
      ls_asset_out-sign = 'I'.
     ls_asset_out-option = 'EQ'.

      CALL FUNCTION 'CONVERSION_EXIT_EQUNR_INPUT'
        EXPORTING
          input  = ls_asset-low
        IMPORTING
          output = ls_asset_out-low.
      APPEND ls_asset_out TO lt_asset_out.
      CLEAR: ls_asset_out, ls_asset.
    ENDLOOP.

    SUBMIT zmr_oneems_equipment_extract WITH so_equnr IN lt_asset_out
                                        WITH pa_xml = 'X'.
    REFRESH: lt_asset_out.
  ENDIF.

0 Kudos

If your issue is resolved, you can close the thread.