Hi Members of Mibuso,
I'm importing a text file into a table using a dataport. Then I need create a list form to display those values from that table. Then I have to create a button to post that values from this form to Sales Header Table.
I just want to know how to Code using a codeunit to post values from a list form to Sales Header Table?
Can Someone help me on Creating Codeunits and Codes inside that?
Any Help will be appreciated.
Thank You.
0
Answers
it depends on the table structure you have..
if both tables structures are same then you can use TRANSFERFIELDS function or you need to assign manually..
What you tried so far?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
I have imported the text file through dataport and it successfully imported to the table. I have linked the table to a list form so far.I got Stucked from the Following. Through that List form by creating a button i have to post the values that are in the Form to the Sales Header using Codeunit. I need the help on Creating Codeunits and on its Codes.
:?
I have few question to ask before answering your question -
I have imported the text file through dataport and it successfully imported to the table.
I have linked the table to a list form so far.
Question -
1) What are the values in the table which you have imported?
2) Are the values same as Sales Header Table?
I got Stucked from the Following. Through that List form by creating a button i have to post the values that are in the Form to the Sales Header using Codeunit.
Questions -
3) What do you mean by Post the values that are in the form to Sales Header. (Sales header consist records of UNPOSTED Sales order, so how you can post in that table?)
What i Understand -
1) I think you want to copy values from that form to Sales Header via a codeunit.
If this is what you want than, you need to make sure of some point -
a) The fields on the both sames should either be same or the mandatory fields in the sales Header table should be present in the Form/Table which you imported.
b) If the fields are same as of sales header with the same field id then Transferfields can be used in codeunit as already suggested by Mohan.
c) Else you need to create a new codeunit where you will have two record variables one for sales header and one for the new table(where you imported records).
d) Then you need to Initalize the sales header record by Saying salesHead.INIT (where salesHead is the record of Sales header).
Map field by field to the sales header table as-
SalesHead."Field Name" := NewTable."Field Name";
OR
SalesHead.Validate("Field Name",NewTable."Field Name");
Where NewTable is the variable name for the New table.
After this you need to say SalesHead.Insert(True);
Then on the click event of that button in the form you can call Codeunit.
Let me know if you need any more help.
Regards,
Saurav Dhyani
http://saurav-nav.blogspot.com/
Thanks & Regards,
Saurav Dhyani
Do you Know this About NAV?
Connect - Twitter | Facebook | Google + | YouTube
Follow - Blog | Facebook Page | Google + Page