Performing Pull Stored Print Management (Delphi)

// global
LEADDicomPrintSCU1: TLEADDicomPrintSCU; 
Procedure TForm1.PerformPullStoredPM();
var
   nRet: Integer; 
   strMsg: String; 
begin
   // Establish the Association
   nRet:= LEADDicomPrintSCU1.Associate ('10.0.2.20', 7104, 'PrintSCP', 'PrintSCU', 
                                       PRNSCU_PULL_STORED_PM_META_SOP_CLASS +
                                       PRNSCU_PRINT_JOB_SOP_CLASS +
                                       PRNSCU_PRINTER_CONFIGURATION_RETRIEVAL_SOP_CLASS); 
   if(nRet = DICOM_ERROR_PRINTSCU_ASSOCIATE_RQ_REJECTED)then
   begin
      strMsg:= 'Source = ' + IntToStr(LEADDicomPrintSCU1.AssociateRejectSource) + ', ' +
               'Reason = ' + IntToStr(LEADDicomPrintSCU1.AssociateRejectReason);
      Application.MessageBox(PChar(strMsg), 'Association Request was Rejected', MB_OK);
      Exit;
   end
   else
   begin
      if(nRet <> DICOM_SUCCESS)then
      begin
         strMsg:= 'Error code: ' + IntToStr(nRet);
         Application.MessageBox(PChar(strMsg), 'Failed to Establish the Association', MB_OK);
         Exit;
      end;
   end;

   // Display some printer info
   //GetPrinterInfo(LEADDicomPrintSCU1);

   // Display some printer configuration info
   //GetPrinterConfigInfo(LEADDicomPrintSCU1);

   // A referenced Stored Print Storage SOP Instance
   LEADDicomPrintSCU1.PullPrintRequest.RemoveAllStoredPrintItems();
   LEADDicomPrintSCU1.PullPrintRequest.AddStoredPrintItem('SomeAE',
                                                          '1.2.840.114257.254.7638.6787',
                                                          '1.2.840.114257.945.5676.5674',
                                                          '1.2.840.114257.23.2343.3489',
                                                          'SomeID');

      // Ask the Print SCP to create a Pull Print Request SOP Instance
   LEADDicomPrintSCU1.PullPrintRequest.IncludedParameters:= PPR_NUMBER_OF_COPIES;
   LEADDicomPrintSCU1.PullPrintRequest.NumberOfCopies:= 1;
   LEADDicomPrintSCU1.PullPrintRequest.Create();
   strMsg:= LEADDicomPrintSCU1.PullPrintRequest.SOPInstanceUID;
   Application.MessageBox(PChar(strMsg), 'Pull Print Request SOP Instance UID', MB_OK);

      // Print the session
   LEADDicomPrintSCU1.PullPrintRequest.PrintSession ();

      // Display some info about the Print Job
   if(LEADDicomPrintSCU1.PullPrintRequest.MainObject.IsClassSupported (PRNSCU_PRINT_JOB_SOP_CLASS))then
   begin
      //GetPrintJobInfo objPrintSCU, .PrintJobSOPInstanceUID
   end;

   // Ask the Print SCP to delete the Pull Print Request SOP Instance
   LEADDicomPrintSCU1.PullPrintRequest.Delete ();

   // Release the Association and close the connection
   LEADDicomPrintSCU1.ReleaseAssociation ();
end;