Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8556

Re: Load DbDatasource

$
0
0

hi.

By using this method u can load some values in to form

here form means customization form

in system form like sap b1 forms this operation will not work.

 

Suppose Example::

in you Customization ,, header some values are there... and also one matrix is there.

your requirement is  show all the order details in your customization form

 

first your have to run the query..

 

select itemcode,itemname,qty,docentry,docnum from rdr1 inner join ordr

on rdr1.docentry = ordr.docentry

 

here u have to do orecordset for run the above query..

 

in this query all the values are saved..

now u want to copy all these values to customization form

 

 

Dim oDBDataSource As SAPbouiCOM.DBDataSource = frmContractOrder.DataSources.DBDataSources.Item("@I8_CO_DETAIL")


'here @I8_CO_DETAIL is mine detail  table name nothing but row level data

like i data bind it to the matrix columns


                                Dim oDBDataSource1 As SAPbouiCOM.DBDataSource = frmContractOrder.DataSources.DBDataSources.Item("@I8_CO_HEAD")


'@I8_CO_HEAD is mine header table of my customization form like docnum



now



For row As Integer = 0 To oDataTable.Rows.Count - 1

 

 

                                    Dim offset As Integer = oDBDataSource.Size

 

 

                                    oDBDataSource.InsertRecord(row)

 

 

                                    oDBDataSource.SetValue("U_I8_icode", offset,

oDataTable.GetValue("ItemCode", row).ToString())

 

'here  U_i8_icode is your matrix column name of your matrix

'here item code is query running  value

 

                                    oDBDataSource.SetValue("U_I8_iname", offset, oDataTable.GetValue("Dscription", row).ToString())

                                    oDBDataSource.SetValue("U_I8_Tides", offset, oDataTable.GetValue("Text", row).ToString())

 

 

                                    oDBDataSource.SetValue("U_I8_unit", offset, oDataTable.GetValue("unitMsr", row).ToString)

                                    oDBDataSource.SetValue("U_I8_orqty", offset, oDataTable.GetValue("Quantity", row).ToString())

                                    oDBDataSource.SetValue("U_I8_rate", offset, oDataTable.GetValue("Price", row))

                                    oDBDataSource.SetValue("U_I8_tamt", offset, oDataTable.GetValue("LineTotal", row))

                                    oDBDataSource.SetValue("U_I8_tcode", offset, oDataTable.GetValue("TaxCode", row))

                                    oDBDataSource.SetValue("U_I8_trate", offset, oDataTable.GetValue("U_Rate", row))

                                    oDBDataSource.SetValue("U_I8_txamt", offset, oDataTable.GetValue("VatSum", row))

                                    oDBDataSource.SetValue("U_I8_wcode", offset, oDataTable.GetValue("WhsCode", row))

                                    oDBDataSource.SetValue("U_I8_proj", offset, oDataTable.GetValue("Project", row))

                                    oDBDataSource.SetValue("U_I8_cogsl", offset, oDataTable.GetValue("cogsloc", row))

                                    oDBDataSource.SetValue("U_I8_cogsb", offset, oDataTable.GetValue("cogsbr", row))

                                    oDBDataSource.SetValue("U_I8_cogss", offset, oDataTable.GetValue("cogssit", row))

                                    oDBDataSource.SetValue("U_I8_cogsd", offset, oDataTable.GetValue("cogsdept", row))

                                    oDBDataSource.SetValue("U_I8_cogsa", offset, oDataTable.GetValue("cogsact", row))

                                    oDBDataSource.SetValue("U_I8_loc", offset, oDataTable.GetValue("Location", row))

                                    oDBDataSource.SetValue("U_I8_sqno", offset, oDataTable.GetValue("DocEntry", row))

                                    oDBDataSource.SetValue("U_I8_symno", offset, oDataTable.GetValue("Series", row))

                                    oDBDataSource.SetValue("U_BaseType", offset, oDataTable.GetValue("ObjType", row))

 

 

                                    oDBDataSource.SetValue("U_BPCatlog", offset, oDataTable.GetValue("SubCatNum", row))

                                    ' oDBDataSource.SetValue("U_ItemDet", offset, oDataTable.GetValue("Text", row))

                                    oDBDataSource.SetValue("U_BaseLine", offset, oDataTable.GetValue("LineNum", row))

 

 

                                    If oDataTable.GetValue("ExpnsCode", row) = 0 Then

                                        oDBDataSource.SetValue("U_I8_frcod", offset, "")

                                    Else

                                        oDBDataSource.SetValue("U_I8_frcod", offset, oDataTable.GetValue("ExpnsCode", row))

                                    End If

 

 

                                    oDBDataSource.SetValue("LineId", offset, row + 1)

 

 

 

 

                                    oDBDataSource.SetValue("U_I8_framt", offset, oDataTable.GetValue("FrAmt", row))

 

 

                                    CustRef = oDataTable.GetValue("NumAtCard", row)

 

 

                                    CntPrsn = oDataTable.GetValue("CntctCode", row)

 

 

                                    VatAmt = VatAmt + oDataTable.GetValue("VatSum", row)

 

 

                                    Freight = Freight + oDataTable.GetValue("FrAmt", row)

 

 

                                    Total = Total + oDataTable.GetValue("VatSum", row) + oDataTable.GetValue("LineTotal", row) + oDataTable.GetValue("FrAmt", row)

 

 

 

 

                                Next

 

 

                                oMatrix.LoadFromDataSource()

 

 

                                oDBDataSource1.SetValue("u_I8_vatsumamt", 0, VatAmt)

                                oDBDataSource1.SetValue("u_I8_amt", 0, Total)

                                oDBDataSource1.SetValue("u_I8_framt", 0, Freight)

                                oDBDataSource1.SetValue("u_I8_custref", 0, CustRef)

                                oDBDataSource1.SetValue("u_I8_cntprsn", 0, CntPrsn)

                                oDBDataSource1.SetValue("u_I8_Discou", 0, DisTotal)

                                oDBDataSource1.SetValue("u_I8_PrjTitle", 0, Rprjtitle)

                                oDBDataSource1.SetValue("u_I8_basedoc", 0, RDoCNo)

 

 

                                'oDBDataSource1.SetValue("t_amt", 0, oDataTable.GetValue("LineNum", row))

                                'oDBDataSource1.SetValue("t_vatamt", 0, oDataTable.GetValue("LineNum", row))

                                'oDBDataSource1.SetValue("t_vatamt", 0, oDataTable.GetValue("LineNum", row))

 

 

                                'frmContractOrder.Items.Item("t_vatamt").Specific.Value = VatAmt

 

 

                                'frmContractOrder.Items.Item("t_amt").Specific.Value = Total

                                'frmContractOrder.Items.Item("t_vfdate").Specific.Value = CustRef

                                'frmContractOrder.Items.Item("t_ctprsn").Specific.Value = CntPrsn

                                'frmContractOrder.Items.Item("t_framt").Specific.Value = CntPrsn

 

 

 

 

 

 

                                K = K + 1

 

 

                            Catch ex As Exception

                                K = K + 1

                                oApplication.MessageBox(ex.Message)

                            End Try

 

 

                        End If





Viewing all articles
Browse latest Browse all 8556

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>