cancel
Showing results for 
Search instead for 
Did you mean: 

Change Patient

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Answers (0)