Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
  Hello in this blog we show an ABAP report which uses the Communication Channel Web Service (see SAP help page (http://help.sap.com/saphelp_nw04/helpdata/en/46/6dca42e5c269dfe10000000a11466f/frameset.htm)) which is officially realeased with XI 3.0 SP21 and PI 7.0 SP13 but it is already avaliable with PI 7.0 SP12:     This Web Service gives us the methods to create, read and change the configuration of Communication Channels:     In this example we try to read and then modify the "Source Directory" and the "Adapter Status" of a Communication Channel of File type:     At first we create in the target system (where we want to read and modify the Communication Channels) the user "PIWSDIRUSER" with the permissions to read and change the Integration Directory Objects and the roles "Api_develop" and "Api_display" (see SAP help page (http://help.sap.com/saphelp_nw04/helpdata/en/46/6ec1a65eca0ad4e10000000a11466f/frameset.htm)). In the source system, in which we will create and run the ABAP report, we have to create the client proxy class (see this blog (BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP) for detailed instructions) with the address: http://%3Csource_hostname%3E:5/CommunicationChannelService/HTTPBasicAuth/portty?wsdl&style=document (http://%3Csource_hostname%3E:5/CommunicationChannelService/HTTPBasicAuth/portty?wsdl&style=document) and then we have to create the logical port "INTEGRATION_DIRECTORY" which points to our traget system. +REPORT  ZSC_COMCHAN_DEMO.+   +data:+ +     src_read_req TYPE ZPRREAD_IN_DOC,+ +     src_read_rsp TYPE ZPRREAD_OUT_DOC,+ +     src_open_req type ZPROPEN_FOR_EDIT_IN_DOC,+ +     src_open_rsp type ZPROPEN_FOR_EDIT_out_DOC,+ +     src_change_req TYPE ZPRCHANGE_IN_DOC,+ +     src_change_rsp TYPE ZPRCHANGE_OUT_DOC.+   Before using these methods we have to create the proxy object with the logical port "INTEGRATION_ENGINE":   +DATA:+ +    src_clientproxy     TYPE REF TO zprco_communication_channel_se,+ +    src_sys_exception   TYPE REF TO cx_ai_system_fault.+   +* Initialize parameters+ +logical_destination_port = 'INTEGRATION_DIRECTORY'.+   +* Create proxy+ +CREATE OBJECT src_clientproxy+ +  EXPORTING+ +    +logical_port_name = logical_destination_port.

 

The read method is the first which we will use and it allows retrieving the configuration of every Communication Channels, once it has all the Communication Channels IDs. A Communication Channel ID is made of three fields:

 

  • PARTY_ID = the name of the party which the Communication Channel belongs.
  • COMPONENT_ID = the name of the Business System / Service which the Communication Channel belongs.
  • CHANNEL_ID = The name of the Communication Channel.

 

The structure ZPRREAD_IN_DOC is a simple table. Every line is made by the Communication Channels IDs which we want to read:

 

 

So after preparing the input structure we can call the read method:

 

+data scr_comm_channell_id type ZPRCOMMUNICATION_CHANNEL_ID,+   +scr_comm_channell_id-party_id = ''.+ +scr_comm_channell_id-component_id = 'BS_CORSO2_SENDER'.+ +scr_comm_channell_id-channel_id = 'CC_FILE_In'.+ +append scr_comm_channell_id to src_read_req-COMMUNICATION_CHANNEL_READ_RE-COMMUNICATION_CHANNEL_ID.+   +TRY.+ +    CALL METHOD src_clientproxy->read+ +      EXPORTING+ +        input  = src_read_req+ +      IMPORTING+ +        output = src_read_rsp.+   +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   The structure "ZPRREAD_OUT_DOC" has two fields:   ** LOG_MESSAGE_COLLECTION: A structure which contains the log of the operations.   n.b. For this operation there aren't log messages. If a communication channel is not found in the Integration Directory then it's not present in the table COMMUNICATION_CHANNEL.   Now let's analyze the structure of a line of table COMMUNICATION_CHANNEL:     As we can see there are some attributes which can be accessed directly (The adapter name, direction etc...) and other attributes which are in the table ADAPTER_SPECIFIC_ATTRIBUTE. In order to be able to read and modify them we need to analyze the structures of the table and make some forms:   *ADAPTER_SPECIFIC_ATTRIBUTE:*   This table is very simple because a line is done by an attribute name and an attribute value: Here's an example for the "Adapter Status" attribute:   | %1,2% | *ADAPTER_SPECIFIC_ATTRIBUTE* | | *NAME* | | *VALUE* | file.adapterStatus | active |   n.b. The name of the attributes may depends on adapter type: For example every adapter type has the value "adapterStatus" in the field "name" but File adapters has the value "file.adapterStatus". The names of the Directory and File Name attributes depend on the direction of our Communication Channel.   For a "Sender" we have:   | | *NAME* | | *VALUE* | file.sourceDir | / | | file.sourceFileName | file.txt |   And for a "Receiver" we have:   | | *NAME* | | *VALUE* | file.targetDir | / | | file.targetFileName | file.txt |   Now we can code a form which takes the attribute name and return the attribute value. If it can't find the attribute it returns an initial value (for the complete code see APPENDIX A):   +FORM read_adp_sp_attr USING wa_cc type ZPRCOMMUNICATION_CHANNEL+ +                            attr_name TYPE string+ +                      CHANGING attr_value TYPE string.+ +...+ +ENDFORM.+   We can make also a form which takes as input a Communication Channel, an attribute name and attribute value. The form look for the line with attribute name: if this line is present it modifies the filed value otherwise it creates and appends anew line.   +FORM set_adp_sp_attr USING attr_name TYPE string+ +                           attr_value TYPE string+ +                     CHANGING wa_cc type ZPRCOMMUNICATION_CHANNEL.+   +...+ +ENDFORM.+   So we can loop on the response (even if we requested only one communication channel) and read and print some attributes:   +data wa_cc type ZPRCOMMUNICATION_CHANNEL.+   +data: attr_value type string,+ +      directory_name type string+   +loop at src_read_rsp-response-COMMUNICATION_CHANNEL into wa_cc.+ +       ** Print attributes (see APPENDIX A)+ +endloop.+   The next step is to call the openForEdit method: This method locks in a change list all the Communication Channels which we have passed to it. The structure of input structure ZPROPEN_FOR_EDIT_IN_DOC requires only the IDs of the Communication Channels which we want to lock:   +append scr_comm_channell_id to src_open_req-COMMUNICATION_CHANNEL_OPEN_FO-COMMUNICATION_CHANNEL_ID.+   +TRY.+ +    CALL METHOD src_clientproxy->open_for_edit+ +      EXPORTING+ +        input  = src_open_req+ +      IMPORTING+ +        output = src_open_rsp.+   +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   The response is the structure ZPROPEN_FOR_EDIT_OUT_DOC which contains three fields:   0.1. COMMUNICATION_CHANNEL: The same table of* *ZPRREAD_OUT_DOC.

  • LOG_MESSAGE_COLLECTION: The same structure of ZPRREAD_OUT_DOC.
  • CHANGE_LIST_ID: A structure with all the details of our new change list.

 

For the first time we have to read the LOG_MESSAGE_COLLECTION: In fact it's possible that another user has already locked in modify our Communication Channel. In this case the COMMUNINCATION_CHANNEL and CHANGE_LIST_ID fields are INITIAL and the LOG_MESSAGE_COLLECTION-LOG_MESSAGE_COMMUNICATION_CHA contains the error.

Let's analyze in details the structure LOG_MESSAGE_COLLECTION:

 

 

 

It contains a lot of tables but the only one which is used by the Communication Channel Service is the LOG_MESSAGE_COMMUNICATION_CHA.

A line of this table is made by two fields:

 

  • COMMUNICATION_CHANNEL_ID: The structures that identifies a Communication Channel
  • LOG_MESSAGE_ITEM:
    1. SEVERITY_CODE
    2. CLASSIFICATION_CODE
    3. MESSAGE

 

The SEVERITY_CODE is an integer which indicates seriousness of the log. The value 2 indicates a warning and the value 3 indicates an error. In case of warning operations on the Corresponding Communication Channel are executed while in case of error the operation are not executed. The classification code and message are texts which explain the reason of the warning/error.

Here are a simple form which reads the log and then prints it (for the complete code see APPENDIX A):

 

+FORM print_operation_log USING cc_log_messages TYPE zprlog_message_communicat_tab1.+

+ ...+

+ENDFORM.+

 

Now it's time to make effective our modifications using the Change operation. So let's look the ZPRCHANGE_IN_DOC structure:

 

 

It's very simple, in fact the field COMMUNICATION_CHANNEL has a different type among the homonymic structure of ZPRREAD_OUT_DOC and ZPROPEN_FOR_EDIT_OUT_DOC but they are very similar. The field CHANGE_LIST_ID is optional, in fact we can leave it empty and a new change list will be created or we can specify an open change list (for example the value returned by the open operation). Pay attention because the change operation modifies all the values in the COMMUNICATION_CHANNEL_CHANGE structures: so if you leave empty one of them, the operation assumes that you want to modify it with the empty value. The safest way is to modify the fields in the Communication Channel returned by the read/open operation and then copy the structures:

 

+data wa_change_cc type ZPRCOMMUNICATION_CHANNEL_RESTR.+

 

+ MOVE-CORRESPONDING wa_cc TO wa_change_cc.+

+  APPEND wa_change_cc TO src_change_req-communication_channel_change-communication_channel.+

 

Before calling the modify method we have to do further operations:

The first is to check the value of the field MASTER_LANGUAGE because although the read/open can give us any values the only two values admitted by the change are ‘EN' and ‘DE'. If there isn't one of them the change on the Communication Channel will fail and it will not be modified!

 

+if wa_cc-master_language ne 'EN' and wa_cc-master_language ne 'DE'.+

+    wa_cc-master_language = 'EN'.+

+endif.+

 

A same behaviour happens for the table DESCRIPTION:

 

 

Every line is made by two fields, a LANGUAGE_CODE and a text VALUE. If the line has the language code different from ‘EN'/ ‘DE' it will be ignored by the change operations and it gives us only a warning. So we can code a simple form which reads the table DESCRIPTION of a Communication Channel and modify the LANGUAGE_CODE different from ‘EN' and ‘DE' (for the complete code see APPENDIX A):

 

+FORM TRANSLATE_DESCRIPTION CHANGING wa_cc TYPE ZPRCOMMUNICATION_CHANNEL.+

+...+

+ENDFORM.+

 

The last operation is to modify the value TRANSPORT_PROTOCOL_VERSION: In fact for file adapter this field is missing in the structures returned from read/open. But in the change, this field must be present with initial value otherwise the operation will fail!

If we analyze in more detail the structure ZRPCOMMUNICATION_CHANNEL_CREA1 we see another field called CONTROLLER:

 

 

This is a table and the lines are made by a field FIELD and a field VALUE. If we insert in this table a line with the name of an attribute and certain value, the xml generated by this proxy the field will be added with his default value (see for more details sap help (http://help.sap.com/saphelp_nwpi71/helpdata/en/73/3f5c3c3906b006e10000000a11402f/frameset.htm) page for more details):

 

*FIELD* | | *VALUE* | TRANSPORT_PROTOCOL_VERSION | 1 (sai_ctrl_initial) |   We have to modify also the proxy object in order to enable this feature and then add a line to the controller and finally we can call the method change:   +DATA src_payload_protocol TYPE REF TO if_wsprotocol_payload.+   +TRY.+ +src_payload_protocol ?= src_clientproxy->get_protocol( if_wsprotocol=>payload ).+ +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   +CALL METHOD src_payload_protocol->set_extended_xml_handling+ +  EXPORTING+ +    extended_xml_handling = 'X'. +

 

+loop at src_open_rsp-response-COMMUNICATION_CHANNEL into wa_cc.+ +** Modify attributes (see APPENDIX A)+ +endloop.+   +src_change_req-communication_channel_change-change_list_id = src_open_rsp-RESPONSE-CHANGE_LIST_ID-CHANGE_LIST_ID.+   +TRY.+ +    CALL METHOD src_clientproxy->change+ +      EXPORTING+ +        input  = src_change_req+ +      IMPORTING+ +        output = src_change_rsp.+   +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   The response is the structure ZPRCHANGE_OUT_DOC which contains two fields:   0.1. LOG_MESSAGE_COLLECTION: The same structure of ZPRREAD_OUT_DOC. 0.2. CHANGE_LIST_ID: A structure with all the details of our new change list.   If the operations go well we have a Change List and no logs.   +perform print_operation_log USING src_change_rsp-response-LOG_MESSAGE_COLLECTION-LOG_MESSAGE_COMMUNICATION_CHA.+   Now we can log on the Integration Builder: Configuration as PIWSDIRUSER and activate our Change List.     As default the change list is called Created with API plus the timestamp plus the user.   *APPENDIX A:*   Here is the complete source code of report ZSC_COMCHAN_DEMO.   +*&-------------------------------------------------------------------- *+ +*& Report  ZSC_COMCHAN_DEMO+ +*&+ +*&-------------------------------------------------------------------- *+ +*&+ +*&+ +*&-------------------------------------------------------------------- *+   +REPORT  ZSC_COMCHAN_DEMO.+   +*Input parameters+   +data:+ +      logical_destination_port like srt_lp_key_fields-lp_name.+   +* Proxy Management Variables+ +DATA:+ +    src_clientproxy     TYPE REF TO zprco_communication_channel_se,+ +    src_sys_exception   TYPE REF TO cx_ai_system_fault,+ +    src_payload_protocol TYPE REF TO if_wsprotocol_payload.+   +* Proxy Operation Structures+ +data:+ +     src_read_req TYPE ZPRREAD_IN_DOC,+ +     src_read_rsp TYPE ZPRREAD_OUT_DOC,+ +     src_open_req type ZPROPEN_FOR_EDIT_IN_DOC,+ +     src_open_rsp type ZPROPEN_FOR_EDIT_out_DOC,+ +     src_change_req TYPE ZPRCHANGE_IN_DOC,+ +     src_change_rsp TYPE ZPRCHANGE_OUT_DOC.+   +* Structures for Communication Channel:+ +data:+ +      scr_comm_channell_id type ZPRCOMMUNICATION_CHANNEL_ID,+ +      ++wa_cc type ZPRCOMMUNICATION_CHANNEL,+ +      wa_change_cc type ZPRCOMMUNICATION_CHANNEL_RESTR.+   +* Initialize parameters+ +logical_destination_port = 'INTEGRATION_DIRECTORY'.+   +* Create proxy+ +CREATE OBJECT src_clientproxy+ +  EXPORTING+ +    +logical_port_name = logical_destination_port.

 

+** We need that the proxy for the source system has advanced control for sending xml+ +TRY.+ +src_payload_protocol ?= src_clientproxy->get_protocol( if_wsprotocol=>payload ).+ +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+ +CALL METHOD src_payload_protocol->set_extended_xml_handling+ +  EXPORTING+ +    extended_xml_handling = 'X'.+   +scr_comm_channell_id-party_id = ''.+ +scr_comm_channell_id-component_id = 'BS_CORSO2_SENDER'.+ +scr_comm_channell_id-channel_id = 'CC_FILE_In'.+ +append scr_comm_channell_id to src_read_req-COMMUNICATION_CHANNEL_READ_RE-COMMUNICATION_CHANNEL_ID.+   +TRY.+ +    CALL METHOD src_clientproxy->read+ +      EXPORTING+ +        input  = src_read_req+ +      IMPORTING+ +        output = src_read_rsp.+   +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   +data: attr_value type string,+ +      directory_name type string.+   +loop at src_read_rsp-response-COMMUNICATION_CHANNEL into wa_cc.+   +  if wa_cc-ADAPTER_METADATA-name ne 'File' and wa_cc-TRANSPORT_PROTOCOL ne 'File'.+ +    CONTINUE.+ +  endif.+   +  if wa_cc-direction eq 'Sender'.+ +    directory_name = 'file.sourceDir'.+ +  else.+ +    directory_name = 'file.targetDir'.+ +  endif.+   +  PERFORM READ_ADP_SP_ATTR+ +              USING+ +                 WA_CC+ +                 directory_name+ +              CHANGING+ +                 ATTR_VALUE.+   +  write attr_value.+ +  PERFORM READ_ADP_SP_ATTR+ +              USING+ +                 WA_CC+ +                 'file.adapterStatus'+ +              CHANGING+ +                 ATTR_VALUE.+   +  write attr_value.+ +  write /.+   +endloop.+   +append scr_comm_channell_id to src_open_req-COMMUNICATION_CHANNEL_OPEN_FO-COMMUNICATION_CHANNEL_ID.+   +TRY.+ +    CALL METHOD src_clientproxy->open_for_edit+ +      EXPORTING+ +        input  = src_open_req+ +      IMPORTING+ +        output = src_open_rsp.+   +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   +perform print_operation_log USING src_open_rsp-response-LOG_MESSAGE_COLLECTION-LOG_MESSAGE_COMMUNICATION_CHA.+   +loop at src_open_rsp-response-COMMUNICATION_CHANNEL into wa_cc.+   +  if wa_cc-ADAPTER_METADATA-name ne 'File' and wa_cc-TRANSPORT_PROTOCOL ne 'File'.+ +    CONTINUE.+ +  endif.+   +  if wa_cc-direction eq 'Sender'.+ +    directory_name = 'file.sourceDir'.+ +  else.+ +    directory_name = 'file.targetDir'.+ +  endif.+   +  PERFORM SET_ADP_SP_ATTR+ +            USING+ +               directory_name+ +               'gestopeXI/'+ +            CHANGING+ +               WA_CC.+ +  PERFORM SET_ADP_SP_ATTR+ +          USING+ +             'file.adapterStatus'+ +             'active'+ +          CHANGING+ +             WA_CC.+  +  if wa_cc-master_language ne 'EN' and wa_cc-master_language ne 'DE'.+ +    wa_cc-master_language = 'EN'.+ +  endif.+   +  PERFORM TRANSLATE_DESCRIPTION CHANGING WA_CC.+   +  MOVE-CORRESPONDING wa_cc TO wa_change_cc.+   +  IF wa_change_cc-transport_protocol_version IS INITIAL.+ +    DATA controller_line TYPE LINE OF zprchange_in_doc-controller.+   +    controller_line-field = 'TRANSPORT_PROTOCOL_VERSION'.+ +    controller_line-value = '1'.+ +    APPEND controller_line TO wa_change_cc-controller.+ +  ENDIF.+   +  APPEND wa_change_cc TO src_change_req-communication_channel_change-communication_channel.+   +endloop.+   +src_change_req-communication_channel_change-change_list_id = src_open_rsp-RESPONSE-CHANGE_LIST_ID-CHANGE_LIST_ID.+   +TRY.+ +    CALL METHOD src_clientproxy->change+ +      EXPORTING+ +        input  = src_change_req+ +      IMPORTING+ +        output = src_change_rsp.+   +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   +perform print_operation_log USING src_change_rsp-response-LOG_MESSAGE_COLLECTION-LOG_MESSAGE_COMMUNICATION_CHA.+   +*&-------------------------------------------------------------------- *+ +*&      Form  PRINT_MESSAGE+ +*&-------------------------------------------------------------------- *+ +*       text+ +*--------------------------------------------------------------------- *+ +*  -->  p1        text+ +*  <--  p2        text+ +*--------------------------------------------------------------------- *+ +FORM PRINT_MESSAGE USING channel_id type ZPRCOMMUNICATION_CHANNEL_ID+ +                        message TYPE string+ +                        severity_code type string.+   +  CONSTANTS warning_code TYPE i VALUE '2'.+   +  CONCATENATE channel_id-PARTY_ID channel_id-COMPONENT_ID channel_id-channel_id message INTO message SEPARATED BY space.+     +  if severity_code lt warning_code.+ +* success+ +    write: / message.+ +  elseif severity_code eq warning_code .+ +* warning+ +    write: / message COLOR 3.+ +  else.+ +* failure+ +    write: / message COLOR COL_NEGATIVE.+ +  endif.+   +ENDFORM.                    " PRINT_MESSAGE+ +*&-------------------------------------------------------------------- *+ +*&      Form  print_operation_log+ +*&-------------------------------------------------------------------- *+ +*       text+ +*--------------------------------------------------------------------- *+ +*  -->  p1        text+ +*  <--  p2        text+ +*--------------------------------------------------------------------- *+ +FORM print_operation_log USING cc_log_messages TYPE zprlog_message_communicat_tab1.+ +  CONSTANTS error_code TYPE i VALUE '3'.+ +  CONSTANTS warning_code TYPE i VALUE '2'.+   +  DATA wa_cc_log_messages LIKE LINE OF cc_log_messages.+   +  LOOP AT cc_log_messages INTO wa_cc_log_messages.+ +    DATA message_type TYPE c.+ +    DATA message_string TYPE string.+ +    DATA cc_id type ZPRCOMMUNICATION_CHANNEL_ID.+   +* we prepare the string to print+ +    ++CONCATENATE 'Classification Code:' wa_cc_log_messages-log_message_item-classification_code message_string+ +                'Message:' wa_cc_log_messages-log_message_item-message-value INTO message_string SEPARATED BY space.+   +* we pass the cc details+ +    CLEAR cc_id.+ +    cc_id-party_id = wa_cc_log_messages-communication_channel_id-party_id.+ +    cc_id-component_id = wa_cc_log_messages-communication_channel_id-component_id.+ +    cc_id-channel_id = wa_cc_log_messages-communication_channel_id-channel_id.+ +* now we print the log+ +    PERFORM PRINT_MESSAGE USING cc_id message_string wa_cc_log_messages-log_message_item-severity_code.+ +  ENDLOOP.+   +ENDFORM.                    " print_operation_log+ +*&-------------------------------------------------------------------- *+ +*&      Form  read_adp_sp_attr+ +*&-------------------------------------------------------------------- *+ +*       text+ +*--------------------------------------------------------------------- *+ +*  -->  p1        text+ +*  <--  p2        text+ +*--------------------------------------------------------------------- *+ +FORM read_adp_sp_attr USING wa_cc type ZPRCOMMUNICATION_CHANNEL+ +                            attr_name TYPE string+ +                      CHANGING attr_value TYPE string.+   +  DATA cc_attr LIKE LINE OF wa_cc-adapter_specific_attribute.+   +  CLEAR attr_value.+   +  READ TABLE wa_cc-adapter_specific_attribute INTO cc_attr WITH KEY name = attr_name.+ +  CHECK sy-subrc EQ 0.+ +  attr_value = cc_attr-value.+   +ENDFORM.                   " read_adp_sp_attr+ +*&-------------------------------------------------------------------- *+ +*&      Form  set_adp_sp_attr+ +*&-------------------------------------------------------------------- *+ +*       text+ +*--------------------------------------------------------------------- *+ +*  -->  p1        text+ +*  <--  p2        text+ +*--------------------------------------------------------------------- *+ +FORM set_adp_sp_attr USING attr_name TYPE string+ +                           attr_value TYPE string+ +                     CHANGING wa_cc type ZPRCOMMUNICATION_CHANNEL.+   +  DATA wa_adapter_attr_line LIKE LINE OF wa_cc-adapter_specific_attribute.+   +  READ TABLE wa_cc-adapter_specific_attribute INTO wa_adapter_attr_line WITH KEY name = attr_name.+   +  wa_adapter_attr_line-value = attr_value.+ +  IF sy-subrc EQ 0.+ +    MODIFY wa_cc-adapter_specific_attribute INDEX sy-tabix FROM wa_adapter_attr_line.+ +  ELSE.+ +    wa_adapter_attr_line-name = attr_name.+ +    APPEND wa_adapter_attr_line TO wa_cc-adapter_specific_attribute.+ +  ENDIF.+ +ENDFORM.                      " set_adp_sp_attr+ +*&-------------------------------------------------------------------- *+ +*&      Form  TRANSLATE_DESCRIPTION+ +*&-------------------------------------------------------------------- *+ +*       text+ +*--------------------------------------------------------------------- *+ +*  -->  p1        text+ +*  <--  p2        text+ +*--------------------------------------------------------------------- *+ +FORM TRANSLATE_DESCRIPTION CHANGING wa_cc TYPE ZPRCOMMUNICATION_CHANNEL.+ +  DATA wa_description TYPE zprlong_description.+   +  LOOP AT wa_cc-description INTO wa_description.+ +    +IF wa_description-language_code NE 'EN' OR wa_description-language_code NE 'DE'.

 

+      wa_description-language_code = 'EN'.+ +      MODIFY wa_cc-description INDEX sy-tabix FROM wa_description .+   +    ENDIF.+ +  ENDLOOP.+ +ENDFORM.                    " TRANSLATE_DESCRIPTION+   *APPENDIX B: Query Method*   The query method allows discovering the IDs of the Communication Channels present in a system using a lot of filters. Here is the ZPRQUERY_IN_DOC structure:     For example we can search for all the Communication Channel IDs in a system with these instructions:   +data:+ +     src_query_req TYPE ZPRQUERY_IN_DOC,+ +     src_query_rsp TYPE ZPRQUERY_OUT_DOC.+   +src_query_req-communication_channel_query_r-communication_channel_id-party_id = '*'.+ +src_query_req-communication_channel_query_r-communication_channel_id-component_id = '*'.+ +src_query_req-communication_channel_query_r-communication_channel_id-channel_id = ''.+   +TRY.+ +    CALL METHOD src_clientproxy->query+ +      EXPORTING+ +        input  = src_query_req+ +      IMPORTING+ +        output = src_query_rsp.+   +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   The response is the structure ZPRQUERY_OUT_DOC:     As we can see it contains the usual LOG_MESSAGE_COLLECTION and the table COMMUNICATION_CHANNEL_ID which has a line for each Communication Channel ID discovered. We can use these data as input for the other operations with a simple loop:   +data wa_cc_id type ZPRCOMMUNICATION_CHANNEL_ID.+   +loop at src_query_rsp-response-communication_channel_id into wa_cc_id.+ +  append wa_cc_id to src_read_req-COMMUNICATION_CHANNEL_READ_RE-COMMUNICATION_CHANNEL_ID.+ +endloop  +

 

Now when we call the read method we will have as response the configuration of every Communication Channels found with the query method.

 

*APPENDIX C: Revert Method*

 

The revert operations allows us to remove a Communication Channel from a change list rejecting the changes on it. This operation need only a list of Communication Channel IDs and then it will search in all the change list in charge of our user (PIWSDIRUSER) and delete them.

So the structure ZPRREVERT_IN_DOC is a simply a table of Communication Channel IDs:

 

+data:+ +      src_rev_req type ZPRREVERT_IN_DOC,+ +      src_rev_rsp type ZPRREVERT_OUT_DOC,+ +   wa_cc_id type ZPRCOMMUNICATION_CHANNEL_ID.+   +wa_cc_id-component_id = 'BS_CORSO2_SENDER'.+ +wa_cc_id-channel_id = 'CC_FILE_In'.+   +append wa_cc_id to src_rev_req-COMMUNICATION_CHANNEL_REVERT-COMMUNICATION_CHANNEL_ID.+ +TRY.+ +    CALL METHOD src_clientproxy->revert+ +      EXPORTING+ +        input  = src_rev_req+ +      IMPORTING+ +        output = src_rev_rsp.+   +  CATCH cx_ai_system_fault INTO src_sys_exception.+ +ENDTRY.+   The response is the structure ZPRREVERT_OUT_DOC:     It contains only the log of the operation: as usual if the operations are successfully there aren't logs.   *APPENDIX 😧 Adapter_Specific_Table_Attrib*  

9 Comments