Hi Everyone,
I am creating 'dimension set id' in temporary dimension set entry table,once its created ,but now its showing its already there.
Please find below my code:
TempDimSetEntry.RESET;
TempDimSetEntry."Dimension Code" := 'DEPT';
TempDimSetEntry."Dimension Value Code" := DeptCode;
TempDimSetEntry."Dimension Value ID" := DeptID;
TempDimSetEntry.INSERT;
TempDimSetEntry.RESET;
TempDimSetEntry."Dimension Code" := 'CHANNEL';
TempDimSetEntry."Dimension Value Code" := ChanCode;
TempDimSetEntry."Dimension Value ID" := ChanID;
TempDimSetEntry.INSERT;
TempDimSetEntry.RESET;
TempDimSetEntry."Dimension Code" := 'PROJECT';
TempDimSetEntry."Dimension Value Code" := ProjCode;
TempDimSetEntry."Dimension Value ID" := ProjID;
TempDimSetEntry.INSERT;
AvailDimSetId := DimensionManagement.GetDimensionSetID(TempDimSetEntry);
DimensionSetEntry."Dimension Set ID" := AvailDimSetId;
PurchaseHeader."Dimension Set ID" := DimensionSetEntry."Dimension Set ID";
IF DimensionSetEntry."Dimension Set ID" =0 THEN
NewDimSetId := DimensionManagement.CreateDimSetIDFromDimBuf(TempDimBuf);
PurchaseHeader."Dimension Set ID" := DimensionSetEntry."Dimension Set ID";
PurchaseHeader.MODIFY;
how, i should give condition to not create dimension set id for above three combination dimension code(Dept,project and channel),if it is already there.
Please guide me regarding above query.
Thanks,
Mani.
Answers
is your TempDimSetEntry really Temporary=Yes?
Also, according to my understanding, DimensionManagement.GetDimensionSetID will only return 0 if no dimension/values are provided. If the ID did not exist before, it will create the necessary entries in the DB, so no need for calling CreateDimSetIDFromDimBuf. (And where did you fill TempDimBuf anyway?)
Thanks for your reply.
Yes,TempDimSetEntry, property: Temporary=Yes.
As,you advice above: no need for calling CreateDimSetIDFromDimBuf. so, i removed this, but i am getting the same error as above.
Please guide me further,how i can overcome this issue.
(And where did you fill TempDimBuf anyway?:-I created temporary=yes,for dimension buffer table,and its updating 'dimension set id' in dimension set entry table inside the createDimSetIdFromDimBuf function.so,atlast i assigned that 'dimension set id' to purchase header.)
Thanks,
Mani.
Please help me regarding above query.
Thanks,
Mani.
I fixed the above issue.
I filtered then create,and removed CreateDimSetIDFromDimBuf function as vaprog guide,now its working fine.
Like:(StagingtoPI: staging table,from where data is taking)
IF StagingtoPI.Department <> '' THEN BEGIN
TempDimSetEntry.RESET;
TempDimSetEntry.INIT;
TempDimSetEntry.VALIDATE("Dimension Code",'DEPT');
TempDimSetEntry.VALIDATE("Dimension Value Code",DeptCode);
TempDimSetEntry.VALIDATE("Dimension Value ID",DeptID);
IF NOT TempDimSetEntry.INSERT THEN TempDimSetEntry.MODIFY;
END;
did for all three dimension code(Dept,project and channel).
Thanks for the help.
Mani.