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

wrong selection in routine

former_member215107
Active Participant
0 Likes
705

Hello everybody,

I have the following ZJOBR table:

JOB_ID ¦ JOD_DATE ¦ STATUS_ID ¦ BW_PROCESS_CHAIN

-

-


98 ¦ 07.03.2008 ¦ F ¦ PC_CUST_DB

98 ¦ 08.03.2008 ¦ V ¦ PC_CUST_DB

98 ¦ 09.03.2008 ¦ V ¦ PC_CUST_DB

98 ¦ 10.03.2008 ¦ V ¦ PC_CUST_DB

When, i execute this ABAP Code:

select * from zjobr up to 1 rows

where bw_process_chain = 'PC_CUST_DB'

and status_id = 'V'.

endselect.

if sy-subrc = 0.

  • The precedent day should be correctly termitated - status F *

dt_1 = zjobr-job_date - 1.

select * from zjobr up to 1 rows

where job_id = zjobr-job_id

and job_date = dt_1

and status_id = 'F'.

endselect.

if sy-subrc <> 0.

p_subrc = 4.

else.

p_subrc = 0.

...

After execution, i have the following error: Routine for characteristic ... with sy-subrc 4 terminated.

However, this ABAP code should extract the following record:

98 ¦ 08.03.2008 ¦ V ¦ PC_CUST_DB

and then, verify if the precedent record has the Status F:

98 ¦ 07.03.2008 ¦ F ¦ PC_CUST_DB

I don't know why this routine exit with sy-subrc 4...

Could you give me suggestions how do this?

Thanks in advance.

Best Regards,

Rod.

Edited by: Rodolphe LALOUX on Mar 13, 2008 10:23 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
596

Hi

declare an work area for the same and try

data : wa_zjobr type zjobr .

select *

into wa_zjobr

from zjobr zjobr up to 1 rows

where bw_process_chain = 'PC_CUST_DB'

and status_id = 'V'.

endselect.

if sy-subrc = 0.

  • The precedent day should be correctly termitated - status F *

dt_1 = wa_zjobr-job_date - 1.

select * from zjobr up to 1 rows

where job_id = wa_zjobr-job_id

and job_date = dt_1

and status_id = 'F'.

endselect.

if sy-subrc 0.

p_subrc = 4.

else.

p_subrc = 0.

Regards

Shiva

3 REPLIES 3
Read only

Former Member
0 Likes
596

Hi,

I guess the code "where job_id = zjobr-job_id" in

select * from zjobr up to 1 rows

where job_id = zjobr-job_id

and job_date = dt_1

and status_id = 'F'.

endselect.

is wrong. U r comparing zjobr-jobid with zjobr-jobid . Remove it and try.

Reward if helpful.

Regards,

Ramya

Read only

Former Member
0 Likes
597

Hi

declare an work area for the same and try

data : wa_zjobr type zjobr .

select *

into wa_zjobr

from zjobr zjobr up to 1 rows

where bw_process_chain = 'PC_CUST_DB'

and status_id = 'V'.

endselect.

if sy-subrc = 0.

  • The precedent day should be correctly termitated - status F *

dt_1 = wa_zjobr-job_date - 1.

select * from zjobr up to 1 rows

where job_id = wa_zjobr-job_id

and job_date = dt_1

and status_id = 'F'.

endselect.

if sy-subrc 0.

p_subrc = 4.

else.

p_subrc = 0.

Regards

Shiva

Read only

former_member215107
Active Participant
0 Likes
596

YES!!

Thank a lot for your help