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

problem with CONVERSION_EXIT_ABPSP_INPUT

former_member185116
Active Participant
0 Likes
3,309

hello all,

in the below function module i am passing POSID to get PSPNR...


if lv_posid is NOT INITIAL.

    CALL FUNCTION 'CONVERSION_EXIT_ABPSP_INPUT'
      EXPORTING
        INPUT           = lv_posid
     IMPORTING
       OUTPUT          = lv_pspnr
     EXCEPTIONS
       NOT_FOUND       = 1
       OTHERS          = 2


endif.


my question is if lv_posid = 'E-B'


then it is throwing error


how do i catch this error (its not possible to c atch with sy-subrc)...


thanks in advance....


1 ACCEPTED SOLUTION
Read only

atul_mohanty
Active Contributor
0 Likes
1,916

Hi - Please check the below code, especially line no 10

DAta :    v_message TYPE char255.

  1. if lv_posid is NOT INITIAL. 
  2.   
  3.     CALL FUNCTION 'CONVERSION_EXIT_ABPSP_INPUT' 
  4.       EXPORTING 
  5.         INPUT           = lv_posid 
  6.      IMPORTING 
  7.        OUTPUT          = lv_pspnr 
  8.      EXCEPTIONS 
  9.        NOT_FOUND       = 1 
  10.        error_message          =  3
  11.        OTHERS          = 2   


IF sy-subrc <> 0.

       CALL FUNCTION 'FORMAT_MESSAGE'

         EXPORTING

           id        = sy-msgid

           lang      = '-D'

           no        = sy-msgno

           v1        = sy-msgv1

           v2        = sy-msgv2

           v3        = sy-msgv3

           v4        = sy-msgv4

         IMPORTING

           msg       = v_message

         EXCEPTIONS

           not_found = 1

           OTHERS    = 2.

       IF sy-subrc = 0.

* HERE you can take the V_MESSAGE

      ENDIF

      ENDIF

endif

3 REPLIES 3
Read only

atul_mohanty
Active Contributor
0 Likes
1,917

Hi - Please check the below code, especially line no 10

DAta :    v_message TYPE char255.

  1. if lv_posid is NOT INITIAL. 
  2.   
  3.     CALL FUNCTION 'CONVERSION_EXIT_ABPSP_INPUT' 
  4.       EXPORTING 
  5.         INPUT           = lv_posid 
  6.      IMPORTING 
  7.        OUTPUT          = lv_pspnr 
  8.      EXCEPTIONS 
  9.        NOT_FOUND       = 1 
  10.        error_message          =  3
  11.        OTHERS          = 2   


IF sy-subrc <> 0.

       CALL FUNCTION 'FORMAT_MESSAGE'

         EXPORTING

           id        = sy-msgid

           lang      = '-D'

           no        = sy-msgno

           v1        = sy-msgv1

           v2        = sy-msgv2

           v3        = sy-msgv3

           v4        = sy-msgv4

         IMPORTING

           msg       = v_message

         EXCEPTIONS

           not_found = 1

           OTHERS    = 2.

       IF sy-subrc = 0.

* HERE you can take the V_MESSAGE

      ENDIF

      ENDIF

endif

Read only

0 Likes
1,916

thanks atul mohanty,

solved my problem...

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,916

Could you try a

CALL FUNCTION 'CONVERSION_EXIT_ABPSP_INPUT'
   EXPORTING
     input         = lv_posid
   IMPORTING
     output        = lv_pspnr
   EXCEPTIONS
     not_found     = 1
     error_message = 2.

cause OTHERS has no usage here (can only be triggered by non monitored exception of the FM, and there are none.)


Regards,

Raymond