Report for creating no. series of item from vendor card

george175george175 Member Posts: 26
edited 2014-12-11 in NAV Three Tier
Hi,
i made processing only report for creating no series of items in NAV 2009. My no. series consists of three parts.
ZBxxxyyy-zzzzzz
where xxx- last three symbols from vendor number( from D000175 its 175)
yyy- Product group code
zzz- 000001 is starting number
I have insert data into No. Series record, No series line and No series relationship. Please help me, here is my code, I cant find my mistake in it. When I start this report in vendor card, choose product group, and click on OK , report dont insert new series. Vendor number i get automatically with REPORT.RUNMODAL function.

greProductGroup.TESTFIELD(greProductGroup.Code);
IF greVendor.GET(greVendor."No.") THEN
gcoVendorNoMin:=COPYSTR(greVendor."No.",5,3);
IF greProductGroup.GET(greProductGroup.Code) THEN
gcoNoSeriesCode:=STRSUBSTNO('ZB%1%2',gcoVendorNoMin,greProductGroup.Code);
MESSAGE(gcoNoSeriesCode);
greNoseries.INIT;
greNoseries.Code:=gcoNoSeriesCode;
greNoseries.Description:=STRSUBSTNO('%1-#%3', greVendor.Name, greNoseries.Description);
greNoseries."Item Category Code":=greProductGroup."Item Category Code";
greNoseries."Product Group Code":=greProductGroup.Code;
greNoseries."Vendor No.":=greVendor."No.";
greNoseries.INSERT;
greNoSeriesLine.INIT;
greNoSeriesLine."Series Code":=STRSUBSTNO('ZB%1%2',gcoVendorNoMin,gcoProductCode);
greNoSeriesLine."Line No.":= 10000;
greNoSeriesLine."Starting No.":=STRSUBSTNO('%1%2-%4',gcoVendorNoMin,gcoProductCode,1);
greNoSeriesLine."Ending No.":=STRSUBSTNO('%1%2-%4',gcoVendorNoMin,gcoProductCode,999999);
greNoSeriesLine."Increment-by No.":=1;
greNoSeriesLine.INSERT;
greNoSeriesRelationship.INIT;
greNoSeriesRelationship.Code:='ZB';
greNoSeriesRelationship."Series Code":=STRSUBSTNO('ZB%1%2',gcoVendorNoMin,gcoProductCode);
greNoSeriesRelationship.INSERT;
CurrReport.QUIT
Sign In or Register to comment.