Error Handling in BDC...Review code..
Hi Gurus,
I have made a BDC program to do call transaction for FV50...i AM NOT SURE ON HOW TO DO ERROR HANDLING IN THAT...TRIED TO DO SOMETHING BUT IT NEEDS LOT OF IMPROVEMENT...
CAN ONE YOU EXPERTS HELP ME IN THAT...I AM ATTACHING THE ENTIRE CODE..
REPORT zbdc_park_fv50.
DATA:
t_document_line_item_main LIKE bapiacgl09 OCCURS 100,
t_document_line_item_enhn LIKE bapiacextc OCCURS 100,
t_document_line_item_amnt LIKE bapiaccr09 OCCURS 100,
wa_document_header LIKE bapiache09,
wa_document_line_item_main LIKE bapiacgl09,
wa_document_line_item_enhn LIKE bapiacextc,
wa_document_line_item_amnt LIKE bapiaccr09.
DATA: BEGIN OF s_bdc_document_item_main,
v_HKONT LIKE ACGL_ITEM-HKONT,
v_SHKZG LIKE ACGL_ITEM-SHKZG,
v_SGTXT LIKE ACGL_ITEM-SGTXT,
v_WRBTR LIKE ACGL_ITEM-WRBTR,
v_WAERS LIKE ACGL_HEAD-WAERS,
v_PRCTR LIKE ACGL_ITEM-PRCTR,
v_YYLOB LIKE ACGL_ITEM-YYLOB,
v_YYCSG LIKE ACGL_ITEM-YYCSG,
END OF s_bdc_document_item_main.
DATA: t_bdc_document_item_main LIKE s_bdc_document_item_main OCCURS 0,
wa_bdc_document_item_main LIKE s_bdc_document_item_main.
DATA: t_bdcdata LIKE bdcdata OCCURS 0 with header line,
t_messages LIKE bdcmsgcoll OCCURS 0 with header line.
DATA: idx TYPE i,
ch3(2) TYPE n,
fname(40) TYPE c,
options TYPE ctu_params.
DATA: indate TYPE d,
intdate TYPE d,
var_SHKZG LIKE BSEG-SHKZG,
amount(13) type c.
DATA: w_textout LIKE t100-text.
*DATA: gd_update TYPE i,
gd_lines TYPE i.
CLEAR wa_document_header.
***FILL DOCUMENT HEADER***********
wa_document_header-obj_type = space. "
wa_document_header-obj_key = space.
wa_document_header-obj_sys = space.
wa_document_header-bus_act = 'RFBU'.
wa_document_header-username = 'samwil'.
wa_document_header-header_txt = 'TEST_BDC_PARK123'.
wa_document_header-comp_code = '1001'.
wa_document_header-doc_date = '20070817'.
wa_document_header-pstng_date = '20070817'.
CLEAR wa_document_header-trans_date.
CLEAR wa_document_header-fisc_year.
CLEAR wa_document_header-fis_period.
wa_document_header-doc_type = 'SY'.
wa_document_header-ref_doc_no = 'AAR1213'.
wa_document_header-ac_doc_no = space.
wa_document_header-obj_key_r = space.
wa_document_header-reason_rev = space.
wa_document_header-compo_acc = space.
wa_document_header-ref_doc_no_long = space.
wa_document_header-acc_principle = 'LGAP'.
wa_document_header-neg_postng = space.
wa_document_header-obj_key_inv = space.
wa_document_header-bill_category = space.
FILL LINE ITEMS *******************
CLEAR: wa_document_line_item_main, wa_document_line_item_enhn, wa_document_line_item_amnt.
Fill Main Portion Of Accounting Line Item
wa_document_line_item_main-itemno_acc = '1'. "Accounting Document Line Item Number
wa_document_line_item_main-gl_account = '2480001067'."HKONT - Account
wa_document_line_item_main-item_text = 'ITEM 2'. "SGTXT - Item Text
wa_document_line_item_main-doc_type = space. "BLART - Document Type
wa_document_line_item_main-comp_code = space. "BUKRS - Company Code
wa_document_line_item_main-pstng_date = '20080817'. "BUDAT - Posting Date
wa_document_line_item_main-alloc_nmbr = space. "ZUONR - Allocation Number
wa_document_line_item_main-costcenter = space. "KOSTL - Cost Center
wa_document_line_item_main-profit_ctr = '1999999'. "PRCTR - Profit Center
wa_document_line_item_main-de_cre_ind = 'D'. "NEWBS - Posting Key / Debit Credit Indicator
wa_document_line_item_main-trade_id = space. "RASSC - Company ID Of Trading Partner
Fill Amount Portion Of Accounting Line Item
wa_document_line_item_amnt-itemno_acc = '1'. "Accounting Document Line Item Number
wa_document_line_item_amnt-curr_type = '00'. "Currency Type
wa_document_line_item_amnt-currency = 'USD'. "WAERS - Currency Key
wa_document_line_item_amnt-amt_doccur = '100'. "WRBTR - Amount In Document Currency Type
Create Enhancement Portion Of Accounting Line Item
wa_document_line_item_enhn-field1+0(3) = '001'. "Line of Bus YYLOB
wa_document_line_item_enhn-field1+3(3) = '008'. "Customer Segm YYCSG
wa_document_line_item_enhn-field1+6(5) = space. "Product Group
wa_document_line_item_enhn-field1+11(2) = space. "Distribution Ch
wa_document_line_item_enhn-field1+13(4) = space. "Maturity Year
wa_document_line_item_enhn-field1+17(3) = space. "Insurance Type
wa_document_line_item_enhn-field1+20(4) = space. "Accident Year
wa_document_line_item_enhn-field1+24(6) = space. "Product
wa_document_line_item_enhn-field1+30(3) = space. "Source
wa_document_line_item_enhn-field1+33(22) = space. "DI Run Name
wa_document_line_item_enhn-field1+55(1) = space. "DI Run Type
wa_document_line_item_enhn-field1+56(5) = space. "DI Run Number
wa_document_line_item_enhn-field1+61(16) = space. "DI Journal ID
wa_document_line_item_enhn-field1+77(5) = space. "DI Journal Link
wa_document_line_item_enhn-field1+82(22) = space. "DI File Name
APPEND: wa_document_line_item_main TO t_document_line_item_main,
wa_document_line_item_enhn TO t_document_line_item_enhn,
wa_document_line_item_amnt TO t_document_line_item_amnt.
Fill Next Line Item #2
CLEAR: wa_document_line_item_main, wa_document_line_item_enhn, wa_document_line_item_amnt.
Fill Main Portion Of Accounting Line Item
wa_document_line_item_main-itemno_acc = '2'. "Accounting Document Line Item Number
wa_document_line_item_main-gl_account = '2480001067'."HKONT - Account
wa_document_line_item_main-item_text = 'ITEM 3'. "SGTXT - Item Text
wa_document_line_item_main-doc_type = space. "BLART - Document Type
wa_document_line_item_main-comp_code = space. "BUKRS - Company Code
wa_document_line_item_main-pstng_date = '20080817'. "BUDAT - Posting Date
wa_document_line_item_main-alloc_nmbr = space. "ZUONR - Allocation Number
wa_document_line_item_main-costcenter = space. "KOSTL - Cost Center
wa_document_line_item_main-profit_ctr = '1999999'. "PRCTR - Profit Center
wa_document_line_item_main-de_cre_ind = 'C'. "NEWBS - Posting Key / Debit Credit Indicator
wa_document_line_item_main-trade_id = space. "RASSC - Company ID Of Trading Partner
Fill Enhancement Portion Of Accounting Line Item
Fill Amount Portion Of Accounting Line Item
wa_document_line_item_amnt-itemno_acc = '2'. "Accounting Document Line Item Number
wa_document_line_item_amnt-curr_type = '00'. "Currency Type
wa_document_line_item_amnt-currency = 'USD'. "WAERS - Currency Key
wa_document_line_item_amnt-amt_doccur = '100'. "WRBTR - Amount In Document Currency Type
Create Enhancement Portion Of Accounting Line Item
wa_document_line_item_enhn-field1+0(3) = '001'. "Line of Bus YYLOB.
wa_document_line_item_enhn-field1+3(3) = '008'. "Customer Segm YYCSG
wa_document_line_item_enhn-field1+6(5) = space. "Product Group
wa_document_line_item_enhn-field1+11(2) = space. "Distribution Ch
wa_document_line_item_enhn-field1+13(4) = space. "Maturity Year
wa_document_line_item_enhn-field1+17(3) = space. "Insurance Type
wa_document_line_item_enhn-field1+20(4) = space. "Accident Year
wa_document_line_item_enhn-field1+24(6) = space. "Product
wa_document_line_item_enhn-field1+30(3) = space. "Source
wa_document_line_item_enhn-field1+33(22) = space. "DI Run Name
wa_document_line_item_enhn-field1+55(1) = space. "DI Run Type
wa_document_line_item_enhn-field1+56(5) = space. "DI Run Number
wa_document_line_item_enhn-field1+61(16) = space. "DI Journal ID
wa_document_line_item_enhn-field1+77(5) = space. "DI Journal Link
wa_document_line_item_enhn-field1+82(22) = space. "DI File Name
APPEND: wa_document_line_item_main TO t_document_line_item_main,
wa_document_line_item_enhn TO t_document_line_item_enhn,
wa_document_line_item_amnt TO t_document_line_item_amnt.
****FILL THE BDC TABLE*******************************************************
LOOP AT t_document_line_item_main INTO wa_document_line_item_main.
Move: wa_document_line_item_main-gl_account TO wa_bdc_document_item_main-v_HKONT,
wa_document_line_item_main-item_text TO wa_bdc_document_item_main-v_SGTXT,
wa_document_line_item_main-profit_ctr TO wa_bdc_document_item_main-v_PRCTR,
wa_document_line_item_main-de_cre_ind TO wa_bdc_document_item_main-v_SHKZG.
Read table t_document_line_item_amnt index sy-tabix into wa_document_line_item_amnt.
IF sy-subrc = 0.
Move : wa_document_line_item_amnt-currency TO wa_bdc_document_item_main-v_WAERS,
wa_document_line_item_amnt-amt_doccur TO wa_bdc_document_item_main-v_WRBTR.
ENDIF.
Read table t_document_line_item_enhn index sy-tabix into wa_document_line_item_enhn.
IF sy-subrc = 0.
Move : wa_document_line_item_enhn-field1+0(3) TO wa_bdc_document_item_main-v_YYLOB,
wa_document_line_item_enhn-field1+3(3) TO wa_bdc_document_item_main-v_YYCSG.
ENDIF.
APPEND wa_bdc_document_item_main TO t_bdc_document_item_main.
CLEAR: wa_bdc_document_item_main.
ENDLOOP. " BDC Table.
************************BDC PROGRAM**************************************************************
perform bdc_dynpro TABLES t_bdcdata using 'SAPLACHD' '1000'.
perform bdc_field TABLES t_bdcdata using 'BDC_CURSOR'
'BKPF-BUKRS'.
perform bdc_field TABLES t_bdcdata using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field TABLES t_bdcdata using 'BKPF-BUKRS'
wa_document_header-comp_code.
perform bdc_dynpro TABLES t_bdcdata using 'SAPMF05A' '1001'.
perform bdc_field TABLES t_bdcdata using 'BDC_OKCODE'
'=PBBP'.
perform bdc_field TABLES t_bdcdata using 'ACGL_HEAD-BLDAT'
wa_document_header-doc_date.
perform bdc_field TABLES t_bdcdata using 'ACGL_HEAD-WAERS'
'USD'.
perform bdc_field TABLES t_bdcdata using 'ACGL_HEAD-BUDAT'
wa_document_header-pstng_date.
perform bdc_field TABLES t_bdcdata using 'ACGL_HEAD-XBLNR'
wa_document_header-ref_doc_no.
perform bdc_field TABLES t_bdcdata using 'ACGL_HEAD-BKTXT'
wa_document_header-header_txt.
perform bdc_field TABLES t_bdcdata using 'ACGL_HEAD-BLART'
wa_document_header-doc_type.
perform bdc_field TABLES t_bdcdata using 'BDC_CURSOR'
'ACGL_ITEM_GEN-GEN_CHAR2(02)'.
LOOP AT t_bdc_document_item_main INTO wa_bdc_document_item_main.
idx = idx + 1.
ch3 = idx.
CONCATENATE 'ACGL_ITEM-HKONT('ch3')' INTO FNAME.
perform bdc_field TABLES t_bdcdata using fname
wa_bdc_document_item_main-v_HKONT.
CONCATENATE 'ACGL_ITEM-SHKZG('ch3')' INTO FNAME.
IF wa_bdc_document_item_main-v_SHKZG = 'C'.
var_SHKZG = 'H'.
ELSEIF wa_bdc_document_item_main-v_SHKZG = 'D'.
var_SHKZG = 'S'.
ENDIF.
perform bdc_field TABLES t_bdcdata using fname
var_SHKZG.
CONCATENATE 'ACGL_ITEM-WRBTR('ch3')' INTO FNAME.
WRITE: wa_bdc_document_item_main-v_WRBTR to amount.
perform bdc_field TABLES t_bdcdata using FNAME
wa_bdc_document_item_main-v_WRBTR.
amount.
CONCATENATE 'ACGL_ITEM-SGTXT('ch3')' INTO FNAME.
perform bdc_field TABLES t_bdcdata using FNAME
wa_bdc_document_item_main-v_SGTXT.
CONCATENATE 'ACGL_ITEM-PRCTR('ch3')' INTO FNAME.
perform bdc_field TABLES t_bdcdata using FNAME
wa_bdc_document_item_main-v_PRCTR.
CONCATENATE 'ACGL_ITEM_GEN-GEN_CHAR1('ch3')' INTO FNAME.
perform bdc_field TABLES t_bdcdata using FNAME
wa_bdc_document_item_main-v_YYLOB.
CONCATENATE 'ACGL_ITEM_GEN-GEN_CHAR2('ch3')' INTO FNAME.
perform bdc_field TABLES t_bdcdata using FNAME
wa_bdc_document_item_main-v_YYCSG.
options-dismode = 'A'.
options-nobinpt = 'X'.
endloop.
CALL TRANSACTION 'FV50' USING t_bdcdata MESSAGES INTO
t_messages OPTIONS FROM options.
*if sy-subrc = 0.
Retrieve error messages
LOOP AT t_messages WHERE msgtyp = 'E'.
Builds actual message based on info returned from Call transaction
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = t_messages-msgid
msgnr = t_messages-msgnr
msgv1 = t_messages-msgv1
msgv2 = t_messages-msgv2
msgv3 = t_messages-msgv3
msgv4 = t_messages-msgv4
IMPORTING
message_text_output = w_textout.
ENDLOOP.
Start new screen
FORM bdc_dynpro TABLES it_bdcdata STRUCTURE bdcdata USING program
dynpro.
DATA: wa_bdcdata TYPE bdcdata.
wa_bdcdata-program = program.
wa_bdcdata-dynpro = dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO it_bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field
FORM bdc_field TABLES it_bdcdata STRUCTURE bdcdata USING fnam fval.
DATA: wa_bdcdata TYPE bdcdata.
IF fval <> space.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = fnam.
wa_bdcdata-fval = fval.
APPEND wa_bdcdata TO it_bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
Title was edited by:
Alvaro Tejada Galindo
HI,
The code looks ok...
take a internal table for messages.
data : begin of itab occurs 0,
message(100) type c,
end of itab.
put this after
Retrieve error messages
LOOP AT t_messages WHERE msgtyp = 'E'.
Builds actual message based on info returned from Call transaction
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = t_messages-msgid
msgnr = t_messages-msgnr
msgv1 = t_messages-msgv1
msgv2 = t_messages-msgv2
msgv3 = t_messages-msgv3
msgv4 = t_messages-msgv4
IMPORTING
message_text_output = w_textout.
<b>itab-message = w_textout.
append itab</b>.
ENDLOOP.
Similar Messages
-
Error handling in bdc Fb01along with erros in Idoc.
Hi,
Can any one send me the sample code for the error handling in bdc Fb01along with erros in Idoc. Actually, mail should be sent
Thanks
Avi.Hi,
This may help you.
<b>FORM send_mail USING receiver.
CLEAR: w_lines,tbl_packing_list,tbl_object_header,
tbl_contents_txt, tbl_receivers.
REFRESH:tbl_packing_list, tbl_object_header,
tbl_contents_txt,tbl_receivers.
SORT tbl_err.
DELETE ADJACENT DUPLICATES FROM tbl_err COMPARING ALL FIELDS.
IF NOT tbl_err[] IS INITIAL.
Preparing the email.
PERFORM prepare_email.
ELSE.
If sy-subrc NE 0.
MOVE sy-subrc TO w_code.
ENDIF.
EXIT.
ENDIF.
Get the content of header e-mail document data
PERFORM document_data.
Get details of the error file attached (like type of file and format)
PERFORM packing_list.
Get receiver mail id's
tbl_receivers-receiver = receiver.
tbl_receivers-rec_type = 'C'.
tbl_receivers-express = c_flag.
tbl_receivers-sap_body = c_flag.
APPEND tbl_receivers.
Call FM to send E-mails to receivers
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = st_document_data
put_in_outbox = 'X'
TABLES
packing_list = tbl_packing_list
object_header = tbl_object_header
contents_txt = tbl_contents_txt
receivers = tbl_receivers[]
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
ENDFORM. " send_mail
*& Form prepare_email
text
--> p1 text
<-- p2 text
FORM prepare_email.
E-Mail body content
IF NOT w_lifnr IS INITIAL.
CONCATENATE text-015 w_docnum text-016
INTO tbl_contents_txt-line
SEPARATED BY space.
ENDIF.
APPEND tbl_contents_txt.
CLEAR tbl_contents_txt.
E-mail error file attachment header
CONCATENATE text-063 text-064
text-065 text-066 c_comma
INTO tbl_contents_txt-line
SEPARATED BY c_comma.
APPEND tbl_contents_txt.
CLEAR tbl_contents_txt.
E-mail error file attachment content
LOOP AT tbl_err.
CONCATENATE w_docnum tbl_err-v_segnum
tbl_err-msg tbl_err-type
INTO tbl_contents_txt-line
SEPARATED BY c_comma.
CONCATENATE c_linefeed tbl_contents_txt-line c_comma
INTO tbl_contents_txt-line.
APPEND tbl_contents_txt.
CLEAR tbl_contents_txt.
ENDLOOP.
ENDFORM. " prepare_email
*& Form document_data
text
--> p1 text
<-- p2 text
FORM document_data.
CLEAR w_line.
IF NOT w_lifnr IS INITIAL.
CONCATENATE text-075 text-027 sy-datum sy-uzeit INTO w_line
SEPARATED BY c_uscore.
ENDIF.
st_document_data-obj_name = w_line.
st_document_data-obj_descr = w_line.
st_document_data-priority = 1.
st_document_data-obj_prio = 1.
ENDFORM. " document_data
*& Form packing_list
text
--> p1 text
<-- p2 text
FORM packing_list.
CLEAR w_lines.
DESCRIBE TABLE tbl_err LINES w_lines.
READ TABLE tbl_contents_txt INDEX w_lines.
tbl_packing_list-head_start = 1.
tbl_packing_list-head_num = 1.
tbl_packing_list-body_start = 1.
tbl_packing_list-body_num = 1.
tbl_packing_list-doc_type = 'RAW'.
APPEND tbl_packing_list.
tbl_packing_list-head_start = 1.
tbl_packing_list-head_num = 0.
tbl_packing_list-body_start = 2.
tbl_packing_list-body_num = w_lines + 1.
tbl_packing_list-doc_type = 'CSV'.
tbl_packing_list-obj_descr = 'Error_Attachment'(060).
IF NOT w_lifnr IS INITIAL.
tbl_packing_list-obj_name = 'Idoc Number is'(072).
ENDIF.
tbl_packing_list-doc_size = 255 * ( w_lines + 1 ).
APPEND tbl_packing_list.
ENDFORM. " packing_list
</b>
Thanks
Manju. -
Error Handling in Stored Procedure code
Hi All,
I need to know which step is failing and whats the error message when i run a stored procedure.
Lets say i have a stored procedure with below content.So i want to know which of the below four statements failed,and
the error message belonging to it.
How can i modify the below code to achieve my output.
begin try
DELETE FROM Table1 WHERE Column1 = 'A'
UPDATE Table1 SET Column1 = 'C' WHERE Column2 = 'B'
SELECT * FROM Table1 WHERE Column3 = 'C'
SELECT * FROM Table1 WHERE Column4 = 'D'
end try
begin catch
end catch
Thanks in Advance!!Take a look at this excellent TechNet Wiki article
Structured
Error Handling Mechanism in SQL Server 2012
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
Error Handling when excel vba code does not find the file
Hi Below is my code:
file1 = Dir("Q:\Budget\Historical Budgets\" & new_dept_folder & "\*.xls*")
col = 2
col_new = 3
Application.DisplayAlerts = False
While (file1 <> "")
filename = Left$(file1, 6)
' Open the newly selected workbook
Set wb = Workbooks.Open("Q:\Budget\Historical Budgets\" & new_dept_folder & "\" & file1)
udds = filename & " - " & wb.Sheets("Budget").Range("J1").Value
ThisWorkbook.Sheets(1).Cells(1, col).Value = udds
For x = LBound(data_new) To UBound(data_new)
wb.Sheets("Budget").Select
Range(data_new(x)).Select
Selection.Copy
ThisWorkbook.Sheets(1).Cells(x + 5, col_new).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Next x
' Close the current workbook
wb.Close SaveChanges:=False
On Error GoTo Errhandler
Set wb_old = Workbooks.Open("Q:\Budget\Historical Budgets\" & old_dept_folder & "\" & file1)
<--- Need Error handling on this line (i.e. if I get error here)
For x = LBound(data) To UBound(data)
wb_old.Sheets("Budget").Select
Range(data(x)).Select
Selection.Copy
ThisWorkbook.Sheets(1).Cells(x + 5, col).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Next x
Application.CutCopyMode = False
' Close the current workbook
On Error Resume Next
wb_old.Close SaveChanges:=False
Errhandler:
For x = LBound(data) To UBound(data)
ThisWorkbook.Sheets(1).Cells(x + 5, col).Value = 0
Next x
' Select the next file in the dir array
file1 = Dir
col = col + 5
col_new = col_new + 5
Wend
Everytime I run the code the errhandler which I don't need. Could you please help me on this.
Regards, HiteshHi,
You could check whether the file is exist, then open it.
If Dir(path)<>”” Then
There are three On Error Statements, On Error GoTo <line>, On Error Resume Next and On Error GoTo 0.
More information, please refer to:
# How to Use "On Error" to Handle Errors in a Macro
https://support.microsoft.com/en-us/kb/141571?wa=wsignin1.0
Regards
Starain
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Error Handler Returning 200 Status Code
Greetings,
I have a section of my site assigned to be an "Error Handler" however when a user is brought to this page, the status code is a 200. As you can imagine, this has the potential to cause a lot of problems for processes that rely on status codes to operate.
I have found the following solution on another site, indicating to place this Idoc Script code at the top of the Page Template:
<!--$setValue("#local", "ssChangeHTTPHeader", "true")-->
Unfortunately, doing the above does not work. Am I missing something?
Any help is appreciated. Thanks!
JoshHi Srinath,
First of all, thanks for taking time to help. I removed the tag that I previously had inside of my Page Template and put yours in the body, however my page still returns a 200. I completely stripped the Page Template of all but the necessary markup.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--$include ss_layout_head_info-->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script id="ssInfo" type="text/xml" warning="DO NOT MODIFY!">
<ssinfo></ssinfo>
</script>
</head>
<body>
<!--$ssSet404Response("true")-->
</body>
</html>
Thanks! -
How can I add error handling facilities to this code?
Hi everyone, i have this code that needs some error handling facilities (messages that warn user the data inputted is not valid that prvent crashing) added to it. I have no idea on how to do it and i accept any ideas. I'll post the code in two sections as it doesnt fit. The code works by recieveing inputs for student grades and calculating the total and the average. That works fine, but i need to include an error handling facility that doesnt allow the user to input letters, special characters or numbers outside the range 1-10. Can anyone help?
Code Part 1:
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.util.*;
//Defines the counter for the student count and uses a usage method to
public class EdronProject {
private int studentCount;
private static final String USAGE = "Usage: java EdronProject <student count>";
private List<Student> list;
//Set up the counter fo the number of students and the list in which
//each student's information is saved once processed
public EdronProject(int count) {
studentCount = count;
list = new ArrayList<Student>();
//Checks the number or arguments, and it executes the rest of the code
//if there is 1 argument or more (the number of arguments = the number
//of students being processed)
public static void main( String args[] ) throws NumberFormatException {
int count = 0;
switch (args.length) {
case 1: count = Integer.parseInt(args[0]); break;
default: System.out.println(USAGE); System.exit(0);
//Defines method for processing and printing students within the
//EdronProject class
EdronProject edp = new EdronProject(count);
edp.processStudents();
edp.printStudents();
class Student {
//Define integer values for the 5 subject's grades, the gradeCounter (used
//in the processing stage) and the student name string
private int
gradeCounter,
grade1,
grade2,
grade3,
grade4,
grade5;
private double total;
private String studentName;
//Use setter getter methods for the student name to be retrieved
public void setStudentName(String name) {
studentName = name;
public String getStudentName() {
return( studentName );
//Use setter getter methods for the grades inputted to be retrieved
//by the processing stage
public void setGrade(int gradeNo, int grade) throws IllegalArgumentException {
switch( gradeNo) {
case 1 : grade1 = grade; break;
case 2 : grade2 = grade; break;
case 3 : grade3 = grade; break;
case 4 : grade4 = grade; break;
case 5 : grade5 = grade; break;
default: throw new IllegalArgumentException("ERROR: Bad grade number passed!");
//Increase grade counter for it to register the number of grades inputted
//by user
gradeCounter++;
public int getGrade(int gradeNo) throws IllegalArgumentException {
int grade = 0;
switch( gradeNo) {
case 1 : grade = grade1; break;
case 2 : grade = grade2; break;
case 3 : grade = grade3; break;
case 4 : grade = grade4; break;
case 5 : grade = grade5; break;
default: throw new IllegalArgumentException("ERROR: Bad grade number passed!");
//Return grade values for them to be used by the processing stage
return( grade );
} -
Error Handling in BDC....?
Hi Gurus,
I have scenario here where in I have written a BDC program for transaction FV50L to park an FI document and then later made it is a function module.In this function module one of the TABLES parameter is BAPIRET2 to return error messages to the calling program..
Actually this FM is RFC enabled so that it can be called from non sap system...
Now i am not sure how to transfer the error messages from the BDC program to this BAPIRET2 table...
Can any of u gurus provide me detail insight into this how it can be done....code samples will be helpful as i am still in a learning phase of ABAP...
Points will be awarded.
Cheers: Jimhi Jimmy..
You can do this in case of Call transaction method only..
Sample code:
Using BDCMSGCOLL Structure we have to declare an itab.
DATA : IT_MSG LIKE TABLE OF BDCMSGCOLL .
DATA : V_MSG TYPE STRING .
Then We can catch the messages using:
CALL TRANSACTION 'MK01'
USING IT_BDCDATA
MODE 'N'
MESSAGES INTO IT_MSG. "stores the messages
IF sy-subrc ne 0.
LOOP AT IT_MSG INTO WA_MSG .
**WHERE MSGTYP = 'E' OR MSGTYP = 'A'. "if you want only error messages
CALL FUNCTION 'FORMAT_MESSAGE' "To get the Message text into V_MSG.
IT_BAPIRET2-MSGTYP = IT_MSG-MSGTYP.
IT_BAPIRET2-MSGID = IT_MSG-MSGTYP.
IT_BAPIRET2-MESSAGE = V_MSG.
APPEND IT_BAPIRET2.
CLEAR IT_BAPIRET2.
ENDLOOP.
REWARD IF HELPFUL. -
Regarding Error Handling by using VBA code
I want to skip the "Server Error in '/' Application" in one page( page 5), and goback to previews worked page (page 4) , continue to next page( page 6).
If errNumber = -1 Then
RSWApp.GoBack
RSWApp.GotoPage (6)
End If
but it didn't go back.Then try adding the code for GoBack in the Before Play event of Page 5.
If errNumber = -1 Then
blnPg5Err = True
RSWApp.GoBack
End If
Also add a boolean so when you go back to Page 4, you know that the reason you are there is because of error on Page 5. And in the code for Page 4, add validation like
If blnPg5Err = True then
'whatever you need to do
rswapp.gotopage(6)
end if
You will have to declare blnPg5Err in the Shared Module
Public blnPg5Err as boolean.
Hope this works for you. -
WebRTC's CreateOffer appears to have broken the error handling
I had a working implementation of WebRTC, using the Adapter.js pollyfill. It was previously working between Firefox and Chrome but now it appears to have a type error on the error handler. I had it set to use null, which still works in Chrome but Firefox now requires {} for an empty error handler (therefore breaking either Chrome or Firefox depending which I use). And it doesn't seem to work with an actual error handler either!
Example Code:
// Works in Firefox
pc.createOffer(function(description) {
console.log(description);
pc.setLocalDescription(description);
socket.emit('received_offer', JSON.stringify(description));
}, {}, mediaConstraints);
// Works in Chrome
pc.createOffer(function(description) {
console.log(description);
pc.setLocalDescription(description);
socket.emit('received_offer', JSON.stringify(description));
}, null, mediaConstraints);A good place to ask advice about web development is at the mozillaZine "Web Development/Standards Evangelism" forum.
*http://forums.mozillazine.org/viewforum.php?f=25
The helpers at that forum are more knowledgeable about web development issues.<br>
You need to register at the mozillaZine forum site in order to post at that forum.
See also:
*https://developer.mozilla.org/en-US/docs/Web/Guide/API/WebRTC
*https://developer.mozilla.org/en-US/docs/Web/Guide/API/WebRTC/WebRTC_basics -
Execution properties, Enable automatic error handling
Hi
I am writing real-time code for standalone execution on a cRIO-9074.
If I untick the "Enable automatic error handling" option in VI properties (Execution), what is the consequence if I have an application with no error handling case structures to detect the occurrence of errors elsewhere and within subVI's ? Does the error just go undetected and the application continue regardless? If ticked, could a standalone application hang as there is no user-interface for the error to get reported automatically to? Can I configure the LabVIEW RTE to automatically handle errors in a certain way regardless of individual VI settings of the "Enable automatic error handling" option?
I am a bit confused by the usefulness of "Enable automatic error handling" within RT/FPGA code, and where in the development process it is best enabled then disabled (if necessary).
ThanksIf I untick the "Enable automatic error handling" option in VI properties (Execution), what is the consequence if I have an application with no error handling case structures to detect the occurrence of errors elsewhere and within subVI's ? Does the error just go undetected and the application continue regardless?
That's the case: the error is lost (i.e. it's not handled), and the application goes on.
If ticked, could a standalone application hang as there is no user-interface for the error to get reported automatically to?
The property "Enable automatic error handling" is not availabe in the run-time engine, so there's no automatic error handling in a built application,
Can I configure the LabVIEW RTE to automatically handle errors in a certain way regardless of individual VI settings of the "Enable automatic error handling" option?
No, for the reason stated above.
I am a bit confused by the usefulness of "Enable automatic error handling" within RT/FPGA code, and where in the development process it is best enabled then disabled (if necessary).
There's no "Enable automatic error handling" property in Labview RT either.
Regards,
Marco -
How to perform Error Handling in this Bdc Code
Hi,
I had created this BDC for the tcode MB1B and i want to know how to perform the ERROR HANDLING in it ..
Plzz provide me guidelines for doing it . here's d code:-
report ZBDC_MB1B
no standard page heading line-size 255.
include bdcrecx1.
data: begin of record OCCURS 0,
WERKS_001(004), "Plant
MATNR_002(018), "ItemId
ERFMG_003(013), "Quantity in Unit of Entry
ERFME_004(003), "Unit of Entry
LGORT_005(004), "Storage Location
CHARG_006(010), "BatchId
KDAUF_007(010), "Sales Order Number
KDPOS_008(006), "Item Number in Sales Order
end of record.
PARAMETERS : P_FILNAM LIKE RLGRAP-FILENAME.
initialization.
CTUMODE = 'A'.
CUPDATE = 'A'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILNAM.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
MASK = ',. '
MODE = 'O'
IMPORTING
FILENAME = P_FILNAM
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_FILNAM
FILETYPE = 'DAT'
TABLES
DATA_TAB = RECORD
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
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 RECORD.
BEGIN OF SCREEN 1
perform bdc_dynpro using 'SAPMM07M' '0400'.
perform bdc_field using 'BDC_CURSOR'
'RM07M-SOBKZ'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'MKPF-BLDAT'
'22.12.2008'.
*perform bdc_field using 'MKPF-BUDAT'
'22.12.2008'.
perform bdc_field using 'RM07M-BWARTWA'
'411'.
perform bdc_field using 'RM07M-SOBKZ'
'E'.
perform bdc_field using 'RM07M-WERKS'
RECORD-WERKS_001. "Plant
perform bdc_field using 'XFULL'
'X'.
perform bdc_field using 'RM07M-WVERS2'
'X'.
BEGIN OF SCREEN 2
perform bdc_dynpro using 'SAPMM07M' '0421'.
perform bdc_field using 'BDC_CURSOR'
'MSEG-CHARG(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MSEG-MATNR(01)'
RECORD-MATNR_002. "ITEMID
perform bdc_field using 'MSEG-ERFMG(01)'
RECORD-ERFMG_003. "QTY.
perform bdc_field using 'MSEG-ERFME(01)'
RECORD-ERFME_004. "UOM
perform bdc_field using 'MSEG-LGORT(01)'
RECORD-LGORT_005. "ST.LOC
perform bdc_field using 'MSEG-CHARG(01)'
RECORD-CHARG_006. "BATCHID
perform bdc_field using 'MSEGK-MAT_KDAUF'
RECORD-KDAUF_007. "S.O.
perform bdc_field using 'MSEGK-MAT_KDPOS'
RECORD-KDPOS_008. "S.O.LINE ITEM
perform bdc_field using 'DKACB-FMORE'
'X'.
BEGIN OF SCREEN 3
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_dynpro using 'SAPMM07M' '0421'.
perform bdc_field using 'BDC_CURSOR'
'MSEG-ERFMG(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'DKACB-FMORE'
'X'.
BEGIN OF SCREEN 4
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_transaction using 'MB1B'.
ENDLOOP.hi,
check this code in bold letters.
INCLUDE BDCRECX1.
TABLES : MARC.
TYPES : BEGIN OF TY_UPLOAD,
MATNR TYPE MARA-MATNR,
WERKS TYPE MARC-WERKS,
STEUC TYPE MARC-STEUC,
END OF TY_UPLOAD.
TYPES : BEGIN OF TY_MARC,
MATNR TYPE MARA-MATNR,
WERKS TYPE MARC-WERKS,
END OF TY_MARC.
TYPES : BEGIN OF TY_MTART,
MATNR TYPE MARA-MATNR,
MTART TYPE MARA-MTART,
END OF TY_MTART.
DATA : T_MARC TYPE STANDARD TABLE OF TY_MARC,
: T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD,
: T_BASIC TYPE STANDARD TABLE OF TY_UPLOAD,
: T_SALES TYPE STANDARD TABLE OF TY_UPLOAD,
: T_ERROR TYPE STANDARD TABLE OF TY_UPLOAD.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_BDCDATA_VIEW LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
IT_DATA(3200) OCCURS 0 WITH HEADER LINE,
IT_FIELD(3200) OCCURS 0 WITH HEADER LINE,
IT_BDCMSG TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA GI_MSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : CHAR1(500),
CHAR2(500),
CHAR3 TYPE STRING,
V_SELECTION TYPE STRING. " For View Selection
DATA : W_MARC TYPE TY_MARC,
WA_UPLOAD TYPE TY_UPLOAD,
WA_BASIC TYPE TY_UPLOAD,
WA_SALES TYPE TY_UPLOAD,
WA_ERROR TYPE TY_UPLOAD,
WA_MTART TYPE TY_MTART.
DATA : VAR TYPE N,
VAR1 TYPE STRING.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001. "SELECTION SCREEN
PARAMETERS: P_FNAM LIKE RLGRAP-FILENAME.
PARAMETERS: P_BAS LIKE RLGRAP-FILENAME.
PARAMETERS: P_SAL LIKE RLGRAP-FILENAME.
PARAMETERS: P_ERR LIKE RLGRAP-FILENAME.
SELECTION-SCREEN : END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAM.
PERFORM SEARCH USING P_FNAM.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BAS.
PERFORM SEARCH USING P_BAS.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SAL.
PERFORM SEARCH USING P_SAL.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_ERR.
PERFORM SEARCH USING P_ERR.
*& Form SEARCH
text
-->PFNAME text
FORM SEARCH USING PFNAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
STATIC = 'X'
CHANGING
FILE_NAME = PFNAME.
ENDFORM. "SEARCH
START-OF-SELECTION.
PERFORM UPLOAD_PROCESS USING P_FNAM.
PERFORM OPEN_GROUP.
PERFORM PROCESS.
PERFORM CLOSE_GROUP.
IF NOT T_BASIC[] IS INITIAL.
PERFORM DOWNLOAD TABLES T_BASIC[] USING P_BAS .
ENDIF.
IF NOT T_SALES[] IS INITIAL.
PERFORM DOWNLOAD TABLES T_SALES[] USING P_SAL .
ENDIF.
IF NOT T_ERROR[] IS INITIAL.
PERFORM DOWNLOAD TABLES T_ERROR[] USING P_ERR.
ENDIF.
*& Form PROCESS
text
FORM PROCESS.
LOOP AT T_UPLOAD INTO WA_UPLOAD.
PERFORM CONV_ROUTINE USING WA_UPLOAD-MATNR
CHANGING WA_UPLOAD-MATNR.
SELECT COUNT(*) FROM MARA WHERE MATNR = WA_UPLOAD-MATNR.
IF SY-SUBRC NE 0.
MOVE-CORRESPONDING WA_UPLOAD TO WA_BASIC.
APPEND WA_BASIC TO T_BASIC.
CLEAR WA_BASIC.
CONTINUE.
ENDIF.
SELECT COUNT(*) FROM MARC WHERE MATNR = WA_UPLOAD-MATNR
AND WERKS = WA_UPLOAD-WERKS
AND PSTAT LIKE '%V%'.
IF SY-SUBRC NE 0.
MOVE-CORRESPONDING WA_UPLOAD TO WA_SALES.
APPEND WA_SALES TO T_SALES.
CLEAR WA_SALES.
CONTINUE.
ENDIF.
CLEAR : WA_MTART.
SELECT SINGLE MATNR MTART FROM MARA INTO WA_MTART WHERE MATNR = WA_UPLOAD-MATNR.
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'
WA_UPLOAD-MATNR.
CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW' " Function module
EXPORTING
MATERIAL = WA_UPLOAD-MATNR " Material number
MATERIALART = WA_MTART-MTART " Material Type
SELECTION = 'V' "
TCODE = 'MM02' " Tcode where view's are called.
TABLES
BTCI_D0070 = IT_BDCDATA_VIEW
EXCEPTIONS
MATERIAL_NOT_FOUND = 1
MATERIAL_NUMBER_MISSING = 2
MATERIAL_TYPE_MISSING = 3
MATERIAL_TYPE_NOT_FOUND = 4
NO_ACTIVE_DYNPRO_SELECTED = 5
NO_AUTHORITY = 6
OTHERS = 7.
READ TABLE IT_BDCDATA_VIEW WITH KEY FVAL = 'X'.
IF SY-SUBRC = 0.
V_SELECTION = IT_BDCDATA_VIEW-FNAM.
ELSE.
CONTINUE.
ENDIF.
VAR = IT_BDCDATA_VIEW-FNAM+17(2).
VAR = VAR + 3.
CONCATENATE 'MSICHTAUSW-KZSEL(' '0' VAR ')' INTO VAR1.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(06)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD USING VAR1
'X'.
CLEAR VAR.
CLEAR VAR1.
PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(06)'
'X'.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0080'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RMMG1-VKORG'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD USING 'RMMG1-WERKS'
WA_UPLOAD-WERKS.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4004'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=BU'.
PERFORM BDC_FIELD USING 'MAKT-MAKTX'
'MTI_ESE_HALB_01'.
PERFORM BDC_FIELD USING 'MARC-STEUC'
WA_UPLOAD-STEUC.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MARC-HERKR'.
PERFORM BDC_FIELD USING 'MARC-HERKL'
'IN'.
PERFORM BDC_FIELD USING 'MARC-HERKR'
'MAH'.
PERFORM BDC_TRANSACTION USING 'MM02'.
move the error record into seperate internal table nad down load it ****
IF MESSTAB-MSGTYP = 'E'.
MOVE-CORRESPONDING WA_UPLOAD TO WA_ERROR.
APPEND WA_ERROR TO T_ERROR.
CLEAR WA_ERROR.
ENDIF.
ENDLOOP.
ENDFORM. "PROCESS
*& Form UPLOAD_PROCESS
text
-->PFNAME text
FORM UPLOAD_PROCESS USING PFNAME.
DATA : PFNAME1 TYPE STRING.
PFNAME1 = PFNAME.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = PFNAME1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = T_UPLOAD[].
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. "UPLOAD_PROCESS
*& Form CONV_ROUTINE
text
-->P_INPUT text
-->P_OUTPUT text
FORM CONV_ROUTINE USING P_INPUT
CHANGING P_OUTPUT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = P_INPUT
IMPORTING
OUTPUT = P_OUTPUT.
ENDFORM. "CONV_ROUTINE
*& Form DOWNLOAD
text
-->GI_FINAL text
-->PFNAME text
FORM DOWNLOAD TABLES
GI_FINAL
USING PFNAME .
DATA : FNAME TYPE STRING.
FNAME = PFNAME.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FNAME
FILETYPE = 'DAT'
WRITE_FIELD_SEPARATOR = 'x'
HEADER = '00'
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = GI_FINAL[]
FIELDNAMES = GI_FIELDNAMES[]
IF SY-SUBRC = 0.
MESSAGE 'FILE DOWNLOADED SUCCESSFULLY' TYPE 'I'.
ENDIF.
ENDFORM. " DOWNLOAD
Regards
Siva Prasad -
Error in bdc programing code-pls help
hi friends,
I was tring to do a bdc program.But it shows me an error. MY bdc program is jus to upload a 2 fields in vendoe master table.
That is LIFNR,NAME1 field for the new vendors.
I worked out an execl sheet for this, and jus copied it to the text file by selecting all and pasting.
Even then i get an error code that BDC_open does not exits.
MY code is this, please help me if iam wrong.
If anyone can help to make it more understandable,I Kindly request you to try out this program with the screen shot and mail to this id [email protected] would be very thankful for your timely help.
report Z_PK_BDC
no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case.
parameters: p_file like rlgrap-filename default
'C:\SAP TESTING\p_file.txt'.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record OCCURS 0,
data element: LIF16
LIFNR_001(016),
data element: BUKRS
BUKRS_002(004),
data element: KTOKK
KTOKK_003(004),
data element: ANRED
ANRED_004(015),
data element: NAME1_GP
NAME1_005(035),
data element: SORTL
SORTL_006(010),
data element: NAME2_GP
NAME2_007(035),
data element: STRAS_GP
STRAS_008(035),
data element: ORT01_GP
ORT01_009(035),
data element: ORT02_GP
ORT02_010(035),
data element: PFORT_GP
PFORT_011(035),
data element: LAND1_GP
LAND1_012(003),
data element: SPRAS
SPRAS_013(002),
end of record.
End generated data section ***
start-of-selection.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = P_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = record
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
WRITE:/ 'SY-SUBRC:', SY-SUBRC.
ENDIF.
LOOP AT RECORD.
*perform open_dataset using dataset.
*perform open_group.
*do.
*read dataset dataset into record.
*if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPMF02K' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
record-LIFNR_001.
perform bdc_field using 'RF02K-BUKRS'
record-BUKRS_002.
perform bdc_field using 'RF02K-KTOKK'
record-KTOKK_003.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_field using 'LFA1-ANRED'
record-ANRED_004.
perform bdc_field using 'LFA1-NAME1'
record-NAME1_005.
perform bdc_field using 'LFA1-SORTL'
record-SORTL_006.
perform bdc_field using 'LFA1-NAME2'
record-NAME2_007.
perform bdc_field using 'LFA1-STRAS'
record-STRAS_008.
perform bdc_field using 'LFA1-ORT01'
record-ORT01_009.
perform bdc_field using 'LFA1-ORT02'
record-ORT02_010.
perform bdc_field using 'LFA1-PFORT'
record-PFORT_011.
perform bdc_field using 'LFA1-LAND1'
record-LAND1_012.
perform bdc_field using 'LFA1-SPRAS'
record-SPRAS_013.
perform bdc_transaction using 'FK01'.
**enddo.
**perform close_group.
endloop.
**perform close_dataset using dataset.
Thanks in Advance
Rinky123Hi,
If you are using GUI_UPLOAD in 4.7 then the file path whatever you are using currently it won't work. Replace the file path like this.
P_FILE LIKE RLGRAP-FILENAME.
DATA: V_FILE TYPE STRING.
V_FILE = P_FILE.
Now take this v_file for function module.Then only it will open the file otherwise you won't get unable to open file error message.
I observerd that you are getting so many fields from the file to the internal table. -
Hi all,
I'm having a peculiar problem.
I inherited a project saved in LabVIEW 8.6. The project must use of particular dll that was built a few years ago. The original developer and source code for this .dll are long gone. The very core logic exists, in the form of embedded C code, and that's it. The .dll is called through a Code Interface Node in LV 8.6 and this setup manages to "work". Howver, running the VI that calls this .dll in LV 2011 causes an "insta crash", as in, no "program has stopped responding". Error message pops up, then all LV windows close.
It's very similar to that described in here:
http://digital.ni.com/public.nsf/allkb/D84C9775ABD921CF8625772A005CA50C
but this KB says to try putting the amount of error handling to maximum. I tried that, but it didn't help.
Using the "Debug" option allows me to run the just-in-time debugger with CVI 2010, which then proceeds to say this:
Finally, I manage to get this out of it:
FATAL RUN-TIME ERROR: Unknown source position, thread id 0x000012D4: A non-debuggable thread caused a 'General Protection' fault at address 0x00000000.
I don't think that really helps at all, but it's there.
Here is the function prototype of the .dll:
void _inputPM@224(uint8_t arg1, uint16_t arg2, uint8_t arg3, float arg4, float arg5, float arg6, float arg7, float arg8, float arg9, float arg10, float arg11, float arg12, float arg13, float arg14, float arg15, float arg16, float arg17, uint16_t arg18, uint16_t arg19, uint16_t arg20, uint16_t arg21, uint16_t arg22, uint16_t arg23, uint16_t arg24, uint16_t arg25, uint16_t arg26, float arg27, float arg28, float arg29, float arg30, float arg31, float arg32, float arg33, float arg34, float arg35, float arg36, float arg37, float arg38, float arg39, float arg40, float arg41, float arg42, float arg43, float arg44, float arg45, float arg46, float arg47, uint16_t arg48, uint16_t arg49, uint16_t arg50, uint16_t arg51, uint16_t arg52, float arg53, float arg54, float arg55, float arg56);
(never seen a function take 50 input params like that (wouldn't you use a struct? array? something? But I digress, and I don't know anything about .dlls...))
I do have a ".lib" and a ".cdb" file with the same name as the .dll, but those also looks like some kind of compiled file.
I'm sure the answer I'm going to get is that there is no way of telling what's really going on without .dll source code. I'm hoping against hope that there may be another way or hack.
Any ideas? Thank you for you help.
Regards,
Mark G
Solved!
Go to Solution.MarkCG wrote:
Changing the call library node to stdcall (WINAPI) did the trick! No more crash. Thank you very much!
I haven't run LV2011 on windows XP, only on windows 7, so I don't know if that makes a dfference. But The call type makes no difference when using LV 8.6 on the same machine, however.
Now I've got to make the .DLL run corretly on a compact fieldpoint.... and avoid crashing IT.
Thank you for the help all!
Well, the DLL did work fine in LabVIEW 8.6 because earlier versions of LabVIEW automatically proceeded to change the calling convention to stdcall, if they noticed a function name decoration of @# (# = number of bytes passed on the stack) appended to the name. This is the default naming decoration for stdcall functions used by VisualC. However this decoration can be overwritten with linker switches, other compilers don't use them always in the same way, and most likely there are in the mean time compilers out there that can produce such decorations also for non stdcall calling convention. So this automagic trickery was removed from newer LabVIEW versions.
I do think it could be considered a bug in the code that upgrades LabVIEW VIs, that it uses the calling convention that is configuerd in the dialog, instead of the calling convention earlier LabVIEW versions used automagically, but it is an esoteric corner case.
What Compact Fieldpoint controller do you have? If it's anything newer than 20xx or 21xx forget it. The 22xx controllers use a PPC CPU and VxWorks operating system and can never get a Windows DLL to operate properly. If it is a 20xx controller it's still highly likely that DLL can not even get loaded into LabVIEW as it likely relies on other runtime libraries and possibly Win32 APIs not present in the Pharlap ETS runtime kernel used on those controllers.
There is a tool to check a DLL for incompatible imports that are not present on specific ETS RT systems. And this list summarizes the RT system used on the various NI controllers.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
HTTP status code returned by site-wide error handler is 200 OK?
I'm using a developer install of ColdFusion 11. I set up the following page at http://localhost:8500/test/index.cfm:
<cfthrow type="application" message="This is an error">
When I visit that page, the HTTP status code returned is 500, as expected.
I then created the following page at http://localhost:8500/error.cfm:
<p>Sorry! That was an error.</p>
If I set the site-wide error handler in the CF Admin to /error.cfm and visit /test/index.cfm, the HTTP status code returned is 200 OK.
This seems weird to me. It looks like I can include the following in the error.cfm file to send an error code instead:
<cfheader statuscode="500" statustext="Server Error">
Does anyone see that as problematic? Is there a reason why the site-wide error handler should return 200 OK?Error Codes are the responsibility of the developer, to define and broadcast. Ultimately, the ColdFusion server has acted appropriately and fulfilled the request (hence the 202). Only the code would know what error was truly thrown, and how to appropriately handle that message to the user, hence the need for you to change the header in the response, if you want that broadcast to the browser in anything of than a "successful request" type of status.
-
Error handling return code for Provide Statement
Hi Experts,
For select statement we have error handling return code sy-subrc.
What is the error handling return code for provide.. end provide statement.
Thanks,
RaguRagu,
Same thing.
Check sy-subrc.
sy-subrc is the return code for all ABAP statements as far as I know.
Regards,
Dilek
Maybe you are looking for
-
How to create an expression using distinct()?
I want to create an expression for the following SQL statement: select distinct aCol from mytable where bCol = 123 and cCol = 'something'; My expression without using the distinct() is followed: Expression exp = new ExpressionBuilder().get("bcol"). e
-
Login problem in oracle form and reports......
Ii have installed oracle10g database edition... Then i installed oracle10g forms and reports i've altered and created login username and password in oracle10g database edition... when i try to give username and password in oracle sqlplus it show erro
-
Internal Order with Commitment Mgmt Issue (ME23N)
Trying to close the Internal Order that has a Commitment amount. Unfortunately, as long as SAP calculates a Commitment Due the Internal Order will not close. I cannot Delete Commitment Amount (ME22N) because it will change the Quantity amount also. M
-
when i used my itunes to report porblem, it send me to http://www.apple.com/support/itunes/
-
Keep getting error:the file is damaged and cannot be repaired when i try to go into a web page
i am trying to go to a web page and keep getting an error