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

Error in displaying the message

Former Member
0 Likes
705

Hi All,

I am working with a BDC to upload the data for Infotype 0195.The BDC was already developed and I am looking into the support issue of the object.

The BDC is working fine.When I am uploading new records its giving the correct message 'Record Created'.But when I am trying to upload the already existing data then also the same message is being displayed instead of the message 'Record Already Exists'.

When I am trying to insert the code using Read table..........I am missing the logic somewhere else.Ca anyone help me out in this.For ur convenience I am pasting the code below.

Thanks in Advance.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = gw_p0195-pernr

IMPORTING

return = gw_return.

IF gw_return-type NE 'E'.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0195'

number = gw_p0195-pernr

validityend = gw_p0195-endda

validitybegin = gw_p0195-begda

record = gw_p0195

operation = 'INS'

dialog_mode = p_ctumod "Mod-01

tclas = 'A'

nocommit = ' '

IMPORTING

return = gw_return.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = gw_p0195-pernr.

ENDIF.

Append gw_p0195 to gi_p0195.

clear gw_p0195.

IF gw_return IS NOT INITIAL.

gw_log-msg_id = gw_return-id.

gw_log-msg_num = gw_return-number.

CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO

gw_log-msg_key SEPARATED BY '|'.

gw_log-msg_typ = gw_return-type.

gw_log-rec_no = gv_count.

gw_log-msg_txt = gw_return-message.

ELSE.

READ TABLE gi_P0195 INTO gw_P0195 WITH KEY pernr = gw_data_d-pernr

grnum = gw_p0194-grnum.

Check sy-subrc eq 0.

gw_log-msg_id = 'CUST'.

gw_log-msg_num = '000'.

CONCATENATE gw_data_d-pernr gw_p0195-grnum INTO

gw_log-msg_key SEPARATED BY '|'.

If gw_p0195-grnum is not initial.

gw_log-msg_typ = 'I'.

gw_log-rec_no = gv_count.

gw_log-msg_txt = 'Record Already Exists'(t04).

endif.

gw_log-msg_id = 'CUST'.

gw_log-msg_num = '000'.

CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO

gw_log-msg_key SEPARATED BY '|'.

gw_log-msg_typ = 'S'.

gw_log-rec_no = gv_count.

gw_log-msg_txt = 'Record Created'(t02).

ENDIF.

ELSE.

gw_log-msg_id = 'CUST'.

gw_log-msg_num = 'XXX'.

CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO

gw_log-msg_key SEPARATED BY '|'.

gw_log-msg_typ = 'E'.

gw_log-rec_no = gv_count.

gw_log-msg_txt = 'Case does not exists for Personnel No '(t03).

ENDIF.

Hi All,

I am working with a BDC to upload the data for Infotype 0195.The BDC was already developed and I am looking into the support issue of the object.

The BDC is working fine.When I am uploading new records its giving the correct message 'Record Created'.But when I am trying to upload the already existing data then also the same message is being displayed instead of the message 'Record Already Exists'.

When I am trying to insert the code using Read table..........I am missing the logic somewhere else.Ca anyone help me out in this.For ur convenience I am pasting the code below.

Thanks in Advance.

CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'

EXPORTING

number = gw_p0195-pernr

IMPORTING

return = gw_return.

IF gw_return-type NE 'E'.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0195'

number = gw_p0195-pernr

validityend = gw_p0195-endda

validitybegin = gw_p0195-begda

record = gw_p0195

operation = 'INS'

dialog_mode = p_ctumod "Mod-01

tclas = 'A'

nocommit = ' '

IMPORTING

return = gw_return.

CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'

EXPORTING

number = gw_p0195-pernr.

ENDIF.

Append gw_p0195 to gi_p0195.

clear gw_p0195.

IF gw_return IS NOT INITIAL.

gw_log-msg_id = gw_return-id.

gw_log-msg_num = gw_return-number.

CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO

gw_log-msg_key SEPARATED BY '|'.

gw_log-msg_typ = gw_return-type.

gw_log-rec_no = gv_count.

gw_log-msg_txt = gw_return-message.

ELSE.

READ TABLE gi_P0195 INTO gw_P0195 WITH KEY pernr = gw_data_d-pernr

grnum = gw_p0194-grnum.

Check sy-subrc eq 0.

gw_log-msg_id = 'CUST'.

gw_log-msg_num = '000'.

CONCATENATE gw_data_d-pernr gw_p0195-grnum INTO

gw_log-msg_key SEPARATED BY '|'.

If gw_p0195-grnum is not initial.

gw_log-msg_typ = 'I'.

gw_log-rec_no = gv_count.

gw_log-msg_txt = 'Record Already Exists'(t04).

endif.

gw_log-msg_id = 'CUST'.

gw_log-msg_num = '000'.

CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO

gw_log-msg_key SEPARATED BY '|'.

gw_log-msg_typ = 'S'.

gw_log-rec_no = gv_count.

gw_log-msg_txt = 'Record Created'(t02).

ENDIF.

ELSE.

gw_log-msg_id = 'CUST'.

gw_log-msg_num = 'XXX'.

CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO

gw_log-msg_key SEPARATED BY '|'.

gw_log-msg_typ = 'E'.

gw_log-rec_no = gv_count.

gw_log-msg_txt = 'Case does not exists for Personnel No '(t03).

ENDIF.

4 REPLIES 4
Read only

Former Member
0 Likes
682

READ TABLE gi_P0195 INTO gw_P0195 WITH KEY pernr = gw_data_d-pernr

grnum = gw_p0194-grnum.

Check sy-subrc eq 0.

if record is found sy-subrc value will become zero....

change to sy-subrc ne 0

Read only

0 Likes
682

Hi Chayan,

I checked by changing the code SY-SUBRC NE 0.But no message is being displayed now.

Help me out.

Read only

0 Likes
682

I tried using sy-subrc ne 0 as mentioned below.But still its not working.Can anyone help me out.

READ TABLE gi_P0195 INTO gw_P0195 WITH KEY grnum = gw_p0194-grnum.

IF sy-subrc ne 0.

gw_log-msg_id = 'CUST'.

gw_log-msg_num = '000'.

CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO

gw_log-msg_key SEPARATED BY '|'.

gw_log-msg_typ = 'S'.

gw_log-rec_no = gv_count.

gw_log-msg_txt = 'Record Already exists'(t04).

  • gw_log-msg_txt = 'Record Created'(t02).

else.

*Changes end by deepthi

gw_log-msg_id = 'CUST'.

gw_log-msg_num = '000'.

CONCATENATE gw_data_d-pernr gw_data_d-gcase INTO

gw_log-msg_key SEPARATED BY '|'.

gw_log-msg_typ = 'S'.

gw_log-rec_no = gv_count.

gw_log-msg_txt = 'Record Created'(t02).

  • gw_log-msg_txt = 'Record Already exists'(t04).

ENDIF.

ENDIF.

Read only

Former Member
0 Likes
682

HI

check whether gw_data_d has value.

use if condition instead of check ( sy-subrc ....) .

reg

Ramya