cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using BAPI_OBJCL_CHANGE

former_member42743
Active Contributor
0 Likes
14,688

I've looked at a ton of entries in the questions but I probably don't know enough to undersrtand what i'm reading.

So here is the issue.

We have a program that updates batch characteristics based on some business process requirements. This works.

However, we will have some numeric characteristics that have no values, (i.e. null or in SAP parlence, not not-initial) when the program runs. When the program is done, the batch values now shows as 0.00 and not null for these characteristics. The developers solution for this was to go back and delete them. But this resutls in change records showing a value of 0.00 created and a value of 0.00 deleted in the batch change records. Not good and not accurate.

I know in the underlaying tables there is an indicator flag, (initial/not-initial), that tells the system whether the value stored (0.0000000000) is really a true zero, or null.

My developers are telling me that is how BABI_OBJCL_CHANGE works. I disagree. There must be a way to use BABI_OBCJL_CHANGE to only update the characteristics you want to and not have it "default" in 0.00 for numeric characteristics that the program shouldn't even touch or know about.

Any suggestions as to what I can suggest to my developers?

Thanks!

Craig

View Entire Topic
former_member182371
Active Contributor
0 Likes

Hi,

maybe you could use fm 'BAPI_OBJCL_EXISTENCECHECK' as it is used in fm CKCVAL_COSTING_CHARVAL_SET.

check first and according to the result change or...whatever you decide

e.g.

CALL FUNCTION 'BAPI_OBJCL_EXISTENCECHECK'
    EXPORTING
      objectkey         = lf_class-objek
      objecttable       = lf_class-obtab
      classnum          = lf_class-class
      classtype         = lf_class-classtype
*     KEYDATE           = SY-DATUM
    tables
      return            = lt_return.
  LOOP AT LT_RETURN WHERE TYPE = 'S'.
    EXIT.
  ENDLOOP.
  if SY-SUBRC = 0.
* Change the characteristic valuation
    CALL FUNCTION 'BAPI_OBJCL_CHANGE'
      EXPORTING
        objectkey                = lf_class-objek
        objecttable              = lf_class-obtab
        classnum                 = lf_class-class
        classtype                = lf_class-classtype
*       STATUS                   = '1'
*       STANDARDCLASS            =
*       CHANGENUMBER             =
*       KEYDATE                  = SY-DATUM
      tables
        allocvaluesnumnew        = LT_VALUESNUM
        allocvaluescharnew       = LT_VALUESCHAR
        allocvaluescurrnew       = LT_VALUESCURR
        return                   = LT_RETURN.
  else.
* Create the characterisitc valuation
    refresh lt_return.
    CALL FUNCTION 'BAPI_OBJCL_CREATE'
      EXPORTING
        objectkeynew          = lf_class-objek
        objecttablenew        = lf_class-obtab
        classnumnew           = lf_class-class
        classtypenew          = lf_class-classtype
*       STATUS                = '1'
*       STANDARDCLASS         =
*       CHANGENUMBER          =
*       KEYDATE               = SY-DATUM
      tables
        ALLOCVALUESNUM        = LT_VALUESNUM
        ALLOCVALUESCHAR       = LT_VALUESCHAR
        ALLOCVALUESCURR       = LT_VALUESCURR
        return                = lt_return.
  endif.
<br>

Best regards,

Pablo

former_member42743
Active Contributor
0 Likes

Thanks for your suggestion Pablo.

Isn't this check just telling me however that classification has occurred? It's not going to tell me for any one specific numeric characteristic of the value of 0.00 is actually a null value or a real value of 0.00? (see my comment on next answer)

former_member182371
Active Contributor

Hi,

check BAPI_OBJCL_GETDETAIL and within that bapi have a look at fm CTMS_DDB_HAS_VALUES_INTERNAL that returns internal table lit_valtab.

Regards,

Pablo