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

EDI_DATA_INCOMING

Former Member
0 Likes
2,842

Hi all,

I am using EDI_DATA_INCOMING in my program .To this Function module i need to pass file name and port name . this function module i am calling in a loop . One of the file in the loop contains errors or if i give wrong port number . the program should skip that file and need to process the next file.Due to this function module the program is stopping with an error message . How could i overcome that one?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,003

Handle the execption of the function module when the file display a success message like ERROR

AND use RETURN.

LOOP AT ITAB.
Call Function 'XXX'
EXECPTIONS.

IF <SY_SUBRC >           " File not found
Message 'XXX' type 'S' Display like 'E'.
Return.
ENDIF.
ENDLOOP.

Regards,

Gurpreet

Hi all,

I am using EDI_DATA_INCOMING in my program .To this Function module i need to pass file name and port name . this function module i am calling in a loop . One of the file in the loop contains errors or if i give wrong port number . the program should skip that file and need to process the next file.Due to this function module the program is stopping with an error message . How could i overcome that one?

11 REPLIES 11
Read only

former_member156446
Active Contributor
0 Likes
2,003

Check CL_GUI_FRONTEND_SERVICES=>FILE_EXIST. if this method returns sy-subrc 0. then call your FM of EDI.

data:RCbool type ABAP_BOOL.
  WRITE: / 'TEST METHOD FILE_EXIST'.
  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
    EXPORTING
      FILE                 = 'c:\temp\test_frontend_services.txt'
    RECEIVING
      RESULT               = rcbool
*  EXCEPTIONS
*    CNTL_ERROR           = 1
*    ERROR_NO_GUI         = 2
*    WRONG_PARAMETER      = 3
*    NOT_SUPPORTED_BY_GUI = 4
*    others               = 5
          .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  WRITE: / RCbool.

Read only

former_member376453
Contributor
0 Likes
2,003

I don't think you can handle this. You can check in the program of this FM, there is one EXIT command if, port is wrong. So It's not possible to skip this.

Kuntal

P.S. - As Jay said, nly way to validate everything and filter the data before going into loop.

Edited by: Kuntal Nandi on Mar 17, 2009 2:36 PM

Read only

0 Likes
2,003

If any errors in the file the progra terminates with an error. is there any way to overcome this?

Read only

0 Likes
2,003

that's what I have siad earlier. You which are the possibility to have some error data in the file. So, validate those data then pass the value to the final table, where you are looping, else skip that data, so that function module should not be processed with any wrong data.

I don't think, there is any way out, to skip error part in the standard FM. Hope this will help you.

Kuntal

Read only

0 Likes
2,003

Hi,

Firstly try to un-comment the exceptions of the function module and alsoin the if condition if sy-subrc <> 0.

just display a success message and display it like 'E'... and the loop will still continue to next....

and in the loop try writing continue or return....

or else if you are getting the short dump then

paste the code probably we would be in a better position to fix your issue

Regards,

Gurpreet

Read only

0 Likes
2,003

I think just to remove the exception, for a specific business requirement, editing a standard FM is very much meaning full, as because this has been used in many standard program as well, which may create some inconsistency if remove the exception.

Kuntal

Read only

0 Likes
2,003

Hi Kuntal,

here we are talking about un-commenting the Exceptions may be in better words de-commenting it from the

call.But not removing it from the standard exceptions.

I think in hurry you misunderstood the sentence written by me in the earlier post.Please read carefully before getting to any conclusions and commenting .

Regards,

Gurpreet

Read only

0 Likes
2,003

Hi Gurpreet,

there was no exception parameter for this FM (So, it's not possible to comment the exception parameters in the call), if there is any error, it will raise exception inside of this FM. So, I thought that you are talking about for commenting out the code.

Kuntal

Read only

Former Member
0 Likes
2,004

Handle the execption of the function module when the file display a success message like ERROR

AND use RETURN.

LOOP AT ITAB.
Call Function 'XXX'
EXECPTIONS.

IF <SY_SUBRC >           " File not found
Message 'XXX' type 'S' Display like 'E'.
Return.
ENDIF.
ENDLOOP.

Regards,

Gurpreet

Read only

uwe_schieferstein
Active Contributor
0 Likes
2,003

Hello Tashvi

I do not see any possibility how to overcome or catch the A(bort) messages that can be raised within the function module.

However, if your inbound IDoc processing occurs within a Z-report where you call fm EDI_DATA_INCOMING then you could use the following approach:

- Copy EDI_DATA_INCOMING -> Z_EDI_DATA_INCOMING

- Add one or more exceptions to the interface of the Z-function module

- Inactivate in the Z-fm all coding which does the processing if both file and port are ok

- Add the exception to the A(bort) messages ( MESSAGE ... TYPE 'A' ... RAISING <name of exception>)

If all of the checks are successfully passed then you can call EDI_DATA_INCOMING within your Z-fm at the very end of the coding.

Regards

Uwe

Read only

former_member723628
Active Participant
0 Likes
2,003

Tashvi,

To circumvent the issue I think you can take one of the two approaches outlined below:

1. Use the function module EDI_DATA_INCOMING the way it is inteded to be used, i.e., through RFC. What I mean to say is try to mimic the RFC call from within your program by specifying RFC destination and calling the FM asyncronously. This will issolate the FM LUW from your program LUW would avoid termination of your program. I haven't really used this method but just give it a try it might work.

2. Create a new report program which takes file name and port as paramters and calls the function module EDI_DATA_INCOMING. Now within the loop in your current program submit this program as a batch job to be executed asyncronously again.

Since this function module does not return any paramters or exceptions the success or error tracking is out of question.

Hope this resolves your problem.

Regards,

Gajendra

Edited by: Gajendra Bhatt on Mar 17, 2009 6:16 PM