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: 

Update Batch Classification for a Material

Former Member
0 Kudos

Hello friends,

I'm facing the following problem : A specific BTCI wich simulates MB01 was calling another program called SAPLCTMS to update Batch classification for a Material, this program (SAPLCTMS ) seems to be not necessary after the support package Level 57 (we just installed SAP4.6C). I didn't find any note on OSS for this...

Now i'm trying to use this BAPI instead of BTCI for the Material batch classification :

CALL FUNCTION 'BAPI_OBJCL_CHANGE'
         EXPORTING
              objectkey          = l_objnum
              objecttable        = 'MCH1' 
              classnum           = 'ZGB_TIDCLASS'
              classtype          = '022'
              status             = '1'
              keydate            = sy-datum
         TABLES
              allocvaluesnumnew  = t_valuesnum
              allocvaluescharnew = t_valueschar
              allocvaluescurrnew = t_valuescurr
              return             = t_return.

But its not working, it keeps asking for a batch number. I guess i'm not using the right FM ?

Any ideas about this ?

Thank you in advance for your help !

Best Regards.

Edited by: Soufiane FAYSSAL on Jun 18, 2009 11:42 AM

12 REPLIES 12

Former Member
0 Kudos

Hello

You need concatenate material number (with leading zeros) and batch number into l_objnum.

former_member555112
Active Contributor
0 Kudos

Hi,

Please check that the entire 18 digit material number is being passed.

Regards,

Ankur Parab

Former Member
0 Kudos

Concatenate is not working. And Yes its a 18 digit passed.

For example:

l_objnum(18) = p_matnr.

l_objnum+18(10) = p_charg.

I'm getting object EFT930G-001-GEN 0098765480 doesn't exist...

Any other suggestions please ?

0 Kudos

Hi,

Incase you want to change the characteristics value assigned with the material for the class type as batch then you have to pass data as follows:-

CALL FUNCTION 'BAPI_OBJCL_CHANGE'
    EXPORTING
      objectkey                =  lv_object
      objecttable              = 'MARA'
      classnum                 = 'ZTEST'
      classtype                = '023'
    tables
      allocvaluesnumnew        = num
      allocvaluescharnew       = char
      allocvaluescurrnew       = curr
      return                   = ret

The objectkey will just contain the 18 digit material number.

The objecttable will be MARA

The classtype will be 023 and the classnum will be the name of the class.

Regards,

Ankur Parab

former_member555112
Active Contributor
0 Kudos

HI,

Are you sure the class type is '022'.

It should be '023' for batch

Regards,

Ankur Parab

Former Member
0 Kudos

Hello Ankur,

Thank you for your help.Its 022 in my case. Here a piece of code wich i'm using :

l_objnum(18)        = p_matnr.
  l_objnum+18(4)    = p_werks.
  l_objnum+22(10)   = p_charg.

  CALL FUNCTION 'BAPI_OBJCL_CREATE'
       EXPORTING
            objectkeynew    = l_objnum
            objecttablenew  = 'MARA'
            classnumnew     = 'ZGB_TIDCLASS'
            classtypenew    = '022'   
            status          = '1'
*            keydate         = sy-datum
       TABLES
            allocvaluesnum  = t_valuesnum
            allocvalueschar = t_valueschar
            allocvaluescurr = t_valuescurr
            return          = t_return.

After a COMIT WORK. The Batch classification is created in MSC2N with my material/Plant/Batch but the values are not even if t_valueschar table is filled with the correct values...

Moreover, after the batch classification creation, when i run a se37 with BAPI_OBJCL_GETDETAIL, its giving the values wich are not displayed in MSC2N.

Any idea ?

Thanks again.

Best Regards.

0 Kudos

Hello,

I am Ashok Chelikani. I am working on the same Issue.

i am getting following message:

TYPE ID    NUMBER  MESSAGE

E       |C1   |003          |Characteristic DIMENSIONSCOLOR not found or not valid

I        |CL   |736          |Assignment was not created 

my procedure as follows:

 

CLEAR: lv_objnum.

lv_objnum = I_MSEG-MATNR.

 

**Get Object Details

CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'

EXPORTING

objectkey = lv_objnum

objecttable = 'MARA'

classnum = 'Z_RMBCH1'

classtype = '001' 

TABLES

allocvaluesnum = lt_alloc_num

allocvalueschar = lt_alloc_char

allocvaluescurr = lt_alloc_curr

return = lt_return.

IF NOT lt_return IS INITIAL.

 

CLEAR: lv_objnum.

lv_objnum(18) = I_MSEG-MATNR.

lv_objnum+18(10) = I_MSEG-CHARG.

 

CALL FUNCTION 'BAPI_OBJCL_CHANGE'

EXPORTING

objectkey = lV_objnum

objecttable = 'MCH1'

classnum = 'Z_RMBCH1'

classtype = '023' 

tables

allocvaluesnumnew = lt_alloc_num

allocvaluescharnew = lt_alloc_char

allocvaluescurrnew = lt_alloc_curr

return = lt_return.

lt_return returing error message. Kindly help me.

Former Member
0 Kudos

Any suggetons Friends.

Former Member
0 Kudos

Solved I ran an SHDB on MSC1.

Thanks for the replies.

0 Kudos

Hi,

how have you solved it?

Many Thanks,

Anna

Former Member
0 Kudos

Hello Anna,

I've wrote a classic BTCI on MSC1 using SHDB T-code.

Regards,

Soufiane

Former Member
0 Kudos

Sorry, MSC2 not MSC1.