importing-Route card journal

static void sri(Args _args)
{
    SysExcelApplication             application;
    SysExcelWorkbooks               workbooks;
    SysExcelWorkbook                workbook;
    SysExcelWorksheets              worksheets;
    SysExcelWorksheet               worksheet;
    SysExcelCells                   cells;
    COMVariantType                  type;
    System.DateTime                 ShlefDate;
    FilenameOpen                    filename;
    dialogField                     dialogFilename;
    Dialog                          dialog;
    int                             row;
    int                             lines;
    str                             jourID;

    //Table Declarations Starts
    ProdJournalRoute              PJR;
    ProdJournalTable              PJTab, table;
    //Table Declartions Ends
    ;
    dialog          =   new Dialog("Upload excel file");
    dialogFilename  =   dialog.addField(typeId(FilenameOpen));
    dialog.filenameLookupTitle("Upload from Excel");
    dialog.caption("Excel upload");
    dialogFilename.value(filename);
    if(!dialog.run())
        return;
    filename    =   dialogFilename.value();
    info(filename);
    application =   SysExcelApplication::construct();
    workbooks   =   application.workbooks();

    try{
     workbooks.open(filename);
    }
    catch(Exception::Error){
     throw error("Cannot open the file. Check if file exists in location ");
    }
    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
    row = 1;
    ttsbegin;
    // create a journal header
    //journalType = Routecard
    PJTab.JournalType =ProdJournalType::RouteCard ;
    //get name ID for header
    PJTab.ProdId=cells.item(2,1).value().bStr();
    //PJTab.JournalNameId = ProdJournalName::standardJournalName(ProdJournalType::RouteCard,PJTab.ProdId);
    //PJTab.JournalNameId = ProdParametersDim::findDefault().RouteJournalNameId;
    PJTab.Description =ProdJournalName::find(PJTab.JournalNameId).Description;
    PJTab.insert();

    do{
     ttsbegin;
     row++;
     PJR.JournalId = PJTab.JournalId;

     PJR.OprId = cells.item(row,2).value().bStr();
     PJR.TransDate=cells.item(row,3).value().date();
     PJR.OprFinished=cells.item(row,4).value().boolean();
     PJR.QtyError = cells.item(row,5).value().double();
     PJR.QtyGood = cells.item(row,6).value().double();
     PJR.EmplId= cells.item(row,7).value().bStr();

    //Initialize lineNum to '0' else inventJournalTrans.insert() method wouldn't create a new lineNum for each insertion
    PJR.LineNum=0;
    //parameter for insert method
    PJR.insert();
    //update type variable to next row in file
    type= cells.item(row+1,1).value().variantType();
    ttscommit;
    }
    while(type != COMVariantType::VT_EMPTY);
    select count(recid) from PJR where PJR.JournalId == PJTab.JournalId;
    lines = PJR.RecId;
    select forupdate table where table.JournalId == PJTab.JournalId;
    table.NumOfLines=lines;
    table.update();
    application.quit();
    ttscommit;
}

I tried this coding, but the result came is like

pastedimage1511934428437v1.png

but i want the prd id 174 as a new journal with 2 lines as oprnum 10 and 20 and a new journals for other prodid’s…