09-04-2007 6:41 AM
hi gurus
we are working with bdc calltransaction during in runtime power of how we can find out how many records are upload and how many remains.
plz give me replay
srinivas
09-04-2007 8:04 AM
hi srinivas,
in call transaction
updation is asyncronous,
process also asyncronous.
that mean all data will upload into data base other wise no data (single record) will
upload into database.
so u check data base tables ie data will uploaded ar not.
if not run call transaction once again.
cheers,
nagaraju.m
09-04-2007 8:04 AM
hi srinivas,
in call transaction
updation is asyncronous,
process also asyncronous.
that mean all data will upload into data base other wise no data (single record) will
upload into database.
so u check data base tables ie data will uploaded ar not.
if not run call transaction once again.
cheers,
nagaraju.m
09-04-2007 8:49 AM
Hi,
In call transaction one if any errors occured or power off occured it won't be update the database, its just process the code.
So you need to run the call transaction again.
<b>Reward with points if helpful.</b>
Regards,
Vijay
09-04-2007 9:01 AM
Hi Srinivas
Go to SM35 and look for you register. There you can analysis the errors.
If you need to get errors in runtime, you can use MESSAGES table in call transaction as follow.
CALL TRANSACTION 'SE38' USING BDCDATA MODE 'N'
MESSAGES INTO ITAB. "<--- Get it here
READ TABLE ITAB WITH KEY MSGTYP = <E, I, W...>.
************************
Regarding the error handling in call transaction.
The BDCMSGCOLL does not have the messages text. It has only the message type, number and message parameters.
You have to read the message text. (recall that the database table T100 stores all the messages.)
There are more than one method of doing this.
Following is the psuedocode for one of the methods.
LOOP for the internal table IT1 which has data value from flat file.
call transcation using....
if SY-SUBRC <> 0.
Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL.
(also use the condition T100-SPRAS = SY-LANGU (the log on language. This is because you need only the message texts in English if the user is logged in English language)
IF message type is E , then, transfer the contents of this particular error record to file x. (TRANSFER......)
( Ignore all other messages. Only consider type 'E' messages. Ignore other types of messages.)
(You can also store the message text from T100 and the error record in another internal table IT2)
.....
....
ENDLOOP.
Please note that the client might ask you for a file of records which could not be uploaded.
Give him the file created in the above psuedocode. (most often you will have to do this).
Otherwise just display the error messages and the error records in the internal table IT2 in the form of a list.
Thats it.
Alternatively,
Instead of
" Read the dictionary table T100 FOR ALL ENTRIES in BDCMSGCOLL."
you can use the function module
WRITE_MESSAGES to read the messages.
Please refer to the function module for the list of parameters.
Also refer FORMAT_MESSAGES function module.
***************************
The errors you get depends upon the transaction you are
running.
This is how you handle:
Let's consider you are recording for the transction CJ40
(Messages table declaration )
DATA :BEGIN of t_msg occurs 0.
include structure BDCMSGCOLL.
DATA END of t_msg.
Handling it :
CALL TRANSACTION 'CJ40' using T_BDCDATA MODE 'N' UPDATE 'S' MESSAGES INTO t_msg.
commit work.
If you want to display the errors in the screen you can use a function module named 'RPY_MESSAGE_COMPOSE'
This gives you the corresponding message for the message number that you input.
Below is the sample code
Loop at t_msg. " Messages internal table
w_msgid = t_msg-msgid.
w_msgno = t_msg-msgnr.
w_msgv1 = t_msg-msgv1.
w_msgv2 = t_msg-msgv2.
w_msgv3 = t_msg-msgv3.
w_msgv4 = t_msg-msgv4.
CALL FUNCTION 'RPY_MESSAGE_COMPOSE'
EXPORTING
LANGUAGE = SY-LANGU
MESSAGE_ID = w_msgid
MESSAGE_NUMBER = w_msgno
MESSAGE_VAR1 = w_msgv1
MESSAGE_VAR2 = w_msgv2
MESSAGE_VAR3 = w_msgv3
MESSAGE_VAR4 = w_msgv4
IMPORTING
MESSAGE_TEXT = t_text-text.
TABLES
LONGTEXT =
EXCEPTIONS
MESSAGE_NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
MESSAGE_TEXT contains the message.
Reward points to helpful answer. It Motivates us to Help Others.
Thanks
Naveen khan
09-04-2007 9:10 AM
hi Srinivas..
This is a sample code to find it.
LOOP AT ITAB.
PERFORM BDC_MAPPING.
CALL TRANSACTION <TCODE>
USING IT_BDCDATA
MODE 'N'
UPDATE 'S'
MESSAGES INTO IT_BDCMSGCOLL.
IF SY-SUBRC = 0.
Write:/ 'Record ', SY-TABIX , 'Created'.
ELSE.
LOOP AT IT_BDCMSGCOLL WHERE MSGTYP = 'E' .
CALL FUNCTION 'FORMAT_MESSAGE'
ENDLOOP.
REFRESH : IT_BDCMSGCOLL,
IT_BDCDATA.
ENDLOOP.
<b>REWARD IF HELPFUL</b>