on 04-25-2008 2:36 PM
Hello !
For an IHS I want to updata Datas in a SAP System by using Visual Basic. I found the BAPI Patient and the
methode Change. Anyhow I do not succeed what is no wonder, because it's my first trial with SAP.
Does anyone has an example how:
1. how to search a Patient by mandant and PatientID
2. change the first Name and
3. write it back to SAP
Thank you very much in advance.
Yours, Gerrit
Hi Gerrit,
when you already have the PatientID I don't know what you want to search for. You can use the PatientID to call a BAPI to get the details. For the Change BAPI you have to fill the structures and tables with the new values. Normaly you also have to fill structures and tables which indicate what fields should be changed (X-Fields). After you've called the Change BADI you have to call 'BAPI_TRANSACTION_COMMIT' to commit the changes.
Best regards
Gregor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gregor, hi all,
First very much thanks to Gregor for his help !
The real problem might be my missing knowledge to handle with BAPIs.
What I do is: (oPatient and oPatientData are VB-Objects)
1. Logon to SAP (works fine)
2. Look if Patient exists: (works also fine, but do not ask my why)
Set oPatient = Form1.oBAPICtrl.GetSAPObject("Patient")
oPatient.search INSTITUTION:=" ", FilterPatientid:=Pat_ID$, return:=oMsgReturn
If oMsgReturn.rowcount > 0 Then ' there's no Patient / exit function
3. Now I try to change the Name
Set oPatient = Form1.oBAPICtrl.GetSAPObject("Patient", "003", Pat_ID$)
Set oPatientData = Form1.oBAPICtrl.DimAs(oPatient, "Change", "PatientData")
oPatientData("LAST_NAME_PAT") = "NewName"
Debug.Print oPatientData("LAST_NAME_PAT") ' shows "NewName"
oPatient.Enqueue return:=oReturn
oPatient.Change CLIENT.PATIENTID = Pat_ID$, _
CLIENT.CLIENT = "003", _
CLIENT.INSTITUTION = " ", _
PatientData:=oPatientData, _
return:=oReturn
A messagebox pops up and says:
Data type mismatch or data conversion failed.
Parameter or attribute PATIENTDATA
Any Idea?
Thank you very much in advance for your help.
Best regards,
Gerrit
Edited by: Gerrit Raith on Apr 28, 2008 2:45 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.