on 03-10-2008 7:12 AM
Hi All,
Is there any way to insert records in document and document line type user defined tables other than using recordset (insert SQL )? the columns of these tables are bound to my user form's matrix columns and other edit text fields.
thanks in advance,
Regards,
Binita
Hi David,
I have followed all the steps given by you (much before) and this is what I face. have gone thru number of threads on this but, cud not find much so posting back.
1) created two tables with type document and document rows resp.
2) created UDO out of them
3) generted form with B1DE UDO form generator
4) have 'add' and 'cancel' button on the form thru screen painter
have three columns namely itemcode, UOM and Quantity in detail table.
now, when I add row to this matrix which is bound to lines UDT, and copy or type data in the column, and click 'add' , it adds the data perfectly in each column, generates the docentry and docnum as u said, without my writing any code.
problem arises when I load the matrix with datasource. this is how my code looks like:
Form = sbo_Application.Forms.Item("UDO_MASTER_")
Matrix = Form.Items.Item("mt").Specific
Matrix.AddRow()
Form.DataSources.DataTables.Add("DBDS")
strquery = "select rowc,it,uom,qty from ....."
Form.DataSources.DataTables.Item("DBDS").ExecuteQuery(strquery)
Matrix.Columns.Item("col_f").DataBind.Bind("DBDS", "rowc")
Matrix.Columns.Item("col_0").DataBind.Bind("DBDS", "it")
Matrix.Columns.Item("col_1").DataBind.Bind("DBDS", "uom")
Matrix.Columns.Item("col_2").DataBind.Bind("DBDS", "qty")
Matrix.LoadFromDataSource()
even my first column '#' is bound to LineId of detail table. on 'Add' click, it does create the rows in data base table equal to the number of records in matrix but the user defined columns remain null.
please help me out on what cud be missing
thanks and regards,
Binita Joshi
Edited by: Binita Joshi on May 19, 2008 1:15 PM
Also, I tried again binding the matrix columns with the columns of UDT after I do LoadFromDataSource() on matrix but, with no luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Binita,
because you said this in the other thread:
iam still here sorry for the late answer.
ok, now back to topic:
in my opionion you're doing it wrong.
the reason - you use a query and you use loadfromdatasource.
i'll show you vb6 sample how i bind the document_lines object.
Set oItem = oForm.Items("mtxList1")
Set oMatrix = oItem.Specific
oMatrix.SelectionMode = ms_None
Set oColumns = oMatrix.Columns
oColumns("LineId").DataBind.SetBound True, "@B1C_PRJ1", "LineId" 'First Column
oColumns("ColStueck").DataBind.SetBound True, "@B1C_PRJ1", "U_Stueck"
oColumns("ColEinheit").DataBind.SetBound True, "@B1C_PRJ1", "U_Einheit"
that's it, no datatable necessary, but it is important you registered your object correctly
regards
David
Hi David,
relieved to find u still here.
I do need datatable as I mentioned in my previous thread, because I am loading the matrix with the output of a complex query.
But, As U suggested, the problem must have been with my registering the UDO. I recreated the UDO and tables too. Now, its working. thanks.
regards,
Binita
thts a good news. but, do we have to generate docentry on our own (by fetching max(docentry) from master table and adding one ) or the object takes care of generating or replacing the docentries when they are colliding?
regards,
BInita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the docentry is generated from sap
i'll do it always so
i have a disabled edittext field where you see the docentry - i bind it to a edit text:
oEditText.DataBind.SetBound True, "@B1C_TEST", "DocEntry"
in the end i say that i want to browse this field
oForm.DataBrowser.BrowseBy = "txtDocE"
thats it - you should face no problems
regards
David
Hi David,
I m not worried about the status bar message. I know, its a system behaviour tht doesn't happen for user forms. but, all I want to know is , are concurrent entries supported in database tables without loosing the data integrity when more than one users are inserting data at the same time? I have never used UDO bound forms. I m using standard SQL DML statments to insert the data and so, I have to manually lock the tables when one user is modifying it. otherwise, there is a complete mess-up with the generated doc numbers and data saved against it.
and thanks for trying .
regards,
Bintia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David.
m little late in replying. I wanted to know, by attaching a form with UDOs of type document and document rows, does the insertion work the same way as it does in standard forms? for example, when more than one users are adding the data in sales order form simultaneously, a status bar message is displayed stating that, "your document has been saved with so..ans so.. number". and there is no ambiguity. is the scenario same with using UDOs bound forms? I had raised this query to SAP support and I was replied that with the current release, DI API objects for document type tables are not exposed. and so transactions can not take place the standard way it happens for standard SAP forms and objects.
(Hope my question is clear.)
regards,
Binita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are using screen painter to design the form , enter the UDO code in the object Type property of the form.
I hope it may work...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI David,
Thanks for replying.
One last question. u said , for UDO forms, u don't need to write any code. system saves the data on its own. by UDO forms, wht do u mean to imply? are these forms which are created thru some B1DE tools, like User-Defined Objects Form Generator?
thanks and regards,
Binita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Many thanks for replying. I just want to confirm what I m doing is technically the same as what you have sent. I am creating a form using screen painter. I create the controls and bind them with the columns of user defined tables of type document and document rows(with the matrix).I change the extention of this .srf file to .xml and load it through standard LoadFromXml function. The browse by key works in the update mode. but, in add mode, when I click 'Add' button (with unique ID '1' in screen painter), the data do not get added to the bound table automatically.I have to catch the click event of add button and write the code for insertion through recordset doquery method. does the code sent by you precisely do the same thing? or Is it different? and also let me know if I can insert/update the data in UDTs of document type any other way which is more efficient than this.
Thanks for all the efforts in advance :)....
regards,
Binita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Thanks for replying. the question may sound trivial but, will you please let me know how can I bind the UDOs with the form, after I have registered them?
regards,
Binita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok Binita,
i post a sample here
Set creationPackage = oSBO.appl.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
creationPackage.UniqueID = "B1C_CRYM"
creationPackage.ObjectType = "B1C_CRYM"
creationPackage.FormType = 20009004 '"MyFormType"
'creationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
Set oXMLDoc1 = New MSXML2.DOMDocument
'// load the content of the XML File
oXMLDoc1.Load (FileName)
creationPackage.XmlData = oXMLDoc1.xml '// You can load the form with XML
'// Add the form to the SBO application
Set frm = oSBO.appl.Forms.AddEx(creationPackage)
frm.Items("DocEntry").Specific.DataBind.SetBound True, "@B1C_CRYM", "DocEntry"
frm.Items("txtName").Specific.DataBind.SetBound True, "@B1C_CRYM", "U_Name"
frm.DataBrowser.BrowseBy = "DocEntry"
this should help you
lg
David
Hi Binita,
in your situation i recommend you to register the tables as UDO and bind your user form to it.
regards
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.