I got solution for the problem. By adding an else clause, surprisingly it works.
Global StringVar VarINAME:="";
if not(ISNULL({invoice01.INAME})) then VarINAME := {invoice01.INAME}
else VarINAME := "";
if not (ISNULL({invoice01.BATCHNO})) then
(
if {invoice01.BATCHNO} <> "" then
VarINAME := VarINAME + ' Batch:' + {invoice01.BATCHNO}
else VarINAME := VarINAME + "";
)
else VarINAME := VarINAME + "";
if not (ISNULL({invoice01.EXPDATE})) then
(
if year({invoice01.EXPDATE})>1970 then
VarINAME := VarINAME + ' Exp:' + totext({invoice01.EXPDATE},"MMM yy")
else VarINAME := VarINAME + "";
)
else VarINAME := VarINAME + "";