cancel
Showing results for 
Search instead for 
Did you mean: 

Seperate Document Row with same account when post GL

Former Member
0 Kudos

Hello everyone

How I can seperate Document Row with same account when post GL

because If I post dcoument that have many rows but same account and difference detail. It will sum amount for same account in JE

and I found that will seperate if it has diference project code but it's not enough for me.

How I can config SAP B1 to seperate Doc row when post to JE if it has difference detail (as userfield or standard filed)

Sorry for my poor english

Thank,Seang

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Yatsea Li,

Thanks for your shared code.

In my experiences, SDK will not allow for updating some JE data such as shortname, credit, debit. So that you can not seperate JE lines by this way.

I think your first solution is also ok for some cases.

Rgds,

NT

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

Ok. In this case, we can't update the JE to seperate it with SDK...

also unable to remove it...

Kind Regards

-Yatsea

Answers (2)

Answers (2)

YatseaLi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Suthee,

Sorry to tell you, it is not possible to do so in current B1 without addon development.

There are 2 alternative.

1.Consulting Workaround:

Seperate the Item into 2 items, the account into 2 sub accounts.e.g.

Item A => Item A01 and A02

G/L Account 1001 => Sub Account 100101 and 100102

2.AddOn development to seperate the JE just after it is created document

You can update to JE to seperate just after JE are created by docuemnts.

Just Listen FormDataAdd Event.

Sample Code:

Private Sub FormDataEventHandler( _
    ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, _
    ByRef BubbleEvent As Boolean) Handles oApp.FormDataEvent
        'I just listen 133 - AR invoice here, 
        'You may add the target documents
        'Before action = true, start the transation
        If BusinessObjectInfo.FormTypeEx = "133" _
                And (BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD _
                Or BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE) _
                And BusinessObjectInfo.BeforeAction = True Then
            oCompany.StartTransaction()
        End If

        'Before Action = false, 
        'Update the JE in document
        'Succeed, commit, otherwise rollback
        If BusinessObjectInfo.FormTypeEx = "133" _
        And (BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD _
        Or BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE) Then
            If BusinessObjectInfo.BeforeAction = False And BusinessObjectInfo.ActionSuccess Then
                Dim xmlDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument
                xmlDoc.LoadXml(BusinessObjectInfo.ObjectKey)
                Dim objectKey As String
                objectKey = xmlDoc.SelectSingleNode("//DocEntry").InnerText

                Dim oDocument As SAPbobsCOM.Documents = Nothing
                oDocument = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders)
                If oDocument.GetByKey(CInt(objectKey)) Then
                    Dim oJE As SAPbobsCOM.JournalEntries
                    oJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
                    If oJE.GetByKey(oDocument.TransNum) Then
                        '*Add you code to Update oJE lines here*
                        lRetCode = oJE.Update
                        If 0 <> lRetCode Then
                            oApp.MessageBox("Failed to update JE")
                            'roll back the whole transaction, including the document
                            oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
                            Exit Sub
                        Else
                            'Commit the transaction
                            oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
                        End If
                    End If

                End If
            End If
        End If
    End Sub

Hope it helps. Thanks.

Kind Regards

-Yatsea

Former Member
0 Kudos

Hi,

SAP will seperate JE rows if there have different project code or profit center between base document rows.

Hope it helpful.

N.Ti