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

bdc

Former Member
0 Likes
367

hi,

how can we handle errors in call transcation?

3 REPLIES 3
Read only

Former Member
0 Likes
347

Hi,

Populate error messages using a table with structure BDCMSGCOLL.

DATA : <BDCMSGCOLL Int.Table> type table of bdcmsgcoll.
.....
.....
CALL TRANSACTION <T.Code> 
           USING <BDCTAB> 
           MODE <A/N/E> 
           UPDATE <S/A>
           MESSAGES INTO <BDCMSGCOLL Int.Table>

The structure has:

- Message type

- Message id

- Message Number

- Variable1

- Variable2

- Variable3

By using FORMAT_MESSAGES function module we can process the error records.

Refer to the following links for more informaion and code:

Regards,

Srilatha.

Read only

Former Member
0 Likes
347

Hi Priya,

With CALL TRANSACTION there is an addition in its syntax, MESSAGES INTO itab,

The internal table itab must have the structure BDCMSGCOLL.

check the sample code below

DATA: BDCDATA TYPE TABLE OF BDCDATA.

DATA: ITAB TYPE TABLE OF BDCMSGCOLL.

DATA: PROGRAM LIKE SY-REPID,

WA_BDCDATA TYPE BDCDATA.

WA_BDCDATA-PROGRAM = 'SAPMS38M'.

WA_BDCDATA-DYNPRO = '0100'.

WA_BDCDATA-DYNBEGIN = 'X'.

APPEND WA_BDCDATA TO BDCDATA.

CLEAR WA_BDCDATA.

WA_BDCDATA-FNAM = 'RS38M-PROGRAMM'.

WA_BDCDATA-FVAL = PROGRAM.

APPEND WA_BDCDATA TO BDCDATA.

...

CALL TRANSACTION 'SE38' USING BDCDATA MODE 'N'

MESSAGES INTO ITAB.

regards,

Antony Thomas

REward points only if find useful

Read only

Former Member
0 Likes
347

Hi

u can use funtion module WRITE_MESSAGES and FORMAT_MESSAGES to read the messeges in stead of BDCMSGCOLL.

WE CAN USE SESSION METHOD LOGFILE IN CALL TRANSACTION.

1. WE HAVE TO SEND ERROR RECORDS IN TO ONE INTERNAL TABLE .

2. NEXT FOR THAT ITAB U CAN USE SESSION METHOD .

3 WITH THIS U WILL GET SESSION METHOD LOG FILE IN CALL TRAN.

in call transaction we can explicitly provide the logic for handling error records, for that one we create internal table of type BDCMSGCOLL.

syntax:

DATA: IT_ERROR LIKE BDCMSGCOLL WITH HEADER LINE.

CALL TRANSACTION <transaction-name> using BDCDATA

mode <A/N/E>

update <A/S/L>

MESSAGES INTO IT_ERROR.

We can create a internal table like 'bsgmcgcoll'. All themessages will go to ternal table. We can get errors inthis internal table.

Below messages are go to internal table. when you run the

call transaction.

- Message type

- Message id

- Message Number

- Variable1

- Variable2

- Variable3

by using FORMAT_MESSAGES function module we can process the error records.

or

by using session method also we can handle error records in

CALL TRANSACTION method.

CALL TRANSACTION <transaction-name> using BDCDATA

mode <A/N/E>

update <A/S/L>.

IF SY-SUBRC <> 0.

here call BDC_OPEN_GROUP for creating session.

here call BDC_INSERT for adding trassaction and table BDCDATA to handling error records.

here call BDC_CLOSE_GROUP for closing the session.

now all the error records available in logfile, for handling error records follow these steps.

1) goto SM35.

2) here select your SESSION name.

3) and choose LOG tab

4) press the selected LOG tab, then it will display error records

check these threads

Plz go through the below mention link .there is an example for call transaction method error handling.

http://www.sapbrainsonline.com/PROJECTS/TECHNICAL/ABAP%20Source%20codes/Batch%20Input%20with%20Call%...

http://www.sap-img.com/abap/question-about-bdc-program.htm

http://www.sap-img.com/abap/answers-to-some-abap-interview-questions.htm

Reward all helpfull answers

Regards

Pavan