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

Classifiction View in material master --- ausp

Former Member
0 Likes
1,928

Hi all,

I am using the BAPI_MATERIAL_SAVEDATA to create or save the material.

In that i dont know how to create or update the classification view which concerns the ausp table.

Any one help me how to update the Classifiction view.

Anyother bapi has to be used in addition to that of bapi_material_savedata.

Please suggest me the way.

Thanks & Regards,

S.Shankar

7 REPLIES 7
Read only

Former Member
0 Likes
1,428

Try this FM, CLAP_DDB_UPDATE_CLASSIFICATION, otherwise manually update the classification of material and try to debug how the value is being saved by SAP and use the same FM.

You can try the BDC approach as well. Use the FM SELECTION_VIEWS_ACTIVE for the same.

Let us know if this helps.

Regards,

Subramanian V.

Read only

Former Member
0 Likes
1,428

Hi,

Thank you For your Reply.

I will try the same.

Regards,

S.Shankar

Read only

Former Member
1,428

Hi,

Some time ago I used the FM CLBPAX_WRITE_CLASSIFICATIONS in order to update the materials batch classification.

Maybe it would be useful to you.

Best regards,

Claudiu Besmeciuc

Read only

Former Member
0 Likes
1,428

Hi,

Check the program: RCCLBI03 for classification related info.

regards

Aveek

Read only

Former Member
0 Likes
1,428

Hi Shankar,

You can use BAPI_OBJCL_CREATE to Create, BAPI_OBJCL_CHANGE to change and BAPI_OBJCL_DELETE to delete the classification for materials.To get the classification use BAPI_OBJCL_GETDETAIL.

Hope this solves your problem.

Thanks

Kathirvel

Read only

Former Member
0 Likes
1,428

Hi Shankar,

Go through these threads,

Thanks,

Kathirvel

Read only

Former Member
0 Likes
1,428

Hi Shankar,

I once faced the similar problem. I got a code which will give you a clear picture,

report zc1_bapi_classification .

----


  • This is a dummy program designed to show how to create a batch and *

  • then apply/change characteristics via BAPI control. *

----


tables: klah, ksml, cabn.

  • holds data for charcateristics with type NUM

data: begin of numtab occurs 0.

include structure bapi1003_alloc_values_num.

data: end of numtab.

  • holds data for charcateristics with type CHAR/DATE

data: begin of chatab occurs 0.

include structure bapi1003_alloc_values_char.

data: end of chatab.

  • holds data for charcateristics with type CURR

data: begin of curtab occurs 0.

include structure bapi1003_alloc_values_curr.

data: end of curtab.

  • Error return table

data: begin of rettab occurs 0.

include structure bapiret2.

data: end of rettab.

data: begin of it_ksml occurs 0.

include structure ksml.

data: end of it_ksml.

  • characteristic names

data: begin of it_cabn occurs 0,

atinn like cabn-atinn,

atnam like cabn-atnam,

atfor like cabn-atfor,

end of it_cabn.

data: begin of it_object occurs 0.

include structure bapi1003_object_keys.

data: end of it_object.

  • example of an object key 00000000000730000007505847897897

data: w_object like bapi1003_key-object.

  • Change these defaults to suit your system

parameters: p_matnr like mara-matnr obligatory default '7300000',

p_werks like t001w-werks obligatory default '0750',

p_charg like mcha-charg obligatory default '5847897898',

p_lgort like dfbatch-lgort obligatory default '1000',

p_klart like klah-klart obligatory default '022',

p_class like klah-class obligatory default 'RETREAD'.

initialization.

perform get_characteristics.

start-of-selection.

perform create_batch.

perform bapi_commit.

perform build_object_key.

perform extract_original_batch.

end-of-selection.

perform update_original_batch.

perform bapi_commit.

----


  • FORM get_characteristics *

----


form get_characteristics.

  • extract the characteristic names for KLART/CLASS

clear: klah, ksml, it_cabn.

refresh it_cabn.

select single clint from klah

into corresponding fields of klah

where klart = p_klart

and class = p_class.

if syst-subrc = 0.

select * from ksml

into corresponding fields of ksml

where clint = klah-clint.

select single * from cabn

into corresponding fields of cabn

where atinn = ksml-imerk.

if syst-subrc = 0.

it_cabn-atinn = cabn-atinn.

it_cabn-atnam = cabn-atnam.

it_cabn-atfor = cabn-atfor.

append it_cabn.

endif.

endselect.

endif.

endform.

----


  • FORM create_batch *

----


form create_batch.

clear: rettab.

refresh: rettab.

  • create the batch using screen values, you will most likely have to

  • determine the next batch number from the number range.

call function 'BAPI_BATCH_CREATE'

exporting

material = p_matnr

batch = p_charg

plant = p_werks

batchstoragelocation = p_lgort

tables

return = rettab.

endform.

----


  • FORM build_object_key *

