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: 

How to remove function module error?

Former Member
0 Kudos

Hi Iam using a FM to get the database value of project name(PROJ-PSPID),Iam using this in my module pool program,when I enter wrong project name,the FM itself throwing the error,I want my own error message rather FM error message.How to achieve it?

Thanks in advance.

9 REPLIES 9

Former Member
0 Kudos

After the FM call, do a sy-subrc check and based on the value you can trigger your own message..

0 Kudos

Thanks all of u guys for u r replies,but I have tried sy-subrc,before the control coming out of FM itself,the error is coming,and as far as not using that FM and just checking with select statement is concerned,it is not possible becoz of the conversion I need to use the routines to see the correctness of the value.PLZ advice.

Former Member
0 Kudos

HI when you call fm.

here in exception you can use as in place of if sy-subrc ,

case sy-subrc.

when '1'.

write.'jhjk'.

when '2'.

write: 'jfkj'.

endcsae.

Former Member
0 Kudos

Just select from table PROJ yourself instead of using the function module. You can then throw whatever error you want depending upon the return code.

Regards,

Darren

Former Member
0 Kudos

Hi,

Try like this.....


call function 'RZL_READ_DIR'
        exporting
          name           = p_file
          srvname        = ' '
        tables
          file_tbl       = lt_file
        exceptions
          argument_error = 1
          not_found      = 2
          send_error     = 3
          system_failure = 4
          others         = 5.
      if sy-subrc NE 0.
        case sy-subrc.
          when 1.
            message i000(zdmf) with text-108.
          when 2.
            message i000(zdmf) with text-109.
          when 3.
            message i000(zdmf) with text-110.
          when 4.
            message i000(zdmf) with text-111.
          when 5.
            message i000(zdmf) with text-112.
        endcase.
        return.
      endif.

Former Member
0 Kudos

Hi,

First you use conversion routines using FMs

CONVERSION_EXIT_ABPSN_INPUT

CONVERSION_EXIT_ABPSN_OUTPUT

and then validate the value of PROJ-PSPID you entered.

Regards,

Raju.

Former Member
0 Kudos

Hi Rock,

After executing the function module , check for sy-subrc value as shown below

data: w_return type bapiret2,

it_return type table of bapiret2.

......

....

call function '.....'

......

IF SY-SUBRC EQ 0.

PERFORM fm_update_return_msg

USING 'E'

your Message class

'msg no'

' '

' '

' '

' '

CHANGING w_return.

APPEND w_return TO IT_RETURN.

clear w_return.

ENDIF.

FORM fm_update_return_msg USING p_msgty TYPE sy-msgty

p_msgid TYPE sy-msgid

p_msgno TYPE sy-msgno

p_msg_v1 TYPE sy-msgv1

p_msg_v2 TYPE sy-msgv2

p_msg_v3 TYPE sy-msgv3

p_msg_v4 TYPE sy-msgv4

CHANGING p_return TYPE bapiret2.

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

type = p_msgty

cl = p_msgid

number = p_msgno

par1 = p_msg_v1

par2 = p_msg_v2

par3 = p_msg_v3

par4 = p_msg_v4

IMPORTING

return = p_return.

.

ENDFORM. "fm_update_return_msg

Former Member
0 Kudos

Solved : This error was coming only in IDES,when I did the same in DEV server,it has not come.Thanks all for u r valuble replies and u r valuble time.

Former Member
0 Kudos

hi,

1.check whether it is generated by exception in the FM.if yes then comment exceptions and messages

2.if the message is generaeted from inside.u have to do the cecking before the function module and throw error and dont let the function module to execute