cancel
Showing results for 
Search instead for 
Did you mean: 

How to start picking files from source folder once a particular file is placed?

Former Member
0 Kudos

Hello Experts,

My requirement is like ECC is creating multiple file and Client wants that PI should start picking the file only once a final file like'.done' file is there.

Can any one help me on this that how can we proceed with this requirement?

I have gone through following two options:

Option 1: "Msecs to Wait Before Modification Check".

Option 2: Trigger file logic through checking 'Additional File(s)' check box in Sender Communication Channel.

Regards,

Pradeep

Accepted Solutions (1)

Accepted Solutions (1)

Harish
Active Contributor
0 Kudos

Hi Pradeep,

you can use the trigger file option. Please check the below wiki question 4

Sender File Adapter Frequently Asked Questions - Process Integration - SCN Wiki

Former Member
0 Kudos

Hi Harish,

I have gone through this blog but it couldn't help if the number of files are more than one with different name.

former_member182412
Active Contributor
0 Kudos

Hi Pradeep,

After you place the done file you can start the channel externally in the abap program itself, please check the below blog for reference.

Regards,

Praveen.

Former Member
0 Kudos

Hi Praveen,

This option looks pretty good to me.

I will surely check this by tomorrow and will update you .

Regards,

Pradeep

Former Member
0 Kudos

Hi Pradeep,

If you want to pick number of files with different name you can use advanced file selection option

using that you can able to pick the files.

Regards,

Subhani

Former Member
0 Kudos

Hi Praveen,

I have gone through this blog and created the report. But while calling method

*Get http response from server

call method CLIENT->RECEIVE

   exceptions

     HTTP_COMMUNICATION_FAILURE = 1

     HTTP_INVALID_STATE         = 2

     HTTP_PROCESSING_FAILED     = 3

     others                     = 4.


Sy-subrc value is coming as '1' and giving following error 'HTTPIO_PLG_CANCELED'.


Can you tell me what can be wrong in this.


Regards,

Pradeep

Former Member
0 Kudos

Hi Pradeep,

copy and paste your code,so that we can check where the error is triggering.

Regards,

Subhani

Former Member
0 Kudos

Hello,

Here is my code, and its failing at "call method CLIENT->RECEIVE". Here Sy-subrc value is coming as 1.

data: V_URL type STRING,

       CLIENT type ref to IF_HTTP_CLIENT.

data: RESPONSE_CODE type  SYSUBRC,

       RESPONSE_TEXT type  STRING.

data: FIELDS_TAB type TIHTTPNVP,

       STATUS_CODE type STRING,

       STATUS_REASON type STRING,

       NUMBER type I.

data: W_RESULT type STRING,

       RESULT_TAB type table of STRING,

       RESULT_WA like line of RESULT_TAB.

"Get comm channel status

*V_URL = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=status'.

"Start comm channel

v_url = 'http(s):XXX.XX.XXX.XXX:XXXXX/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=CC_File_Merch_Recv&action=start'.

"Stop comm channel

"v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=stop'.

call method CL_HTTP_CLIENT=>CREATE

   exporting

     HOST               = 'XXX.XX.XXX.XXX'         "PI system name

     SERVICE            = 'XXXXX'      "Port number

*      PROXY_HOST         =

*      PROXY_SERVICE      =

*      SCHEME             = SCHEMETYPE_HTTP

*      SSL_ID             =

*      SAP_USERNAME       =

*      SAP_CLIENT         =

   importing

     CLIENT             = CLIENT

   exceptions

     ARGUMENT_NOT_FOUND = 1

     PLUGIN_NOT_ACTIVE  = 2

     INTERNAL_ERROR     = 3

     others             = 4.

*if SY-SUBRC <> 0.

*  message E000 with SY-SUBRC.

*endif.

*

*if SY-SUBRC <> 0.

*  message E000 with SY-SUBRC.

*endif.

*set header fields

call method CLIENT->REQUEST->SET_HEADER_FIELD

   exporting

     NAME  = '~request_method'

     VALUE = 'POST'.

call method CLIENT->REQUEST->SET_HEADER_FIELD

   exporting

     NAME  = 'Content-Type'

     VALUE = 'application/xml'. "; charset=UTF-8' .

*Set request protocol

call method CLIENT->REQUEST->SET_HEADER_FIELD

   exporting

     NAME  = '~server_protocol'

     VALUE = 'HTTP/1.0'.

*Update url

call method CLIENT->REQUEST->SET_HEADER_FIELD

   exporting

     NAME  = '~request_uri'

     VALUE = V_URL.

*Disable logon popup

CLIENT->PROPERTYTYPE_LOGON_POPUP = CLIENT->CO_DISABLED.

