Ansicht
Dokumentation

CRM_WEBREQ_EXTERN_CREATE_DOC - Create a Web Request with Attachments - Offline

CRM_WEBREQ_EXTERN_CREATE_DOC - Create a Web Request with Attachments - Offline

General Material Data   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This function module enables you to create a Web request offline using an external interface. You can also specify files that are saved as attachments for the business transaction created in SAP S/4 HANA for customer management.

This means that a business transaction is created with the transaction type assigned to the request category. The requester (if transferred to the interface, or placed in the Business Add-In (BAdI) method FORM_ON_CREATIONin the 'envelope' (header information of the XML file)) is entered as a business partner with the specification sold-to party in the partner list. If a product is assigned to the request category, the product is also created in the business transaction.

The XML stream (data information in the 'body' tag) represents the form. The XML document is provided with the 'envelope', in which tax data is documented, and stored in the database in the Knowledge Provider (KPro) of SAP S/4 HANA for customer management as a KPro document in the document area CRM_WEBREQ(as is the case with forms that are created online). A link is created between this object and the business transaction, so that the form can be fetched from the transaction to be displayed or changed. The documents of a Web request that are stored as attachments are saved as KPro documents in the document area Customer Management documents.

The following prerequisites must be met to create offline Web requests with attachments:

  • The request category must exist in the S/4 HANA for customer management system with the relevant request data structure and transaction type. Otherwise, the interface is terminated and an error message is displayed. The parameter for the request category is a required entry field.
  • An XML file "suitable for" the request category must be provided as an XML stream. This means that the XML tags used must also form part of the request data structure definition.
  • If business partners are specified for the creator and the requester, these must exist in the system. Otherwise, processing is terminated and an error message is displayed.

Note the following if you specify documents as attachments:

  • The following parameters belong together as pairs, in each case. This means that values must always be specified for both or neither of them.
  • IS_CONT_DOC1 / IS_PROP_DOC1

  • IS_CONT_DOC2/ IS_PROP_DOC2

  • IT_CONT_DOC/ IT_PROP_DOC

The parameters IS_CONT_DOC1 / IS_PROP_DOC1and IS_CONT_DOC2 / IS_PROP_DOC2are for compressed data (for example, *.jpg or *.zip).
The table parameters IT_CONT_DOC / IT_PROP_DOCare for non-compressed files (for example *.xml, *.txt, *.doc, *.pdf , *.ppt, *.xds). In both tables, the link between the content (IT_CONT_DOC) and the properties (IT_PROP_DOC) of a specific attachment is created using the document number.
  • The values entered for the properties should be as accurate as possible in order that the attachment can be saved (file size and HTML MIME type) and supplies the important information in the customer management system (for example, file name).

Example

parameters:
       preqtype  type  crmt_req_type,
       pcreator  type  bu_partner,
       prequest  type  bu_partner,
       pcateg    type  crmt_act_category.

data:

      lv_xml             type string,

      lv_order_guid      type crmt_object_guid,

      ls_message         type bapiret2,

      ls_cont_doc1       type xstring,

      ls_prop_doc1       type crmt_doc_prop,

      lt_cont_doc        type crmt_doc_contt,

      lt_prop_doc        type crmt_doc_propt,

      lt_message         type bapirettab,

      lt_webreq_message  type bapirettab.

call function 'CRM_WEBREQ_EXTERN_CREATE_DOC'

  exporting

    iv_reqtype        = preqtype

    iv_bupa_creator   = pcreator

    iv_bupa_requester = prequest

    iv_xml            = lv_xml

    iv_category       = pcateg

    is_cont_doc1      = ls_cont_doc1

    is_prop_doc1      = ls_prop_doc1

  importing

    ev_order_guid     = lv_order_guid

  tables

    it_cont_doc       = lt_cont_doc

    it_prop_doc       = lt_prop_doc

    et_message        = lt_message

    et_webreq_message = lt_webreq_message.      

Notes

If you transfer more than two compressed files, it is also possible to transfer these in the tables IT_CONT_DOC / IT_PROP_DOC. This means that the availability of only two corresponding parameter pairs is not a restriction. The only disadvantage of this method is a slight loss of performance.

A business transaction is also saved when errors occur in the request, in the transaction, or in relation to the attachments. The recorded error messages are returned in the tables ET_MESSAGE(general errors) and ET_WEBREQ_MESSAGE(errors in the request). The creation of a transaction is terminated only if there are critical parameter errors or inconsistencies in the Customizing entries.

Parameter EV_ORDER_GUIDcontains the information on the creation of a transaction with a linked request. If a GUID is returned in this parameter, a transaction has been created. Nevertheless, we recommend that you look at the error messages recorded in table ET_MESSAGE. When processing the request, the agent or caseworker sees and can correct any errors in the request.

Further information

You can test the functions of this module using the sample program CRM_WEBREQ_EXTERN_WITH_UPLOADA.





Parameters

ET_MESSAGE
ET_WEBREQ_MESSAGE
EV_ORDER_GUID
IS_CONT_DOC1
IS_CONT_DOC2
IS_PROP_DOC1
IS_PROP_DOC2
IT_CONT_DOC
IT_PROP_DOC
IV_BUPA_CREATOR
IV_BUPA_REQUESTER
IV_CATEGORY
IV_COMMIT_FLAG
IV_PARAMETER
IV_REQTYPE
IV_XML

Exceptions

Function Group

CRM_WEBREQ_EXTERN

BAL_S_LOG - Application Log: Log header data   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 10961 Date: 20240523 Time: 093920     sap01-206 ( 132 ms )