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: 

Display Error log as a report for Session and Call tranaction

Former Member
0 Kudos

Hi all,

I am using a BDC to upload cost centre data for tranaction KS01 Ks02 for that I want to display the error message as a report ie what r the recrds get sucessfully updated similar way what r the records get changed and error record.

Kindly Please send me the coding that used display these messagages as report for both session and call tranaction method

regards

paul

1 ACCEPTED SOLUTION

former_member184569
Active Contributor
0 Kudos

Hello Paul,

You can get the log details in program RSBDCLOG.

Here you get the entire details of what all had happened while the session was procesed.

SUbmit rsbdclog with groupid = 'group_name'.

Hope it helped!

Thanks,

Susmitha

8 REPLIES 8

former_member184569
Active Contributor
0 Kudos

Hello Paul,

You can get the log details in program RSBDCLOG.

Here you get the entire details of what all had happened while the session was procesed.

SUbmit rsbdclog with groupid = 'group_name'.

Hope it helped!

Thanks,

Susmitha

0 Kudos

Hi susmiyha,

I dont find any RSBDCLOG program in my SAP 4.7,

kindly clarify.

regards

paul

Former Member
0 Kudos

Hi Paul,

Using <b>CALL TRANSACTION</b>,you can display successful records and error records with the function module <b>'FORMAT_MESSAGE'</b> after CALL TRANSACTION. Your success/error record information is stored in table <b>BDCMSGCOLL</b>.

CALL TRANSACTION TCODE USING BDCDATA

MODE 'A'

UPDATE 'A'

MESSAGES INTO MESSTAB.

Give the MESSTAB values to function module to get message.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = MESSTAB-MSGID

NO = MESSTAB-MSGNO

V1 = MESSTAB-MSGV1

V2 = MESSTAB-MSGV2

V3 = MESSTAB-MSGV3

V4 = MESSTAB-MSGV4

IMPORTING

MSG = <b>message</b>

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

IF sy-subrc = 0.

<b>WRITE:/ message.</b>

ENDIF.

Thanks,

Vinay

Message was edited by: Vinaykumar Gorrela

0 Kudos

check.programm.....

RSBDC_PROTOCOL

former_member181962
Active Contributor
0 Kudos

use the syntax.

call transaction ....messages into bdcmsg.

loop at bdcmsg.

call function 'FORMAT_MESSAGE'

EXPORTING

id = bdcmsg-msgid

lang = bdcmsg-msgspra

no = bdcmsg-msgnr

v1 = bdcmsg-msgv1

v2 = bdcmsg-msgv2

v3 = bdcmsg-msgv3

v4 = bdcmsg-msgv4

IMPORTING

msg = l_message

EXCEPTIONS

not_found = 1

others = 2.

write:/ l_message.

endloop.

Former Member
0 Kudos

HI,

report zxx_recording_fk01 .

************************************************************************

  • Program name : zsh_recording_fk01 *

  • Title : BDC *

  • Functional req ID : - *

  • Development analyst : - *

  • Developer : XXXX *

  • Date : 01/10/2006 *

  • Type : BDC *

  • Description : This program will get all the vendor details *

  • from a flat file . *

************************************************************************

----


  • Change Log

----


  • Date Correction# Changed by Description

----


  • 01/10/2006 - SHARATH Initial Development

----


************************************************************************

  • T A B L E S *

************************************************************************

tables : lfa1 . " Vendor Master.

************************************************************************

  • I N T E R N A L T A B L E - D E C L A R A T I O N *

************************************************************************

data : begin of it_tab occurs 0,

lifnr(16), "account number of vendor

ktokk(4), "Vendor Number

anred(15), "Account Group

name1(35), "Name

sortl(10), "Sort field

land1(3) , "Land

spras(1), "Language Key

kunnr(10), "customer number

banks(3), "Bank country key

bankl(15), "Bank Key

bankn(18), "Bank Account Number

koinh(60), "Account Holder Name

banka(60), "Name of bank

provz(3), "region

end of it_tab.

data : begin of it_tab1 occurs 0,

banks(3), "Bank country key

bankl(15), "Bank Key

