Hi,
I'm trying to create a form that contains a header table and a line table, using the sales line table.
The SubformLink that I used in my customized subform is:
Document No.=FIELD(Contract No.),Group Entry No.=FIELD(No.)
My problem is that when I try to create a new record in the subform, while the Document No. is being filled automatically by the SubformLink, the "Group Entry No." field is left blank.
I have tried to solve this by adding that field as a key on the sales line table, as well as switching the order between the two fields on the SubformLink, but neither of them worked.
The other approach I used was to create a subroutine in the subform, and call it from the header. Even though the subform routine gets the value successfully, the new record begins again with that column left blank.
The subroutine is:
SetGroupEntryNo(GroupEntryNo : Integer)
"Group Entry No." := GroupEntryNo;
CurrForm.UPDATE(FALSE); // I inserted this line after reading another post suggestion on a a similar issue. I tried without that statement, but I achieve the same result.
Any idea of how can this be solved? Any suggestion will be appreciated. Thank you very much for your attention.
0
Comments
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Sales Line table keys:
Document Type,Document No.,Line No.
Document Type,Type,No.,Variant Code,Drop Shipment,Location Code,Shipment Date
Document Type,Bill-to Customer No.,Currency Code
Document Type,Type,No.,Variant Code,Drop Shipment,Shipment Date
Document Type,Blanket Order No.,Blanket Order Line No.
Document Type,Document No.,Location Code
Document Type,Shipment No.,Shipment Line No.
Type,No.,Variant Code,Drop Shipment,Location Code,Document Type,Shipment Date
Document Type,Document No.,Type,No.
Document Type,Sell-to Customer No.
Document No.,Group Entry No.
I created the last one, and also tried it inverted. Same with the sortings but nothing.
Here is a snippet of the code in case it becomes handful to someone with a similar issue:
// Subroutine defined on subform>>
SetGroupEntryNo(GroupEntryNo : Integer)
GlobalGroupEntryNo := GroupEntryNo;
CurrForm.UPDATE(FALSE);
// Subroutine defined on subform<<
// Field definition on subform>>
No. - OnLookup()
IF MySalesHeader2.GET(GlobalGroupEntryNo) THEN BEGIN
MyItem.SETFILTER("Item Group", MySalesHeader2."Item Group");
IF FORM.RUNMODAL(FORM::"Item List", MyItem) = ACTION::LookupOK THEN BEGIN
VALIDATE("No.", MyItem."No.");
"Copy of No." := "No.";
"Group Entry No." := GlobalGroupEntryNo; // Insert "Group Entry No." value.
END;
// Field definition on subform<<
If someone finds a way to get the values for two or more fields defined on SubformLink, from the header form, please feel free to post the solution. Thank you very much for your attention.