SAP for Higher Education and Research Discussions
Spark conversations about student engagement, research optimization, and administrative efficiency using SAP in higher education and research. Join in!
cancel
Showing results for 
Search instead for 
Did you mean: 

Student not created using BAPI_STUDENT_CREATEFROMDATA3

Former Member
0 Kudos

Hi,

I use the recommended remote function "BAPI_STUDENT_CREATEFROMDATA3" through Excel VBA to import student data, which seems to run fine - it returns a success message and student's object ID generated, e.g. "TRUE, 00000795". However, whenever I check the Student file or PP01 for this newly created student, I can't find it.

Any ideas what can go wrong? I already tried to look up this student using different key dates - no success.

Sub TestStudentCreation()
        Dim functionCtrl As Object             'Function Control (Collective object)
        Dim sapConnection As Object         'Connection object
        Dim theFunc As Object                 'Function object
        Set functionCtrl = CreateObject("SAP.Functions")

        Set sapConnection = functionCtrl.Connection
        sapConnection.Client = "020" 'Test client
        sapConnection.user = "janek"
        sapConnection.Language = "EN"

        If sapConnection.logon(0, False) <> True Then
            MsgBox ("No connection to R/3!")
            Exit Sub
        End If

        Set theFunc = functionCtrl.Add("BAPI_STUDENT_CREATEFROMDATA3")

        'Fills the structure with key required fields
        Dim oStructure As Object
        theFunc.Exports("STUDENTPERSONALDATA").Value("LAST_NAME") = "TestLastName"
        theFunc.Exports("STUDENTPERSONALDATA").Value("FIRST_NAME") = "TestFirstName"
        theFunc.Exports("STUDENTPERSONALDATA").Value("CORRESP_LANGUAGE") = "E" 'English

        Dim returnFunc As Boolean
        returnFunc = theFunc.Call
        functionCtrl.Connection.logoff

        MsgBox (returnFunc & " " & theFunc.Imports("OBJECTID").Value)
        
End Sub

1 ACCEPTED SOLUTION

former_member195888
Active Participant
0 Kudos

A quick guess (without immediately having verified whether it is really true...): you may have to do a subsequent "commit" call, something like BAPI_TRANSACTION_COMMIT or so.

View solution in original post

3 REPLIES 3

former_member195888
Active Participant
0 Kudos

A quick guess (without immediately having verified whether it is really true...): you may have to do a subsequent "commit" call, something like BAPI_TRANSACTION_COMMIT or so.

0 Kudos

This neatly solved the issue.

Thanks

Former Member
0 Kudos

We had the same problem with BAPI_CTRACDOCUMENT_CREATE, and we could only generate a document number but we could not found it. So we used the commit Joachim mentioned and we could post documents then

Cheers

Sergio