Target object not in edit mode

Discussion in 'Requests' started by murtuza shakir, May 13, 2019.

         

  1. Dear Experts

    i am trying to call a function to update print details , it give an error that target object is not in edit mode

    kindly help me on how to get the target object in edit mode
    Code:
    [#Report: Voucher]
        On     : After Print    : not $$InPreviewMode    :Call    : PRINTUP2
    [Function:printup2]   
        090 :    INSERT COLLECTION OBJECT     : AggPrintUDF
        100 :     Walk                         : AggPrintUDF
        110 :     Set Target                     : AggPrintUDF
        130 :     Set Value                     : RTuserPrintdetail    :  $$String:$$CmpUserName + " On " +$$String:$$MachineDate + " @ " +$$String:$$Machinetime
        140 :     SET TARGET                     : ..
        160 :     END Walk
    
     


  2. Amit Kamdar

    Amit Kamdar Moderator Staff Member


    On : After Print : YES :Call : PRINTUP2
     



  3. Amit Sir

    thank you for quick reply , but still it gives the same error that target is not in the edit mode

    regards
     


  4. Amit Kamdar

    Amit Kamdar Moderator Staff Member


    On : After Print ......... should be used in a LINE level...........
     



  5. Sir

    i dint understand "should be used at line level"

    the purpose is to update and record by who n when the voucher was printed

    so how can we associate it at the line level

    kindly elaborate

    regards
     


  6. Amit Kamdar

    Amit Kamdar Moderator Staff Member


    Kindly search "On : After Print" in TDE and try to understand that.

    You are putting it in report....which is beginning of a TDL and coupled with the error message "Not in Editmode"..... logically means at the report level there is no data updation either in createmode or altermode/editmode.........hence the error.

    So logically, the function should be called after all the data entry fields are exhausted/finished.........i.e look for the end of the voucher TDL.... somewhere there would be ..... On :Form Accept : Call : Save or update..............your function should come after that.
     



  7. dear Ami
    Dear Amit Sir

    I tried to run a another function which works fine , this is just a UDF update after print of the voucher
    Code:
    [#Report: Voucher]
        On     : After Print    : not $$InPreviewMode    :Call    : UpdateTimes
    [Function: UpdateTimes]
        Variable           : VchMasterID : String
           
        10 :     Set            : VchMasterID : $$SPrintF:@@VCHMasterID:$MasterID
        20 :     New Object     : Voucher : ##VchMasterID
        30 :     SET VALUE      : RTnoofprint : $RTnoofprint + 1
        42 :     Save Target
    but if i try to update an aggregate udf with the following code it doesn't & gives the error , "target not in edit mode"
    Code:
    [Function:printup2]   
        090 :    INSERT COLLECTION OBJECT     : AggPrintUDF
        100 :     Walk                         : AggPrintUDF
        110 :     Set Target                     : AggPrintUDF
        130 :     Set Value                     : RTuserPrintdetail    :  $$String:$$CmpUserName + " On " +$$String:$$MachineDate + " @ " +$$String:$$Machinetime
        140 :     SET TARGET                     : ..
        160 :     END Walk
    [#Report: Voucher]
        On     : After Print    : not $$InPreviewMode    :Call    : PRINTUP2
     


  8. sattam

    sattam Member


    Try This

    [Function:printup2]

    Variable : VchMasterID : String

    10 : Set : VchMasterID : $$SPrintF:mad:@VCHMasterID:$MasterID
    20 : New Object : Voucher : ##VchMasterID

    090 : INSERT COLLECTION OBJECT : AggPrintUDF
    ;100 : Walk : AggPrintUDF
    110 : Set Target : AggPrintUDF
    130 : Set Value : RTuserPrintdetail : $$String:$$CmpUserName + " On " +$$String:$$MachineDate + " @ " +$$String:$$Machinetime
    140 : SET TARGET : ..
    150 : ACCEPT ALTER
    ;160 : END Walk
    110 : Return
    [#Report: Voucher]
    On : After Print : YES :Call : PRINTUP2
     



  9. thnk you for your reply sattan tried your way

    it dint give an error but at the same time did not update the udf
     


  10. Amit Kamdar

    Amit Kamdar Moderator Staff Member


    Sorry Buddy...functions are my weak point....so am sorry cannot guide you with problems within the function.
     


Share This Page