Catching error in call transaction
Hi,
Can anyone tell me how to catch errors in call transaction method.
Please provide step by step guide.
Thanks,
Shipra
Hi Shipra...
This is the way...
data : It_MSG type table of BDCMSGCOLL with header line.
DATA : V_MESSAGE TYPE STRING.
LOOP AT ITAB.
PERFORM MAP_BDCDATA.
CALL Transaction 'MK01'
USING it_bdcdata
MODE 'N'
Messages into IT_MSG.
if sy-subrc ne 0. "when the Transaction is unsuccessful
**Display the Error messages
LOOP AT IT_MSG WHERE MSGTYP = 'E'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
msgtyp = it_msg-msgtyp
msgno = it_msg-msgnr
msgid = it_msg-msgid
msgv1 = it_msg-msgv1
msgv2 = it_msg-msgv2
IMPORTING
MESSAGE = V_MESSAGE.
WRITE:/ V_MESSAGE.
ENDLOOP.
REFRESH : IT_BDCDATA, IT_MSG.
ENDLOOP.
<b>Reward if Helpful.</b>
Similar Messages
-
Catching Errors in Call Transaction
Hi All,
I have develop the BDC using call transaction for MM01 transaction but i need to catch the success messages as well as errors in a log file that i wanna download. below is the code for the same and is it mandatory to give the update mode.please let me know.
DATA: i_bdcdata TYPE bdcdata OCCURS 0 WITH HEADER LINE,
i_error TYPE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY,
p_mode(1) DEFAULT 'A'.
p_erfile TYPE rlgrap-filename.
SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETER: PBROW_HD TYPE I, PEROW_HD TYPE I, PBCOL_HD TYPE I, PECOL_HD TYPE I.
SELECTION-SCREEN : END OF BLOCK BLK1.
DATA: T_EXCEL LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
Data: begin of record occurs 0,
MATNR(40),
MBRSH(01),
MTART(04),
MAKTX(40),
MEINS(03),
MATKL(09),
BISMT(18),
UMREN_02(05),
UMREN_03(05),
MEINH_02(03),
MEINH_03(03),
UMREZ_02(05),
UMREZ_03(05),
WERKS(04),
EKGRP(3) ,
LGORT(04),
DISMM(02),
DISPO(03), "Cash Discount Indicator
DISLS(02),
BESKZ(1),
DZEIT(3),
FHORI(3),
PERKZ(1),
MTVFP(02),
IPRKZ(01),
END OF RECORD.
DATA: v_filename LIKE RLGRAP-FILENAME.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM read_file CHANGING p_file.
CALL FUNCTION 'F4_FILENAME'
* EXPORTING
* PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FILE.
start-of-selection.
PERFORM upload_file.
PERFORM bdc
PERFORM error_download
FORM UPLOAD_FILE .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = PBCOL_HD
i_begin_row = PBROW_HD
i_end_col = PECOL_HD
i_end_row = PEROW_HD
TABLES
intern = T_EXCEL
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
LOOP AT T_EXCEL.
CASE T_EXCEL-COL.
WHEN 1. MOVE T_EXCEL-VALUE TO record-MATNR.
WHEN 2. MOVE T_EXCEL-VALUE TO record-MBRSH.
WHEN 3. MOVE T_EXCEL-VALUE TO RECORD-MTART.
WHEN 4. MOVE T_EXCEL-VALUE TO RECORD-MAKTX.
WHEN 5. MOVE T_EXCEL-VALUE TO RECORD-MEINS.
WHEN 6. MOVE T_EXCEL-VALUE TO RECORD-MATKL.
WHEN 7. MOVE T_EXCEL-VALUE TO RECORD-BISMT.
WHEN 8. MOVE T_EXCEL-VALUE TO RECORD-UMREN_02.
WHEN 9. MOVE T_EXCEL-VALUE TO RECORD-UMREN_03.
WHEN 10. MOVE T_EXCEL-VALUE TO RECORD-MEINH_02.
WHEN 11. MOVE T_EXCEL-VALUE TO RECORD-MEINH_03.
WHEN 12. MOVE T_EXCEL-VALUE TO RECORD-UMREZ_02.
WHEN 13. MOVE T_EXCEL-VALUE TO RECORD-UMREZ_03.
WHEN 14. MOVE T_EXCEL-VALUE TO RECORD-WERKS.
WHEN 15. MOVE T_EXCEL-VALUE TO RECORD-EKGRP.
WHEN 16. MOVE T_EXCEL-VALUE TO RECORD-LGORT.
WHEN 17. MOVE T_EXCEL-VALUE TO RECORD-DISMM.
WHEN 18. MOVE T_EXCEL-VALUE TO RECORD-DISPO.
WHEN 19. MOVE T_EXCEL-VALUE TO RECORD-DISLS.
WHEN 20. MOVE T_EXCEL-VALUE TO RECORD-BESKZ.
WHEN 21. MOVE T_EXCEL-VALUE TO RECORD-DZEIT.
WHEN 22. MOVE T_EXCEL-VALUE TO RECORD-FHORI.
WHEN 23. MOVE T_EXCEL-VALUE TO RECORD-PERKZ.
WHEN 24. MOVE T_EXCEL-VALUE TO RECORD-MTVFP.
WHEN 25. MOVE T_EXCEL-VALUE TO RECORD-IPRKZ.
ENDCASE.
AT END OF ROW.
APPEND record.
CLEAR record.
ENDAT.
ENDLOOP.
ENDFORM. " UPLOAD_FILE
*& Form BDC
text
--> p1 text
<-- p2 text
FORM BDC .
loop at record.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
record-matnr.
perform bdc_field using 'RMMG1-MBRSH'
record-mbrsh.
perform bdc_field using 'RMMG1-MTART'
record-mtart.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=ZU01'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-MEINS'
record-meins.
perform bdc_field using 'MARA-MATKL'
record-matkl.
perform bdc_field using 'MARA-BISMT'
record-bismt.
perform bdc_dynpro using 'SAPLMGMM' '4300'.
perform bdc_field using 'BDC_OKCODE'
'=ZU02'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLMGMM' '4300'.
perform bdc_field using 'BDC_OKCODE'
'=MAIN'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_field using 'BDC_CURSOR'
'SMEINH-UMREZ(03)'.
perform bdc_field using 'SMEINH-UMREN(02)'
record-umren_02.
perform bdc_field using 'SMEINH-UMREN(03)'
record-umren_03.
perform bdc_field using 'SMEINH-MEINH(02)'
record-meinh_02.
perform bdc_field using 'SMEINH-MEINH(03)'
record-meinh_03.
perform bdc_field using 'SMEINH-UMREZ(02)'
record-umrez_02.
perform bdc_field using 'SMEINH-UMREZ(03)'
record-umrez_03.
*perform bdc_dynpro using 'SAPLMGMM' '4300'.
*perform bdc_field using 'BDC_OKCODE'
'=MAIN'.
*perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
*perform bdc_field using 'MAKT-MAKTX'
record-maktx.
*perform bdc_dynpro using 'SAPLMGMM' '4004'.
*perform bdc_field using 'BDC_OKCODE'
'=SP02'.
*perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
*perform bdc_field using 'MAKT-MAKTX'
record-maktx.
*perform bdc_field using 'MARA-MEINS'
record-meins.
*perform bdc_field using 'MARA-MATKL'
record-matkl.
*perform bdc_field using 'MARA-BISMT'
record-bismt.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=SP09'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_dynpro using 'SAPLMGMM' '0081'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-WERKS'
record-werks.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP10'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_field using 'BDC_CURSOR'
'MARC-EKGRP'.
perform bdc_field using 'MARA-MEINS'
record-meins.
perform bdc_field using 'MARC-EKGRP'
record-ekgrp.
perform bdc_field using 'MARA-MATKL'
record-matkl.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP11'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4040'.
perform bdc_field using 'BDC_OKCODE'
'=SP12'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_dynpro using 'SAPLMGMM' '0081'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-LGORT'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-LGORT'
record-lgort.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP13'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_field using 'MARA-MEINS'
record-meins.
perform bdc_field using 'MARC-EKGRP'
record-ekgrp.
perform bdc_field using 'MARC-DISMM'
record-dismm.
perform bdc_field using 'MARC-DISPO'
record-dispo.
perform bdc_field using 'BDC_CURSOR'
'MARC-DISLS'.
perform bdc_field using 'MARC-DISLS'
record-disls.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'SP14'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_field using 'MARC-BESKZ'
record-beskz.
perform bdc_field using 'BDC_CURSOR'
'MARC-FHORI'.
perform bdc_field using 'MARC-FHORI'
record-fhori.
perform bdc_field using 'MARC-DZEIT'
record-dzeit.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP15'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_field using 'MARC-PERKZ'
record-perkz.
perform bdc_field using 'BDC_CURSOR'
'MARC-MTVFP'.
perform bdc_field using 'MARC-MTVFP'
record-mtvfp.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP19'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP20'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_field using 'MARA-MEINS'
record-meins.
perform bdc_field using 'MARA-IPRKZ'
record-iprkz.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=SP23'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
record-maktx.
perform bdc_field using 'MARA-MEINS'
record-meins.
CALL TRANSACTION 'MM01' USING i_bdcdata MODE p_mode.
CLEAR I_BDCDATA[].
ENDLOOP.
ENDFORM. " BDC
FORM bdc_dynpro USING program dynpro.
CLEAR i_bdcdata.
i_bdcdata-program = program.
i_bdcdata-dynpro = dynpro.
i_bdcdata-dynbegin = 'X'.
APPEND i_bdcdata.
ENDFORM.
FORM bdc_field USING fnam fval.
CLEAR i_bdcdata.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
APPEND i_bdcdata.
ENDFORM.
FORM ERROR_DOWNLOAD .
DATA: v_errorpath TYPE string.
v_errorpath = p_erfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = v_errorpath
filetype = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = i_error
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
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.Can't read your code, but what you need would be something like
CALL TRANSACTION ... USING bdcdata MESSAGES it_messages UPDATE ...
In messages you will have both succesfully performed steps (field MSGTYP = 'S' ) and the ones which failed (MSGTYP = 'E'),
so simply loop at that table and create error log based on that messages, then download it.
Regards
Marcin -
Errors in Call transaction and Session method.
Hi all
Please explain me in detail with example how to handle errors in call transaction method and session method.
Thanks in advance
Manu.Hi,
In Session Method Datawill be stored in session.In that session u can find error recods.
In CALL Transation useing 'FORMAT_MESSAGE' Function Module u can catch the errors.
ex:
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 = g_msg
EXCEPTIONS
OTHERS = 0.
IF it_messtab-msgtyp = 'S'.
it_sucess-sucess_rec = g_msg.
it_sucess-lifnr = it_header-lifnr." Based on your field
it_sucess-tabix = v_lines.
APPEND it_sucess.
ELSEIF it_messtab-msgtyp = 'E'.
it_error-error_rec = g_msg.
it_error-lifnr = it_header-lifnr.
it_error-tabix = v_lines.
APPEND it_error.
ELSE.
it_info-info_rec = g_msg.
it_info-lifnr = it_header-lifnr.
it_info-tabix = v_lines.
APPEND it_info.
ENDIF.
ENDLOOP.
LOOP AT IT_BDC_MESSAGES.
IF IT_BDC_MESSAGES-msgtyp = 'E'.
SELECT single * FROM t100 WHERE
sprsl = it_BDC_MESSAGES-msgspra
AND arbgb = IT_BDC_MESSAGES-msgid
AND msgnr = IT_BDC_MESSAGES-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.
REPLACE '&2' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.
REPLACE '&3' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.
REPLACE '&4' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.
APPEND it_mess.
ELSE.
it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.
APPEND it_mess.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
Reward if useful.
Regards,
Narasimha -
How to rectify the errors through call transaction metod in bdc
how to rectify the errors through call transaction metod in bdc
Hi ,
View the highlited part of the below code.
REPORT ygfrivat1 NO STANDARD PAGE HEADING
LINE-SIZE 165
MESSAGE-ID yif_groc.
Program YGFRIVAT1
Function Report to Upload the VAT Adjustment File.
Author ARENAPU
Date 11.05.2007
PMTS AM12810157
Transport G6DK937834
Description:
Modification log:
1. Changed by :
Changed on :
PMTS :
Transport :
Tag :
Description :
T A B L E S D E C L A R A T I O N S
TABLES: edidc, "Control record (IDoc)
edids, "Status Record (IDoc)
t001w.
Internal Tables Declaration.
Internal table to hold data from table EDIDS
DATA: BEGIN OF t_edids OCCURS 0,
docnum LIKE edids-docnum,
logdat LIKE edids-logdat,
logtim LIKE edids-logtim,
countr LIKE edids-countr,
credat LIKE edids-credat,
uname LIKE edids-uname,
END OF t_edids,
Internal table to hold data from table EDIDC
BEGIN OF t_edidc OCCURS 0,
docnum LIKE edidc-docnum,
rcvprt LIKE edidc-rcvprt,
rcvprn LIKE edidc-rcvprn,
credat LIKE edidc-credat,
END OF t_edidc,
Internal table to hold data from upload file
BEGIN OF t_tab OCCURS 0,
cust(10), "site/customer number
date(10), "transaction date
currency(04), "currency
extnbr(15), "external reference number
pos-cont(05), "POS controler
pos-id(25), "POS id
cashier(10), "cashier name
qualif(04), "qualifier of the article
matnr(25), "article number
qty(10), "quantity
sale(16), "sale value
pos-tr(04), "POS transfert type
paymeth(04), "payment method
final(35), "final price
tarcur(04), "target currency
assign(35), "assignment day
error,
END OF t_tab,
Internal table for Report display.
BEGIN OF t_tab1 OCCURS 0,
cust(10), "site/customer number
date(10), "transaction date
currency(04), "currency
extnbr(15), "external reference number
pos-cont(05), "POS controler
pos-id(25), "POS id
cashier(10), "cashier name
qualif(04), "qualifier of the article
matnr(25), "article number
qty(16) TYPE p DECIMALS 2, "quantity
sale(16) TYPE p DECIMALS 2, "sale value
pos-tr(04), "POS transfert type
paymeth(04), "payment method
final(16) TYPE p DECIMALS 2, "final price
tarcur(04), "target currency
assign(35), "assignment day
END OF t_tab1,
t_tab_temp LIKE t_tab OCCURS 0 WITH HEADER LINE,
Internal table to Validate Customer no.
BEGIN OF t_check OCCURS 0,
werks LIKE t001w-werks,
vkorg LIKE t001w-vkorg,
value(40),
END OF t_check,
t_check_temp LIKE t_check OCCURS 0 WITH HEADER LINE.
Internal table to hold data from table ZCS_PARAM.
DATA: BEGIN OF t_zcs_param OCCURS 0.
INCLUDE STRUCTURE zcs_param.
DATA: vkorg LIKE t001w-vkorg,
END OF t_zcs_param.
*Internal table to hold Messages.
DATA: BEGIN OF t_message OCCURS 0,
msgnum TYPE msgnum,
msgtyp TYPE msgtyp,
msgtxt TYPE msgtext,
END OF t_message.
*Work area for table t_message
DATA : w_message LIKE LINE OF t_message.
Internal table to hold BDC data
DATA: t_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
Internal table to collect error messages
messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
*Internal table to hold messages from call transaction
DATA: BEGIN OF t_text OCCURS 0,
desc(150),
msgtxt(100),
END OF t_text.
D A T A D E C L A R A T I O N S
DATA: n TYPE i,
gv_status(11) TYPE c, "Shows status, Production or Test
gv_exit TYPE c, "Exit Flag
gv_qty(16) TYPE p DECIMALS 2, "Variable to sum Quantity
gv_sale(16) TYPE p DECIMALS 2, "Variable to sum Amount
gv_final(16) TYPE p DECIMALS 2. "Variable to sum Final Amount
DATA: w_text(100),
gv_mode TYPE c,
error TYPE c. "Flag to Indicate error.
CONSTANSTS DECLARATION
CONSTANTS : gc_fieldname LIKE dynpread-fieldname VALUE 'P_FNAME',
gc_seq_no LIKE zcs_param-seq_no VALUE '00110',
gc_object LIKE zcs_param-object VALUE 'YGFVAT',
gc_paraname LIKE zcs_param-paraname VALUE 'VKORG',
gc_back TYPE c VALUE 'N',
gc_error TYPE c VALUE 'E',
gc_all TYPE c VALUE 'A'.
S E L E C T I O N S C R E E N
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
PARAMETERS : p_fname LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(31) text-002 FOR FIELD p_test.
PARAMETERS : p_test AS CHECKBOX.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK a1.
SELECTION-SCREEN BEGIN OF BLOCK a2 WITH FRAME TITLE text-006.
PARAMETERS : rb_back RADIOBUTTON GROUP rb1 DEFAULT 'X',
rb_error RADIOBUTTON GROUP rb1,
rb_all RADIOBUTTON GROUP rb1.
SELECTION-SCREEN END OF BLOCK a2.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
*Subroutine to provide F4 help for file name
PERFORM fr_get_filename.
I N I T I A L I Z A T I O N
INITIALIZATION.
*Subroutine to check authorization.
PERFORM fr_authority_check.
T O P - O F - P A G E
TOP-OF-PAGE.
*Subroutine to diplay header
PERFORM fr_display_header.
S T A R T - O F - S E L E C T I O N
START-OF-SELECTION.
*Subroutine to upload data from presentation server.
PERFORM fr_upload_data.
*Subroutine to validate records from uploaded file.
PERFORM fr_validate_data.
*Subroutine to build report internal table.
PERFORM fr_build_rep.
E N D - O F - S E L E C T I O N
END-OF-SELECTION.
*Subroutine to display report.
PERFORM fr_write_report.
F O R M S U B R O U T I N E S
*& Form fr_get_filename
text
FORM fr_get_filename.
DATA : lv_repid LIKE sy-repid, " Report id
lv_file LIKE ibipparms-path. " File Path
lv_repid = sy-repid.
F4 help for file path.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = lv_repid
dynpro_number = syst-dynnr
field_name = gc_fieldname " p_fname1
IMPORTING
file_name = lv_file.
IF NOT lv_file EQ space.
p_fname = lv_file.
ELSE.
MESSAGE e999 WITH 'Invalid Path'(005).
ENDIF.
ENDFORM. " fr_get_filename
*& Form fr_upload_data
text
FORM fr_upload_data.
DATA: lv_fname TYPE string.
CLEAR lv_fname.
lv_fname = p_fname.
Uploading file from PC or presentation server to internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_fname
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = t_tab
EXCEPTIONS
file_open_error = 1.
IF sy-subrc <> 0.
DESCRIBE TABLE t_message LINES n.
w_message-msgnum = n + 1.
w_message-msgtyp = 'E'.
MOVE text-m01 TO w_message-msgtxt.
APPEND w_message TO t_message.
Subroutine for writing log.
PERFORM fr_write_log.
ENDIF.
ENDFORM. " fr_upload_data
*& Form fr_validate_data
text
FORM fr_validate_data.
DATA : lv_lines1 TYPE i,
lv_lines2 TYPE i.
*Obtain Status depending on Check box selected.
IF p_test IS INITIAL.
gv_status = 'PRODUCTION'.
ELSE.
gv_status = 'TEST RUN'.
ENDIF.
*Batch Mode
CLEAR gv_mode.
IF rb_back EQ 'X'. "No Display
MOVE gc_back TO gv_mode.
ELSEIF rb_error EQ 'X'. "Error Only
MOVE gc_error TO gv_mode.
ELSEIF rb_all EQ 'X'. "All Screens
MOVE gc_all TO gv_mode.
ENDIF.
IF NOT t_tab[] IS INITIAL.
SORT t_tab BY cust.
REFRESH t_tab_temp.
t_tab_temp[] = t_tab[].
SORT t_tab_temp BY cust.
DELETE ADJACENT DUPLICATES FROM t_tab_temp COMPARING cust.
IF NOT t_tab_temp[] IS INITIAL.
SELECT werks vkorg FROM t001w
INTO TABLE t_check
FOR ALL ENTRIES IN t_tab_temp
WHERE werks = t_tab_temp-cust+0(4).
IF sy-subrc = 0.
SORT t_check BY werks.
ENDIF.
LOOP AT t_check.
IF t_check-vkorg <> ' '.
MOVE t_check-vkorg TO t_check-value.
MODIFY t_check TRANSPORTING value.
ENDIF.
ENDLOOP.
ENDIF.
FREE t_tab_temp.
ENDIF.
IF NOT t_check[] IS INITIAL.
REFRESH t_check_temp.
t_check_temp[] = t_check[].
SORT t_check_temp BY value.
DELETE ADJACENT DUPLICATES FROM t_check_temp COMPARING value.
IF NOT t_check_temp[] IS INITIAL.
SELECT * FROM zcs_param INTO TABLE t_zcs_param
FOR ALL ENTRIES IN t_check_temp
WHERE seq_no EQ gc_seq_no
AND object EQ gc_object
AND paraname EQ gc_paraname
AND value EQ t_check_temp-value.
IF sy-subrc = 0.
SORT t_zcs_param BY value.
ENDIF.
ENDIF.
FREE t_check_temp.
ENDIF.
IF NOT t_tab[] IS INITIAL.
LOOP AT t_tab.
READ TABLE t_check WITH KEY werks = t_tab-cust BINARY SEARCH.
IF sy-subrc <> 0.
MOVE 'X' TO t_tab-error.
MODIFY t_tab TRANSPORTING error.
DESCRIBE TABLE t_message LINES n.
w_message-msgnum = n + 1.
w_message-msgtyp = 'E'.
CONCATENATE t_tab-cust text-030
INTO w_message-msgtxt SEPARATED BY space.
APPEND w_message TO t_message.
Subroutine for writing log.
PERFORM fr_write_log.
EXIT.
ELSE.
READ TABLE t_zcs_param WITH KEY value = t_check-vkorg
BINARY SEARCH.
IF sy-subrc <> 0.
MOVE 'X' TO t_tab-error.
MODIFY t_tab TRANSPORTING error.
DESCRIBE TABLE t_message LINES n.
w_message-msgnum = n + 1.
w_message-msgtyp = 'E'.
CONCATENATE text-003 t_tab-cust text-004 t_check-vkorg
INTO w_message-msgtxt SEPARATED BY space.
APPEND w_message TO t_message.
Subroutine for writing log.
PERFORM fr_write_log.
EXIT.
ELSE.
PERFORM fr_format_tab.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
DESCRIBE TABLE t_tab LINES lv_lines1.
IF lv_lines1 <> 0.
DELETE t_tab WHERE error EQ 'X'.
ENDIF.
DESCRIBE TABLE t_tab LINES lv_lines2.
IF lv_lines2 <> 0.
IF lv_lines2 <> lv_lines1.
EXIT.
ELSE.
IF p_test IS INITIAL.
LOOP AT t_tab.
*Subroutine to build BDC table
PERFORM fr_fill_bdctab.
*Subroutine to Post Data into SAP.
PERFORM fr_data_posting.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " fr_validate_data
*& Form fr_write_log
text
FORM fr_write_log.
CLEAR error.
error = 'X'.
WRITE:/1 'Msg No'(027), 10 'Type'(028), 20 'Text'(029).
ULINE:/1(120).
FORMAT RESET.
LOOP AT t_message.
IF t_message-msgtyp = 'E'.
FORMAT COLOR 6 INTENSIFIED .
ELSEIF t_message-msgtyp = 'W'.
FORMAT COLOR 3 INTENSIFIED .
ELSEIF t_message-msgtyp = 'I'.
FORMAT COLOR 5 INTENSIFIED .
ENDIF.
WRITE:/1 t_message-msgnum,
10 t_message-msgtyp,
20 t_message-msgtxt.
FORMAT RESET.
ENDLOOP.
ULINE:/1(120).
ENDFORM. " fr_write_log
*& Form fr_write_report
text
FORM fr_write_report.
CLEAR gv_exit.
LOOP AT t_message.
IF t_message-msgtyp = 'E'.
gv_exit = 'X'.
EXIT.
ENDIF.
ENDLOOP.
IF NOT gv_exit IS INITIAL.
EXIT.
ELSE.
PERFORM fr_display_report.
IF NOT t_text[] IS INITIAL.
Subroutine for Display Call Transaction messages.
PERFORM fr_write_msg.
ENDIF.
ENDIF.
ENDFORM. " fr_write_report
*& Form fr_display_report
text
FORM fr_display_report.
IF NOT t_tab1[] IS INITIAL.
CLEAR: gv_qty, gv_sale, gv_final.
LOOP AT t_tab1.
WRITE:/1(10) t_tab1-cust,
13(10) t_tab1-date,
25(05) t_tab1-currency,
32(14) t_tab1-extnbr,
48(09) t_tab1-pos-cont,
60(18) t_tab1-matnr,
80(16) t_tab1-qty RIGHT-JUSTIFIED ,
98(16) t_tab1-sale RIGHT-JUSTIFIED ,
116(07) t_tab1-paymeth,
125(16) t_tab1-final RIGHT-JUSTIFIED,
143(06) t_tab1-tarcur,
152(12) t_tab1-assign.
gv_qty = t_tab1-qty + gv_qty.
gv_sale = t_tab1-sale + gv_sale.
gv_final = t_tab1-final + gv_final.
ENDLOOP.
FORMAT COLOR 3.
ULINE: /(164).
WRITE:/ 'TOTALS',
80(16) gv_qty RIGHT-JUSTIFIED,
98(16) gv_sale RIGHT-JUSTIFIED,
125(16) gv_final RIGHT-JUSTIFIED,
182 ''.
ULINE: /(164).
FORMAT RESET.
ENDIF.
ENDFORM. " fr_display_report
*& Form FR_DISPLAY_HEADER
text
FORM fr_display_header.
IF error IS INITIAL.
FORMAT COLOR 1.
WRITE:/ 'Date upload :'(007), 25 sy-datum, 38 ''.
WRITE:/ 'Production or Test Run:'(008), 25 gv_status, 38 ''.
WRITE:/ 'Upload User Logon :'(009), 25 sy-uname, 38 ''.
ULINE: /(164).
WRITE:/1(04) 'Site'(010),
13(10) 'Date'(011),
25(05) 'Curr.'(012),
32(14) 'Receipt'(013),
48(09) 'Cashier'(014),
60(18) 'Article'(015),
92 'Qty'(016),
102 'Item Amount'(017),
116(7) 'M.o.P.'(018),
128 'Tender Amount'(019),
143(6) 'T.Curr'(020),
152(12) 'Assignment'(021).
ULINE:/(164).
FORMAT RESET.
ENDIF.
ENDFORM. " FR_DISPLAY_HEADER
*& Form fr_newdynpro
text
FORM fr_newdynpro USING program LIKE bdcdata-program
dynpro LIKE bdcdata-dynpro.
t_bdcdata-program = program .
t_bdcdata-dynpro = dynpro.
t_bdcdata-dynbegin = 'X'.
APPEND t_bdcdata.
CLEAR t_bdcdata.
ENDFORM. " fr_newdynpro
*& Form fr_loadfield
text
FORM fr_loadfield USING field LIKE bdcdata-fnam
value.
t_bdcdata-fnam = field.
t_bdcdata-fval = value.
APPEND t_bdcdata.
CLEAR t_bdcdata.
ENDFORM. " fr_loadfield
*& Form fr_fill_bdctab
text
FORM fr_fill_bdctab.
REFRESH t_bdcdata.
PERFORM fr_newdynpro USING 'SAPMWPUK' '100'.
PERFORM fr_loadfield USING 'G_FILIALE' t_tab-cust.
PERFORM fr_loadfield USING 'G_DATUM' t_tab-date.
PERFORM fr_loadfield USING 'BDC_OKCODE' 'BON'.
PERFORM fr_newdynpro USING 'SAPMWPUK' '500'.
PERFORM fr_loadfield USING 'WPSCB01-POSKREIS' t_tab-pos-cont.
PERFORM fr_loadfield USING 'WPSCB01-KASSID' t_tab-pos-id.
PERFORM fr_loadfield USING 'WPSCB01-BELEGWAERS' t_tab-currency.
PERFORM fr_loadfield USING 'WPSCB01-CSHNAME' t_tab-cashier.
PERFORM fr_loadfield USING 'WPSCB01-BONNUMMER' t_tab-extnbr.
PERFORM fr_loadfield USING 'E1WPB02-QUALARTNR(01)' t_tab-qualif.
PERFORM fr_loadfield USING 'E1WPB02-ARTNR(01)' t_tab-matnr.
PERFORM fr_loadfield USING 'E1WPB02-MENGE(01)' t_tab-qty.
PERFORM fr_loadfield USING 'WPSCB03-KONDVALUE(01)' t_tab-sale.
PERFORM fr_loadfield USING 'E1WPB02-VORGANGART(01)' t_tab-pos-tr.
PERFORM fr_loadfield USING 'BDC_OKCODE' 'ZAHL'.
PERFORM fr_newdynpro USING 'SAPMWPUK' '530'.
PERFORM fr_loadfield USING 'WPSCB06-ZAHLART' t_tab-paymeth.
PERFORM fr_loadfield USING 'WPSCB06-SUMME' t_tab-final.
PERFORM fr_loadfield USING 'WPSCB06-WAEHRUNG' t_tab-tarcur.
PERFORM fr_loadfield USING 'WPSCB06-ZUONR' t_tab-assign.
PERFORM fr_loadfield USING 'BDC_OKCODE' 'SAVE'.
PERFORM fr_newdynpro USING 'SAPMWPUK' '530'.
PERFORM fr_loadfield USING 'WPSCB06-ZAHLART' t_tab-paymeth.
PERFORM fr_loadfield USING 'WPSCB06-SUMME' t_tab-final.
PERFORM fr_loadfield USING 'WPSCB06-WAEHRUNG' t_tab-tarcur.
PERFORM fr_loadfield USING 'WPSCB06-ZUONR' t_tab-assign.
PERFORM fr_loadfield USING 'BDC_OKCODE' 'BACK'.
PERFORM fr_newdynpro USING 'SAPLSPO1' '0200'.
PERFORM fr_loadfield USING 'BDC_OKCODE' 'YES'.
PERFORM fr_newdynpro USING 'SAPMWPUK' '100'.
PERFORM fr_loadfield USING 'G_FILIALE' t_tab-cust.
PERFORM fr_loadfield USING 'G_DATUM' t_tab-date.
PERFORM fr_loadfield USING 'BDC_OKCODE' 'BACK'.
ENDFORM. " fr_fill_bdctab
*& Form fr_data_posting
text
FORM fr_data_posting.
IF NOT t_bdcdata[] IS INITIAL.
REFRESH messtab.
CALL TRANSACTION 'WPUK' USING t_bdcdata
MODE gv_mode
UPDATE 'S'
MESSAGES INTO messtab.
IF sy-subrc = 0 .
CLEAR w_text.
LOOP AT messtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = messtab-msgid
lang = sy-langu
no = messtab-msgnr
v1 = messtab-msgv1
v2 = messtab-msgv2
v3 = messtab-msgv3
v4 = messtab-msgv4
IMPORTING
msg = w_text
EXCEPTIONS
not_found = 1
OTHERS = 2.
MOVE w_text TO t_text-msgtxt.
CONCATENATE 'Site:'(031) t_tab-cust
'Article:'(024) t_tab-matnr
'Posted Sucessfully'(032)
INTO t_text-desc SEPARATED BY space.
APPEND t_text.
CLEAR t_text.
ENDLOOP.
ELSE.
CLEAR w_text.
LOOP AT messtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = messtab-msgid
lang = sy-langu
no = messtab-msgnr
v1 = messtab-msgv1
v2 = messtab-msgv2
v3 = messtab-msgv3
v4 = messtab-msgv4
IMPORTING
msg = w_text
EXCEPTIONS
not_found = 1
OTHERS = 2.
MOVE w_text TO t_text-msgtxt.
IF messtab-msgnr EQ '213'.
CONCATENATE 'Site:'(031) t_tab-cust
'Article:'(024) t_tab-matnr
'Posted Sucessfully'(032)
INTO t_text-desc SEPARATED BY space.
APPEND t_text.
CLEAR t_text.
EXIT. ELSE.
CONCATENATE 'Site:'(031) t_tab-cust
'Article:'(024) t_tab-matnr
'Not Posted'(033)
INTO t_text-desc SEPARATED BY space.
APPEND t_text.
CLEAR t_text.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " fr_data_posting
*& Form fr_authority_check
text
FORM fr_authority_check.
AUTHORITY-CHECK OBJECT 'Y_VATADJ'
ID 'VKORG' FIELD t001w-vkorg
ID 'TCD' FIELD 'YGFVAT'.
IF sy-subrc NE 0.
MESSAGE e999 WITH text-m02.
ENDIF.
ENDFORM. " fr_authority_check
*& Form fr_write_msg
text
FORM fr_write_msg.
SKIP.
ULINE:/(164).
WRITE:/
'Messages encountered while Calling Transaction WPUK'(025),
90 'Message Text'(026).
ULINE:/1(164).
LOOP AT t_text.
WRITE:/1 t_text-desc,
90 t_text-msgtxt,
164 ''.
ENDLOOP.
ULINE:/1(164).
ENDFORM. " fr_write_msg
*& Form FR_BUILD_REP
text
FORM fr_build_rep.
IF error IS INITIAL.
IF NOT t_tab[] IS INITIAL.
LOOP AT t_tab.
MOVE:
t_tab-cust TO t_tab1-cust, "site/customer number
t_tab-date TO t_tab1-date, "transaction date
t_tab-currency TO t_tab1-currency, "currency
t_tab-extnbr TO t_tab1-extnbr, "external reference number
t_tab-pos-cont TO t_tab1-pos-cont, "POS controler
t_tab-pos-id TO t_tab1-pos-id, "POS id
t_tab-cashier TO t_tab1-cashier, "cashier name
t_tab-qualif TO t_tab1-qualif, "qualifier of the article
t_tab-matnr TO t_tab1-matnr, "article number
t_tab-pos-tr TO t_tab1-pos-tr, "POS transfert type
t_tab-paymeth TO t_tab1-paymeth, "payment method
t_tab-tarcur TO t_tab1-tarcur, "target currency
t_tab-assign TO t_tab1-assign.
REPLACE ',' WITH '.' INTO t_tab-qty.
CONDENSE t_tab-qty NO-GAPS.
MOVE t_tab-qty TO t_tab1-qty.
REPLACE ',' WITH '.' INTO t_tab-sale.
CONDENSE t_tab-sale NO-GAPS.
MOVE t_tab-sale TO t_tab1-sale.
REPLACE ',' WITH '.' INTO t_tab-final.
CONDENSE t_tab-final NO-GAPS.
MOVE t_tab-final TO t_tab1-final.
APPEND t_tab1.
CLEAR t_tab1.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " FR_BUILD_REP
*& Form fr_format_tab
text
FORM fr_format_tab.
DATA : lv_qty TYPE string.
IF NOT t_tab-qty IS INITIAL.
IF t_tab-qty+0(1) EQ '-'.
CLEAR lv_qty.
MOVE t_tab-qty TO lv_qty.
CLEAR t_tab-qty.
SHIFT lv_qty LEFT CIRCULAR.
CONDENSE lv_qty NO-GAPS.
MOVE lv_qty TO t_tab-qty.
MODIFY t_tab TRANSPORTING qty.
ENDIF.
ENDIF.
ENDFORM. " fr_format_tab -
Hi all,
In my program I am trying to handle errors in call transaction method using bdcmsgcoll and format_message.To check this I have given some false data like trying to create materials which are already in mara tables. The data is not updated in the mara tables but No error messages are populated into the bdcmsgcoll structure. The status of all messges is success. How do messages get populated into bdcmsgcoll ?
I am forwardimng my code too. Can anyone please explain me what's happening ? For what type of errors, Error messages get poplated into bdcmsgcoll ?
report Z_MAT_CALL
no standard page heading line-size 255.
data : begin of material occurs 0,
matnr like mara-matnr, " Material Number
mbrsh like mara-mbrsh, " Industry sector
mtart like mara-mtart, " material Type
maktx like makt-maktx, " Material Description
meins like mara-meins, " Base Unit of Measure
end of material.
data fnam type string value 'C:\BW\MAT.TXT'.
*---- BDCDATA
data : bdcdata like bdcdata occurs 0 with header line,
itab like bdcmsgcoll occurs 0 with header line,
mesg(100).
*---- Uploading data into internal table from flat File.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = fnam "'C:\BW\MAT.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = material.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at material.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MTART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
material-matnr.
perform bdc_field using 'RMMG1-MBRSH'
material-mbrsh.
perform bdc_field using 'RMMG1-MTART'
material-mtart.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'MAKT-MAKTX'
material-maktx.
perform bdc_field using 'BDC_CURSOR'
'MARA-MEINS'.
perform bdc_field using 'MARA-MEINS'
material-meins.
perform bdc_field using 'MARA-MTPOS_MARA'
'NORM'.
perform bdc_transaction using 'MM01'.
refresh bdcdata.
endloop.
*LOOP AT iTAB.
*WRITE: / iTAB-TCODE,
*iTAB-DYNAME,
*iTAB-DYNUMB,
*iTAB-MSGTYP,
*iTAB-MSGSPRA,
*iTAB-MSGID,
*iTAB-MSGNR.
*ENDLOOP.
Start new screen *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
CLEAR BDCDATA.
ENDFORM.
Insert field *
FORM BDC_FIELD USING FNAM FVAL.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
CLEAR BDCDATA.
ENDFORM.
Form bdc_transaction
form bdc_transaction using value(tcode).
call transaction tcode using bdcdata
mode 'N'
update 'S' messages into itab.
if sy-subrc Ne 0.
read table itab with key msgtyp = 'E'.
if sy-subrc = 0.
perform check.
endif.
endif.
endform. " bdc_transaction
Form check
form check .
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = itab-msgid
lang = sy-langu
no = itab-msgnr
v1 = itab-msgv1
v2 = itab-msgv2
v3 = itab-msgv3
v4 = itab-msgv4
IMPORTING
msg = mesg
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. " check
Regards,
Varun.Hi
DATA : T_BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.
DATA : WA_BDCMSGCOLL TYPE BDCMSGCOLL.
DATA : ERR_LOG TYPE MESSAGE.
Call Transaction MM01
IF W_FLAG NE 'X'.
CALL TRANSACTION 'MM01' USING T_BDCDATA OPTIONS FROM WA_CTU_PARAMS
MESSAGES INTO T_BDCMSGCOLL.
COMMIT WORK AND WAIT.
DESCRIBE TABLE T_BDCMSGCOLL LINES N.
IF N <> 0.
LOOP AT T_BDCMSGCOLL INTO WA_BDCMSGCOLL.
CLEAR ERR_LOG.
W_MSGNO = WA_BDCMSGCOLL-MSGNR.
CALL FUNCTION 'WRITE_MESSAGE'
EXPORTING
MSGID = WA_BDCMSGCOLL-MSGID
MSGNO = W_MSGNO
MSGTY = WA_BDCMSGCOLL-MSGTYP
IMPORTING
MESSG = ERR_LOG.
Error that occurs during transactoon
IF ERR_LOG-MSGTY = 'E'.
MOVE-CORRESPONDING T_UPLOAD TO T_DOWNLOAD.
MOVE ERR_LOG-MSGTX TO T_DOWNLOAD-MSG.
APPEND T_DOWNLOAD.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
check structure declaration and code it may be useful
regards
vinod -
Hi,
Let me know why this issue is coming.
I'M doing a bdc using call transaction and want to catch the error messages and throw back as alvoutput.
my code is
PERFORM bdc_dynpro using 'X' 'SAPMV50A' '0101' '' ''.
PERFORM bdc_dynpro using 'X' 'SAPMV50A' '4004' '' ''.
PERFORM bdc_dynpro using '' '' '' 'LIKP-VBELN' wa_likp-vbeln.
PERFORM bdc_dynpro using '' '' '' 'BDC_OKCODE' 'WABU_T'.
CALL TRANSACTION 'VL02N'
USING itab_bdcdata
MODE lv_tmpmode
UPDATE 'S'
MESSAGES INTO itab_messages.
IF sy-subrc NE 0.
PERFORM messages.
ENDIF.
what the message that i'm getting in itab_messages is "
Start screen does not exist in batch input data".
please let me know why this error is coming.
--sudhaHi,
no need to call the screen num 101.
4004 is the first screen number of the transaction code vl02n.
regards.
sriram. -
How to catch errors in calling program when using SUBMIT ... AND RETURN ?
Hi ,
I am calling a report using submit and return statement from a function module. The report has select-options field for a date field. If user enters a date in low, which is greater than high, getting error message "Lower limit is greater than upper limit".
How to catch this error without endup stoping on selection screen of the report?
In the documentation, I read :
Programs called with SUBMIT ... AND RETURN or CALL TRANSACTION cannot propagate exceptions to the caller, because exception objects are bound to the internal mode of a program.
Is there any way to overcome this?
Also my aim is to write a validation on the date selection-option to have the date range not more than 20 days.
I am not sure of how to achieve this.
Is there a way to do validation of select-options data before submiting to the report ?
Is there any standard FM to achieve this task?
Thank you,
Surya.
Edited by: Surya on May 24, 2009 6:08 PMHi Surya ,
In your function module's code validate the date .
If the low value of the date less than high and date period is not more than 20 then
call transaction and in else condition raise exception.
In your FM write like that - -
IF date-low LT date-high AND
date_difference LE '20' .
CALL TRANSACTION 'transaction'.
ELSE.
RAISE ........... " Raise the invalid date exception
ENDIF.
Regards
Pinaki -
Error in CALL TRANSACTION and SESSION Method
I have 8 records (1,2,3,4,5,6,7,8) to update into SAP database using CALL TRANSACTION and SESSION Method. If there is a error in 6th record. What happens in both call transaction and session method.
Please let me know which records will process and what about the error record. How to process only the error record if all other records have updated into database.Hi Patil_sumeet,
if your code for this is not protected secret of some federal agency, you may read [How to post code in SCN, and some things NOT to do...|How to post code in SCN, and some things NOT to do...; and then post relevant lines here.
According to the facts presented until know it may have been better to ask Radio Eriwan
Regards
Clemens -
Timeout Error in Call Transaction on Asynchronous Abap Proxy
Hi Gurus!!
We have a problem with a Call Transaction on Asynchronous Abap Proxy. When the process of Call Transaction (transaction CO02) takes more than 10 minutes, the process is cancelled with sy-subrc 1001 and the Abap Proxy continues with the execution. Strangely, there is a short dump in ST22 on transaction CO02, although on the ABAP Proxy we don't get any dump.
When this process is called from a Background Job no dumps are get.
Somebody knows if there is a problem with the Asynchronous ABAP Proxy executing CALL TRANSACTION statementent?
Thanks and regards,
Manuel.and the message after recording is
Number 1
Transaction F-22
SY-SUBRC 0
Messages
FB01 SAPMF05A 0301WEZ001 066
FB01 SAPMF05A 0300WEZ001 066
FB01 SAPMF05A 0300EEZ001 073
I F5 573 Correct the error reported before on the next screen
FB01 SAPMF05A 0300WEZ001 066
FB01 SAPMF05A 0300EEZ001 073
I F5 573 Correct the error reported before on the next screen
FB01 SAPMF05A 0330WEZ001 066
FB01 SAPMF05A 0301WEZ001 066
FB01 SAPMF05A 0301WEZ001 066
FB01 SAPMF05A 0301WEZ001 066
S F5 312 Document 100001677 was posted in company code 3100 -
Error when Calling Transaction in ABAP Proxy
Hi All,
I'm trying to call a transaction in synchronous ABAP Proxy, but there's a CNTL_ERROR in the details of SXMB_MONI.
I've checked some threads related to this problem, but they're not solved yet.
Please advise, can I use "call transaction" in synchronous ABAP Proxy ? Is there any additional setting / code to prevent the error ?
Thanks in advance,
Andy SHi Stefan,
I'm trying to assign marketing attributes in our CRM Business Partner Transaction, which is triggered by messages sent from some 3rd party application.
Recently, I find out that this transaction (TCode BP) raise the same error (CNTL_ERROR) if run background from SM35. So the problem is not about calling transaction in ABAP Proxy, but due to the TCode BP itself.......
My ABAPER friend is trying to find the BAPI to replace this call transaction .........
Thanks a lot for your response........
Regards,
Andy S -
TIME_OUT Error in calling transaction IP10
Hi all,
I would like to ask help from you guys, i am currently handling an error when using transaction IP30 (RISTRA20). The program returns an error (Message No. 00341)stating that the "texts from the batch input are not output. Only a placeholder".
Hope anyone can help me figure this out.
Note: In Transaction IP30, Transaction IP10 is being called. The error arises at this point.
Thanks in advance!Hi John,
I dont know what transaction are you talking about...
But if it is TIME_OUT.... you need to check for any OSS Notes available for this problem.
If not send a product error message to SAP.
There cannot be anyother solution,,,, if it is time_out.
go ahead. -
Error in 'Call Transaction 'LS24'
Hi Abapers,
I am unable to go back to List after pressing back button for this Particular Transaction 'LS24'.It is wokring fine with other Transactions MM03,CS03.
WHEN 'test'.
SET PARAMETER ID 'LGN' FIELD L_WA_VENTRIES-LGNUM.
SET PARAMETER ID 'MAT' FIELD L_WA_VENTRIES-MATNR.
SET PARAMETER ID 'WRK' FIELD L_WA_VENTRIES-WERKS.
CALL TRANSACTION 'LS24' AND SKIP FIRST SCREEN.
thx in advance.
Any idea?
With best regards
Sudip..
Edited by: Sudip Samal on Jul 2, 2009 6:28 PM
Moderator message - Cross post locked
Edited by: Rob Burbank on Jul 2, 2009 12:38 PMSo what messages you are getting in messtab?
sy-subrc = 1.001 means transaction not completed with the given data, this may be due to wrong data passed.
Analyze messtab, you will come to know of the error.
Regards
Karthik D -
hello,
i'm prepare a bdc program for F-22, when i record the process through shdb, an error occurs said a field must be filled( but the field is not on the current screen), and when a press enter a popup dialog said i can fill the field in the next screen.
but when i fill my bdcdata in program according the recording, and then use call transaction to do the BDC job, it stops on the error (Note that when recording, i can press enter and modify the error in the next screen).
could someone give a solution ??
thank you !!and the message after recording is
Number 1
Transaction F-22
SY-SUBRC 0
Messages
FB01 SAPMF05A 0301WEZ001 066
FB01 SAPMF05A 0300WEZ001 066
FB01 SAPMF05A 0300EEZ001 073
I F5 573 Correct the error reported before on the next screen
FB01 SAPMF05A 0300WEZ001 066
FB01 SAPMF05A 0300EEZ001 073
I F5 573 Correct the error reported before on the next screen
FB01 SAPMF05A 0330WEZ001 066
FB01 SAPMF05A 0301WEZ001 066
FB01 SAPMF05A 0301WEZ001 066
FB01 SAPMF05A 0301WEZ001 066
S F5 312 Document 100001677 was posted in company code 3100 -
ESS throwing error while calling transaction from R/3
Whenever u try to pull certain I-view like under ESS > Income tax provisional statement then the portal throws below mentioned error. Portal is not able to call transactions from R/3.
Error:
The requested URL could not be retrieved
While trying to retrieve the URL: http://dev.mglep.com:26000/sap(ZT0yZElaRG5xNDlZdFF4aGcyTDhzMWxRLS1hVUR5bDBMbjBDZ2hWUUcyMlZmcmlBLS0=)/bc/gui/sap/its/webgui?
The following error was encountered:
Connection to 69.43.161.156 Failed
The system returned:
(111) Connection refusedThe remote host or network may be down. Please try the request again.
Your cache administrator is root.
Please helpHi,
Please check the parameters that has been defined in SICF for the transaction you are using.
With Regards,
Kaustuv Goswami. -
Error in call transaction to ab08
Hi,
I am doing a call transaction to ab08 but when I do the movement revocation. SAPMF05A 105 screen appears and doesn't let me continue. Is there any problem with this transaction to call transaction? Has anyone ever had to make?
By.Hi Millan,
Can you please provide the details, what exactly you are getting the problem.
Before that you try with below option.
When you are doing SHDB select the check box option Cont. after commit as shown below.
Regards,
Rajesh
Maybe you are looking for
-
Apple Menu System Preferences no longer works
When I click on the System Preferenes item under the Apple Menu, nothing happens, but when I click on the System Preferences icon in the Dock, the System Preferences pane opens normally. How can I reactivate the System Preferences item in the Apple M
-
Hi Guys, I am trying to Execute RSA3 with 2LIS_05_Q0NOTIF , It is giving the below Short Dump. We have done transports recently and it is ended with Warning RC4. Runtime Errors CONNE_IMPORT_WRONG_COMP_TYPE Exceptn CX_SY_IMPORT_
-
My yahoo acct is infected with a trojan.
My yahoo acct is infected with a trojan. I ran a full system scan with sophos but it is still infected. can someone walk me through the fix?
-
Trackpad Clicker Input Problem
I have an unusual track pad clicker problem on my new macbook pro. Sometimes the computer acts as if I am holding the clicker down after I have released it. This happens when using scroll bars, causing scrolling all the way to the bottom of the page.
-
Long black wire from ant socket in rear i want to know where the other end goes in front S5710f PC
I have a long black wire that is connected in the rear to a part that serves the antenna. The other end goes to the front of the PC. It came off when I removed the hard drive and dvd player. I have the pavilion s5710f.