bankn(18), "Bank Account Number

koinh(60), "Account Holder Name

banka(60), "Name of bank

provz(3), "region

end of it_tab1.

DATA:it_BDCtab LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

  • ERROR MESSAGE TABLE

DATA:it_MSGtab LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

data: program type BDCDATA-PROGRAM,

dynpro type BDCDATA-dynpro,

fnam type BDCDATA-fnam,

fval type BDCDATA-fval.

************************************************************************

  • S E L E C T I O N - S C R E E N *

************************************************************************

selection-screen : begin of block bl1 with frame.

parameter : p_file type rlgrap-filename default

'C:\Vendor.txt.txt' obligatory,

p_file1 type rlgrap-filename default

'C:\Vendor1.txt.txt' obligatory.

selection-screen : end of block bl1.

************************************************************************

  • A T S E L E C T I O N - S C R E E N *

************************************************************************

at selection-screen on value-request for p_file.

  • to get F4 help for p_file

perform f4_get_help using p_file.

  • to get F4 help for p_file

perform f4_get_help1 using p_file1.

************************************************************************

  • S T A R T O F S E L E C T I O N *

************************************************************************

start-of-selection.

  • Uploading data from flat file into it_tab

perform bdc_upload.

perform bdc_upload1.

perform populate_bdc.

************************************************************************

  • E N D O F S E L E C T I O N *

************************************************************************

end-of-selection.

  • displaying fields which r uploaded from flat file.

perform display_report.

************************************************************************

  • T O P _ O F _ P A G E *

************************************************************************

top-of-page.

  • to display header in the report

perform header.

&----


*& Form f4_get_help

&----


  • text

----


  • -->P_P_FILE text

----


form f4_get_help using p_p_file.

call function 'F4_FILENAME'

exporting

program_name = syst-cprog

dynpro_number = syst-dynnr

  • FIELD_NAME = ' '

importing

file_name = p_p_file.

.

endform. " f4_get_help

&----


*& Form bdc_upload

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form bdc_upload .

data: v_file type string.

v_file = p_file.

call function 'GUI_UPLOAD'

exporting

filename = v_file

filetype = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = it_tab

exceptions

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

others = 17.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

endform. " bdc_upload

&----


*& Form display_report

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_report .

uline 1(86).

loop at it_tab .

format color 2.

write :/1 sy-vline,

2 it_tab-lifnr,

12 it_tab-ktokk ,

18 it_tab-anred ,

30 it_tab-name1 ,

55 it_tab-sortl ,

58 it_tab-land1 ,

72 it_tab-spras ,

76 it_tab-kunnr ,

88 it_tab-banks ,

94 it_tab-bankl ,

112 it_tab-bankn ,

132 it_tab-koinh ,

194 it_tab-banka ,

256 it_tab-provz ,

260 sy-vline.

.

endloop.

uline 1(86).

endform. " display_report

&----


*& Form header

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form header .

uline 1(86).

format color col_heading.

write :/1 sy-vline,

2 'VEN.NO',

12 'ACC' ,

18 'TITLE' ,

30 'NAME' ,

55 'ST',

58 'LAND' ,

72 'L' ,

76 'CUSTNO',

88 'CKI',

94 'BANKKEY',

112 'B.NO',

132 'ACC HOLDER NAME',

194 'BANK NAME',

256 'reg',

260 sy-vline.

endform. " header

&----


*& Form populate_bdc

&----


  • text

----


form populate_bdc .

loop at it_tab.

perform build_screen_details using 'SAPMF02K' '0105'.

*

perform build_fields using: 'BDC_OKCODE' '/00',

'RF02K-LIFNR' it_tab-lifnr,

'RF02K-KTOKK' it_tab-ktokk.

perform build_screen_details using 'SAPMF02K' '0110'.

perform build_fields using: 'BDC_OKCODE' '/00',

'LFA1-ANRED' it_tab-anred,

'LFA1-NAME1' it_tab-name1,

'LFA1-SORTL' it_tab-sortl,

'LFA1-LAND1' it_tab-land1,

'LFA1-SPRAS' it_tab-spras.

perform build_screen_details using 'SAPMF02K' '0120'.

