Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to attach PDF files to invoice document from ECM.

vigneshwar_reddy
Active Participant
0 Kudos
7,371

Hi Gurus,

We have one requirement in that around three million  invoice pdf files are there in ECM system. we need to attach those pdf files(GOS) to  existing invoice document in SAP.as we searched in SCN we found one function module ARCHIVE_CONNECTION_INSERT. for this  function module we need pass mandatory import parameters as SAP object ID ,Document ID and some other variables(object type, doc.type , repository ID).

My problem is how can I find the value of  respective SAP object ID and Document ID  form ECM system. and how can I match the SAP object ID and Document ID.

please  help on this.

Thanks in advance!!

Regards,

Vigneshwar.D

1 ACCEPTED SOLUTION
Read only

vigneshwar_reddy
Active Participant
0 Kudos
2,872

Thanks all for your valuble suggestions.


And we have achived the requirement with the below steps.

First we have stored(copied) invoice image files in to the SAP application server.

and using OPEN DATA SET and READ DATASET reading the image file from the application server.

Calling function module"  SCMS_XSTRING_TO_BINARY" for converting String into Binary .

Create Archive-link document by calling FM "  ARCHIVOBJECT_CREATE_TABLE" and get  the archive ID(ARC_DOC_ID).

And using FM "  ARCHIV_CONNECTION_INSERT" we can archive and insert the image in to the  ECM system.

Regrads,

Vignesh

10 REPLIES 10
Read only

Abhijit74
Active Contributor
0 Kudos
2,872

Hello,

You can find Business object in BAPI (i.e BOR repository) and also you can check in SE80 by providing object directory.

You can also navigate through SWO2 and SWO3 transactions .

Other details i.e. values of SAP_OBJECT are maintained on TOAOM table ( SAP ArchiveLink: Meta table for links )


Thanks & Regards,


Abhijit

Read only

Former Member
0 Kudos
2,872

Hello,

Check with Global document type is maintained for the PDF you are looking for in OAC2. You will find the Document type, for the respective object type, check in OAC3. Content Repository is the archiving ID. Search by the archiving ID.

Regards

Rakesh

Read only

vigneshwar_reddy
Active Participant
0 Kudos
2,872

Thanks Abhijit and Rakesh for your valuable  inputs.

We found all the values for the SAP_OBJECT ,Document type, Object type and ARCHIV_ID.

My problem is how can we  match the respective values of the SAP object ID(like 51057139872013) and Document ID(like 8E36EA52E6141643E10000000AD3F470) .where I can found this data .but after executing function we found these details in TOA01.for executing function module we need  pass those  values .

Regards,

Vigneshwar.D

Read only

0 Kudos
2,872

Use the t-code OAAD and do the technical search for the business object you are looking for. This will show the sap object ID with the respective document ID.

Also check the FM ARCHIV_GET_CONNECTIONS which returns the archiving connections.

Rakesh

Read only

vigneshwar_reddy
Active Participant
0 Kudos
2,872

Hi Friends,

We are having one million invoice  PDF documents in content server(ECM).how can we  link/attach those PDF documents to invoices(accounting and invoice ) in SAP.

Iam using the function module ARCHIVE_CONNECTION_INSERT.and passing the  respective

data like (sap object:BUS2081 and BKPF,archive ID:ZI,archive doc. ID:ZAIP_INV, Doc.type:PDF and Object ID:51057999862013) but what value i need to ARC_DOC_ID.where i can get this ARC_DOC_ID.

Wheather iam following the  correct way to achive the requirement.or any thing going wrong in way.

Please suggest the possible solution for this.

Regards,

Vignesh

Read only

vigneshwar_reddy
Active Participant
0 Kudos
2,873

Thanks all for your valuble suggestions.


And we have achived the requirement with the below steps.

First we have stored(copied) invoice image files in to the SAP application server.

and using OPEN DATA SET and READ DATASET reading the image file from the application server.

Calling function module"  SCMS_XSTRING_TO_BINARY" for converting String into Binary .

Create Archive-link document by calling FM "  ARCHIVOBJECT_CREATE_TABLE" and get  the archive ID(ARC_DOC_ID).

And using FM "  ARCHIV_CONNECTION_INSERT" we can archive and insert the image in to the  ECM system.

Regrads,

Vignesh

Read only

0 Kudos
2,872

Did you have an 400 - Bad request error during development?

Read only

0 Kudos
2,872

I didn’t get any error like mentioned.

can you explain  how your getting  that error message so i can help you on this.

Read only

0 Kudos
2,872

Hi Vigneswar,

I am trying to follow the steps you indicate:

DATA: lv_id type SAEARDOID.

filele1 = XSTRLEN( l_xstring ).

CALL FUNCTION 'ARCHIVOBJECT_CREATE_TABLE'

  EXPORTING

    ARCHIV_ID                      = 'Z2'

*    ARC_DOC_ID                     = '00000212idj12j'

    DOCUMENT_TYPE                  = 'JPG'

   LENGTH                         = filele1

*   COMPID                         = 'data'

*   SIGNATURE                      = 'X'

*   VSCAN_PROFILE                  = '/SCMS/KPRO_CREATE'

IMPORTING

   ARCHIV_DOC_ID                  = lv_id

TABLES

*   ARCHIVOBJECT                   = it_upload

**   COMPONENTS                     =

   BINARCHIVOBJECT                = it_upload

EXCEPTIONS

   ERROR_ARCHIV                   = 1

   ERROR_COMMUNICATIONTABLE       = 2

   ERROR_KERNEL                   = 3

   BLOCKED_BY_POLICY              = 4

   OTHERS                         = 5

          .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

By now everything is ok, but i have doubts how to fill the next request.

CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'

    EXPORTING

   archiv_id                   = 'Z2'

      arc_doc_id                  = l_archiv_doc_id " The doc ID retrieved from the previous FM

*   AR_DATE                     = ' '

      ar_object                   = toa_dara-ar_object " What?

      del_date                    = toa_dara-del_date " What ?

      mandant                     = '100'

      object_id                   = toa_dara-object_id " What?

      sap_object                  = toa_dara-sap_object " What?

      doc_type                    = 'JPG'

*   BARCODE                     = ' '

   EXCEPTIONS

     error_connectiontable       = 1

     OTHERS                      = 2

            .

  IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.

Could you help me please?

Regards

.

Read only

0 Kudos
2,872

Hi Jon,

Please find the below answer.

ar_object                   = toa_dara-ar_object " What?:

need to pass archive object(i.e Z****  check basis team or archive team what is the archive object)


del_date                    = toa_dara-del_date " What ?

No need to pass the del_date  ,just pass only  AR_DATE   as sy-datum.


object_id                   = toa_dara-object_id " What?

Here you need to pass the combination  invoice doc. number and fiscal year.(i.e concatenate  BELNR and GJAHR and pass it)


sap_object                  = toa_dara-sap_object " What?

Need to pass the BO of invoice(I.e BUS2081)

Also you  can  also find details in my  previous   comments in this thread only.

And let me know any difficulties.


Regards,

Vigneshwar.D