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: 

BAPI_OBJCL_GETCLASSES and negative numeric values.

Former Member
0 Kudos

Haw to get negative numeric values using BAPI_OBJCL_GETCLASSES? This BAPI returns in table  ALLOCVALUESNUM positive values only.

When i set positive numeric value (for example 21) to characteristic, then BAPI_OBJCL_GETCLASSES returns 21 (images 1-2), and when i set negative value (for example -35), then BAPI_OBJCL_GETCLASSES returns 0 (images 3-4). Why?

16 REPLIES 16

PeterJonker
Active Contributor
0 Kudos

Could it be that the associated datatype does not allow negative values or +/- sign ?

0 Kudos

Datatype allow negative values and +/- sign too. And value in AUSP table is correct (see screenshot, 1 row).

0 Kudos

OK, did you check the RETURN table for any messages ? Is the class in the table ALLOCLIST ?

Looking in the sourcecode I could imagine something goes wrong in the perform convert_tables_cacl_to_bapi /CTCV_SYNTAX_CHECK.

If I look at the code then when the call to this FM fails for some reason the values will be empty. Maybe you can check in debug.

0 Kudos

This is RETURN table content

This is ALLOCLIST content. My class name is PM_TR+UC_RD (6 row)

0 Kudos

Source code fragment:

DATA:

          OBJECTNUM          TYPE OBJNUM,

           IT_CLASSLIST       TYPE STANDARD TABLE OF BAPI1003_ALLOC_LIST INITIAL SIZE 1,

           WA_CLASSLIST       TYPE BAPI1003_ALLOC_LIST,

           IT_ALLOCVALUESCHAR TYPE STANDARD TABLE OF BAPI1003_ALLOC_VALUES_CHAR INITIAL SIZE 1,

           WA_ALLOCVALUESCHAR TYPE BAPI1003_ALLOC_VALUES_CHAR,

           IT_ALLOCVALUESCURR TYPE STANDARD TABLE OF BAPI1003_ALLOC_VALUES_CURR INITIAL SIZE 1,

           WA_ALLOCVALUESCURR TYPE BAPI1003_ALLOC_VALUES_CURR,

           IT_ALLOCVALUESNUM  TYPE STANDARD TABLE OF BAPI1003_ALLOC_VALUES_NUM INITIAL SIZE 1,

           WA_ALLOCVALUESNUM  TYPE BAPI1003_ALLOC_VALUES_NUM,

           IT_RETURN2         TYPE STANDARD TABLE OF BAPIRET2 INITIAL SIZE 1,

           WA_RETURN2         TYPE BAPIRET2.

OBJECTNUM = PPLS_DATA-EQUNR.


CALL FUNCTION 'BAPI_OBJCL_GETCLASSES'

         EXPORTING

           OBJECTKEY_IMP         = OBJECTNUM

           OBJECTTABLE_IMP       = 'EQUI'

           CLASSTYPE_IMP         = '002'

           READ_VALUATIONS       = 'X'

         TABLES

           ALLOCLIST             = IT_CLASSLIST

           ALLOCVALUESCHAR       = IT_ALLOCVALUESCHAR

           ALLOCVALUESCURR       = IT_ALLOCVALUESCURR

           ALLOCVALUESNUM        = IT_ALLOCVALUESNUM

           RETURN                = IT_RETURN2.

       READ TABLE IT_RETURN2 INTO WA_RETURN2 WITH KEY TYPE = 'E' .

       IF SY-SUBRC = 0.

         MESSAGE ID WA_RETURN2-ID TYPE WA_RETURN2-TYPE NUMBER WA_RETURN2-NUMBER

                 WITH WA_RETURN2-MESSAGE_V1 WA_RETURN2-MESSAGE_V2 WA_RETURN2-MESSAGE_V3 WA_RETURN2-MESSAGE_V4.

       ENDIF.

0 Kudos

Looking in the sourcecode I could imagine something goes wrong in the perform convert_tables_cacl_to_bapi /CTCV_SYNTAX_CHECK. If I look at the code then when the call to this FM fails for some reason the values will be empty. Maybe you can check in debug for your situation what happens at that moment.

I am trying to think here together with you, in no means I am trying to claim that I know what is wrong. Your code looks good, the table has the value stored as negative and you are calling a standard SAP BAPI.  Weird indeed.

Sorry I cant be of any more help but I am out of ideas.  😞

0 Kudos

Thank You for help.

You are right, the problem is in convert_tables_cacl_to_bapi /CTCV_SYNTAX_CHECK - sy-subrc =  6 (i.e. pattern_check exception).

numeric value is 35,000- (negative sign after number), and pattern is -__,___ (negative sign before number). But i can't change pattern in characteristic options. Even if i set negative sign after number, then, after saving characteristic options, it is again before!

Any ideas?

0 Kudos

I see that the mask comes from CABN-ATSCH. Does that mean that this has been set when the characteristic was created ?

Maybe you can change this mask for this characteristic with CT04 ?

In the system I am working on now there are no characteristics so I cannot test anything out.

0 Kudos

If you go to transaction code SM30 fill in table name TCPA and click customizing. Now you are in customizing where this mask is defined. Hope this helps you finding a solution.

0 Kudos

Yes, template has been set when the characteristic was created.

But i can't change template in characteristic options. Even if i set negative sign after number (__,___-), then, after saving characteristic options, it is again before (-__,___)!

0 Kudos

In SM30 i fill the table TCPA with template __,___-, but when i try to use it, message appears...

Former Member

Hello,  have a similar problem .. has this issue been solved already?

0 Kudos

No, but I use Batch Inpup for negative values. It works fine.

0 Kudos

I will start a OSS message for this

Former Member
0 Kudos

Hello Alexander,

Good Day,

This is a mere guess.. Check, whether the characteristics has any dependency in the back end.

Tcode : CU03/CU33

If there is a dependency, check the function module attached to the dependency.

There could be some code which may change the negative value to 0.

Thank you,

Regards,

Kavitha.

0 Kudos

CTCV_SYNTAX_CHECK or PATTERN_CHECK brings back subrc = 6 .. for pattern_error..

Either this is a real poorly documented feedback message or simply a fault in standard coding.

It did not happen before implementation of a service pack.. so it should make me wonder service packs to create any kind of displayable dependencies... that return 0 values

I will evaluate changes using version history...

Message Class C4 Message Number 002