Please advise on custom code to create SAP Link compatible with ASSAP

gcampos
gcampos Member
edited October 2, 2012 in Documentum #1

Hello guys,

I would like to ask your advice on some custom code we're developing, our target is to connect on SAP, create a link on TOA01 table that is compatible with Archive Services for SAP and create a dm_relation. By saying it must be compatible with ASSAP I mean that SAP will call ASSAP and ASSAP must find our document in the repository.

We already did all oac0, oac2 and oac3 config, and archived a file using FB03 transaction and "Store Business Document" option.

We are doing the following to write on SAP:

DctmSAPFunctionProcessor functionProcessor = new DctmSAPFunctionProcessor("ARCHIV_CONNECTION_INSERT");

functionProcessor.addImportParameterList(this.config.getArchiveID(), "ARCHIV_ID");  //as configured in oac0

functionProcessor.addImportParameterList(this.config.getMandant(), "MANDANT"); 

functionProcessor.addImportParameterList(this.config.getArObject(),  "AR_OBJECT");  //as configured in oac2

functionProcessor.addImportParameterList(this.config.getRepository()+":/DCTM"+sapRelationId.toUpperCase(), "ARC_DOC_ID"); //uses sap_link_relation ID

functionProcessor.addImportParameterList(this.config.getDocumentType(), "DOC_TYPE"); // PDF

functionProcessor.addImportParameterList(idDocument, "OBJECT_ID");  //document name = COMPANY_CODE + DOC_NUMBER + YEAR

functionProcessor.addImportParameterList(this.config.getObjectType(), "SAP_OBJECT"); // BKPF

functionProcessor.addExportParameterInfo("ECHOTEXT", JCO.TYPE_CHAR, 255);

functionProcessor.addExportParameterInfo("RESPTEXT",  JCO.TYPE_CHAR, 255);

functionProcessor.execute();

functionProcessor.disconnect();

And we're creating the following relation on DCTM:

IDfPersistentObject sapLinkRelation = session.newObject("sap_link_relation");

String r_object_id = sapDocument.getString("r_object_id");

sapLinkRelation.setString("parent_id", sapDocument.getString("i_chronicle_id")); //chronicle ID

sapLinkRelation.setString("child_id", r_object_id);  //object ID

sapLinkRelation.setString("child_label", "");

