Hi,
I have created a program that should out put a flat file in a folder.
but while running the code i am getting the following error :
Report is now running. Press Ctrl-C to cancel
** Unable to open file: /extdata/desktop/dtlive/Board/Sales_details.txt.
Press space bar to continue.
How could i resolve this issue?
Pls find below the codes.
/* added for desktop version */
{mfdtitle.i "2+ "}
/* end desktop add */
define variable st-dt as DATE LABEL "Start date".
define variable end-dt as date LABEL "End date".
DEFINE VARIABLE outfile AS CHARACTER NO-UNDO.
def stream x.
def stream y.
def temp-table t1_hist no-undo
field t1_ship like ih_ship
field t1_name like ad_name
field t1_cust like ih_cust
field t1_name1 like ad_name
field t1_date as dat
field t1_part like idh_part
field t1_desc1 like pt_desc1
field t1_desc2 like pt_desc2
field t1_pl like pt_prod_line
field t1_qty as decimal format "->>>>>>9.99"
field t1_um like pt_um
field t1_price like idh_price
field t1_amt as decimal format "->>>>>>9.99"
field t1_cost as decimal format "->>>>>>9.99"
field t1_margin as decimal format "->>>>>>9.99"
index t1_part is primary unique t1_cust
t1_part
t1_date.
assign outfile = "" .
FORM
st-dt colon 19
end-dt colon 19
WITH FRAME a SIDE-LABELS WIDTH 80 ATTR-SPACE.
/* added for desktop version */
setframelabels(FRAME a:HANDLE).
{wbrp01.i}
repeat :
IF c-application-mode <> 'web' THEN
UPDATE st-dt end-dt WITH FRAME a.
{gpselout.i &printType = "printer"
&printWidth = 352
&pagedFlag = " "
&stream = " "
&appendToFile = " "
&streamedOutdisplayToTerminal = " "
&withBatchOption = "yes"
&displayStatementType = 1
&withCancelMessage = "yes"
&pageBottomMargin = 4
&withEmail = "yes"
&withWinprint = "yes"
&defineVariables = "yes"}
{mfrpchk.i}
/* end desktop add */
outfile = "/extdata/desktop/dtlive/Board/Sales_details.txt".
output stream x to value( outfile).
for each t1_hist :
delete t1_hist.
end.
for each ih_hist where
ih_inv_date >= st-dt and ih_inv_date <= end-dt no-lock,
each idh_hist where idh_inv_nbr = ih_inv_nbr
and idh_nbr = ih_nbr
and idh_site = ih_site
and idh_qty_inv <> 0 no-lock,
first cm_mstr where
cm_addr = ih_bill and cm_addr = ih_ship no-lock,
first ad_mstr where
ad_addr = ih_cust no-lock,
first pt_mstr where pt_part = idh_part no-lock,
first ar_mstr where ar_nbr = ih_inv_nbr no-lock:
find first t1_hist where t1_part = idh_part
and t1_cust = ih_cust
and t1_pl = pt_prod_line
and t1_date = ih_inv_date no-error.
if not available t1_hist then do:
create t1_hist.
assign
t1_date = ih_inv_date
t1_ship = ih_ship
t1_name = ad_name
t1_cust = ih_cust
t1_name1 = ad_name
t1_part = idh_part
t1_um = pt_um
t1_desc1 = pt_desc1
t1_desc2 = pt_desc2
t1_pl = pt_prod_line
t1_qty = idh_qty_inv
t1_amt = idh_qty_inv * idh_price
t1_cost = idh_qty_inv * idh_std_cost
t1_margin = t1_amt - t1_cost.
end.
end.
for each t1_hist by t1_date
by t1_cust
by t1_part
by t1_pl :
put stream x unformatted
string(t1_cust ) AT 1
string(t1_name1 ) AT 11
string(t1_ship ) AT 42
string(t1_name ) AT 51
string(t1_part ) AT 80
string(t1_um ) AT 102
string(t1_desc1) AT 105
string(t1_desc2 ) AT 130
string(t1_pl ) AT 156
string(year(t1_date),"9999") + " " + string(month(t1_date),"99") + " " + string(day(t1_date),"99") AT 162
string (t1_qty) AT 175
string (t1_amt) AT 182
string (t1_margin) AT 195
skip.
end. /* end of t1_hist */
{mfrtrail.i}
end.
output stream x close.
Message "The Sales Details sent to Board" VIEW-AS ALERT-BOX.
{wbrp04.i &frame-spec = a}
/* end of desktop . */
Its most urgent so kindly give me solution.
I have created a program that should out put a flat file in a folder.
but while running the code i am getting the following error :
Report is now running. Press Ctrl-C to cancel
** Unable to open file: /extdata/desktop/dtlive/Board/Sales_details.txt.
Press space bar to continue.
How could i resolve this issue?
Pls find below the codes.
/* added for desktop version */
{mfdtitle.i "2+ "}
/* end desktop add */
define variable st-dt as DATE LABEL "Start date".
define variable end-dt as date LABEL "End date".
DEFINE VARIABLE outfile AS CHARACTER NO-UNDO.
def stream x.
def stream y.
def temp-table t1_hist no-undo
field t1_ship like ih_ship
field t1_name like ad_name
field t1_cust like ih_cust
field t1_name1 like ad_name
field t1_date as dat
field t1_part like idh_part
field t1_desc1 like pt_desc1
field t1_desc2 like pt_desc2
field t1_pl like pt_prod_line
field t1_qty as decimal format "->>>>>>9.99"
field t1_um like pt_um
field t1_price like idh_price
field t1_amt as decimal format "->>>>>>9.99"
field t1_cost as decimal format "->>>>>>9.99"
field t1_margin as decimal format "->>>>>>9.99"
index t1_part is primary unique t1_cust
t1_part
t1_date.
assign outfile = "" .
FORM
st-dt colon 19
end-dt colon 19
WITH FRAME a SIDE-LABELS WIDTH 80 ATTR-SPACE.
/* added for desktop version */
setframelabels(FRAME a:HANDLE).
{wbrp01.i}
repeat :
IF c-application-mode <> 'web' THEN
UPDATE st-dt end-dt WITH FRAME a.
{gpselout.i &printType = "printer"
&printWidth = 352
&pagedFlag = " "
&stream = " "
&appendToFile = " "
&streamedOutdisplayToTerminal = " "
&withBatchOption = "yes"
&displayStatementType = 1
&withCancelMessage = "yes"
&pageBottomMargin = 4
&withEmail = "yes"
&withWinprint = "yes"
&defineVariables = "yes"}
{mfrpchk.i}
/* end desktop add */
outfile = "/extdata/desktop/dtlive/Board/Sales_details.txt".
output stream x to value( outfile).
for each t1_hist :
delete t1_hist.
end.
for each ih_hist where
ih_inv_date >= st-dt and ih_inv_date <= end-dt no-lock,
each idh_hist where idh_inv_nbr = ih_inv_nbr
and idh_nbr = ih_nbr
and idh_site = ih_site
and idh_qty_inv <> 0 no-lock,
first cm_mstr where
cm_addr = ih_bill and cm_addr = ih_ship no-lock,
first ad_mstr where
ad_addr = ih_cust no-lock,
first pt_mstr where pt_part = idh_part no-lock,
first ar_mstr where ar_nbr = ih_inv_nbr no-lock:
find first t1_hist where t1_part = idh_part
and t1_cust = ih_cust
and t1_pl = pt_prod_line
and t1_date = ih_inv_date no-error.
if not available t1_hist then do:
create t1_hist.
assign
t1_date = ih_inv_date
t1_ship = ih_ship
t1_name = ad_name
t1_cust = ih_cust
t1_name1 = ad_name
t1_part = idh_part
t1_um = pt_um
t1_desc1 = pt_desc1
t1_desc2 = pt_desc2
t1_pl = pt_prod_line
t1_qty = idh_qty_inv
t1_amt = idh_qty_inv * idh_price
t1_cost = idh_qty_inv * idh_std_cost
t1_margin = t1_amt - t1_cost.
end.
end.
for each t1_hist by t1_date
by t1_cust
by t1_part
by t1_pl :
put stream x unformatted
string(t1_cust ) AT 1
string(t1_name1 ) AT 11
string(t1_ship ) AT 42
string(t1_name ) AT 51
string(t1_part ) AT 80
string(t1_um ) AT 102
string(t1_desc1) AT 105
string(t1_desc2 ) AT 130
string(t1_pl ) AT 156
string(year(t1_date),"9999") + " " + string(month(t1_date),"99") + " " + string(day(t1_date),"99") AT 162
string (t1_qty) AT 175
string (t1_amt) AT 182
string (t1_margin) AT 195
skip.
end. /* end of t1_hist */
{mfrtrail.i}
end.
output stream x close.
Message "The Sales Details sent to Board" VIEW-AS ALERT-BOX.
{wbrp04.i &frame-spec = a}
/* end of desktop . */
Its most urgent so kindly give me solution.