‎2006 Nov 23 11:38 AM
Hi,
I have created a transction in which i am entering employee number, salary, department and name. First screen have only employee number as an edit field and create, display as push button. When we click on create second screen will be displayed where we can enter rest of the details (salary, department and name).
And i have created BDC program on this, but when i execute the program...it asks for the path of data file.... and after selecting proper file...in status bar system shows message "Uploading data from data file" and after about 20 minutes it shows "time-out" error message.
BDC Code:
report ZBDC_EMPN
no standard page heading line-size 255.
include bdcrecx1.
TABLES: ZTRGEMP, ZTRGDEPT, ZTRGTXN.
parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
*
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
*
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
data element:
IEMP_001(006),
data element:
INAME_002(010),
data element:
ISAL_003(010),
data element:
IDPT_004(020),
end of record.
End generated data section ***
DATA : BEGIN OF ITAB OCCURS 0,
EMPNO LIKE ZTRGEMP-EMPNO,
EMPNAME LIKE ZTRGEMP-EMPNAME,
EMPDPT LIKE ZTRGDEPT-EMPDPT,
SALARY LIKE ZTRGTXN-SALARY,
END OF ITAB.
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:\EMP.TXT'
FILETYPE = 'ASC'
TABLES
DATA_TAB = ITAB.
*perform open_dataset using dataset.
perform open_group.
LOOP AT ITAB.
do.
*read dataset dataset into record.
if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'ZASS_6' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=CRT'.
perform bdc_field using 'BDC_CURSOR'
'IEMP'.
perform bdc_field using 'IEMP'
ITAB-EMPNO.
perform bdc_dynpro using 'ZASS_6' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=CRT'.
perform bdc_field using 'BDC_CURSOR'
'IDPT'.
perform bdc_field using 'INAME'
ITAB-EMPNAME.
perform bdc_field using 'ISAL'
ITAB-SALARY.
perform bdc_field using 'IDPT'
ITAB-EMPDPT.
perform bdc_dynpro using 'ZASS_6' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=C'.
perform bdc_field using 'BDC_CURSOR'
'INAME'.
perform bdc_transaction using 'ZEMPN'.
enddo.
ENDLOOP.
perform close_group.
Mahesh
‎2006 Nov 23 11:41 AM
LOOP AT ITAB.
<b>*do.</b>--->remove it
*read dataset dataset into record.
if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'ZASS_6' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=CRT'.
perform bdc_field using 'BDC_CURSOR'
'IEMP'.
perform bdc_field using 'IEMP'
ITAB-EMPNO.
perform bdc_dynpro using 'ZASS_6' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=CRT'.
perform bdc_field using 'BDC_CURSOR'
'IDPT'.
perform bdc_field using 'INAME'
ITAB-EMPNAME.
perform bdc_field using 'ISAL'
ITAB-SALARY.
perform bdc_field using 'IDPT'
ITAB-EMPDPT.
perform bdc_dynpro using 'ZASS_6' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=C'.
perform bdc_field using 'BDC_CURSOR'
'INAME'.
perform bdc_transaction using 'ZEMPN'.
<b>*enddo</b>---->remove it.
ENDLOOP.
y u r using do and enddo...
kishan negi
‎2006 Nov 23 11:40 AM
‎2006 Nov 23 2:23 PM
‎2006 Nov 23 2:30 PM
Can any one explain me where to write code for recording error messages using bdcmsgcoll and "format message" FM?
‎2006 Nov 23 11:41 AM
LOOP AT ITAB.
<b>*do.</b>--->remove it
*read dataset dataset into record.
if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'ZASS_6' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=CRT'.
perform bdc_field using 'BDC_CURSOR'
'IEMP'.
perform bdc_field using 'IEMP'
ITAB-EMPNO.
perform bdc_dynpro using 'ZASS_6' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=CRT'.
perform bdc_field using 'BDC_CURSOR'
'IDPT'.
perform bdc_field using 'INAME'
ITAB-EMPNAME.
perform bdc_field using 'ISAL'
ITAB-SALARY.
perform bdc_field using 'IDPT'
ITAB-EMPDPT.
perform bdc_dynpro using 'ZASS_6' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=C'.
perform bdc_field using 'BDC_CURSOR'
'INAME'.
perform bdc_transaction using 'ZEMPN'.
<b>*enddo</b>---->remove it.
ENDLOOP.
y u r using do and enddo...
kishan negi
‎2006 Nov 23 11:42 AM
hi ,
there's an infinite loop because
you've inactivated :
*read dataset dataset into record.
pls activate and remove star
A.
Message was edited by:
Andreas Mann
‎2006 Nov 23 11:43 AM
Why you are reading data from application server within loop.
Read data from application server outside the loop. and try to run the program.
‎2006 Nov 23 11:47 AM
Hi
U're using the statament LOOP/ENDLOOP to fill the BDC table with file data (because now you use a file of presentation server), but you haven't delete the statament DO/ENDO and so you've an infinite loop, so delete it.
LOOP AT ITAB.
<b>do. <----
DELETE THIS ROW</b>
*read dataset dataset into record.
<b>if sy-subrc <> 0. exit. endif. <----
DELETE THIS ROW</b>
perform bdc_dynpro using 'ZASS_6' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=CRT'.
perform bdc_field using 'BDC_CURSOR'
'IEMP'.
perform bdc_field using 'IEMP'
ITAB-EMPNO.
perform bdc_dynpro using 'ZASS_6' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=CRT'.
perform bdc_field using 'BDC_CURSOR'
'IDPT'.
perform bdc_field using 'INAME'
ITAB-EMPNAME.
perform bdc_field using 'ISAL'
ITAB-SALARY.
perform bdc_field using 'IDPT'
ITAB-EMPDPT.
perform bdc_dynpro using 'ZASS_6' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=C'.
perform bdc_field using 'BDC_CURSOR'
'INAME'.
perform bdc_transaction using 'ZEMPN'.
<b>enddo. <----
DELETE THIS ROW</b>
ENDLOOP.
Max
‎2006 Nov 23 11:47 AM
Hullo,
your problem looks like to be caused after you've changed the automatically generated program that used a file on the AS, which you changed to a file on the PS using the upload function.
You did remove the 'READ DATASET' statement, but you forgot to remove the test on the sy-subrc.
LOOP AT ITAB.
DO.
* read dataset dataset into record.
IF sy-subrc <> 0. EXIT. ENDIF.
*** <snipped rest of the code>
ENDDO.ENDLOOP.
Since no new sy-subrc will be set after the upload function the sy-subrc will always be 0 and thus in your loop you have created a never ending do loop.
Remove these three commands from your code ("DO.", "IF sy-subrc <> 0. EXIT. ENDIF." and "ENDDO.") and your program should work correctly.
Hope this helps.
‎2006 Nov 23 11:48 AM
1) declare your input fields as character fields with respective lengths
2) use FM 'GUI_UPLOAD' and pass your input file to it
3) Call your transaction
4) loop at your data tab and populate screens
‎2006 Nov 24 10:39 AM