gen Journal by code

hi all ,

i am using

AxLedgerJournalTable journalTable;
AxLedgerJournalTrans journalTrans;

classes to create a genral journal

i am not able to get multiple journal lines

&&

i am not able to pass bank account id to offset account

i have my code below:

NumberSeq _numberSeq;
int i;

AxLedgerJournalTable journalTable;
AxLedgerJournalTrans journalTrans;
CEMPayrollPaymentProcessLine paymentProcessLine;
;

journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();

_numberSeq = NumberSeq::newGetVoucherFromId(LedgerJournalName::find(CEMPayRollNBKParameters::find().PaymentProcessJournalName).NumberSequenceTable);

//journalTrans.parmVoucher(_numberSeq.voucher());
//Journal Name
journalTable.parmJournalName(CEMPayRollNBKParameters::find().PaymentProcessJournalName);
journalTable.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTable.save();

for(paymentProcessLine = CEMPayrollPaymentProcessLine_ds.getFirst(); paymentProcessLine; paymentProcessLine = CEMPayrollPaymentProcessLine_ds.getNext())
{

journalTrans.parmJournalNum(journalTable.parmJournalNum());
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmAccountType(LedgerJournalACType::Ledger);
journalTrans.parmVoucher(_numberSeq.voucher());
journalTrans.parmCurrencyCode(CompanyInfo::standardCurrency());
journalTrans.parmExchRate(Currency::exchRate(journalTrans.parmCurrencyCode()));

//LedgerDimension => Ledgeraccount, DAX 2009
accEntryPattern = element.getAccountEntryPttern(paymentProcessLine.Worker,paymentProcessLine.PaymentProcessId);

//accEntryPattern = [“601501”, “601501”, 0];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(accEntryPattern));

journalTrans.parmAmountCurDebit(paymentProcessLine.NetPayable);
journalTrans.parmTxt(strFmt("%1 Payment Journal for %2",(CEMPayrollPaymentProcessMaster::findByProcessId(paymentProcessLine.PaymentProcessId).ProcessName),paymentProcessLine.EmployeeName));
//OffsetLedgerDimension => OffsetLedgerAccount, DAX 2009
//offSetEntryPattern = element.getoffSetAccountEntryPttern();
journalTrans.parmOffsetAccountType(LedgerJournalACType::Bank);
//offSetEntryPattern = [“110120”,“110120”,0];
journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::(CEMPayrollPaymentProcessingTable.AccountID));
//journaltrans.parmBankAccountId(CEMPayrollPaymentProcessingTable.AccountID);

journalTrans.save();
}

info(strFmt(“Journal %1 created”, journalTable.ledgerJournalTable().JournalNum));
}

some body pls help

regards

karna