I have written a .p that copies the notes from ITEM to POITEM, for the particular line you have just added.
User creates New PO, New PO line. Hits my accelerator key, and my program copies in the lines.
This works great.
My problem is that Cur-po-line is ALWAYS a 1. Even if I start a new session, go directly to line 5, and run, it will still be line 1..
How do I get around this??
I am posting my code hoping that will help:
Thank you.. Skylar
DEF SHARED VAR cur-po-num LIKE symix.poitem.po-num.
DEF SHARED VAR cur-po-line LIKE symix.poitem.po-line.
DEF SHARED VAR cur-po-rel LIKE symix.poitem.po-rel.
DEFINE VARIABLE n-count AS INTEGER NO-UNDO.
DEFINE VARIABLE p-count AS INTEGER NO-UNDO.
DEFINE VARIABLE counter AS INTEGER NO-UNDO.
DEF BUFFER x-notes FOR symix.notes.
ASSIGN
n-count = 0.
p-count = 0.
FIND symix.poitem WHERE poitem.po-num = cur-po-num AND poitem.po-line = cur-po-line.
FIND symix.ITEM WHERE symix.ITEM.ITEM = symix.poitem.ITEM.
FOR EACH symix.notes NO-LOCK WHERE symix.notes.KEY = symix.ITEM.KEY:
n-count = n-count + 1.
END.
FOR EACH symix.notes NO-LOCK WHERE symix.notes.KEY = symix.poitem.KEY:
p-count = p-count + 1.
END.
IF p-count >= 3 THEN DO:
message "Notes already exist" view-as alert-box.
DISPLAY symix.poitem.KEY.
RETURN.
END.
FOR EACH symix.notes NO-LOCK WHERE symix.notes.KEY = symix.ITEM.KEY:
IF notes.seq = 1 THEN
NEXT.
ELSE DO:
CREATE x-notes.
ASSIGN
x-notes.key = symix.poitem.KEY
x-notes.seq = symix.notes.seq
x-notes.new-paragraph = symix.notes.new-paragraph
x-notes.txt = symix.notes.txt
.
END.
END.
message "Notes copied" view-as alert-box.
DISPLAY symix.poitem.KEY n-count p-count.
User creates New PO, New PO line. Hits my accelerator key, and my program copies in the lines.
This works great.
My problem is that Cur-po-line is ALWAYS a 1. Even if I start a new session, go directly to line 5, and run, it will still be line 1..
How do I get around this??
I am posting my code hoping that will help:
Thank you.. Skylar
DEF SHARED VAR cur-po-num LIKE symix.poitem.po-num.
DEF SHARED VAR cur-po-line LIKE symix.poitem.po-line.
DEF SHARED VAR cur-po-rel LIKE symix.poitem.po-rel.
DEFINE VARIABLE n-count AS INTEGER NO-UNDO.
DEFINE VARIABLE p-count AS INTEGER NO-UNDO.
DEFINE VARIABLE counter AS INTEGER NO-UNDO.
DEF BUFFER x-notes FOR symix.notes.
ASSIGN
n-count = 0.
p-count = 0.
FIND symix.poitem WHERE poitem.po-num = cur-po-num AND poitem.po-line = cur-po-line.
FIND symix.ITEM WHERE symix.ITEM.ITEM = symix.poitem.ITEM.
FOR EACH symix.notes NO-LOCK WHERE symix.notes.KEY = symix.ITEM.KEY:
n-count = n-count + 1.
END.
FOR EACH symix.notes NO-LOCK WHERE symix.notes.KEY = symix.poitem.KEY:
p-count = p-count + 1.
END.
IF p-count >= 3 THEN DO:
message "Notes already exist" view-as alert-box.
DISPLAY symix.poitem.KEY.
RETURN.
END.
FOR EACH symix.notes NO-LOCK WHERE symix.notes.KEY = symix.ITEM.KEY:
IF notes.seq = 1 THEN
NEXT.
ELSE DO:
CREATE x-notes.
ASSIGN
x-notes.key = symix.poitem.KEY
x-notes.seq = symix.notes.seq
x-notes.new-paragraph = symix.notes.new-paragraph
x-notes.txt = symix.notes.txt
.
END.
END.
message "Notes copied" view-as alert-box.
DISPLAY symix.poitem.KEY n-count p-count.