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 record

Former Member
0 Likes
609

how to handle the errors (duplicate records) in CALL TRANSACTION METHOD and how can we show the enduser about he error record?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
581

Hi Mithun,

Using CALL TRANSACTION you can capture the error as below.

data: it_bdcmsgcoll type standard table of BDCMSGCOLL.

CALL TRANSACTION 'Tcode'

USING 'BDCDATA'

Messages 'it_bdcmsgcoll'.

Here once the transaction is called and when you get the cursor back to the program, it_bdcmsgcoll will contain the error message occurred if any during the execution of transaction.

Later you can read the table it_bdcmsgcoll and display the message to the user.

<b>Reward points for helpful answers.</b>

Best Regards,

ram.

4 REPLIES 4
Read only

Former Member
0 Likes
582

Hi Mithun,

Using CALL TRANSACTION you can capture the error as below.

data: it_bdcmsgcoll type standard table of BDCMSGCOLL.

CALL TRANSACTION 'Tcode'

USING 'BDCDATA'

Messages 'it_bdcmsgcoll'.

Here once the transaction is called and when you get the cursor back to the program, it_bdcmsgcoll will contain the error message occurred if any during the execution of transaction.

Later you can read the table it_bdcmsgcoll and display the message to the user.

<b>Reward points for helpful answers.</b>

Best Regards,

ram.

Read only

Former Member
0 Likes
581

Hi Mithun,

Use <b>FORMAT_MESSAGE</b> function module to show the error/successful messages using the CALL TRANSACTION.

Check this code...

CALL TRANSACTION tcode USING it_bdcdata

MODE p_ctumod

MESSAGES INTO it_messtab.

LOOP AT it_messtab .

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = it_messtab-msgid

lang = it_messtab-msgspra

no = it_messtab-msgnr

v1 = it_messtab-msgv1

v2 = it_messtab-msgv2

IMPORTING

msg = v_msg

EXCEPTIONS

OTHERS = 0.

WRITE:/2 it_messtab.

SKIP.

ENDLOOP.

Thanks,

Vinay

Read only

Former Member
0 Likes
581

Hi Mithun,

You are posting lots of simple questions - I'd guess you have been given an exam or interview to complete for a job.

Please try using the search option instead of asking all of these questions as they have all been asked and answered before, and please don't forget to credit SDN if you get an interview.

Gareth.

Read only

varma_narayana
Active Contributor
0 Likes
581

hi..

To Find the duplicate records use Select statement before calling the Transaction..

and this is the Sample code for ur Scenario:

TABLES LFA1.

Loop at Itab.

SELECT SINGLE * FROM LFA1 WHERE LIFNR = ITAB-LIFNR.

IF SY-SUBRC = 0.

PERFORM FILL_BDC_TABLE.

call Transaction 'MK01'

USING IT_BDCDATA

MODE 'N'

MESSAGES INTO IT_BDCMSGCOLL.

if sy-subrc ne 0.

Loop at IT_BDCMSGCOLL.

<<< Call the FM FORMAT_MESSAGE to display the message to user...>>>

Endloop.

Endif.

Refresh: it_bdcdata, it_bdcmsgcoll.

Endloop.

<b>Reward if Helpful</b>