domain comparision

Namasiva

Member
Hi I have developed a program.This program should display the accumulated stock (in_qty_oh) by item number (in_part) by domain (in_domain)
For instance when i have an item located in domain 004 site ITIDD and 5001 then the stock for this domain must be calculated together.
When I run my created script then it shows the accumulated stock but it does not make a break per domain.
I need this because if pt_status inside domain 001 = XX and the stock inside domain 002 to 004 is 0. then the item status of the pt_part must also be XX.
thus i need the report wich shows the item number, + total stock per domain.
so that i can compare with domain 001.

Can any one help me how the code shoud be?..
 

rohitbhoir

New Member
your required code might be something like this:

FOR EACH in_mstr WHERE <<selection criteria>>
BREAK BY in_domain
BY in_site
BY in_part:
IF FIRST-OF(in_domain) THEN
DISPLAY in_domain in_site.
DISPLAY in_part in_qty_oh.

ACCUMULATE in_qty_oh(TOTAL BY in_domain).

IF LAST-OF(in_domain) THEN
DO:
DOWN 2.
DISPLAY "Domain Total ------->" @ in_qty_oh
ACCUM TOTAL BY in_domain in_qty_oh @ in_qty_oh.
progress.gif
DOWN 1.
END.

Do the necessary changes as required.
 

rohitbhoir

New Member
oops:(
replace DISPLAY "Domain Total ------->" @ in_qty_oh
by DISPLAY "Domain Total ------->" @ in_domain.
also add an end.
 

Namasiva

Member
Hi,

Thanks for the update but i can't the same in my below code could you able to help me?. :eek:



{mfdtitle.i "2498636"}
def var totqtyoh as int.
def temp-table t1_ptmstr no-undo
field t1_part like pt_part
field t1_ptstatus like pt_status /*status*/
field t1_ptmoddate like pt_mod_date
field t1_ptdomain like pt_domain.
def temp-table t2_inmstr no-undo
field t2_part like in_part
field t2_qtyoh like in_qty_oh
field t2_domain like in_domain.
for each t1_ptmstr:
delete t1_ptmstr.
end.
for each t2_inmstr :
delete t2_inmstr.
end.

/* SELECT FORM */
form "synchronize item status if pt_status in domain 001 = XX"
" and stock in 002 - 004 = 0 then pt_status in domain 002 - 004 XX."
with frame a width 80 side-labels.
assign bcdparm = "".
{mfselbpr.i printer 80}
{mfphead2.i}
for each pt_mstr where pt_domain = "001"
and pt_status = "XX"
and pt_mod_date > today - 10
no-lock:
if pt_domain = "001" THEN
find first t1_ptmstr where
t1_ptdomain = pt_domain
and t1_part = pt_part and
t1_ptstatus = pt_status NO-ERROR.
if not available t1_ptmstr then DO :
create t1_ptmstr.
assign t1_part = pt_part
t1_ptstatus = pt_status
t1_ptdomain = pt_domain
t1_ptmoddate = pt_mod_date.
end.
Message "I am Here ".
/* end.*/
ASSIGN totqtyoh = 0.
for each in_mstr where in_domain < "005"
and in_domain > "001" and t1_part = in_part no-lock
BREAK BY in_domain BY in_part :
if first-of (in_part) then do:
ACCUMULATE in_part (COUNT).
end.
ACCUMULATE in_qty_oh (TOTAL BY in_part).
if last-of (in_part) then do:

find first t2_inmstr where t2_part = t1_part
NO-ERROR.
if not available t2_inmstr then DO:
create t2_inmstr.
assign t2_part = in_part
t2_qtyoh = ACCUM TOTAL BY in_part in_qty_oh.
t2_domain = in_domain.
Message in_qty_oh in_part.
END.
end.
end.
end.

for each t2_inmstr no-lock:
for each t1_ptmstr no-lock.
for each pt_mstr where pt_status <> t1_ptstatus
and pt_part = t1_part
and pt_domain = t2_domain no-lock:
if available t2_inmstr and
t2_part = t1_part
THEN
DISP pt_part LABEL "Part" format "x(18)"
t1_ptstatus LABEL "sstatus" format "x(8)"
"001" LABEL "sdomain" format "x(4)"
pt_domain LABEL "tDom" format "x(4)"
pt_status LABEL "tPart" format "x(18)"
t2_qtyoh LABEL "tqtyoh"
t1_ptmoddate.

/* else display t1_ptpart . */
end.


END.
end.

{mftrl080.i}
 

rohitbhoir

New Member
First you are doing a find first on empty temp tables after which you put the entire contents of pt_mstr and in_mstr and later you put a not equal to condition between the temp tables and pt_mstr and in_mstr where no records will be found since the temp tables will have all records of pt_mstr and in_mstr.
 
Top