Code: Alles auswählen.
/*
* Erstellt am 03.09.2006
*
*/
public class Characteristic
{
public static void changeCharacteristic(SAPConnection sapConnection,String material,String characteristName,String characteristicNewValue)
{
try
{
Bapi_material_maintaindata_rt mt=new Bapi_material_maintaindata_rt(sapConnection);
// Kopfdaten setzen
Bapie1mathead head=new Bapie1mathead();
head.setMaterial(material);
head.setBasic_view("X");
head.setList_view("X");
Bapie1ausprtTable charTable=new Bapie1ausprtTable();
Bapie1ausprtTable.Row row=charTable.createRow();
row.setMaterial(material);
row.setChar_name(characteristName);
row.setChar_value(characteristicNewValue);
charTable.add(row);
mt.setCharacteristicvalue(charTable);
Bapie1ausprtxTable charxTable=new Bapie1ausprtxTable();
Bapie1ausprtxTable.Row rowx=charxTable.createRow();
rowx.setMaterial(material);
rowx.setChar_name("X");
rowx.setChar_value("X");
// Merkmalname:
System.out.println("Merkmalname: " + rowx.getChar_name());
charxTable.add(rowx);
mt.setCharacteristicvaluex(charxTable);
mt.setHeaddata(head);
mt.execute();
//System.out.println(mt);
Bapireturn1 ret=mt.getReturn();
System.out.println("RETURN:\n"+ret);;
Bapi_transaction_commit commit=new Bapi_transaction_commit(sapConnection);
commit.execute();
}
catch (Exception e)
{
throw new IllegalArgumentException("Fehler beim Ändern des Merkmals "+characteristName+" zum Material "+material,e);
}
}
/**
* @param args
*/
public static void main(String[] args) throws Exception
{
SAPConnection sapConnection=null;
try
{
sapConnection=new SAPConnection(Client.T01_100);
// ALL_ATE = "gelistet im Webshop" "ja"
changeCharacteristic(sapConnection,"1021DS","ALL_ATE","nein");
//changeCharacteristic(sapConnection,"1021CB","gelistet im Webshop","nein");
}
catch (Exception e)
{
System.out.println(JavaLangUtil.getInfo(e));
}
finally
{
if (sapConnection != null)
{
sapConnection.close();
}
}
}
}