----


form build_object_key.

  • build the object key

clear: it_object, rettab.

refresh: it_object, rettab.

it_object-key_field = 'MATNR'.

it_object-value_int = p_matnr.

append it_object.

it_object-key_field = 'WERKS'.

it_object-value_int = p_werks.

append it_object.

it_object-key_field = 'CHARG'.

it_object-value_int = p_charg.

append it_object.

call function 'BAPI_OBJCL_CONCATENATEKEY'

exporting

objecttable = 'MCHA'

importing

objectkey_conc = w_object

tables

objectkeytable = it_object

return = rettab.

endform.

----


  • FORM extract_original_batch *

----


form extract_original_batch.

  • extract the original characteristic data if exists

clear: numtab, chatab, curtab, rettab.

refresh: numtab, chatab, curtab, rettab.

call function 'BAPI_OBJCL_GETDETAIL'

exporting

objectkey = w_object

objecttable = 'MCHA'

classnum = p_class

classtype = p_klart

tables

allocvaluesnum = numtab

allocvalueschar = chatab

allocvaluescurr = curtab

return = rettab.

endform.

----


  • FORM update_original_batch *

----


form update_original_batch.

  • Below are some examples of characteristics to update, obviously you

  • would change these to match the ones in your system

  • ATNAM is the characteristic name.

  • find characteristic format in it_cabn and call update routine

read table it_cabn with key atnam = 'TREAD'.

perform update_table using it_cabn-atfor it_cabn-atnam 'HW203'.

read table it_cabn with key atnam = 'ORRETREAD'.

perform update_table using it_cabn-atfor it_cabn-atnam '11225HW203C'.

read table it_cabn with key atnam = 'CASINGCODE'.

perform update_table using it_cabn-atfor it_cabn-atnam '7100044'.

read table it_cabn with key atnam = 'CASINGSTATUS'.

perform update_table using it_cabn-atfor it_cabn-atnam 'CUSTOMER'.

read table it_cabn with key atnam = 'CASEVAL'.

perform update_table using it_cabn-atfor it_cabn-atnam '0'.

read table it_cabn with key atnam = 'CUSTOMER'.

perform update_table using it_cabn-atfor it_cabn-atnam '0276933500'.

read table it_cabn with key atnam = 'FROMLOC'.

perform update_table using it_cabn-atfor it_cabn-atnam '0584'.

read table it_cabn with key atnam = 'BRAND'.

perform update_table using it_cabn-atfor it_cabn-atnam 'BRI'.

read table it_cabn with key atnam = 'NOCAPS'.

perform update_table using it_cabn-atfor it_cabn-atnam '1'.

read table it_cabn with key atnam = 'RETURNLOC'.

perform update_table using it_cabn-atfor it_cabn-atnam '0584'.

read table it_cabn with key atnam = 'RECDATE'.

perform update_table using it_cabn-atfor it_cabn-atnam '26.07.2004'.

read table it_cabn with key atnam = 'SENTDATE'.

perform update_table using it_cabn-atfor it_cabn-atnam '26.07.2004'.

read table it_cabn with key atnam = 'FLOC'.

perform update_table using it_cabn-atfor it_cabn-atnam '0750'.

read table it_cabn with key atnam = 'AUTOCLAVE'.

perform update_table using it_cabn-atfor it_cabn-atnam '4'.

read table it_cabn with key atnam = 'REPAIRCODE'.

perform update_table using it_cabn-atfor it_cabn-atnam 'MINOR'.

  • perform the update

perform bapi_change.

endform.

----


  • FORM update_table *

----


form update_table using atfor atnam value.

  • depending on data format, start building the characteristics table

  • ready for update

case atfor.

when 'NUM'.

read table numtab with key charact = atnam.

if syst-subrc = 0.

numtab-value_from = value.

modify numtab index syst-tabix.

else.

numtab-charact = atnam.

numtab-value_from = value.

append numtab.

endif.

when 'CURR'.

when 'CHAR' or 'DATE'.

read table chatab with key charact = atnam.

if syst-subrc = 0.

chatab-value_neutral = value.

modify chatab index syst-tabix.

else.

chatab-charact = atnam.

chatab-value_neutral = value.

append chatab.

endif.

endcase.

endform.

----


  • FORM bapi_change *

----


form bapi_change.

  • Apply the characteristics to the batch.

call function 'BAPI_OBJCL_CHANGE'

exporting

objectkey = w_object

objecttable = 'MCHA'

classnum = p_class

classtype = p_klart

tables

allocvaluesnumnew = numtab

allocvaluescharnew = chatab

allocvaluescurrnew = curtab

return = rettab.

endform.

----


  • FORM bapi_commit *

----


form bapi_commit.

  • commit the changes

call function 'BAPI_TRANSACTION_COMMIT'.

endform.

Hope this will solve your problem.

Thanks

Kathirvel