Checking out data models in power designer with VBScript

459 Views Asked by At

Through a VBS code I need to check out some data models from the power designer. The requirements are: Connect to the power designer repository, check out some data models. can anybody help me?

I found this code in SAP documentation, but when i execute it the following error appears.

Dim rc : Set rc = RepositoryConnection
'Check out model
Dim TargetModel
Set TargetModel = rc.FindChildByPath("MyFolder/MyPDM", PdRMG.Cls_RepositoryModel)
TargetModel.CheckOut()
Output "Checked"

The error messege:

Microsoft VBScript Runtime Error Required object (0x800A01A8) on line 5

1

There are 1 best solutions below

1
pascal On

As mentioned by the first comment, at least, verify the FindChildByPath return value:

Set TargetModel = rc.FindChildByPath("MyFolder/MyPDM", PdRMG.Cls_RepositoryModel)
if targetmodel is nothing then
   output "nothing"
else
   TargetModel.CheckOut()
   Output "Checked out"
end if

Apart from that, the sample works for me, and opens the PDM I have checked in.