2008 Apr 15 4:55 AM
Hi ABAP Experts,
I have written a Dialog Program For a Screen Which contains 5 fields namely,
carrid,
connid,
fldate,
price,
planetype.
I have written the PAI logic to insert whatever entries entered in the fields, into Database Table SFLIGHT.
I created a Transaction and Tested whether the entries are succesfully entetered into the Database Table and it works just fine.
Now i planned to write a BDC program for the above Transaction so that i can upload data to the Database table from a flat file.
I went to SHDB transaction and created a new recording and transferred the program to generate a source code.
include bdcrecx1.
start-of-selection.
loop at itab.
perform open_group.
perform bdc_dynpro using 'SAPMZ_TPSCREEN02' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=CREA'.
perform bdc_field using 'BDC_CURSOR'
'SFLIGHT-PLANETYPE'.
perform bdc_field using 'SFLIGHT-CARRID'
'AA'.
perform bdc_field using 'SFLIGHT-CONNID'
'0017'.
perform bdc_field using 'SFLIGHT-FLDATE'
'11/01/2007'.
perform bdc_field using 'SFLIGHT-PRICE'
'767'.
perform bdc_field using 'SFLIGHT-PLANETYPE'
'A310-200F'.
perform bdc_transaction using 'Z_TPSCREEN02'.
perform close_group.
Then i defined an internal table which contains the same fields as those in my Screen and Transaction.
I populated the internal table from a flat file using GUI_UPLOAD function module.
I want to clarify - I got this flat file by using the GUI_DOWNLOAD module and later i uploaded the same file using GUI_UPLOAD.
I tested whether the internal table is populated or not using LOOP AT ITAB. WRITE Statements.
Its working just fine.
Finally my code look like this.
report ZVMREC
no standard page heading line-size 255.
TABLES: sflight.
DATA: BEGIN OF itab OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price TYPE sflight-price,
planetype TYPE sflight-planetype,
END OF itab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\users\vamc\documents\flightinfo.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = itab.
include bdcrecx1.
start-of-selection.
loop at itab.
perform open_group.
perform bdc_dynpro using 'SAPMZ_TPSCREEN02' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=CREA'.
perform bdc_field using 'BDC_CURSOR'
'SFLIGHT-PLANETYPE'.
perform bdc_field using 'SFLIGHT-CARRID'
'AA'.
perform bdc_field using 'SFLIGHT-CONNID'
'0017'.
perform bdc_field using 'SFLIGHT-FLDATE'
'11/01/2007'.
perform bdc_field using 'SFLIGHT-PRICE'
'767'.
perform bdc_field using 'SFLIGHT-PLANETYPE'
'A310-200F'.
perform bdc_transaction using 'Z_TPSCREEN02'.
perform close_group.
endloop. I checked for errors, activated and executed.
I gave session name and executed, it generated same number of sessions as number of records.
I went to SM35 and Processed one of the sessions in foreground.
It brought my screen up with all fields fill up by the fields of first record in the internal table and with
OK Code popping up.
I check the OK Code.
Now the problem has come up, its says
*No batch input data for screen SAPMZ_TPSCREEN02 1000 *
My session was now incorrectly processed,
Please help me to fix this problem.
I searched so many forums and google it a lot.
But i didn't find any clue.
Kindly take your time and have a look at this problem and let me know how can i fix it.
Thank you very much all.
Shiv
Edited by: Sivaram Naga on Apr 15, 2008 5:57 AM
Hi ABAP Experts,
I have written a Dialog Program For a Screen Which contains 5 fields namely,
carrid,
connid,
fldate,
price,
planetype.
I have written the PAI logic to insert whatever entries entered in the fields, into Database Table SFLIGHT.
I created a Transaction and Tested whether the entries are succesfully entetered into the Database Table and it works just fine.
Now i planned to write a BDC program for the above Transaction so that i can upload data to the Database table from a flat file.
I went to SHDB transaction and created a new recording and transferred the program to generate a source code.
include bdcrecx1.
start-of-selection.
loop at itab.
perform open_group.
perform bdc_dynpro using 'SAPMZ_TPSCREEN02' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=CREA'.
perform bdc_field using 'BDC_CURSOR'
'SFLIGHT-PLANETYPE'.
perform bdc_field using 'SFLIGHT-CARRID'
'AA'.
perform bdc_field using 'SFLIGHT-CONNID'
'0017'.
perform bdc_field using 'SFLIGHT-FLDATE'
'11/01/2007'.
perform bdc_field using 'SFLIGHT-PRICE'
'767'.
perform bdc_field using 'SFLIGHT-PLANETYPE'
'A310-200F'.
perform bdc_transaction using 'Z_TPSCREEN02'.
perform close_group.
Then i defined an internal table which contains the same fields as those in my Screen and Transaction.
I populated the internal table from a flat file using GUI_UPLOAD function module.
I want to clarify - I got this flat file by using the GUI_DOWNLOAD module and later i uploaded the same file using GUI_UPLOAD.
I tested whether the internal table is populated or not using LOOP AT ITAB. WRITE Statements.
Its working just fine.
Finally my code look like this.
report ZVMREC
no standard page heading line-size 255.
TABLES: sflight.
DATA: BEGIN OF itab OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price TYPE sflight-price,
planetype TYPE sflight-planetype,
END OF itab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\users\vamc\documents\flightinfo.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = itab.
include bdcrecx1.
start-of-selection.
loop at itab.
perform open_group.
perform bdc_dynpro using 'SAPMZ_TPSCREEN02' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=CREA'.
perform bdc_field using 'BDC_CURSOR'
'SFLIGHT-PLANETYPE'.
perform bdc_field using 'SFLIGHT-CARRID'
'AA'.
perform bdc_field using 'SFLIGHT-CONNID'
'0017'.
perform bdc_field using 'SFLIGHT-FLDATE'
'11/01/2007'.
perform bdc_field using 'SFLIGHT-PRICE'
'767'.
perform bdc_field using 'SFLIGHT-PLANETYPE'
'A310-200F'.
perform bdc_transaction using 'Z_TPSCREEN02'.
perform close_group.
endloop. I checked for errors, activated and executed.
I gave session name and executed, it generated same number of sessions as number of records.
I went to SM35 and Processed one of the sessions in foreground.
It brought my screen up with all fields fill up by the fields of first record in the internal table and with
OK Code popping up.
I check the OK Code.
Now the problem has come up, its says
*No batch input data for screen SAPMZ_TPSCREEN02 1000 *
My session was now incorrectly processed,
Please help me to fix this problem.
I searched so many forums and google it a lot.
But i didn't find any clue.
Kindly take your time and have a look at this problem and let me know how can i fix it.
Thank you very much all.
Shiv
Edited by: Sivaram Naga on Apr 15, 2008 5:57 AM
2008 Apr 15 5:10 AM
hi,
Populate the internal table values on to the screen
loop at itab.
perform open_group.
perform bdc_dynpro using 'SAPMZ_TPSCREEN02' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=CREA'.
perform bdc_field using 'BDC_CURSOR'
itab-PLANETYPE.
perform bdc_field using 'SFLIGHT-CARRID'
itab-CARRID'.
perform bdc_field using 'SFLIGHT-CONNID'
'0017'.
perform bdc_field using 'SFLIGHT-FLDATE'
itab-FLDATE.
perform bdc_field using 'SFLIGHT-PRICE'
itab-PRICE.
perform bdc_field using 'SFLIGHT-PLANETYPE'
itab-PLANETYPE.
perform bdc_transaction using 'Z_TPSCREEN02'.
perform close_group.
endloop.
2008 Apr 15 5:20 AM
HI SANTOSH,
tHANKS FOR YOUR QUICK REPLY.
I GOT SHORT DUMP WHEN I MADE THE CHANGES AS YOU SUGGESTED.
THE DUMP SAYS 'UNABLE TO INTERPRET "/" AS A NUMBER .
NO CLUE AT ALL.
THANKS.
2008 Apr 15 5:20 AM
Please Comment perform open group and close group and then try again.
May be that will help you
I am really sorry, you want to run the bdc through session. then u will require open and close group.
sorry for my mistake
Edited by: Amit Sawant on Apr 15, 2008 6:29 AM
2008 Apr 15 5:24 AM
hi,
The dump is because of the date field ... so convert the date to system format i.e, yyyymmdd before populating it to the bdc ...
Regards,
Santosh
2008 Apr 15 5:30 AM
How could i convert the date field to a System date field. I am directly uploading the data from file and populating the internal field.
How could i possibly do that.
2008 Apr 15 5:39 AM
hi Sivaram,
Declare one more variable
data: v_date as sy-datum.
Once you get the data into the itab_fldate after gui_upload convert the date to the system date format and assign it to v_date.
Then assign this v_date in place of itab_fldate.
2008 Apr 15 7:33 AM
I used this code to convert the date format. I'm still getting the short dump.
DATA: v_yyyy(4) TYPE c,
v_mm(2) TYPE c,
v_dd(2) TYPE c,
v_date(8) TYPE c.
v_yyyy = itab-fldate(4).
v_mm = itab-fldate+4(2).
v_dd = itab-fldate+6(2).
concatenate v_yyyy v_mm v_dd into v_date. I'm once again, putting my code.
report ZVMREC
no standard page heading line-size 255.
TABLES: sflight.
DATA: BEGIN OF itab OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price TYPE sflight-price,
planetype TYPE sflight-planetype,
END OF itab.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\users\vamc\documents\flightinfo.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
tables
data_tab = itab.
include bdcrecx1.
start-of-selection.
loop at itab.
DATA: v_yyyy(4) TYPE c,
v_mm(2) TYPE c,
v_dd(2) TYPE c,
v_date(8) TYPE c.
v_yyyy = itab-fldate(4).
v_mm = itab-fldate+4(2).
v_dd = itab-fldate+6(2).
concatenate v_yyyy v_mm v_dd into v_date.
perform open_group.
perform bdc_dynpro using 'SAPMZ_TPSCREEN02' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=CREA'.
perform bdc_field using 'BDC_CURSOR'
'SFLIGHT-PLANETYPE'.
perform bdc_field using 'SFLIGHT-CARRID'
ITAB-CARRID.
perform bdc_field using 'SFLIGHT-CONNID'
ITAB-CONNID.
perform bdc_field using 'SFLIGHT-FLDATE'
V_DATE.
perform bdc_field using 'SFLIGHT-PRICE'
ITAB-PRICE.
perform bdc_field using 'SFLIGHT-PLANETYPE'
ITAB-PLANETYPE.
perform bdc_transaction using 'Z_TPSCREEN02'.
perform close_group.
endloop.
Kindly take a look at it and please help me out. I tried very hard. But i dont understand why?
Thanks
Shiv
Edited by: Sivaram Naga on Apr 15, 2008 5:46 PM
2008 Apr 15 4:58 PM
Sivaram,
First of all you find out which date format your transaction is taking in. Then convert the date into that format.
What is exact error u r getting?
Go to System>User Profile>Own Data in the second tab defaults u can see the date format.
And check the date format that ur application is taking.
And one more suggestion when u r running the session in foreground check all the fields once again, check whether data is populating in all the fields properly or not?
and try to open a new session and try to enter the same data which is coming while u r runnning the session in foreground and try to find the exact issue where u r getting.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |