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

Code works in debug mode not in normal run mode

Former Member
0 Likes
2,988

Dear Experts,

We have a customized requirement in SAP MM module where we need to send the Purchase order data to a third party system whenever the PO is released in SAP.

Now we need to send an extra field along with the PO data when a single PR line item is split into 2 or more PO's. For example, if a PR line item is having quantity 10, and if there are three PO's created PO1, PO2 and PO3 with quantity 5.2 and 3 respectively, then indicator Y should be sent with PO2 and PO3 when the PO is saved. As PO1 is the first PO created against the PR line item, no split indicator Y should be sent in this case.

In addition to this, once PO2 and PO3 are changed or modified or deleted, no split indicator should be sent. Deletion indicator should be sent in case of deletion. To identify the change, we have added a new field ZMOD ie modification flag, so that the change scenario is distinguished from the one in which new PO is created. ZMOD flag will not be sent to the third party system.

The scenario which is not working in normal run mode but works in debug mode is as follows. PR line item PR1 created with quantity 10.

PO1 created with quantity 5, PO2 created with quantity 2 and PO3 with quantity 3, all three with reference to PR1. When PO2 and PO3 are created, split flag is sent to third party system. Now PO2 is deleted, so deletion indicator is sent to third party system without split flag. User adds a new line item in PO3 (having quantity 3) with reference to PR1 ie user adds a new line item with quantity 2. Thus when PO3 is saved, no split indicator should be sent for PO3 line item 1 whereas split indicator should be sent for PO3 line item 2.

We have developed the code which is attached in a text file. However the scenario explained above works in debug mode but not in normal run mode.

Can anyone please guide if we are missing out on something or try some other option.

Regards,

Mitesh.

Dear Experts,

We have a customized requirement in SAP MM module where we need to send the Purchase order data to a third party system whenever the PO is released in SAP.

Now we need to send an extra field along with the PO data when a single PR line item is split into 2 or more PO's. For example, if a PR line item is having quantity 10, and if there are three PO's created PO1, PO2 and PO3 with quantity 5.2 and 3 respectively, then indicator Y should be sent with PO2 and PO3 when the PO is saved. As PO1 is the first PO created against the PR line item, no split indicator Y should be sent in this case.

In addition to this, once PO2 and PO3 are changed or modified or deleted, no split indicator should be sent. Deletion indicator should be sent in case of deletion. To identify the change, we have added a new field ZMOD ie modification flag, so that the change scenario is distinguished from the one in which new PO is created. ZMOD flag will not be sent to the third party system.

The scenario which is not working in normal run mode but works in debug mode is as follows. PR line item PR1 created with quantity 10.

PO1 created with quantity 5, PO2 created with quantity 2 and PO3 with quantity 3, all three with reference to PR1. When PO2 and PO3 are created, split flag is sent to third party system. Now PO2 is deleted, so deletion indicator is sent to third party system without split flag. User adds a new line item in PO3 (having quantity 3) with reference to PR1 ie user adds a new line item with quantity 2. Thus when PO3 is saved, no split indicator should be sent for PO3 line item 1 whereas split indicator should be sent for PO3 line item 2.

We have developed the code which is attached in a text file. However the scenario explained above works in debug mode but not in normal run mode.

Can anyone please guide if we are missing out on something or try some other option.

Regards,

Mitesh.

6 REPLIES 6
Read only

Former Member
0 Likes
1,750

IF ( ( im_ekko-frgke = '1' ) AND ( sy-tcode = 'ME22N' OR sy-tcode = 'ME21N' OR sy-tcode = 'ME23N' ) )."Added on 06.01.2016

In Normal mode check what is the value for SY-TCODE.

Read only

0 Likes
1,750

Hi,

For me it looks like commit work is not working in the Normal Run whereas it works in the debugger.

Please try to use commit work and wait and write it only once after whole code gets executed.

Hope this helps.

Read only

0 Likes
1,750

Dear Madhu,

As I am changing an existing PO ie PO3 the sy-tcode is ME22n.

Regards,

Mitesh

Read only

0 Likes
1,750

You could be right since there is an implied commit at every break.

Rich

Read only

hubert_heitzer
Contributor
0 Likes
1,750

Mitesh Shah wrote:

...

Thus when PO3 is saved, no split indicator should be sent for PO3 line item 1 whereas split indicator should be sent for PO3 line item 2.

...

You describe, what should happen, but not what actually happens in non debug mode.

Where is the execution of your code triggered?

Read only

0 Likes
1,750

Dear Hubert,

When I add a new line item in PO3 with quantity 2, split indicator should be sent for PO3 line item 2 and no split indicator should be sent for PO3 line item 1.

However no split indicator is being sent for both the line items. Indicator M is being updated in table EKPO for both line items. (This is the Z field we have created to distinguish change scenario from create scenario).

Let me know in case you need any other information.

Regards,

Mitesh