cancel
Showing results for 
Search instead for 
Did you mean: 

regaring document number as primary and manual

Former Member
0 Kudos

Hi all ,

we need a solution for the following problem

we had created a combox as in sap form for document numbering

that combo box contain ywo values as primary and manual

in sap form if we select primary it will be generating numbers automatically

and when we select manual it will allows us to enter manually

can any one tell me hoe to do the same thing for user defined fields

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

If u registered ur table in UDO means

Bind the combobox to the 'Series' field in the table.

oSeriesCombo = oForm.Items.Item("CmbSeries").Specific

oForm.Items.Item("CmbSeries").DisplayDesc = True

oSeriesCombo.DataBind.SetBound(True, "@PSSIT_CMSAMHDR", "Series")

StrSql = "select * from NNM1 where objectCode='PSSIT_CMSAM'"

oRs.DoQuery(StrSql)

If oRs.RecordCount > 0 Then

oRs.MoveFirst()

For IntICount = 0 To oRs.RecordCount - 1

oSeriesCombo.ValidValues.Add(oRs.Fields.Item("Series").Value, oRs.Fields.Item("SeriesName").Value)

oRs.MoveNext()

Next

End If

oSeriesCombo.ValidValues.Add("-1", "Manual")

oSeriesCombo.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)

then for auto increment of document number u have to do as

oDocNumTxt = oForm.Items.Item("TxtDocNum").Specific

oForm.Items.Item("TxtDocNum").Enabled = False

oDocNumTxt.DataBind.SetBound(True, "@PSSIT_CMSAMHDR", "DocNum")

LoadDocNumber()

Private Sub LoadDocNumber()

Dim StrSql As String

Dim oRs As SAPbobsCOM.Recordset

Try

oRs = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

StrSql = "Select ObjectCode,Series,SeriesName,InitialNum,NextNumber,LastNum From NNM1 " _

& "Where NNM1.ObjectCode='PSSIT_CMSAM'"

oRs.DoQuery(StrSql)

If oRs.RecordCount > 0 Then

oRs.MoveFirst()

oDocNumTxt.Value = oRs.Fields.Item("NextNumber").Value

End If

Catch ex As Exception

Throw ex

Finally

oRs = Nothing

GC.Collect()

End Try

End Sub

I hope this will help u...:-)

Regards

Mohana

Answers (0)