Unable to fetch Data from FORM for a CLASS Method.

Hello Guys,

This is my 1st post on the community … i am noob no plz dont mind … for my stupid question.

I am making a function on a ListPage form so that when i select a record and click on a button JV is to pass and posted …

I have the code it works f9 in Job , but when i wrote that code in class method its not fetching data of my current selected record and passing the GV.

code …

public void run()
{

LedgerJournalTable jourTable;
LedgerJournalTrans jourTrans;
LedgerJournalTableData jourTableData;
CourierManagementJournalVoucher jourTransData;
LedgerJournalStatic jourStatic;
DimensionDynamicAccount ledgerDim;
DimensionDynamicAccount offsetLedgerDim;
ttsBegin;
ledgerDim = DimensionStorage::getDynamicAccount(courierinvoicetable.VendorId, LedgerJournalACType::Vend);
offsetLedgerDim = DimensionStorage::getDynamicAccount(
‘USA OPER’,
LedgerJournalACType::Bank);
jourTableData = JournalTableData::newTable(jourTable);
jourTable.JournalNum = jourTableData.nextJournalId();
jourTable.JournalType = LedgerJournalType::Payment;
jourTable.JournalName = ‘APPay’;
jourTableData.initFromJournalName(
LedgerJournalName::find(jourTable.JournalName));
jourStatic = jourTableData.journalStatic();
jourTransData = jourStatic.newJournalTransData(
jourTrans,
jourTableData);
jourTransData.initFromJournalTable();
jourTrans.CurrencyCode = ‘USD’;
jourTrans.initValue();
jourTrans.TransDate = systemDateGet();
jourTrans.AccountType = LedgerJournalACType::Vend;
jourTrans.LedgerDimension = ledgerDim;
jourTrans.Txt = ‘Vendor payment journal demo’;
jourTrans.OffsetAccountType = LedgerJournalACType::Bank;
jourTrans.OffsetLedgerDimension = offsetLedgerDim;
jourTrans.AmountCurDebit = courierrequestline.Amount; ----- this is field of that form … which i want to put in JV
jourTransData.create();
jourTable.insert();
ttsCommit;
info(strFmt(
“Journal ‘%1’ has been created”, jourTable.JournalNum));
}

plz help me out …

Mohit