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 error handling

selvi1
Explorer
0 Likes
636

hai all,

i want to capture the error data into an internal table and i want to display it in alv report along with other datas..

how to do this ...

please help me...

thanks in advance..

regards,

selvi.

7 REPLIES 7
Read only

Former Member
0 Likes
614

Hi,

There is a structure BDCMSGCOLL associated with BDC.Create an Internal table of this structure, and write the CAL Transaction as follows :

CALL TRANSACTION <Transaction> MODE <mode> UPDATE <Mode> MESSAGES INTO <internal table>.

This will capture all sorts of messages which come during BDC processing into the table from which u can select the messages of MESSAGE TYPE = 'E'.

Hope it helps.

Regards,

Himanshu

Read only

0 Likes
614

Hi,

As posted above, you can use the structure BDCMSGCOLL to get the error messages. Also, you can customise your own internal table(e.g. gt_error) where you can move messages or data that is invalid, etc. then display it if needed. Hope this helps you...

P.S. Please award points if found useful.

Read only

abdul_hakim
Active Contributor
0 Likes
614

Hi,

You could use CALL TRANSACTION...MESSAGES INTO <message tab> varaint...

Define the itab with ref to BDCMSGCOLL..

Regards,

Hakim

Read only

Former Member
0 Likes
614

selvi,

After Call transaction Statement..

IF sy-subrc ne 0.

Move the required data in to your internal table.

ENDIF.

After that pass taht internal table to FM. See the example.

-


TYPE-POOLS: slis.

  • Data declaration.

DATA: BEGIN OF itab OCCURS 0,

vbeln TYPE vbeln,

erdat TYPE erdat,

auart TYPE auart,

netwr TYPE vbak-netwr,

END OF itab.

DATA: wa_kna1 TYPE kna1.

DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.

DATA: s_fieldcatalog TYPE slis_fieldcat_alv.

  • Selection-screen.

PARAMETERS: p_kunnr TYPE kunnr OBLIGATORY.

AT SELECTION-SCREEN.

SELECT SINGLE * FROM kna1 INTO wa_kna1

WHERE kunnr = p_kunnr.

IF sy-subrc <> 0.

MESSAGE s208(00) WITH 'Invalid customer'.

LEAVE LIST-PROCESSING.

ENDIF.

START-OF-SELECTION.

  • Building the field catalog.

s_fieldcatalog-col_pos = '1'.

s_fieldcatalog-fieldname = 'VBELN'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'VBELN'.

s_fieldcatalog-outputlen = '12'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '2'.

s_fieldcatalog-fieldname = 'ERDAT'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'ERDAT'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '3'.

s_fieldcatalog-fieldname = 'AUART'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'AUART'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

s_fieldcatalog-col_pos = '4'.

s_fieldcatalog-fieldname = 'NETWR'.

s_fieldcatalog-tabname = 'ITAB'.

s_fieldcatalog-rollname = 'NETWR_AK'.

s_fieldcatalog-do_sum = 'X'.

APPEND s_fieldcatalog TO t_fieldcatalog.

CLEAR: s_fieldcatalog.

  • Get the sales orders.

SELECT vbeln erdat auart netwr

FROM

vbak

INTO TABLE itab

WHERE kunnr = p_kunnr.

IF sy-subrc <> 0.

MESSAGE s208(00) WITH 'No records found'.

LEAVE LIST-PROCESSING.

ENDIF.

DATA: v_repid TYPE syrepid.

v_repid = sy-repid.

  • Display the alv

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

it_fieldcat = t_fieldcatalog

TABLES

t_outtab = itab.

Don't forget to reward if useful

Read only

selvi1
Explorer
0 Likes
614

hai i want the sample code.. because it tried this one but its not working properly

Read only

Former Member
0 Likes
614

Hi...,

be clear with ur question.. whether u want to capture the error transaction data or the messages during the transaction...

If u want to capture the Messages u can use a table with structure BDCMSGCOLL as

call transaction 'SE--' using bdcdata messages into t_msgs.

IF u want to capture the error transaction data u can use another internal table with same structure as BDCDATA.. and

LOOP AT T_DATA INTO WA_DATA.

........................

fill the BDCDATA table.

........................

CALL TRANSACTION '----' USING T_BDCDATA .

(**** Call transaction returns sy-subrc <> 0 for erroneous transactions ***)

IF SY-SUBRC NE 0.

append wa_data into t_data1.

(*** or u can create a session here for the erroneous transactions ***)

ENDIF.

clear t_bdcdata.

endloop.

reward all helpful answers...

sai ramesh

Read only

selvi1
Explorer
0 Likes
614

need steps to carry out bdc recording for t-code 'VA02' to carry out new pricing..