06-19-2010 4:08 PM
Hi all,
I am doing BDC using call Transaction to create Vendor, and getting messages into IT_messages.
my requirement is when the vendor is created , move some required fields to Ztable.
so i took the parameter "msgtyp", if it is not 'E' move the data to Ztable but
in the messages it giving first 'S' then 'E' with error message for one record.
Data is moving to Ztable but vendor is not getting created.
Please any suggestion on this.
Regards,
Sri
06-22-2010 9:32 AM
Hi Srikanth,
Dont do it based on the returned message type, because for example 'NO BATCH INPUT DATA FOUND', This message will be returned with type 'S' ( Here your read statement fails ). Do it based on the sy-subrc value.
Do it like.
call transaction ....
if sy-subrc ne 0.
"Error occurred.
loop at it_mess into wa_mess.
"Here consider all the messages as error, build the message keeping a message type error as constant
endloop.
else.
no error
loop at it_mess into wa_mess.
"Here consider all the messages as success, build the message keeping a message type success as constant
endloop.
endif.
06-19-2010 6:21 PM
Hello Srikanth,
Loop through the message table to check for all lines. Are you doing this ?
But this is not the only criteria. There may be cases where message table does not contain any error messages, but SY-SUBRC returns 1001. Check this as well.
Why not go for a BAPI or else if you still want to use BDC, you can use the concept of events.
When a vendor in created a even will be raised. You have to create a receiver function module where you can push the entries to your Z table.
Rajavnsh
06-22-2010 6:46 AM
Hi Ravi,
I solved it. using read statement.
READ it_messtad into wa_messtab with key 'E'
if sy-subrc = 0.
don't move data
else.
move the data.
endif.
Regards,
sri
06-22-2010 9:32 AM
Hi Srikanth,
Dont do it based on the returned message type, because for example 'NO BATCH INPUT DATA FOUND', This message will be returned with type 'S' ( Here your read statement fails ). Do it based on the sy-subrc value.
Do it like.
call transaction ....
if sy-subrc ne 0.
"Error occurred.
loop at it_mess into wa_mess.
"Here consider all the messages as error, build the message keeping a message type error as constant
endloop.
else.
no error
loop at it_mess into wa_mess.
"Here consider all the messages as success, build the message keeping a message type success as constant
endloop.
endif.