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

Program is exiting after warning message

Neslinn
Participant
0 Likes
1,403

Hi All,

A warning message is displayed if the select query fails as below.

DO.

READ DATASET dataset INTO record.

IF sy-subrc <> 0. EXIT. ENDIF.

SELECT kunnr parvw FROM knvp INTO TABLE lt_knvp

WHERE kunnr = p_record-sold_to_party

AND vkorg = p_record-sales_org

AND vtweg = p_record-dist_channel

AND spart = p_record-division.

IF sy-subrc <> 0.

MESSAGE w000(zz) WITH

'No p.f. exist for:' p_record-sold_to_party

'Partner functions will default from customer master.'.

endif.

ENDDO.

But as per my understanding if a warning message is displayed it should not exit the program but it should continoue with processing the next record. In my case it is exiting from the program. Kindly suggest.

Neslin.

5 REPLIES 5
Read only

Former Member
0 Likes
1,057

Hi,

As per ur code its executing the program even after the warning message. u just put a break point at the read data set. and check the sy-subrc. if it equals to zero then it will be exit from the loop.

Regards,

Naresh

Read only

Former Member
0 Likes
1,057

Hi,

try this .

Here write the warning message in the selection screen

then it will not leave the screen.

But when you write the same in start-of-selection it will leave the screen.

data: itab like mara occurs 0 with header line.

parameters: it(10) type c.

at selection-screen.

do 10 times.

refresh: itab.

select mandt matnr from mara into table itab up to 10 rows.

message w000 with 'NO data'.

enddo.

regards,

Venkatesh

Read only

Former Member
0 Likes
1,057

Hi Neslin,

I thing The control is coming out of the program becasue of the EXIT at the top.

please look into the debugging mode.

Thanks

Read only

Former Member
0 Likes
1,057

Hi

If u want to use it as it is better to use Information message than changing the events to at selection screen.

information message allows to proceed .

and one more point .

see the exit at the top and and also keep a break point before warning message and check it.

reg

Ramya

Read only

Former Member
0 Likes
1,057

hi,

you cantry the below code

DO.

READ DATASET dataset INTO record.

IF sy-subrc 0.

EXIT.

Else .

SELECT kunnr parvw FROM knvp INTO TABLE lt_knvp

WHERE kunnr = p_record-sold_to_party

AND vkorg = p_record-sales_org

AND vtweg = p_record-dist_channel

AND spart = p_record-division.

IF sy-subrc 0.

MESSAGE w000(zz) WITH

'No p.f. exist for:' p_record-sold_to_party

'Partner functions will default from customer master.'.

endif.

endif.

ENDDO.

thanks