perform build_fields using: 'BDC_OKCODE' '/00'.

perform build_screen_details using 'SAPMF02K' '0130'.

perform build_fields using: 'BDC_OKCODE' '=BANK',

'LFBK-BANKS(01)' it_tab-banks,

'LFBK-BANKL(01)' it_tab-bankl,

'LFBK-BANKN(01)' it_tab-bankn,

'LFBK-KOINH(01)' it_tab-koinh.

perform build_screen_details using 'SAPLBANK' '0100'.

perform build_fields using: 'BDC_OKCODE' '=ENTR',

'BNKA-BANKA' it_tab-banka,

'BNKA-PROVZ' it_tab-provz.

perform build_screen_details using 'SAPMF02K' '0130'.

perform build_fields using: 'BDC_OKCODE' '=UPDA'.

endloop.

call transaction 'FK01' using it_bdctab mode 'A' update

'S' messages into it_msgtab.

clear it_bdctab.

refresh it_bdctab.

loop at it_msgtab.

perform format_message.

endloop.

endform. " populate_bdc

&----


*& Form build_screen_details

&----


  • text

----


form build_screen_details using p_program type BDCDATA-PROGRAM

p_dynpro type BDCDATA-dynpro.

it_BDCtab-PROGRAM = p_program. " Program Name

it_BDCtab-DYNPRO = p_dynpro. " Screen Number

it_BDCtab-DYNBEGIN = 'X'. " New screen

Append it_bdctab.

clear it_bdctab.

endform. " build_screen_details

&----


*& Form build_fields

&----


  • text

----


form build_fields using p_fnam

p_fval.

it_BDCtab-FNAM = p_fnam.

it_BDCtab-FVAL = p_fval.

Append it_bdctab.

clear it_bdctab.

endform. " build_fields

&----


*& Form format_message

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form format_message .

call function 'FORMAT_MESSAGE'

EXPORTING

ID = SY-MSGID

LANG = sy-langu

NO = SY-MSGNO

V1 = SY-MSGV1

V2 = SY-MSGV2

V3 = SY-MSGV3

V4 = SY-MSGV4

IMPORTING

MSG = it_msgtab

EXCEPTIONS

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.

endform. " format_message

&----


*& Form bdc_upload1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form bdc_upload1 .

data : v_file1 type string.

v_file1 = p_file1.

call function 'GUI_UPLOAD'

exporting

filename = v_file1

FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

tables

data_tab = it_tab1

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

endform. " bdc_upload1

&----


*& Form f4_get_help1

&----


  • text

----


  • -->P_P_FILE1 text

----


form f4_get_help1 using p_p_file1.

call function 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = p_p_file1

.

endform. " f4_get_help1

Regards

Laxmi

Former Member
0 Kudos

Hi,

If you use call transaction then after CALL TRANSACTION you need to capture these messages by using below code.

data: l_message(200) TYPE c.

IF sy-subrc <> 0.

LOOP AT i_messtab INTO w_messtab WHERE msgtyp = 'E'.

CLEAR l_message.

CALL FUNCTION 'MESSAGE_TEXT_BUILD'

EXPORTING

msgid = w_messtab-msgid

msgnr = w_messtab-msgnr

msgv1 = w_messtab-msgv1

msgv2 = w_messtab-msgv2

msgv3 = w_messtab-msgv3

msgv4 = w_messtab-msgv4

IMPORTING

message_text_output = l_message.

if sy-subrc = 0.

move l_message to respective field.

endif.

ENDLOOP.

ENDIF.

Cheers,

Bujji

rahulkavuri
Active Contributor
0 Kudos

DATA: V_FILE TYPE STRING,

FLAG,

V_MSG(200) TYPE C.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = IT_MSGS-MSGID

LANG = 'EN'

NO = IT_MSGS-MSGNR

V1 = IT_MSGS-MSGV1

V2 = IT_MSGS-MSGV2

V3 = IT_MSGS-MSGV3

V4 = IT_MSGS-MSGV4

IMPORTING

MSG = V_MSG

EXCEPTIONS

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.

WRITE:/ V_MSG.