I am using two data items sales invoice header and sales invoice line when i indent sales invoice line and give the linking It is giving an error.
how I can do it
ITS URGENT
This is message about..if you want to use indenting then choose FileFormat - UpXml.
This is old message - in Nav 5/4Sp3 you can't even select this type of fileformat in property. XmlPort is designed for that.
I think he just meant that you can have two different data items in a dataport (e.g. for Sales Header and Sales Line), but without indentation, and without any link between them.
So you can use filters to export only some specific Sales Headers, but (without coding) there’s no way to get just the Sales Lines for those headers.
For example, you can export all Sales Headers with Status = Open, but (without coding) you can’t export just the Sales Lines for open Sales Headers.
One way to set up such a link is with a temporary Sales Header table. Insert a record for each Sales Header that you export; then when exporting Sales Lines, check that there is a record in the temp table with the same Document Type and Document No.
sales header doc1
sales line doc1 line 1
doc1 line 2
sales header doc2
sales line doc2 line 1
doc2 line 2
i think that's can only possible with indent.
There is another way to do this without indentation which I've used in importing data from external sources, where the file is in header/line/line, header/line/line format. It requires some extra coding, and depends on whether you can tell from a specific field whether an input line is a header or a line item. Here's the basic flow:
1. Use the Integer table as your data item.
2. You have to set up your dataport to input all fields as text. Create fields F1, F2, F3, F4, etc. all as text fields, making them as long as the longest possible value.
3. Now, look at the field that tells you if it's a header or a line. As an example, let's say that the first field F1 has a value of HDR if it is a header and LIN if it is a line item. In your code, you have
IF F1 = HDR THEN
CreateSalesHeader
ELSE
CreateSalesLine
4. Now build 2 functions "CreateSalesHeader" and "CreateSalesLine", converting fields to numeric or date if necessary. Here's a short boilerplate for Header
SalesHeader.INIT;
SalesHeader."Document Type" := SalesHeader."Document Type"::Order;
SalesHeader."No." := F2; // Assuming field 2 is order number. You can also assign an order number by calling the appropriate No. Series commands
SalesHeader.VALIDATE("Sell-to Customer No.", F3); // Assuming field 3 is customer No.
SalesHeader.VALIDATE("Posting Date", DMY2DATE(COPYSTR(F4,4,2), COPYSTR(F4,1,2),COPYSTR(F4,7,4)); // Assuming field 3 is date in format MM/DD/YYYY
... etc.
SalesHeader.INSERT;
Numeric fields like Price or Quantity in the input file should be stored without commas or currency signs, or otherwise they will have to be stripped out in your code. If it is a straight numeric, then you can use the EVALUATE function, e.g.
you can use a temporary table in the fisrt dataitem to insert all the filtered records then in the next dataitem on the beforeexport trigger use a conditional ie. if not tableTMP.get(....) then skip;
Comments
Take a look in OnlineHelp (C/SIDE Reference Guide)
Regards
This is old message - in Nav 5/4Sp3 you can't even select this type of fileformat in property. XmlPort is designed for that.
"you have indented data items but the file format is not UPXML for more information see the C/SIDE reference guide."
this error i got
Regards
http://www.BiloBeauty.com
http://www.autismspeaks.org
How it is possible?
So you can use filters to export only some specific Sales Headers, but (without coding) there’s no way to get just the Sales Lines for those headers.
For example, you can export all Sales Headers with Status = Open, but (without coding) you can’t export just the Sales Lines for open Sales Headers.
One way to set up such a link is with a temporary Sales Header table. Insert a record for each Sales Header that you export; then when exporting Sales Lines, check that there is a record in the temp table with the same Document Type and Document No.
but i want data in form of like.
sales header doc1
sales line doc1 line 1
doc1 line 2
sales header doc2
sales line doc2 line 1
doc2 line 2
i think that's can only possible with indent.
This is not supported in dataports, because dataports export only the field values, without explicitly saying which table the data is from.
There is another way to do this without indentation which I've used in importing data from external sources, where the file is in header/line/line, header/line/line format. It requires some extra coding, and depends on whether you can tell from a specific field whether an input line is a header or a line item. Here's the basic flow:
1. Use the Integer table as your data item.
2. You have to set up your dataport to input all fields as text. Create fields F1, F2, F3, F4, etc. all as text fields, making them as long as the longest possible value.
3. Now, look at the field that tells you if it's a header or a line. As an example, let's say that the first field F1 has a value of HDR if it is a header and LIN if it is a line item. In your code, you have
IF F1 = HDR THEN
CreateSalesHeader
ELSE
CreateSalesLine
4. Now build 2 functions "CreateSalesHeader" and "CreateSalesLine", converting fields to numeric or date if necessary. Here's a short boilerplate for Header
SalesHeader.INIT;
SalesHeader."Document Type" := SalesHeader."Document Type"::Order;
SalesHeader."No." := F2; // Assuming field 2 is order number. You can also assign an order number by calling the appropriate No. Series commands
SalesHeader.VALIDATE("Sell-to Customer No.", F3); // Assuming field 3 is customer No.
SalesHeader.VALIDATE("Posting Date", DMY2DATE(COPYSTR(F4,4,2), COPYSTR(F4,1,2),COPYSTR(F4,7,4)); // Assuming field 3 is date in format MM/DD/YYYY
... etc.
SalesHeader.INSERT;
Numeric fields like Price or Quantity in the input file should be stored without commas or currency signs, or otherwise they will have to be stripped out in your code. If it is a straight numeric, then you can use the EVALUATE function, e.g.
OK := SalesLine.EVALUATE("Quantity", F11);
Hope this gives you some ideas...
looking typical but i have to try with this procedure.
again thanx