Options

What is wrong with the code

Markandey_PandeyMarkandey_Pandey Member Posts: 178
Hi all,

I want to insert the Parent Item No. of the first Item (fisrt line item) to Transfer Header when the Transfer Order is released. So i have written the following code under OnPush trigger of the Release button. but its not working, what is wrong with the code.

Globals
TransferHeader->Record->Transfer Header
TransferLine->Record->Transfer Line
BomCom->Record-> BOM Component

FG Item No. -> A field i have created in the Transfer Header Table.

TransferHeader.RESET;
TransferHeader.SETRANGE(TransferHeader."No.","No.");
IF TransferHeader.FINDFIRST THEN
TransferLine.RESET;
TransferLine.SETRANGE(TransferLine."Document No.","No.");
IF TransferLine.FINDFIRST THEN
BEGIN
BomComp.RESET;
BomComp.SETRANGE(BomComp."No.",TransferLine."Item No.");
TransferHeader."FG Item No.":=BomComp."Parent Item No.";
TransferHeader.MODIFY;
END;
Markandey Pandey

Comments

  • Options
    danlindstromdanlindstrom Member Posts: 130
    Missing a FIND between the lines
    BomComp.SETRANGE(BomComp."No.",TransferLine."Item No.");
    IF BomComp.FINDFIRST THEN BEGIN           <----------------------------------
    TransferHeader."FG Item No.":=BomComp."Parent Item No.";
    TransferHeader.MODIFY;
    END;
    END;
    
    Regards
    Dan Lindström
    NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
    MBSP Developer for Microsoft Dynamics NAV 2009
  • Options
    hemantOnehemantOne Member Posts: 98
    Hi markandey,
    TransferHeader.RESET;
    TransferHeader.SETRANGE(TransferHeader."No.","No.");
    IF TransferHeader.FINDFIRST THEN BEGIN<--------------------check that
    TransferLine.RESET;
    TransferLine.SETRANGE(TransferLine."Document No.","No.");
    IF TransferLine.FINDFIRST THEN
    BEGIN
    BomComp.RESET;
    BomComp.SETRANGE(BomComp."No.",TransferLine."Item No.");
    TransferHeader."FG Item No.":=BomComp."Parent Item No.";
    TransferHeader.MODIFY;
    END;
    

    may be it works.
    Regards,
    Hemant
    They can conquer who believe they can
    .
  • Options
    vijay_gvijay_g Member Posts: 884
    hemantOne wrote:
    may be it works.

    are you technical or functional?
  • Options
    Markandey_PandeyMarkandey_Pandey Member Posts: 178
    its done, thanx
    Markandey Pandey
Sign In or Register to comment.