sapLinkRelation.setString("description", "2@rcud@@);

sapLinkRelation.setString("sap_object_key", documentNumber); //documentNumber = COMPANY_CODE + DOC_NUMBER + YEAR

sapLinkRelation.setTime("effective_date", new DfTime());

sapLinkRelation.setRepeatingString("doc_protection", 0, "rcud");

sapLinkRelation.setRepeatingString("comp_id", 0, "data");

sapLinkRelation.setRepeatingString("format_name", 0, sapDocument.getContentType());

sapLinkRelation.setRepeatingTime("creation_date", 0, new DfTime());

sapLinkRelation.setString("relation_name", "sap_link");

sapLinkRelation.setString("sap_context", DfId.DF_NULLID_STR);

sapLinkRelation.setBoolean("sap_exclusive_link", false);

sapLinkRelation.save();

sapLinkRelation.setString("sap_doc_id", "DCTM"+sapLinkRelation.getObjectId().getId().toUpperCase()); DCTM + relation id

sapLinkRelation.save();

Is this correct? Are we missing any parameter or information that ASSAP would set when archiving natively? Or maybe setting some wrong info...

If someone also need this kind of custom code, I'll be happy to help.

Thanks,

Gustavo

Comments

  • boon046
    boon046 Member
    edited May 15, 2012 #2

    Hi,

    Not sure if this is correct. Is this working?

    We used a different approach for achieving a possible similar scenario and just used the assap webapp for both posting and reading, so:

    - get from SAP the URL to use for a new object by middleware (webmethods in our case)

    - use this URL to post to the assap webapp

    And basically we get to avoid coding in documentum and only have integration logic in middleware (which is intended for such purposes amongst others.

    regards, Mark

  • gcampos
    gcampos Member
    edited May 15, 2012 #3

    Hi Mark,

    I had a chance to test it deeply this week and it's working, I just had to make a minor change on sap_link_relation.

    You have a good point, but how you make SAP aware of the link? My requirement was to upload a document in Documentum and make both SAP and ASSAP aware of that document, like if it was added via SAP using ArchiveLink, we did it because using DMS with SAP was not an option and ArchiveLink integration only does SAP -> DCTM way.

    Regards,

    Gustavo

  • boon046
    boon046 Member
    edited May 16, 2012 #4

    Hi Gustavo,

    Well done to get this working!

    In the scenario we use, middleware post to assap, so middleware first get from SAP the link (as if SAP would post the document and SAP updates its internal table). Next middleware actually post the document via assap. So the uploading is done by middleware to the assap interface. Although I do not have all details from our middleware team, I understood this is essentially calling a specific SAP function module and use the result to call assap to upload the document.

    Regards, Mark

  • gcampos
    gcampos Member
    edited May 16, 2012 #5

    Hi Mark,

    Ok, I got the idea, it's possible to avoid creating internal Documentum data and just call the ASSAP service, thank you for sharing the idea, it's always good to have different point of views.

    Regards,

    Gustavo

  • BYue
    BYue Member
    edited May 18, 2012 #6

    Hi Gustavo,

    You did very good job on the SAP/Documentum integration part. I try to understand more about your application and processes. Is your application related to import SAP business document into Documentum, link the imported document in Documentum to SAP so that SAP users can access it from SAP GOS Attachment List? If true, then CSSAP is a natural approach. What you were doing is a part of CSSAP’s functionality.

    Is your code based on DFC/JCo? I am very interested in learning more about your code. Would you please send a copy to byue@bcyconsulting.com?

    Regards,

    Brian

  • gcampos
    gcampos Member
    edited May 18, 2012 #7

    Hi Brian,

    I tried to trace the communication between ASSAP and SAP, and some information I got from whitepapers.

    Our customer wants to bulk load documents in Documentum, and create a link in SAP FI module using document's name as the key, they contain company code, document number and year.

    The documents are linked as business documents and accessed from GOS Attachment List, but CSSAP wasn't an option because it uses DMS and our customer wanted to use ArchiveLink.

    Also, they wanted us to do validations like checking whether the document number exists on SAP or not, so we used a custom WDK component that does everything, DFC creates sap_link_relation and JCo creates the link information on SAP using ARCHIV_CONNECTION_INSERT.

    Today I was doing more tests and found that some wrong info on sap_link_relation is leading to a "document not found" error on SAP, so I'll have to check that and try to find out how ASSAP finds the document in the docbase.

    I'll send you the code, and please feel free to drop some comments on it.

    Regards,

    Gustavo

  • BYue
    BYue Member
    edited May 18, 2012 #8

    Hi Gustavo,

    Thanks for sending me the code. I did several similar projects to load AP invoices to Documentum and link them to SAP records. But I used CSSAP to do the link. The linkage was based on barcode value which is the concatenated string of document_id, company_code, and fiscal_year.

    I used DFC/JCo code to pass the barcode values to a custom RFC in SAP side which is responsible to validate the document_id, write a barcode entry into SAP BDS_BAR_IN table, and return some related characteristics. The DFC/JCo code populates related attributes with the SAP characteristics. When CSSAP job starts, it links AP invoice image to SAP records by creating a linkage entry in one of the link tables (TOA0x) and creates a linkage in SAP GOS Attachment List. The CSSAP actually uses the same SAP JCo and processes as your code does.

    What does your SAP linkage entry look like in TOA01 link table? Does it contain SAP repository ID there? When SAP users click on the GOS Attachment List, the SAP ArchiveLink will read the linkage in the table which contains SAP repository information and send an http request to SASAP. The http request header contains information including SAP repository ID like the following:

    http://assapserver:port/assap/archivelink/DocbaseName?get&pVersion=0045&contRep=ZS&docId=document_id+certificate_string

  • gcampos
    gcampos Member
    edited May 20, 2012 #9

    Hi Brian,

    Following are two entries of TOA01, the first one was created by SAP usign Business Document Create on GOS List and it works because SAP called ASSAP to create it, the second one is mine, and the error message I got was:

    "Document 'DCTM37026DCF8000493' not found on server 'test_repo_h'."

      |905ZMBKPF UMSA49003572472011 4FAB27F5FCFE1BB2E10000000A0BFD1A ZDCTMUMSA 20120511 PDF |

    |905ZMBKPF UMSA49003572472011 test_repo_h:/DCTM37026DCF8000493ZDCTMUMSA 20120510 PDF |

    So I think that my mistake was putting docbase name in the beginning of the ARC_DOC_ID field, I followed EMC whitepaper as a guideline and maybe this will work just for CSSAP, I'll try to create the link using just the "DCTM37026DCF8000493" string.

    

  • BYue
    BYue Member
    edited May 20, 2012 #10

    Hi Gustavo,

    I received your code, thanks a lot. The link key sent to SAP is correct (DobaseName:/DCTM+sap_link_relation r_object_id). The following is the link table in my system. The entries are inserted by CSSAP using barcode approach.

    TOA02 Link Table Entries.jpg

    The formats of link table entries vary depending on how the entries are inserted. Your link table entries are the same as created by CSSAP because your program uses the same approach as CSSAP does. If you use SAP T-code OAOH to archive the same object type invoice image, you will find the link table entry is different. The same thing is true when you archive SAP ADK files.

    I have a question. How did you know that the document is not found? Was that found when you retrieved the invoice through T-Code FB03 or it was found in the ASSAP log file?

  • gcampos
    gcampos Member
    edited May 20, 2012 #11

    Hi Brian,

    When I open the invoice in FB03 and click on Attachment List, the attachments uploaded by SAP to Documentum are viewed normally, and they don't have the "docbaseName:/DCTM" on it, they are using ArchiveLink so I think this may be related, my attachment has the "docbaseName:/DCTM" and SAP says it can't find the document. On ASSAP log I found the line: "Document 'DCTM37026DCF8000493' not found on server 'test_repo_h'."

    Can you query the sap_link_relation type on Documentum and check how your document's relation is stored? I didn't put DocbaseName:/ on sap_doc_id attribute, because I thought it was only needed by CSSAP to find the correct docbase, that might be my mistake. My sap_doc_id on sap_link_relation looks like: DCTM37026DCF8000493.

    Regards,

    Gustavo

    Message was edited by: Gustavo Campos

  • miles
    miles Member
    edited October 2, 2012 #12

    Hi Gustavo,

    I have a plan to do the same thing you did between DCTM and SAP.

    know that a bunch of time passed by since the post started, but can I get your JCO code if you have?

    If I may, would you email me at supconster@gmail.com?

    Thanks in advance.