
Example: Customer-Specific Input Help for Currencies
You want to replace the standard Input Help for currencies with a customer-specific Input Help by hiding a column.
To do this, proceed as follows:
Java Source Code
package com.sap.expense.customer.examples;
import com.sap.expense.tools.DBHelper;
import com.sap.mycats.basics.tools.badi.*;
import com.sap.mycats.basics.customer.userInterface.IPicklistCustomer;
/** The following record must be defined in the customer file
* C:\me\wwwroot\te_customer\extensions\ci_records.xml
* <record name="ZPICKLIST_CURRENCY">
* <fields>
* <field name="F_CURRENCY" type="E_F_CURRENCY"/>
* <field name="CURRTXT" type="E_CURRTXT"/>
* <field name="RATE" type="E_RATE"/>
* </fields>
* </record>
*/
public class ZPicklistCurrency implements IPicklistCustomer {
public final static String CURRENCY = "F_CURRENCY";
public final static String ZPICKLIST_CURRENCY = "ZPICKLIST_CURRENCY";
public ITableReadWrite getPicklistValues (char anApplication,IRecordReadOnly aRecord) {
ITableReadWrite picklistCurr;
try {
ITableReadOnly sapPicklistTable = new DBHelper().select("TRAVEL_CURRENCIES");
IRecordReadOnly sapPicklistRecord
= new RecordFactory().createRecord("PICKLIST_CURRENCY");
IRecordReadWrite zRecord
= new RecordFactory().createRecord(ZPICKLIST_CURRENCY);
ITableReadWrite zTable
= new TableFactory().createTable(ZPICKLIST_CURRENCY);
int count = sapPicklistTable.getRowCount();
for (int i = 0; i < count; i++) {
sapPicklistRecord = sapPicklistTable.getRecordReadOnly(i);
zRecord.setCorrespondingFields(sapPicklistRecord);
zTable.appendRecord(zRecord);
}
picklistCurr = zTable;
} catch (Exception e) {
e.printStackTrace();
picklistCurr = null;
}
return picklistCurr;
}
public String getCoulumnId () {
return CURRENCY;
}
public String getColumnTitle () {
return null;
}
}