How can I initialize SalesTable

I have declared my table i.e. Sales Table with buffer variable as salesTable. I want to initialize this table. please suggest how can I do that. This may be a simple task but I do not know. please help.

What exactly do you mean by “to initialize”. Do you mean that you don’t know how you assign values to fields? If so, it’s simple - here is an example:

salesTable.ItemId = "ItemA";

Also note that tables often have method for field initialization from other tables, such as SalesTable.initFromCustTable().

And some detault values may be set in initValue().

Please be more specific next time.

what is meant by initialization of a table? Do we have to initialize a table in order to assign its field values to some other table ?

I want to assign values to CreditCardAuthTrans table from different tables. Someone told me I needed to first declare as well as initialize salestable if I wanted to used it to assign value to CreditCardAuthTrans table. Is that true ?

No, it’s not the case. When you declare a table buffer, you can immediately use it, it just have default values (e.g. empty strings and zeros) in all fields.

For example:

MyTable myTable; // Declaration, no extra initialization

myTable.MyField = 'xyz'; // Set a field value

// Validating a record isn't technically necessary, but you should do it
// to ensure data consistency
if (myTable.validateWrite()) 
    // Here we insert a record to DB.
    // If we wanted to update a record, we would have to read it from database
    // instead of just creating an empty buffer.