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

urgent help need

Former Member
0 Likes
663

hi friends,

Could please help me how to do this

Read table KNB1 using company code(BUKRS) and G/L Recon Acct(AKONT)

Read table KNA1 using KNB1-KUNNR

If Not found,put out error message,skip processing and read next KNB1 record

for above one i written the coading like this

select kunnr

bukrs

akont

from knb1

into table i_knb1

where bukrs = p_bukrs

AND akont = p_akont.

DESCRIBE TABLE i_knb1 LINES g_line.

LOOP AT i_knb1 INTO wa_knb1.

SELECT single KUNNR

NAME1

STRAS

ORT01

STCD1

PSTLZ

FROM kna1

INTO wa_kna1

where kunnr = wa_knb1-kunnr.

if sy-subrc <> 0.

*<b>Error KNA1 record not found.</b>

count = Count + 1.

endif.

but my problem is they can ask me put one error message

like

If Not found,put out error message,skip

Could u please tell me what type of error message i have to put

i have a little bit confusion

Could u please help me how to do this

Regards

harshavi

hi friends,

Could please help me how to do this

Read table KNB1 using company code(BUKRS) and G/L Recon Acct(AKONT)

Read table KNA1 using KNB1-KUNNR

If Not found,put out error message,skip processing and read next KNB1 record

for above one i written the coading like this

select kunnr

bukrs

akont

from knb1

into table i_knb1

where bukrs = p_bukrs

AND akont = p_akont.

DESCRIBE TABLE i_knb1 LINES g_line.

LOOP AT i_knb1 INTO wa_knb1.

SELECT single KUNNR

NAME1

STRAS

ORT01

STCD1

PSTLZ

FROM kna1

INTO wa_kna1

where kunnr = wa_knb1-kunnr.

if sy-subrc <> 0.

*<b>Error KNA1 record not found.</b>

count = Count + 1.

endif.

but my problem is they can ask me put one error message

like

If Not found,put out error message,skip

Could u please tell me what type of error message i have to put

i have a little bit confusion

Could u please help me how to do this

Regards

harshavi

4 REPLIES 4
Read only

anversha_s
Active Contributor
0 Likes
637

hi,

give like this.

if sy-subrc <> 0.

*Error KNA1 record not found.

message 'Data not found' type 'S'.

count = Count + 1.

endif.

*this will give message in status bar.

if we give tyep 'E', there is a chance for dump.

rgds

anver

if hlped rwrd points

Read only

Former Member
0 Likes
637

Hi,

if you put error message program will

abend and process next records .

give information message

select kunnr

bukrs

akont

from knb1

into table i_knb1

where bukrs = p_bukrs

AND akont = p_akont.

DESCRIBE TABLE i_knb1 LINES g_line.

LOOP AT i_knb1 INTO wa_knb1.

SELECT single KUNNR

NAME1

STRAS

ORT01

STCD1

PSTLZ

FROM kna1

INTO wa_kna1

where kunnr = wa_knb1-kunnr.

if sy-subrc <> 0.

<b>message i000 "record not found'.

count = Count + 1.

continue.</b>endif.

Regards

amole

Read only

Former Member
0 Likes
637

hi,

try this

parameters:p_bukrs like knb1-bukrs,

p_akont like knb1-akont.

start-of-selection.

select kunnr

bukrs

from knb1

into table tb_knb1

where bukrs = p_bukrs amd

akont = p_akont.

if not tb_knb1[] is initial.

select kunnr

name1

stras

from kna1

into table tb_kna1

for all entries in tb_knb1

where kunnr = tb_knb1-kunnr.

if sy-subrc <> 0.

message i000 with 'not found'.

skip.

endif.

regads,

sudha.

Read only

Former Member
0 Likes
637

Hi Harshavi,

Give an information message instead of error message, and give text stating with 'ERROR ....'.

regards

Srikanth M