Application Development 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: 

Call Transction - BDC

Former Member
0 Kudos
102

Hi,

Can anyone tell me where should i write code(in following BDC program) for handling error messages in Call transction method using bdcmsgcoll?

BDC Code:

report ZBDC_EMPN

no standard page heading line-size 255.

include bdcrecx1.

TABLES: ZTRGEMP, ZTRGDEPT, ZTRGTXN.

parameters: dataset(132) lower case.

      • DO NOT CHANGE - the generated data section - DO NOT CHANGE ***

*

  • If it is nessesary to change the data section use the rules:

  • 1.) Each definition of a field exists of two lines

  • 2.) The first line shows exactly the comment

  • '* data element: ' followed with the data element

  • which describes the field.

  • If you don't have a data element use the

  • comment without a data element name

  • 3.) The second line shows the fieldname of the

  • structure, the fieldname must consist of

  • a fieldname and optional the character '_' and

  • three numbers and the field length in brackets

  • 4.) Each field must be type C.

*

      • Generated data section with specific formatting - DO NOT CHANGE ***

data: begin of record,

  • data element:

IEMP_001(006),

  • data element:

INAME_002(010),

  • data element:

ISAL_003(010),

  • data element:

IDPT_004(020),

end of record.

      • End generated data section ***

DATA : BEGIN OF ITAB OCCURS 0,

EMPNO LIKE ZTRGEMP-EMPNO,

EMPNAME LIKE ZTRGEMP-EMPNAME,

EMPDPT LIKE ZTRGDEPT-EMPDPT,

SALARY LIKE ZTRGTXN-SALARY,

END OF ITAB.

start-of-selection.

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\EMP.TXT'

FILETYPE = 'ASC'

TABLES

DATA_TAB = ITAB.

perform open_group.

LOOP AT ITAB.

perform bdc_dynpro using 'ZASS_6' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=CRT'.

perform bdc_field using 'BDC_CURSOR'

'IEMP'.

perform bdc_field using 'IEMP'

ITAB-EMPNO.

perform bdc_dynpro using 'ZASS_6' '0200'.

perform bdc_field using 'BDC_OKCODE'

'=CRT'.

perform bdc_field using 'BDC_CURSOR'

'IDPT'.

perform bdc_field using 'INAME'

ITAB-EMPNAME.

perform bdc_field using 'ISAL'

ITAB-SALARY.

perform bdc_field using 'IDPT'

ITAB-EMPDPT.

perform bdc_dynpro using 'ZASS_6' '0200'.

perform bdc_field using 'BDC_OKCODE'

'=C'.

perform bdc_field using 'BDC_CURSOR'

'INAME'.

perform bdc_transaction using 'ZEMPN'.

ENDLOOP.

perform close_group.

Mahesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos
65

Hi Mahesh,

You can write the code for getting the error messages after the ENDLOOP statement just before the perform close_group.

Regards,

Chetan.

PS: Reward points if this is helpful.

4 REPLIES 4

Former Member
0 Kudos
65

check this thread for ur answer...

Former Member
0 Kudos
65

hi mahesh,

after call transaction stmt...

for example give as below...

CALL TRANSACTION 'FK01' USING IT_BDCDATA MODE 'A'

UPDATE 'S'

MESSAGES INTO IT_MESSAGES.

WRITe:/ SY-SUBRC.

PERFORM FORMAT_MESSAGES.

CLEAR IT_BDCDATA.

REFRESH IT_BDCDATA.

ENDLOOP.

form FORMAT_MESSAGES .

DATA: L_MSG(100).

LOOP AT IT_MESSAGES.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = IT_MESSAGES-MSGID

LANG = SY-LANGU

NO = IT_MESSAGES-MSGNR

V1 = IT_MESSAGES-MSGV1

V2 = IT_MESSAGES-MSGV2

V3 = IT_MESSAGES-MSGV3

V4 = IT_MESSAGES-MSGV4

IMPORTING

MSG = L_MSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

write:/ l_msg.

endloop.

endform. " FORMAT_MESSAGES

hope this helps,

do reward if it helps,

priya.

Former Member
0 Kudos
66

Hi Mahesh,

You can write the code for getting the error messages after the ENDLOOP statement just before the perform close_group.

Regards,

Chetan.

PS: Reward points if this is helpful.

Former Member
0 Kudos
65

CALL TRANSACTION 'IW36' USING i_data MODE 'A' MESSAGES INTO i_messages.

Now when some error messages are returned by the i_messages table, mark those records as error data in a separate table. At last after all processing is completed you have all error records in a separate table.

Now you can write a log or download that some where for later processing.

Regards

Kathirvel