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

Skipping line when debugging

sri_harsha2
Participant
0 Likes
1,490

Hello gurus,


I have an issue with the below code. This is to get the division field from the table zgb_100 by doing look ups in different tables.

The code is logically but when I debug the code I see that the below highlighted part is not being picked up it is directly going

to the next step from IF ip_zgb_100-val1. Please let me know your valuable suggestion if my logic of extracting the division

is wrong. Thanks in advance


The division is extracted in this way


anln1 -> 10000002

anln2 = 0000


kostl :  O613901     Using cost center, profit center P90309010 is from csks

Use profit center and get the field khinr from table cepc.

get the setname field from table setnode using the conditions and khinr

get the first 4 digits in setname field move them to division.

if the ip_zgb_100-val1 is initial get first 4 digits of khinr

and that is my division.



DATA: xprctr LIKE csks-prctr.

DATA: kostl LIKE anlz-kostl

DATA: xkhinr LIKE cepc-khinr.

DATA: xsetname LIKE setnode-setname.

DATA: xsetn(4).


CLEAR: xkostl, xprctr, xsetname, xkhinr, xsetn, xprctr.

      select kostl from anlz into xkostl

                 where bukrs = zbwfiaa_asset-bukrs and

                      anln1 = zbwfiaa_asset-anln1 and

                      anln2 = zbwfiaa_asset-anln2.

      endselect.

   

    SELECT SINGLE prctr FROM csks into xprctr

                         WHERE kostl = xkostl.

       SELECT SINGLE khinr FROM cepc INTO xkhinr

                              WHERE prctr = zbwfiaa_asset-prctr.

       SELECT SINGLE setname FROM setnode INTO xsetname

                           WHERE setclass   = '0106'

                           AND   subclass   = lv_anla-bukrs

                           AND   subsetname = xkhinr.

         CLEAR ip_zgb_100.

         MOVE xsetname+0(4) TO xsetn.

         SELECT SINGLE val1 FROM zgb_100 INTO ip_zgb_100-val1

                            WHERE vtname = 'ASSET_DIVISION'

                            AND   key1   = xsetn.

       IF ip_zgb_100-val1 = 0.

         CLEAR xsetn.

         MOVE xkhinr+0(4) TO xsetn.

         SELECT SINGLE val1 FROM zgb_100 INTO ip_zgb_100-val1

                             WHERE vtname = 'ASSET_DIVISION'

                             AND key1 = xsetn.

       ENDIF.


IF sy-subrc = 0.

         MOVE  ip_zgb_100-val1  TO  zbwfiaa_asset-zzdivision.

MODIFY    i_t_data   FROM  zbwfiaa_asset INDEX   l_tabix.

       ENDIF.

Message was edited by: Matthew Billingham - added meaningful subject

1 ACCEPTED SOLUTION
Read only

paul_bakker2
Active Contributor
0 Likes
1,410

It's probably activation.

Activate the code (again) and put a breakpoint on that highlighted code. Execute.

cheers

Paul

9 REPLIES 9
Read only

paul_bakker2
Active Contributor
0 Likes
1,411

It's probably activation.

Activate the code (again) and put a breakpoint on that highlighted code. Execute.

cheers

Paul

Read only

0 Likes
1,410

Hi Paul,

Thank you for your response I have activated it multiple times and transported it into quality system. When I put the break point at the activated part it does not run and execute at that point.

Read only

0 Likes
1,410

Hi,

Are you saying that when you debug it steps right over the statement

MOVE xsetname+0(4) TO xsetn.


without executing it?


Sorry, I can't see any explanation for that, other than the code you are viewing in the debugger is not the same that is executing. Activation should fix that!

(Checking sy-subrc should certainly also be done, but it won't affect this behaviour)


cheers

Paul

Read only

0 Likes
1,410

Hi,

in the statement IF ip_zgb_100-val1 = 0. , if the field is of character type then give like

IF ip_zgb_100-val1 = '0' .

Read only

0 Likes
1,410

Hi,

- use pretty printer finction in editor just to see the structure.

- use extende program check, code inspector, to see what's wrong

- zbwfiaa_asset-prctr (used in where clausse) is not populated thus initial

This will give you much insight

Regards Clemens

Read only

Former Member
0 Likes
1,410

You are not checking sy-subrc after each SELECT statement. You can put a break-point before the first SELECT and see the value of sy-subrc after each call. In any case, you should add some logic to handle non-zero return codes.

Rob

Read only

sri_harsha2
Participant
0 Likes
1,410

Thank you Paul, Rob, Clemens, Renjith the issue was that the company code was not passing through the code

WHERE setclass   = '0106'

                           AND   subclass   = lv_anla-bukrs

                           AND   subsetname = xkhinr.


The mistake I did here is I was supposed to give the the extract structure zbwfiaa_asset-bukrs( where the company code passes in). As the company code was not passing through bukrs the ip_zgb_100-val1 = 0

condition was not executing.


Thank you all for your help in this.

Read only

0 Likes
1,410

I'm very glad to hear it's resolved, but your explanation does not actually explain how those two statements were skipped during debugging.

The SELECT SINGLE statement failed to find anything because of a missing bukrs? That won't stop it executing the next line.

Also, once your issue is resolved, you should mark one answer as 'correct' (even if it's your own) to set the discussion to 'Answered'.

cheers

Paul

Read only

matt
Active Contributor
0 Likes
1,410

Moderator message: please use a meaningful subject in future. "Issue within the program" is not meaningful. I've edited it for you this time, but you risk having your post rejected.