LOG HANDLING IN SESSION METHOD
Hi,
My requirement is handle the errors in to internal table and then capture those errors in to flat file by using session method. I am using RSBDC_ANALYSE in my program, but it is display only the errors in the output screen like sm 35 log analyse session. How can i capture that errors in to internal table to flat file.
anybody tell me and give the code for error (log file) handling in to internal table.
Thanks
margani
hI
The system'll create a session error with only the transactions failed and you can run it again.
If you want to check which transaction u should che the log file generated by session, see the program RSBDC_ANALYSE.
But the problem can be how to match the transaction failed with the record of original file.
check these threads...
How to find and separate the Erraneous records in Session Method?
Handling errors in BDC?
Handling sessions in BDC
The error details can be retrived using the database tables;
APQI and APQD...
these tables stores the complete details about the log which occurred in the session method..
check these tables.. it has the QUEUE id.. logs etc..
Similar Messages
-
How is table control data handled in Session Method?
Hi Friends,
Can any1 plz tell me how is table control data handled in Session Method.
In Call tran we do it by count. But how in Session Method?
Thank you.
Regards,
Varun.Hi,
u can do it by both methods. u can check out this program. u need to comment the performs of table control fields and write ur own perform statements.And u have to declare the table control fields as separate internal tables.
report zcustomer_change_bict
no standard page heading line-size 255.
include bdcrecx1.
data: begin of it_record occurs 0,
kunnr like rf02d-kunnr,
d0360 like rf02d-d0360,
anred(30) type c,
name1(35) type c,
namev(35) type c,
telf1(35) type c,
abtnr(10) type c,
end of it_record.
data: begin of it_knvk1 occurs 0,
anred like knvk-anred,
end of it_knvk1.
data: begin of it_knvk2 occurs 0,
name1 like knvk-name1,
end of it_knvk2.
data: begin of it_knvk3 occurs 0,
namev like knvk-namev,
end of it_knvk3.
data: begin of it_knvk4 occurs 0,
telf1 like knvk-telf1,
end of it_knvk4.
data: begin of it_knvk5 occurs 0,
abtnr like knvk-abtnr,
end of it_knvk5.
data : fld(20) type c,
cnt(2) type n.
start-of-selection.
call function 'GUI_UPLOAD'
exporting
filename = 'C:\CUSTCH.TXT'
filetype = 'ASC'
has_field_separator = 'X'
tables
data_tab = it_record
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.
perform open_group.
loop at it_record.
refresh bdcdata.
refresh: it_knvk1,it_knvk2,it_knvk3,it_knvk4,it_knvk5.
split it_record-anred at ',' into table it_knvk1.
split it_record-name1 at ',' into table it_knvk2.
split it_record-namev at ',' into table it_knvk3.
split it_record-telf1 at ',' into table it_knvk4.
split it_record-abtnr at ',' into table it_knvk5.
screen 101
perform bdc_dynpro using 'SAPMF02D' '0101'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-D0360'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-KUNNR'
it_record-kunnr.
perform bdc_field using 'RF02D-D0360'
it_record-d0360.
screen 360
perform bdc_dynpro using 'SAPMF02D' '0360'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-ABTNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'KNVK-ANRED(01)'
record-ANRED_01_003.
*perform bdc_field using 'KNVK-NAMEV(01)'
record-NAMEV_01_004.
*perform bdc_field using 'KNVK-NAME1(01)'
record-NAME1_01_005.
*perform bdc_field using 'KNVK-TELF1(01)'
record-TELF1_01_006.
*perform bdc_field using 'KNVK-ABTNR(01)'
record-ABTNR_01_007.
move 1 to cnt.
loop at it_knvk1 .
concatenate 'knvk-anred( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk1-anred.
cnt = cnt + 1.
endloop.
move 1 to cnt.
loop at it_knvk2 .
concatenate 'knvk-name1( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk2-name1.
cnt = cnt + 1.
endloop.
move 1 to cnt.
loop at it_knvk3 .
concatenate 'knvk-namev( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk3-namev.
cnt = cnt + 1.
endloop.
move 1 to cnt.
loop at it_knvk4 .
concatenate 'knvk-telf1( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk4-telf1.
cnt = cnt + 1.
endloop.
move 1 to cnt.
loop at it_knvk5 .
concatenate 'knvk-abtnr( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk5-abtnr.
cnt = cnt + 1.
endloop.
screen 360
perform bdc_dynpro using 'SAPMF02D' '0360'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_transaction using 'XD02'.
endloop.
perform close_group. -
Want to code for call transaction and session method
my requriment is i upload a data by call tran. but i want to error handling through session method pls give the code and i want to flat file also.
asap.
a.kI suggest you try fulfilling your requirements yourself and come back with specific problems along the way.
-
Call transaction and session method -urgent
Hi,
can anybody tell me the diffence between call transaction and session method .
what are the advantage of each method and when we go for it.
how to see log file in session method.
i will really appricitatehi,
check this code,
REPORT ZTEST_ABCD NO STANDARD PAGE HEADING LINE-SIZE 255.
*REPORT zabzon_bdc
NO STANDARD PAGE HEADING LINE-SIZE 255.
TYPES: BEGIN OF record,
xbanl LIKE raifp3-xbanl,
anln1 LIKE raifp2-anln1,
anln2 LIKE raifp2-anln2,
anbtr TYPE string,
bldat TYPE string,
budat TYPE string,
bzdat TYPE string,
sgtxt LIKE raifp2-sgtxt,
monat LIKE raifp2-monat,
blart LIKE raifp1-blart,
gkont LIKE raifp2-gkont,
bwasl LIKE raifp1-bwasl,
xblnr LIKE raifp1-xblnr,
END OF record.
TYPES :BEGIN OF x_messages,
index TYPE i,
msgtyp(1),
message(120),
END OF x_messages.
DATA: it_record TYPE STANDARD TABLE OF record,
wa_record TYPE record.
DATA : it_messages TYPE STANDARD TABLE OF x_messages,
wa_messages TYPE x_messages.
DATA : it_bdcmsg TYPE STANDARD TABLE OF bdcmsgcoll,
wa_bdcmsg TYPE bdcmsgcoll.
DATA : bdcdata TYPE STANDARD TABLE OF bdcdata,
wa_bdcdata TYPE bdcdata.
DATA : it_excel TYPE STANDARD TABLE OF alsmex_tabline,
wa_excel TYPE alsmex_tabline.
DATA : fname TYPE string.
DATA :l_index LIKE sy-tabix.
data : str type string.
*Selection screen.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file1 TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK b1.
*Selction-Screen F4 Help
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'p_file1'
IMPORTING
file_name = p_file1.
*START-OF-SELECTION.
START-OF-SELECTION.
PERFORM process_f1data.
PERFORM execute_bdc.
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO bdcdata.
CLEAR wa_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval .
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO bdcdata.
CLEAR wa_bdcdata.
ENDFORM. "BDC_FIELD
*& Form process_f1data
text
--> p1 text
<-- p2 text
FORM process_f1data.
REFRESH it_excel.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = 1
i_begin_row = 1
i_end_col = 99
i_end_row = 1000
TABLES
intern = it_excel.
LOOP AT it_excel INTO wa_excel.
CASE wa_excel-col .
WHEN '1' .
wa_record-xbanl = wa_excel-value.
WHEN '1' .
wa_record-anln1 = wa_excel-value.
WHEN '2'.
wa_record-anln2 = wa_excel-value.
WHEN '3'.
wa_record-anbtr = wa_excel-value.
WHEN '4'.
wa_record-bldat = wa_excel-value.
WHEN '5'.
wa_record-budat = wa_excel-value.
WHEN '6'.
wa_record-bzdat = wa_excel-value.
WHEN '7'.
wa_record-sgtxt = wa_excel-value.
WHEN '8'.
wa_record-monat = wa_excel-value.
WHEN '9'.
wa_record-blart = wa_excel-value.
WHEN '10'.
wa_record-gkont = wa_excel-value.
WHEN '11'.
wa_record-bwasl = wa_excel-value.
WHEN '12'.
wa_record-xblnr = wa_excel-value.
ENDCASE.
AT END OF row.
CONDENSE : wa_record-anln1,wa_record-anln2,
wa_record-anbtr,wa_record-bldat,wa_record-budat,
wa_record-bzdat,wa_record-sgtxt,wa_record-monat,
wa_record-blart,wa_record-gkont,wa_record-bwasl,
wa_record-xblnr.
APPEND wa_record TO it_record.
CLEAR wa_record.
ENDAT.
ENDLOOP.
ENDFORM. " process_f1data
*& Form execute_bdc
text
--> p1 text
<-- p2 text
FORM execute_bdc.
LOOP AT it_record INTO wa_record.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NEWA'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP3-XBANL'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANLN1'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
wa_record-anln1. "'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANLN2'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
wa_record-anln2. "'0'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANBTR'.
str = wa_record-anbtr.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
wa_record-anbtr. "'45000'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BLDAT'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
wa_record-bldat. "'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'22.05.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
'01.04.2008'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BUDAT'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
wa_record-budat. "'01.04.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'01.04.2008'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BZDAT'.
PERFORM bdc_field USING 'RAIFP1-BZDAT'
wa_record-bzdat. "'01.04.2008'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BZDAT'
'01.04.2008'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-SGTXT'.
PERFORM bdc_field USING 'RAIFP2-SGTXT'
wa_record-sgtxt. "'test01'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=TAB02'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANLN1'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-ANBTR'
'45,000.00'.
PERFORM bdc_field USING 'RAIFP1-BLDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BUDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP1-BZDAT'
'01.04.2008'.
PERFORM bdc_field USING 'RAIFP2-SGTXT'
'test01'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-MONAT'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
wa_record-monat. "'01'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BLART'.
PERFORM bdc_field USING 'RAIFP1-BLART'
wa_record-blart. " 'AA'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-GKONT'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-GKONT'.
PERFORM bdc_field USING 'RAIFP2-GKONT'
wa_record-gkont. "'1600'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'RAIFP2-GKONT'
'1600'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-BWASL'.
PERFORM bdc_field USING 'RAIFP1-BWASL'
wa_record-bwasl. "'100'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'RAIFP2-GKONT'
'1600'.
PERFORM bdc_field USING 'RAIFP1-BWASL'
'100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP1-XBLNR'.
PERFORM bdc_field USING 'RAIFP1-XBLNR'
wa_record-xblnr. "'TEST01'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RAIFP2-ANLN1'.
PERFORM bdc_field USING 'RAIFP3-XBANL'
'X'.
PERFORM bdc_field USING 'RAIFP2-ANLN1'
'3100309'.
PERFORM bdc_field USING 'RAIFP2-ANLN2'
'0'.
PERFORM bdc_field USING 'RAIFP2-MONAT'
'1'.
PERFORM bdc_field USING 'RAIFP1-BLART'
'AA'.
PERFORM bdc_field USING 'RAIFP2-GKONT'
'1600'.
PERFORM bdc_field USING 'RAIFP1-BWASL'
'100'.
PERFORM bdc_field USING 'RAIFP1-XBLNR'
'TEST01'.
PERFORM bdc_dynpro USING 'SAPLAMDP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SHWD'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
CALL TRANSACTION 'ABZON' USING bdcdata
MODE 'A'
MESSAGES INTO it_bdcmsg.
PERFORM collect_bdc_messages.
ENDLOOP.
ENDFORM. " execute_bdc
*& Form collect_bdc_messages
text
--> p1 text
<-- p2 text
FORM collect_bdc_messages.
DATA: l_msg(100).
LOOP AT it_bdcmsg INTO wa_bdcmsg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_bdcmsg-msgid
lang = wa_bdcmsg-msgspra
no = wa_bdcmsg-msgnr
v1 = wa_bdcmsg-msgv1
v2 = wa_bdcmsg-msgv2
IMPORTING
msg = l_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.
CONDENSE l_msg.
CLEAR wa_bdcmsg.
wa_messages-index = l_index.
wa_messages-msgtyp = wa_bdcmsg-msgtyp.
wa_messages-message = l_msg.
APPEND wa_messages TO it_messages.
WRITE:/ wa_messages-message.
ENDLOOP.
l_index = l_index + 1.
REFRESH it_bdcmsg.
ENDFORM. " collect_bdc_messages
regards
siva -
Error message log in session method of ALV report,
In ALV report please let me know:
1) In session method:
where all error messages are stored,I know that error messages are stored in a log file, so please tell me where is it stored.
2)transaction method:
How to handle error messages in transaction methos(for eg if a weight field text box value is negative)Ans for 2nd point.
CALL TRANSACTION c_mb USING i_bdcdata
MODE g_ctumode
UPDATE g_cupdate
MESSAGES INTO i_messtab.
COMMIT WORK.
IF sy-subrc EQ 0. " BDC Executed Successfully
CLEAR wa_messtab.
LOOP AT i_messtab INTO wa_messtab .
IF wa_messtab-msgtyp = 'S' AND
wa_messtab-msgid = 'M7' AND
wa_messtab-msgnr = '060'.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_messtab-msgid
msgnr = wa_messtab-msgnr
msgv1 = wa_messtab-msgv1
msgv2 = wa_messtab-msgv2
msgv3 = wa_messtab-msgv3
msgv4 = wa_messtab-msgv4
IMPORTING
message_text_output = l_msg.
APPEND l_msg TO i_sucsess.
CLEAR l_msg.
g_docsuc = 1.
ELSE.
IF wa_messtab-msgtyp = 'E'.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_messtab-msgid
msgnr = wa_messtab-msgnr
msgv1 = wa_messtab-msgv1
msgv2 = wa_messtab-msgv2
msgv3 = wa_messtab-msgv3
msgv4 = wa_messtab-msgv4
IMPORTING
message_text_output = l_msg.
g_errflg = 1.
APPEND l_msg TO i_error.
CLEAR: l_msg.
ENDIF. -
How to handle the errors in BDC Session method
Hi All,
I am uploading Material Master (MM01) records using BDC Session Method.my problem is when i am running the program, all the error records are going to flat file.how can i correcting the error records and after correction how can i re-process the error records.tell me with example.
i have around 70,000 records in my flat file.Hi,
I am attaching few threads.Hope these will help you.
If there are any error records in session, all those error records will get poulated in log .SM35 and after the session is completed , u can see error records which can be corrected and reprocessed again
We have the structures BDCLD and BDCLM, which will capture the log details inthe session. Firstly, sesssion should be processed. After that log will be created. Then caputure the information into an internal table using BDCLM and BDCLD.
and refer the link.
error correction in bdc session
regards
Madhu -
Log file in session and call transaction methods
Hi Experts,
How to see log file in session and call transaction methods?hi
If its a session then goto SM35, select ur session and then u can see log button over there at the top... that will give the log
If its a call transaction then in ur program u need to declare internal table IT_MSGS like this
DATA: IT_MSGS LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
LOOP AT IT_SALES.
PERFORM POPULATE_BDC.
CALL TRANSACTION 'VA01' USING IT_BDCDATA
MODE MODE
UPDATE UPDATE
MESSAGES INTO IT_MSGS.
IF NOT IT_MSGS[] IS INITIAL.
LOOP AT IT_MSGS.
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.
ENDLOOP.
ENDIF.
ENDLOOP.
This will create a log for you, dont forget to award points if found helpful -
How to handle screen resolution in bdc session method.
hi all,
how to handle screen resolution in bdc session method.Hello,
Why do need that for? Is it to add rows on a table control??
If it does, add new rows by using the add button instead of adding into the table control directly to each row.
Bye
Gabriel. -
How can we handle multiple applications in session method
how can we handle multiple applications in .. session method.
can any body reply me.
thanksHari,
hi Check out this sample code to use session method
REPORT ztest_report
NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZRASH.
Internal Table Declarations *
*--Internal Table for Data Uploading.
DATA : BEGIN OF IT_FFCUST OCCURS 0,
KUNNR(10),
BUKRS(4),
KTOKD(4),
ANRED(15),
NAME1(35),
SORTL(10),
STRAS(35),
ORT01(35),
PSTLZ(10),
LAND1(3),
SPRAS(2),
AKONT(10),
END OF IT_FFCUST.
*--Internal Table to Store Error Records.
DATA : BEGIN OF IT_ERRCUST OCCURS 0,
KUNNR(10),
EMSG(255),
END OF IT_ERRCUST.
*--Internal Table to Store Successful Records.
DATA : BEGIN OF IT_SUCCUST OCCURS 0,
KUNNR(10),
SMSG(255),
END OF IT_SUCCUST.
*--Internal Table for Storing the BDC data.
DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*--Internal Table for storing the messages.
DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_FLAG1(1) VALUE ' ',
"Flag used for opening session.
V_TLINES LIKE SY-TABIX,
"For storing total records processed.
V_ELINES LIKE SY-TABIX,
"For storing the no of error records.
V_SLINES LIKE SY-TABIX.
"For storing the no of success records.
Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
V_SESNAM LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
Start-of-selection *
START-OF-SELECTION.
*-- Form to upload flatfile data into the internal table.
PERFORM FORM_UPLOADFF.
TOP-OF-PAGE *
TOP-OF-PAGE.
WRITE:/ 'Details of the error and success records for the transaction'
ULINE.
SKIP.
End of Selection *
END-OF-SELECTION.
*-- Form to Generate a BDC from the Uploaded Internal table
PERFORM FORM_BDCGENERATE.
*--To write the totals and the session name.
PERFORM FORM_WRITEOP.
*& Form form_uploadff
Form to upload flatfile data into the internal table.
FORM FORM_UPLOADFF .
*--Variable to change the type of the parameter file name.
DATA : LV_FILE TYPE STRING.
LV_FILE = V_FNAME.
*--Function to upload the flat file to the internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_FFCUST
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.
*--Deleting the headings from the internal table.
DELETE IT_FFCUST INDEX 1.
*--Getting the total number of records uploaded.
DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
ENDIF.
ENDFORM. " form_uploadff
*& Form Form_bdcgenerate
Form to Generate a BDC from the Uploaded Internal table
FORM FORM_BDCGENERATE .
*--Generating the BDC table for the fields of the internal table.
LOOP AT IT_FFCUST.
PERFORM POPULATEBDC USING :
'X' 'SAPMF02D' '0105',
' ' 'BDC_OKCODE' '/00' ,
' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
'X' 'SAPMF02D' '0110' ,
' ' 'BDC_OKCODE' '/00',
' ' 'KNA1-ANRED' IT_FFCUST-ANRED,
' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
' ' 'KNA1-SORTL' IT_FFCUST-SORTL,
' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
'X' 'SAPMFO2D' '0120',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0125',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0130',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0340',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0360',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0210',
' ' 'KNB1-AKONT' IT_FFCUST-AKONT,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0215',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0220',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0230',
' ' 'BDC_OKCODE' '=UPDA'.
*--Calling the transaction 'fd01'.
CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
MESSAGES INTO IT_CUSTMSG.
IF SY-SUBRC <> 0.
*--Populating the error records internal table.
IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_ERRCUST.
CLEAR IT_ERRCUST.
*--Opening a session if there is an error record.
IF V_FLAG1 = ' '.
PERFORM FORM_OPENSESSION.
V_FLAG1 = 'X'.
ENDIF.
*--Inserting the error records into already open session.
IF V_FLAG1 = 'X'.
PERFORM FORM_INSERT.
ENDIF.
*--Populating the Success records internal table.
ELSE.
IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_SUCCUST.
CLEAR IT_SUCCUST.
ENDIF.
*--Displaying the messages.
IF NOT IT_CUSTMSG[] IS INITIAL.
PERFORM FORM_FORMATMSG.
ENDIF.
*--Clearing the message and bdc tables.
CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
ENDLOOP.
*--Getting the total no of error records.
DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
*--Getting the total no of successful records.
DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
*--Closing the session only if it is open.
IF V_FLAG1 = 'X'.
PERFORM FORM_CLOSESESS.
ENDIF.
ENDFORM. " Form_bdcgenerate
*& Form populatebdc
FOrm to Populate the BDC table.
FORM POPULATEBDC USING VALUE(P_0178)
VALUE(P_0179)
VALUE(P_0180).
IF P_0178 = 'X'.
IT_CUSTBDC-PROGRAM = P_0179.
IT_CUSTBDC-DYNPRO = P_0180.
IT_CUSTBDC-DYNBEGIN = 'X'.
ELSE.
IT_CUSTBDC-FNAM = P_0179.
IT_CUSTBDC-FVAL = P_0180.
ENDIF.
APPEND IT_CUSTBDC.
CLEAR IT_CUSTBDC.
ENDFORM. " populatebdc
*& Form FORM_OPENSESSION
Form to Open a session.
FORM FORM_OPENSESSION .
*--Variable to convert the given session name into reqd type.
DATA : LV_SESNAM(12).
LV_SESNAM = V_SESNAM.
*--Opening a session.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = LV_SESNAM
HOLDDATE = '20040805'
KEEP = 'X'
USER = SY-UNAME
PROG = SY-CPROG
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
WRITE :/ 'Session not open'.
ENDIF.
ENDFORM. " FORM_OPENSESSION
*& Form FORM_INSERT
fORM TO INSERT ERROR RECOED INTO A SESSION.
FORM FORM_INSERT .
*--Inserting the record into session.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_CUSTBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
WRITE :/ 'Unable to insert the record'.
ENDIF.
ENDFORM. " FORM_INSERT
*& Form FORM_CLOSESESS
Form to Close the Open Session.
FORM FORM_CLOSESESS .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " FORM_CLOSESESS
*& Form FORM_FORMATMSG
Form to format messages.
FORM FORM_FORMATMSG .
*--Var to store the formatted msg.
DATA : LV_MSG(255).
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 = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE :/ LV_MSG.
ENDIF.
ULINE.
ENDFORM. " FORM_FORMATMSG
*& Form form_writeop
To write the totals and the session name.
FORM FORM_WRITEOP .
WRITE :/ 'Total Records Uploaded :',V_TLINES,
/ 'No of Error Records :',V_ELINES,
/ 'No of Success Records :',V_SLINES,
/ 'Name of the Session :',V_SESNAM.
ULINE.
ENDFORM. " form_writeop
Don't forget to reward if useful.. -
How to handle screen resolution in session method
how to handle screen resolution in session method without bdc_insert .
Hello,
Why do need that for? Is it to add rows on a table control??
If it does, add new rows by using the add button instead of adding into the table control directly to each row.
Bye
Gabriel. -
Application logs for log handling in lsmw idoc method
Hi Abapers,
Im using LSMW IDOC method for data transfer from legacy to sap system.Now the requirement is to handle application logs for log handling i.e i have to make use of custom report to handle logs,can any one tell me what all steps to be done for this or if any one can share a link related to application logs would be greatly appreciated.
Thanks.
Edited by: saeed.abap on Dec 27, 2011 5:13 PMHi Saeed,
Please check with this fms
1) BAL_DSP_LOG_DISPLA
2) APPL_LOG_READ_DB
3) IDOC_GET_MESSAGE_ATTRIBUTE
There is a wiki [Error Log Lsmw|http://wiki.sdn.sap.com/wiki/display/Snippets/ErrorLogProgramforBAPIandIDocMethodin+LSMW] available.
Regards,
Madhu.
Edited by: madhurao123 on Dec 28, 2011 8:25 AM -
Hello friends,
Is it possible to create error log in session method, just like call transaction ( BDCMSGCOLL) . I want to create error log.
Is it possible or not, If possible how ?
Please let me know the answer.
Thanks,
AjayHi,
* To catch no. of lines in itab.
DESCRIBE TABLE itab LINES trec.
* To catch no. of lines in it_err.
DESCRIBE TABLE it_err LINES erec.
* Calculation for records which are successfully uploaded.
srec = trec - erec.
* Layout for display summary begin.
WRITE:(60) sy-uline..
WRITE:/ sy-vline, ' SUMMARY OF TRANSACTION '
COLOR COL_HEADING,60 sy-vline..
WRITE:/(60) sy-uline..
WRITE:/ sy-vline, 'TOTAL NO. OF RECORDS ' COLOR
COL_TOTAL, 46 sy-vline, 50 trec LEFT-JUSTIFIED, 60 sy-vline.
WRITE:/(60) sy-uline.
WRITE:/ sy-vline, 'No Of Records Not Uploaded Successfully are:' COLOR
COL_NEGATIVE HOTSPOT ON,50 erec LEFT-JUSTIFIED, 46 sy-vline,60
sy-vline.
WRITE:/(60) sy-uline.
WRITE:/ sy-vline, 'No Of Records Uploded Successfully are: ' COLOR
COL_POSITIVE ,50 srec LEFT-JUSTIFIED,46 sy-vline,60 sy-vline.
WRITE:/(60) sy-uline.
* Function to create error file.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = 'C:\ERRORS.TXT'
filetype = 'DAT'
TABLES
data_tab = it_err.
* Subroutine for bdc_dynpro.
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
* Subroutine for bdc_field.
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
* Subroutine for bdc_transaction.
FORM bdc_transaction USING tcode.
DATA text(74).
DATA text1(34).
DATA text2(20).
text1 = 'Uploading Data for MATERIAL(MAKTX):' .
text2 = '---PLEASE WAIT.'.
CONCATENATE text1 itab-MAKTX text2 INTO text.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = text
EXCEPTIONS
OTHERS = 1.
REFRESH messtab.
CALL TRANSACTION tcode USING bdcdata
MODE 'N'
* MODE 'A'
UPDATE 'S'
MESSAGES INTO messtab.
l_subrc = sy-subrc.
* Moving data to it_trec.
MOVE l_subrc TO it_trec-rtcode.
MOVE itab-line TO it_trec-rec.
MOVE itab-MAKTX TO it_trec-MAKTX.
MOVE itab-MATKL TO it_trec-MATKL.
APPEND it_trec.
* Looping in bdcmsgcoll structure.
LOOP AT messtab.
SELECT SINGLE * FROM t100 WHERE sprsl = messtab-msgspra
AND arbgb = messtab-msgid
AND msgnr = messtab-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH messtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH messtab-msgv1 INTO l_mstring.
REPLACE '&' WITH messtab-msgv2 INTO l_mstring.
REPLACE '&' WITH messtab-msgv3 INTO l_mstring.
REPLACE '&' WITH messtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE : l_mstring.
MOVE l_mstring TO it_trec-mess.
MODIFY it_trec INDEX sy-tabix.
ENDIF.
ENDLOOP.
FORMAT COLOR 4.
* Catching error records from it_trec & moving to it_err.
LOOP AT it_trec WHERE rtcode <> 0.
MOVE-CORRESPONDING it_trec TO it_err.
APPEND it_err.
ENDLOOP.
REFRESH it_trec.
REFRESH bdcdata.
Nikhil.
Edited by: Nikhil Kanegaonkar on May 27, 2009 2:31 PM -
Handling two transactions in session method at a time
Hi frnds
now im facing problem in handling two transactions in session method fs00,fspo
at a time.
i want some info.on how to handle two transactions at a time
thanxUse the function module in the following sequence.
BDC_OPEN_GROUP.
BDC_INSERT. " for the first TCODE
BDC_INSERT. " for the second TCODE
BDC_CLOSE_GROUP.
This will solve your problem.
Reward if helpfull.
Thanks and regards,
Veerendranath Maddula. -
hi frnds
we can handle error in call transaction method by using bdcmsgcoll,
error is handled by system using session method and these errors can be analysed by going to tr sm35 . <b>is there is any way by which i will use session method in my program and all the errors will be written in the o/p of the list.
is this is possible , if so pls give me some sample code</b>
thanks
pankajHi,
check the belwo sample code.
Declaration of local constants
CONSTANTS : lc_tcode TYPE tstc-tcode VALUE 'ME31K',
lc_n TYPE ctu_mode VALUE 'N'.
Declaration of local variables
DATA: lv_msg TYPE string,
lv_subrc LIKE sy-subrc,
lv_opt TYPE ctu_params.
lv_opt-defsize = c_x.
lv_opt-dismode = lc_n.
lv_opt-updmode = c_l.
REFRESH i_messtab.
Call the transaction to create the Purchasing Contracts
CALL TRANSACTION lc_tcode USING i_bdcdata
OPTIONS FROM lv_opt
MESSAGES INTO i_messtab.
MOVE sy-subrc TO lv_subrc.
IF lv_subrc NE 0.
v_err_cnt = v_err_cnt + 1.
IF NOT i_messtab[] IS INITIAL.
READ TABLE i_messtab WITH KEY msgtyp = 'E'.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = i_messtab-msgid
lang = sy-langu
no = i_messtab-msgnr
v1 = i_messtab-msgv1
v2 = i_messtab-msgv2
v3 = i_messtab-msgv3
v4 = i_messtab-msgv4
IMPORTING
msg = lv_msg.
MOVE: p_wa_header-lifnr TO wa_error-lifnr,
p_wa_header-evart TO wa_error-evart,
p_wa_header-vedat TO wa_error-vedat,
p_wa_header-ekorg TO wa_error-ekorg,
p_wa_header-ekgrp TO wa_error-ekgrp,
p_wa_header-epstp TO wa_error-epstp,
p_wa_header-knttp TO wa_error-knttp,
p_wa_header-bukrs TO wa_error-bukrs,
p_wa_header-kdatb TO wa_error-kdatb,
p_wa_header-kdate TO wa_error-kdate,
p_wa_header-ktwrt TO wa_error-ktwrt,
p_wa_header-waers TO wa_error-waers,
p_wa_header-wkurs TO wa_error-wkurs,
p_wa_header-inco1 TO wa_error-inco1,
p_wa_header-inco2 TO wa_error-inco2,
p_wa_header-ihran TO wa_error-ihran,
p_wa_header-angnr TO wa_error-angnr,
lv_msg TO wa_error-msg.
APPEND wa_error TO i_error.
CLEAR wa_error.
ELSE.
READ TABLE i_messtab WITH KEY msgtyp = 'S'.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = i_messtab-msgid
lang = sy-langu
no = i_messtab-msgnr
v1 = i_messtab-msgv1
v2 = i_messtab-msgv2
v3 = i_messtab-msgv3
v4 = i_messtab-msgv4
IMPORTING
msg = lv_msg.
ENDIF.
ENDIF.
ENDIF.
ELSE.
v_cnt = v_cnt + 1.
ENDIF.
REFRESH i_bdcdata.
*& Form prepare_field_catalog
Prepare Field catalog
<--P_I_FIELDCAT[] Internal table for Field Catalog
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE t_fieldcat.
Declaration of local workarea
DATA: lwa_fieldcat TYPE slis_fieldcat_alv.
Declaration of local constants
CONSTANTS : lc_long_text(1) TYPE c VALUE 'L'.
*--Call the functino module to get the field catalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'I_SUCCESS'
i_inclname = sy-repid
CHANGING
ct_fieldcat = pt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
LOOP AT pt_fieldcat INTO lwa_fieldcat.
CASE lwa_fieldcat-fieldname.
WHEN 'VEDAT'.
lwa_fieldcat-ddictxt = lc_long_text.
lwa_fieldcat-seltext_l = text-004.
MODIFY i_fieldcat FROM lwa_fieldcat
INDEX sy-tabix TRANSPORTING ddictxt seltext_l .
CLEAR lwa_fieldcat.
WHEN 'KDATB'.
lwa_fieldcat-ddictxt = lc_long_text.
lwa_fieldcat-seltext_l = text-005.
MODIFY i_fieldcat FROM lwa_fieldcat
INDEX sy-tabix TRANSPORTING ddictxt seltext_l .
CLEAR lwa_fieldcat.
WHEN 'KDATE'.
lwa_fieldcat-ddictxt = lc_long_text.
lwa_fieldcat-seltext_l = text-006.
MODIFY i_fieldcat FROM lwa_fieldcat
INDEX sy-tabix TRANSPORTING ddictxt seltext_l .
CLEAR lwa_fieldcat.
WHEN 'IHRAN'.
lwa_fieldcat-ddictxt = lc_long_text.
lwa_fieldcat-seltext_l = text-007.
MODIFY i_fieldcat FROM lwa_fieldcat
INDEX sy-tabix TRANSPORTING ddictxt seltext_l .
CLEAR lwa_fieldcat.
ENDCASE.
ENDLOOP. "LOOP AT pt_fieldcat INTO lwa_fieldcat.
ENDIF. "IF sy-subrc <> 0
ENDFORM. " prepare_field_catalog
*& Form display_output
To display the success contracts output in ALV
FORM display_output .
Declaration of local workarea
DATA : lwa_layout TYPE slis_layout_alv.
Declaration of local constants
CONSTANTS : lc_chk(1) TYPE c VALUE 'X',
lc_page TYPE slis_formname VALUE 'SUB_TOP_OF_PAGE'.
Subroutine to prepare the Field Catalog
PERFORM prepare_field_catalog CHANGING i_fieldcat[].
Subroutine to build layout
lwa_layout-box_tabname = 'I_SUCCESS'.
lwa_layout-no_input = lc_chk.
lwa_layout-colwidth_optimize = lc_chk.
lwa_layout-zebra = lc_chk.
lwa_layout-cell_merge = lc_chk.
FM to call the ALV Grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_bypassing_buffer = c_x
i_callback_top_of_page = lc_page
is_layout = lwa_layout
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = i_success
EXCEPTIONS
program_error = 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. " display_output
Rewrad if helpful.
Regards,
Nagaraj -
How to handle multiple transaction in session method.
hi experts.
please tell me how to<b> write code for multiple transaction</b> in session methods.
Quest. -de<b>another question is exactly which method we have to follow , how to</b>decide.
what r the conditions for selecting which method is suitable for which type of
transaction.hi,
if you have run time validation while updating the data into SAP R/3 Transaction,then use BDC Call Transaction.
example : when you load the data into Sales order then you need to load the into Header text of sales order.
for this ,you have to use Update Mode 'S'.
it is online update and if you small amount of data ,then prefer this one
2. If you have huge amount of data and then prefer Session Method.
we have one more advantage in session method...
suppose file has 1,00,000 records and the if you use all the records at time,then you will get short dump like system time exceed .
then you can split the each 10,000 records into one session and will process.
3. Direct Input method : we prefer this method only few Transaction ,
this will not applicable to when system has customer fields .
for session method using multiple transactions.
Have one BDC_OPEN_GROUP, multiple BDC_INSERT s and one BDC_CLOSE_GROUP.
You should have multiple BDC_INSERT s for multiple transactions.
call function BDC_OPENGROUP.
Build BDC data and cal lBDC_INSERT for transaction 1
Build BDC data and cal lBDC_INSERT for transaction 2
Build BDC data and cal lBDC_INSERT for transaction 3
paas the tcodes to bdc_insert.
call function BDC_CLOSE_GROUP.
Maybe you are looking for
-
HT4528 itunes is not recognizing my new iphone 5c when i plug into my lap top
my new iphone 5c is not recognized by itunes when i connect with a cable to my win 7 laptop. when i plugged in a new ipod itunes immediately asked me to register it with itunes. no iphone icone when i plug into itunes??? any ideas
-
How can i transfer filtered data from diadem to excel?
Hi, i'm trying to write a script which would allows me to transfer data automatically from diadem to excel and i need some help. i want to copy the last of my selected channels, open an excel file and paste data into it. My script look like this Dim
-
Can I have the HotSpot function on my iPad 3G as well?
My PC does not have a mobile card, so I would like to use my iPad as a private hotspot. Since iOS4.3 this can be done with an iPhone, but I cannot find it for my iPad 3G.
-
How to unlock iphone 3gs from vodaphone network
I have an Iphone 3gs that is locked to vodaphone currently. When I asked for it to be unlocked from vodaphone they said it was not eligible. The phone was on ready to go service and I was with them long enough to then move network if I wanted to do s
-
I have read that for every consolidation area it is needed to configure a dummy consolidation unit. But my question is: which data transfer method should I assing to it? Thanks in advance! Rushid