call method CLIENT->AUTHENTICATE

    exporting

       USERNAME             = 'XXXXXX'       "Username

       PASSWORD             = 'XXXXXX'  .     "Password

CL_HTTP_UTILITY=>SET_REQUEST_URI( REQUEST = CLIENT->REQUEST

                                   URI = RESPONSE_TEXT ).

*Send http request to server

call method CLIENT->SEND

   exceptions

     HTTP_COMMUNICATION_FAILURE = 1

     HTTP_INVALID_STATE         = 2

     HTTP_PROCESSING_FAILED     = 3

     others                     = 4.

if SY-SUBRC <> 0.

   call method CLIENT->GET_LAST_ERROR

     importing

       CODE    = RESPONSE_CODE

       message = RESPONSE_TEXT.

   message I000(SR) with RESPONSE_TEXT.

   exit.

endif.

*Get http response from server

call method CLIENT->RECEIVE

   exceptions

     HTTP_COMMUNICATION_FAILURE = 1

     HTTP_INVALID_STATE         = 2

     HTTP_PROCESSING_FAILED     = 3

     others                     = 4.

if SY-SUBRC <> 0.

   call method CLIENT->GET_LAST_ERROR

     importing

       CODE    = RESPONSE_CODE

       message = RESPONSE_TEXT.

   STATUS_CODE = CLIENT->RESPONSE->GET_HEADER_FIELD( '~status_code' ).

   STATUS_REASON = CLIENT->RESPONSE->GET_HEADER_FIELD( '~status_reason' ).

   concatenate RESPONSE_TEXT '(' STATUS_CODE STATUS_REASON ')'

   into STATUS_REASON separated by SPACE.

   message I000(SR) with STATUS_REASON.

   exit.

endif.

*Get header_fields contents such status code, reason etc

"call method client->response->GET_HEADER_FIELDS

"   changing

"     FIELDS             =  Fields_Tab  .

clear: W_RESULT.

W_RESULT = CLIENT->RESPONSE->GET_CDATA( ).

refresh RESULT_TAB.

split W_RESULT at CL_ABAP_CHAR_UTILITIES=>NEWLINE into table RESULT_TAB.

loop at RESULT_TAB into RESULT_WA.

   write / RESULT_WA.

endloop.

Former Member
0 Kudos

Hi Subhani,

Its not about picking multiple file.

We have to start picking the file only once Job is completed in ECC and ECC will place '.done' file.

Once '.done' file is there PI needs to start picking the file and process them.

Regards,

Pradeep

Former Member
0 Kudos

Hi Pradeep,

Actual one is this

"Start comm channel
"v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=start'. 

"Stop comm channel
"v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=stop'. 

But you have written this.

"Start comm channel

v_url = 'http(s):XXX.XX.XXX.XXX:XXXXX/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=CC_File_Merch_Recv&action=start'.

"Stop comm channel

"v_url = '/AdapterFramework/ChannelAdminServlet?party=*&service=*&channel=Test_CommChannel_ExtCtrl&action=stop'.



Check it onece.

Former Member
0 Kudos

Hi Pradeep,

I got your point,earlier i thought issue is related to multiple files.

Regards,

Subhani

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Guys..

This problem is resolved. Now I am calling the suggested Report from ECC to start the Communication Channel externally once Job is completed in ECC.

Regards,

Pradeep

Former Member
0 Kudos

Hi Pradeep,

So is it a batch job which is creating these multiple files and placing in the directory? You can set the Polling interval of the channel or set up Availability time planning for this channel to pick up file in a time interval when the job ends or based on the logic in place.

Regards,

Sriram

Former Member
0 Kudos

Hello Sriram,

Yes its a Batch job and above option could not suffice as we have time constrain and needs to start picking the files as soon as the '.done' file is placed

Former Member
0 Kudos

Hi Pradeep,

Agree, so whats the frequency of the job?

Regards,

Sriram

Former Member
0 Kudos

Hi Sriram,

This is a daily job and we have to complete the job in less than 2 hour of which ECC part is taking around 1.5 hours for data extraction.

Regards

Pradeep

Former Member
0 Kudos

Hi Pradeep,

If its a daily job, then you set up ATP as per the end time of the job with some buffer and set an external control to start the channels and stop it post that.

Try and see if it works and satisifies ur requirement. If i have not understood the requirement correctly please do let me know so that i can help further

Regards,

Sriram

Former Member
0 Kudos

Hi Sriram,

Can you please elaborate the external control thing to start or stop the channel.

Regards,

Pradeep

Former Member
0 Kudos

Hi Pradeep,

Please check the below link.

Controlling a Communication Channel Externally - Process Integration Monitoring - SAP Library

External control may not even be required if you know that the predefined job finishes at a paritcular time. You may just start the channel based on the job end time with a buffer..

Regards,
Sriram