1

Is there a function module or BAPI or method that nicely performs a material/material ledger consistency check for a given material?

I am aware of report SAPRCKMU which would be very hard to use inside my own program.

I am also aware of and using function module CKML_F_CKML1_PRICES_GET which performs a consistency check.

When this function module finds an inconsistency, it calls MESSAGE E... which means I lose control in my program. This is the core problem that I have.

So I am searching a way to check consistency before I call CKML_F_CKML1_PRICES_GET in a way that gives me a return parameter with the error message without calling MESSAGE E....

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Gerd Castan
  • 6,275
  • 3
  • 44
  • 89
  • Can't you handle this `E` messages by using `EXCEPTIONS OTHERS = 99.`? – Jagger Dec 28 '15 at 20:37
  • 1
    @Jagger I think this lead me in the right direction. Note to self: try `EXCEPTIONS error_message = 99` – Gerd Castan Dec 28 '15 at 21:12
  • I'm wondering why you need a own consistency check at all?!? There are already a variety of reports available in the material ledger help desk (Tx CKMHELP), for checking consistency of materials, valuation areas and customizing in this area. – Tapio Reisinger Dec 29 '15 at 06:23
  • I wanted to check because `call CKML_F_CKML1_PRICES_GET` did not return nicely because there is a statement `MESSAGE E...` inside. – Gerd Castan Dec 29 '15 at 08:45

1 Answers1

2

I found a solution that works very well:

add the line error_message = 99 to the function module call:

CALL FUNCTION 'CKML_F_CKML1_PRICES_GET'
   ....
EXCEPTIONS 
   ...
   error_message = 99
   others = 98.

Now the program doesn't interrupt the control flow when the function module itself uses MESSAGE E... instead of RAISE ....

Whenever MESSAGE E... is called inside, it is converted into SY-SUBRC = 99 and the error-fields in SY-... are also set.

Gerd Castan
  • 6,275
  • 3
  • 44
  • 89