No series update.

I want a batch job for updating new no series by document no in posted documents.

RCM No series is a field of data type code in table.

i have to update RCM No series.

What is the problem? Do you don’t know how to do it? Is the system giving you an error? …

I have to update that RCM NO series in posted documents.

Detailgsttbl.RESET;
Detailgsttbl.SETRANGE(Detailgsttbl.“Document No.”,“Detailed GST Ledger Entry”.“Document No.”);
IF Detailgsttbl.FINDSET THEN BEGIN
NewrcmNo:=NewrcmNo+1;
IF Detailgsttbl.“RCM No Series”=’’ THEN REPEAT
Detailgsttbl.“RCM No Series”:= FORMAT(NewrcmNo);
Detailgsttbl.MODIFY;
UNTIL Detailgsttbl.NEXT=0;
END;

We don’t have much info. What are the conditions?

  • New RCM No. Series by each document no. in the table
  • RCM No. Series depends on a No. Series to get a new No. (in your example, is simply a counter)

This is an example, if you have a No. Series configured somewhere:

Detailgsttbl.SETRANGE("RCM No Series", '');
WHILE Detailgsttbl.FINDFIRST DO BEGIN
  Detailgsttbl.SETRANGE("Document No.", Detailgsttbl."Document No.");
  Detailgsttbl.MODIFYALL("RCM No Series", NoSeriesMgt.GetNextNo(SetupRCMNoSerie,Detailgsttbl."Posting Date",TRUE);
  Detailgsttbl.SETRANGE("Document No.");
END;

If not, you can use a counter as you do in you example, and increase it for each loop.

I don’t want new no from no series mgt.

I just want to manually update the no to documents that has been already posted.

so I have created the batch job.

I WANT OUTPUT OF RCM NO SEREIS LIKE BELOW SCREEN SHORT

pastedimage1527588364758v2.png

Ok, but why do you SHOUT??? [emoticon:ca08b2c27c2f40e993e89508acf29e0b]

And did you solve your question? You have marked your own reply above here as the verified answer!

Its was by mistake.

Then the problem is not solved, isn’t it?

I don’t know what do you mean when say “I want to output of RCM No. Series like below screenshot”. Do you want to create RCM No. Series like is shown in screenshot? In this case, you have to use a Code var to store initial value (or find the last value used), and use INCSTR to increment its value in each loop.

Please refer screenshort.

Detailgsttbl.RESET;
Detailgsttbl.SETRANGE(Detailgsttbl.“Document No.”,“Detailed GST Ledger Entry”.“Document No.”);
IF Detailgsttbl.FINDSET THEN BEGIN
NewrcmNo:=NewrcmNo+1;
IF Detailgsttbl.“RCM No Series”=’’ THEN REPEAT
Detailgsttbl.“RCM No Series”:= ‘RCM/1819/’+FORMAT(NewrcmNo);
Detailgsttbl.MODIFY;
UNTIL Detailgsttbl.NEXT=0;
END;

issue is for next document instead of 2 no It is jump on 5 no.

Personally I’m getting more confused about what it is that you want, the more you write! [emoticon:4191f5ee34e248a29fa0dbe8d975f74a]

But first please explain me what is the importance of the “No. Series” in this table, and when you talk “No. Series”, do you refer to NAV’s standard No. Series?

Right now you are only updating the NewCrmNO outside your Repeat, so it will assign the same number to all rows in your REPEAT-UNTIL.

Try to change your code to (ps: also updated it so that it follows best practice for readable code):

WITH Detailgsttbl DO BEGIN
    SETRANGE("Document No.","Detailed GST Ledger Entry"."Document No.");
    IF FINDSET THEN REPEAT
        IF "RCM No Series" = '' THEN BEGIN
            NewrcmNo += 1;
            "RCM No Series" := 'RCM/1819/' + FORMAT(NewrcmNo);
            MODIFY;
        END;
    UNTIL NEXT = 0;
END;

But the “RCM No. Series” is related to standard “No. Series”, then it still will not work, as it requires that you also insert the new no. series into the no. series table.

Actually this would be better:

NewrcmNo := 0;
WITH Detailgsttbl DO BEGIN
    SETRANGE("Document No.","Detailed GST Ledger Entry"."Document No.");
    SETRANGE("RCM No. Series",'');
    IF FINDSET THEN REPEAT
        NewrcmNo += 1;
        "RCM No Series" := 'RCM/1819/' + FORMAT(NewrcmNo);
        MODIFY;
    UNTIL NEXT = 0;
END;

You also need to initiate the number. Plus just as well put the check for blank into a filter.

I want same rcm number for same document.

In above screenshot my document no is repeating

for eg- 1 - my doc1 = rcm1

2 - my doc1 = rcm1

3 - my doc1 = rcm1

and if my document is different then Rcm No should be increment by 1

Ahh yes, that will not work. What is the wider context of this code? Where is it called from?

And important, where do you set the value of “Detailed GST Ledger Entry”.“Document No.”?

NewRcmNo := 0;
WITH DetailGST DO BEGIN
    SELECTCURRENTKEY("Document No.");
    SETRANGE("RCM No. Series",'');
    LastDocNo := '';
    IF FINDSET(TRUE,FALSE) THEN REPEAT
        IF LastDocNo <> "Document No." THEN
            NewRcmNo += 1;
        "RCM No Series" := 'RCM/1819/' + FORMAT(NewRcmNo);
        MODIFY;
        LastDocNo := "Document No.";
    UNTIL NEXT = 0;
END;

But you also need to insert the no. series code into the no. series table.

THANK YOU SO MUCH

Mr. Erik