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 get subrc in this function module

Former Member
0 Likes
1,123

CALL FUNCTION 'FI_PERIOD_CHECK'

EXPORTING

I_BUKRS = 'C553'

  • I_OPVAR = ' '

I_GJAHR = it_out-datains1+0(4)

I_KOART = 'S'

I_KONTO = 'zzzzzzzzzz'

I_MONAT = L_IODM

  • EXCEPTIONS

  • ERROR_PERIOD = 1

  • ERROR_PERIOD_ACC = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

when i am testing this function module i am getting error_period_acc =2.

but i used this one in program like above code i am getting subrc=0.

i have doubt in this one is we can comment exceptions or uncomment.

i want sy-subrc <> 0.

how can i get

7 REPLIES 7
Read only

Former Member
0 Likes
883

Try using this way

CALL FUNCTION 'FI_PERIOD_CHECK'

EXPORTING

i_bukrs = cashin_header-bukrs

i_gjahr = i_gjahr

i_koart = 'D'

i_monat = i_poper

EXCEPTIONS

error_period = 1

error_period_acc = 2

OTHERS = 3.

IF sy-subrc <> 0.

CALL FUNCTION 'BALW_BAPIRETURN_GET2'

EXPORTING

type = sy-msgty

cl = sy-msgid

number = sy-msgno

par1 = sy-msgv1

par2 = sy-msgv2

par3 = sy-msgv3

par4 = sy-msgv4

IMPORTING

return = return.

APPEND return.

ENDIF.

Read only

0 Likes
883

i can comment EXCEPTIONS

or no comment?

Read only

0 Likes
883

Dont comment the exceptions

Read only

0 Likes
883

return = return.

APPEND return.

in this one return type.

how to declare.

Read only

0 Likes
883

Hi Venkat,

Data return type BAPIRET2.

Reward all useful answers.

Regards,

Atish

Read only

Former Member
0 Likes
883

Check the parameters ,I mean are you passing valid values or not

I_KOART NE '+'.

then you will get message

CALL FUNCTION 'FI_PERIOD_CHECK'

EXPORTING

I_BUKRS = 'C553'

  • I_OPVAR = ' '

I_GJAHR = it_out-datains1+0(4)

I_KOART = <b>'+'</b> -> pass + value and see the results

I_KONTO = 'zzzzzzzzzz'

I_MONAT = L_IODM

  • EXCEPTIONS

  • ERROR_PERIOD = 1

  • ERROR_PERIOD_ACC = 2

  • OTHERS = 3

Thanks

Seshu

Read only

Former Member
0 Likes
883

when any error is raised by raise <exception name> the sy-subrc is getting the value according to their decvlaration. In your case when

raise ERROR_PERIOD< sy-subrc = 1 return>

raise ERROR_PERIOD_ACC <sy-subrc = 2 return>

raise OTHERS <sy-subrc = 3 return>

if above statement are executed it will return the sy-subrc value as stated.

for getting this you have to un-comment the all the exception.

regards

shiba dutta