cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Program fails via SE38 but not in BW Process chain

sherif_elkoumy
Participant
0 Kudos

Hello ABAP experts

I have an issue with my ABAP program. I fill internal table and then modify the database table from the internal table. If the internal table empty, abort the program. I then added the program to process chain. I was excepting that the program fails in the process chain because the empty internal table. This was not tru and the program executed without errors. What do I do wrong here?

ABAP Code

When I execute in SE38

but when I include the program in process chain

it gets executed without error message

What is wrong here?

matt
Active Contributor
0 Kudos

What is the definition of lt_result?

By the way. Your check for sy-subrc eq 0 is entirely unnecessary.

raymond_giuseppi
Active Contributor
0 Kudos

Is sy-subrc = 0 when executed from process chain?

sherif_elkoumy
Participant
0 Kudos

Hi Matthew

lt_result ist a normal standard table contains 7 columns.

ls_result TYPE json_str,

lt_result TYPE STANDARD TABLE OF json_str,

I fill it from json and then move its content to db table and on this table I have a datasource to load into BW DSO.

regards,
Sh

matthew.billingham

sherif_elkoumy
Participant
0 Kudos

Hi raymond.giuseppi

How can I chcek sy-subrc in process chain? The process chain get executed with background user, aleremote startet rsprocess program . This is what I see in the protocol.

br, Sh.

Sandra_Rossi
Active Contributor
0 Kudos

It's more a BW question.

HowTo create an ABAP process type with a return code (red/green) for use in a process chain in BW 7....

I guess there are many other answers in the forum and in the blog posts.

matt
Active Contributor
0 Kudos

In your program, issue a message, using the MESSAGE statement just before your check. For example:

DATA(message) = |{lines( lt_result ) entries in lt_result|.
MESSAGE message TYPE 'I'.
IF lt_result IS INITIAL.
  ...

These messages will then show up in the log.

See what the log shows.

Eduardo-CE
Active Participant
0 Kudos

Hi,

Have you tried like this?

IF IT_RESULT[] IS INITIAL.
  ERROR
ELSE.
  DELETE....
  MODIFY....
ENDIF.
sherif_elkoumy
Participant
0 Kudos

like this above, because this one bleow does not work

matthew.billingham

sherif_elkoumy
Participant
0 Kudos

Hi eduardo.cardona2

I changed as you proposed like this

Error when executing via SE38 but in the process chain the program went successfully.

br, Sh.

Eduardo-CE
Active Participant
0 Kudos

Hi again,

Change your message type to E and then handle the rest of the chain like is shown in the link from sandra.rossi .

matt
Active Contributor
0 Kudos

I should hope you'd understand enough of what you'd doing to recognise a typo. Even the error message tells you what's wrong. Try this.

DATA(message) = |{ lines( lt_result ) }entries in lt_result|.
MESSAGE message TYPE 'I'.
IF lt_result IS INITIAL.
  ...
sherif_elkoumy
Participant
0 Kudos

Hi matthew.billingham

like before, works via SE38 but via process chain not. The process chain runs normally w/o errors.

Sandra_Rossi
Active Contributor
0 Kudos

I'm surprised that you are still not done, the solution is quite easy, just do as explained 2 days ago, the blog post is the exact answer to your question. Do you have any issue implementing it?

sherif_elkoumy
Participant
0 Kudos

Hi sandra.rossi

I will try this one however I quite sure, it should work without this solution. I mean the abap program should fail in the process chain. I will let you know.

Sandra_Rossi
Active Contributor

sherif.elkoumy My 2 cents: you'd better stop searching alone, and do as per community feedback and experience...

matt
Active Contributor
0 Kudos

But what does the log show? The purpose of the code I gave you was not to make your code fail, but for you to understand what is going on in your code.

Are you actually want the code to fail - which will mean the process chain will stop and fail - or are you want to signal to the process chain that this step has failed?

sherif_elkoumy
Participant
0 Kudos

Hi matthew.billingham

I extract data via API interface, the data came in json format, then cl_json=>deserialize them and put the result into internal table, then I update my database table z-table from the internal table. The program should fail in the process chain if the internal table is empty which means no data came from the API Interface. Situation currently, the process chain runs in green as you see below although now data came from the source (API Interface) but not body mention that. If you monitoring process chains daily, you will see status green. so it looks good, although no data found and source should be checked but you never know because it runs green.

matt
Active Contributor

Then your original attempt at writing the code is wrong. Having a type A message is not how you communicate to the Process Chain that there was an error in the program.

Do what sandra.rossi said - follow this blog: https://blogs.sap.com/2012/09/03/howto-create-an-abap-process-type-with-a-return-code-redgreen-for-u...

sherif_elkoumy
Participant

Hello matthew.billingham

I think I found the problem. The code fails when executed via SE38 as I execute it directly F8. But process chain gets executed via backgound user. The Background user does not have enough authorization on S_OA2C_USE. This authorization object relevant when executing OAUTH 2.0 API. So, the process fails very early and does not reach the error message that checks if internal table empty or not. I asked to extend the authorization to the background user with this object and will test again. I think it should work as expected with the workaround proposed from sandra.rossi . I will let you know. Thanks agian your help.

Sandra_Rossi
Active Contributor

matthew.billingham sherif.elkoumy Addendum: the blog post is a good starting point, BUT read all the comments and feedbacks given by other people in this blog post, because it seems that the original idea of the author did not work exactly as planned. It depends what you exactly want to do...

Accepted Solutions (0)

Answers (0)