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 MRM_INVOICE_PARK

Former Member
0 Likes
2,694

Hi guys.

I'm using the function MRM_INVOICE_PARK to park some docs. The function is working well, but i got a case where the date of the parking invoice gives me an error.

The function stops and says : posting period 004 2011 is not open. Message no. F5201

I dont want that the function stops, because there are others invoices that have to entry park as well and if on this one get stopped, others cant be created.


  CALL FUNCTION 'MRM_INVOICE_PARK'
    EXPORTING
      i_rbkpv           = wa_rbkpv
      i_xupda           = c_update
      i_rbstat_new      = c_source_assign
      ti_drseg          = it_drseg[]
      ti_selbest        = ti_selbest[]
    IMPORTING
      e_belnr           = f_belnr
      e_gjahr           = f_gjahr
      e_only_parked     = f_only_parked
    EXCEPTIONS
      invalid_status    = 1
      update_impossible = 2
      user_exit         = 3
      OTHERS            = 4.

  IF sy-subrc <> 0.
    WRITE:/  'Factura Nº ', f_belnr, ' ERROR'.
  ELSE.
    WRITE:/  'Factura Nº ', f_belnr, ' Modificada'.
  ENDIF.

I commeted the exceptions, but the error is getting display. I want to jump that one and keep going on with the rest.

How can i do it?

I guess that i could do it using TRY. catch. entry.

but what am i going to catch???

Please, some help.

Regards

1 ACCEPTED SOLUTION
Read only

Manohar2u
Active Contributor
0 Likes
2,451

Here is the way you can catch such exceptions and continue with rest of the invoices..

.
 exceptions
   invalid_status          = 1
   update_impossible       = 2
   user_exit               = 3
   error_message           = 99 ">>>>>> this helps to catch any other exceptions
   OTHERS                  = 4
          .

.

Here is the way you can catch such exceptions and continue with rest of the invoices..

.
 exceptions
   invalid_status          = 1
   update_impossible       = 2
   user_exit               = 3
   error_message           = 99 ">>>>>> this helps to catch any other exceptions
   OTHERS                  = 4
          .

.

13 REPLIES 13
Read only

former_member182371
Active Contributor
0 Likes
2,451

Hi,

you could use fm FI_PERIOD_CHECK before the call of fm MRM_INVOICE_PARK

and thus if the error F5201 is raised you could eliminate the record in the corresponding

internal table and in this way avoid processing it.

Best regards.

Edited by: Pablo Casamayor on Apr 20, 2011 10:21 AM

Read only

0 Likes
2,451

Hi,

it doesnt work, the FM works the same as the MRM_INVOICE_PARK.

It triggers a message error, so the process stops.

I need sth that allow me to keep going.

Think about this like this FM is inside a loop.


loop at table.
call function 'MRM_INVOICE_PARK'
endloop.

So, i need keep working with others data.

How can i manage that??

Regards

Read only

0 Likes
2,451

Hi,

you can copy the fm to a ZFI_PERIOD_CHECK where the message type is S instead of E :



      message S201(f5)   with i_monat i_gjahr i_koart ld_opvar
                         raising error_period.

and then:



* 1st check if the error arises
loop at table.
call function 'ZFI_PERIOD_CHECK'
* if the error arises here
* delete the line of table 
endloop.

* and then with the rest of table lines
loop at table.
call function 'MRM_INVOICE_PARK'
endloop.

Best regards

Edited by: Pablo Casamayor on Apr 20, 2011 2:50 PM

Read only

0 Likes
2,451

Hi Pablo.

The function 'FI_PERIOD_CHECK' and 'MRM_INVOICE_PARK' raise message error.

that's means that the process stop and go out of the transaction.

it gives u the red cancel 'X' and u can't do anything else.

I can't put a if error then keep going.

Do u know what i mean???

It is not simple as that.

Thanks, but it doesnt work the FI_PERIOD_CHECK.

Read only

0 Likes
2,451

Hi,

what about table T001B (Permitted Posting Periods) ?

Regards.

Read only

Manohar2u
Active Contributor
0 Likes
2,452

Here is the way you can catch such exceptions and continue with rest of the invoices..

.
 exceptions
   invalid_status          = 1
   update_impossible       = 2
   user_exit               = 3
   error_message           = 99 ">>>>>> this helps to catch any other exceptions
   OTHERS                  = 4
          .

.

Read only

Former Member
0 Likes
2,451

Hi,

I want to do sht like that, but no idea of how.

I'm guessing that sth like this:


  TRY.
      CALL FUNCTION 'MRM_INVOICE_PARK'
        EXPORTING
          i_rbkpv           = wa_rbkpv
          i_xupda           = c_update
          i_rbstat_new      = c_source_assign
          ti_drseg          = it_drseg[]
          ti_selbest        = ti_selbest[]
        IMPORTING
          e_belnr           = f_belnr
          e_gjahr           = f_gjahr
          e_only_parked     = f_only_parked
        EXCEPTIONS
          invalid_status    = 1
          update_impossible = 2
          user_exit         = 3
          OTHERS            = 4.

     CATCH cx_sy_dyn_call_illegal_class.

  ENDTRY.

that code, it didnt work. The FM send me out with the error message and didnt keep working.

But the catch maybe is going to be the solution, i need to figure out what sentence i need to write on the catch.

Thanks,.

Read only

Former Member
0 Likes
2,451

well you could call this within a loop, with just a single record in IT_DRSEG.

So you will exactly know which records to keep for MRM_PARKING them.

Read only

Former Member
0 Likes
2,451

???? Sorry, but i didnt understand ur point.

Read only

Former Member
0 Likes
2,451

well if i understand your correct you are trying to park a list/bunch of documents.

And the problem you got is that nothing is beeing done if just ONE of your documents in your list is outside of posting period.

am i right so far?

Assuming i´m right so far i will continue.

So it seems if MRM_INVOICE_PARK has one item out of posting period it wont do anything. So well you got to make sure that when processing MRM_INVOICE_PARK, that there is no item out of posting range.

So beforehand you could loop over your items, and check every single item with FI_PERIOD_CHECK for posting availability.

If item is able to be posted, leave it in your itab, if not, delete it.

Once you got an ITAB then with just items that are able to be posted (period wise) you can then call MRM_INVOICE_PARK without any problems then.

Read only

Manohar2u
Active Contributor
0 Likes
2,451

have you tried my above option? Is it not worked? Let me know your feedback.

Read only

Former Member
0 Likes
2,451

Hi

thanks for ur explanation.

But the FM FI_PERIOD_CHECK also triggers a raise message, that means that the the FM stops and goes out and display the error, so it works the same as MRM_INVOICE_PARK.

I'm still working on this and checking others option, because until now, everything triggers an error message that stop the process with an error.

Thanks.

Read only

Former Member
0 Likes
2,451

Master (Manohar Reddy Kallem),

ur solution works.

Thanks a lot.

Regards to all of u guys.