08-14-2006 4:21 PM
Hi all,
I need to upload data to selctoptions from a file.
I have following code. But its not working.
The problem is its working only for 8 records.
parameters : p_file like rlgrap-filename default 'c:mat.txt'.
data : begin of record occurs 0,
matnr_001(018),
end of record,
help(2) type n,
bdc(17).
include bdcrecx1.
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.
move '01' to help.
perform open_group.
perform bdc_dynpro using 'SAPLSETB' '0230'.
perform bdc_field using 'BDC_CURSOR'
'DATABROWSE-TABLENAME'.
perform bdc_field using 'BDC_OKCODE'
'=ANZE'.
perform bdc_field using 'DATABROWSE-TABLENAME'
'mara'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=%000'.
perform bdc_field using 'LIST_BRE'
' 250'.
perform bdc_field using 'MAX_SEL'
' 200'.
perform bdc_dynpro using 'SAPLALDB' '3000'.
perform bdc_field using 'BDC_OKCODE'
'=IMPT'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
'RSCSEL-SLOW_I(01)'.
loop at record. ----> code for uploading file
to selectoptions
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
move 'RSCSEL-SLOW_I(' to bdc.
concatenate bdc help ')' into bdc.
condense bdc no-gaps.
perform bdc_field using bdc
record-matnr_001.
help = help + 1.
if help gt '08'.
perform bdc_field using 'BDC_OKCODE'
'=ACPT'.
perform bdc_field using 'BDC_OKCODE'
'=%000'.
perform bdc_dynpro using 'SAPLALDB' '3000'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
move '01' to help.
endif.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=SEND'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'LIST_BRE'
' 250'.
perform bdc_field using 'MAX_SEL'
' 200'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'02/62'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/EE'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_dynpro using 'SAPLSETB' '0230'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'DATABROWSE-TABLENAME'.
perform bdc_transaction using 'SE16'.
perform close_group.
thanks
Saichand.
08-14-2006 9:42 PM
When you find that you have entries greater than 8 you need to advance the current entries before inserting additional entries. For example:
Loop at record.
if help gt '08'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPLALDB'
'3000'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
move '01' to help.
endif.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=ACPT'.
08-14-2006 4:25 PM
Hi,
Try to directly call the program /1BCDWB/DBMARA using the SUBMIT statement, instead of calling the transaction SE16 through BDC.
Populate the values in a Range and pass it in the SUBMIT statement..
Hope this works..
Thanks,
Naren
Message was edited by: Narendran Muthukumaran
08-14-2006 4:28 PM
hi,
Check at this place.. what are you trying to do at this place .. i guess here is the problem ..
help = help + 1.
<b>if help gt '08'.</b>
perform bdc_field using 'BDC_OKCODE'
'=ACPT'.
perform bdc_field using 'BDC_OKCODE'
'=%000'.
Regards,
Santosh
08-14-2006 4:34 PM
Hi all,
Thanks for your replies.
Iam using this statement "if help gt '08'."
In BDC it can only get upto 8 records only.
after that again i have get cursor to the
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
when iam doing its not keeping the last 8 records.
i hope you understand.
Thanks
Saichand.
08-14-2006 4:42 PM
Keep these in mind:
1. Depending on your version of SAP, you have the ability to upload your selection criteria from file in the extension area of the selection screen. I'm not sure of your requirements, so I don't know if this would help you.
2. In most environments, some users have the ability to query from SE16, which means they have the ability to change the fields by which to select. This regenerates the selection-screen for /1BCDWB/DBMARA, possibly removing material number from the screen.
08-14-2006 4:59 PM
Hi Michael,
Actually its not for SE16.
its for kvb2 transaction.
I dont have data in dev so i used se16 and if it works,
I will use this code in for KVB2.
Thanks
Saichand
08-14-2006 4:26 PM
Hi Sai,
What does <b>if help gt '08'.</b> do here. I think thats restricting the records.
parameters : p_file like rlgrap-filename default 'c:mat.txt'.
data : begin of record occurs 0,
matnr_001(018),
end of record,
help(2) type n,
bdc(17).
include bdcrecx1.
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.
move '01' to help.
perform open_group.
perform bdc_dynpro using 'SAPLSETB' '0230'.
perform bdc_field using 'BDC_CURSOR'
'DATABROWSE-TABLENAME'.
perform bdc_field using 'BDC_OKCODE'
'=ANZE'.
perform bdc_field using 'DATABROWSE-TABLENAME'
'mara'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=%000'.
perform bdc_field using 'LIST_BRE'
' 250'.
perform bdc_field using 'MAX_SEL'
' 200'.
perform bdc_dynpro using 'SAPLALDB' '3000'.
perform bdc_field using 'BDC_OKCODE'
'=IMPT'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
'RSCSEL-SLOW_I(01)'.
loop at record. ----> code for uploading file
to selectoptions
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
move 'RSCSEL-SLOW_I(' to bdc.
concatenate bdc help ')' into bdc.
condense bdc no-gaps.
perform bdc_field using bdc
record-matnr_001.
help = help + 1.
<b>if help gt '08'.</b>
perform bdc_field using 'BDC_OKCODE'
'=ACPT'.
perform bdc_field using 'BDC_OKCODE'
'=%000'.
perform bdc_dynpro using 'SAPLALDB' '3000'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
move '01' to help.
endif.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=SEND'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'LIST_BRE'
' 250'.
perform bdc_field using 'MAX_SEL'
' 200'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'02/62'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/EE'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_dynpro using 'SAPLSETB' '0230'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'DATABROWSE-TABLENAME'.
perform bdc_transaction using 'SE16'.
perform close_group.
Regards,
AS
08-14-2006 4:29 PM
hi add one clear statement...
move '01' to help.
perform open_group.
perform bdc_dynpro using 'SAPLSETB' '0230'.
perform bdc_field using 'BDC_CURSOR'
'DATABROWSE-TABLENAME'.
perform bdc_field using 'BDC_OKCODE'
'=ANZE'.
perform bdc_field using 'DATABROWSE-TABLENAME'
'mara'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=%000'.
perform bdc_field using 'LIST_BRE'
' 250'.
perform bdc_field using 'MAX_SEL'
' 200'.
perform bdc_dynpro using 'SAPLALDB' '3000'.
perform bdc_field using 'BDC_OKCODE'
'=IMPT'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
'RSCSEL-SLOW_I(01)'.
loop at record. -
> code for uploading file
to selectoptions
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
move 'RSCSEL-SLOW_I(' to bdc.
concatenate bdc help ')' into bdc.
condense bdc no-gaps.
perform bdc_field using bdc
record-matnr_001.
help = help + 1.
if help gt '08'.
perform bdc_field using 'BDC_OKCODE'
'=ACPT'.
perform bdc_field using 'BDC_OKCODE'
'=%000'.
perform bdc_dynpro using 'SAPLALDB' '3000'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
move '01' to help.
<b>clear record.</b>
endif.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=SEND'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'LIST_BRE'
' 250'.
perform bdc_field using 'MAX_SEL'
' 200'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'02/62'.
perform bdc_dynpro using '/1BCDWB/DBMARA' '1000'.
perform bdc_field using 'BDC_OKCODE'
'/EE'.
perform bdc_field using 'BDC_CURSOR'
'I1-LOW'.
perform bdc_dynpro using 'SAPLSETB' '0230'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'DATABROWSE-TABLENAME'.
perform bdc_transaction using 'SE16'.
perform close_group.
08-14-2006 4:31 PM
Just out of curiosity, why are you writing a call trans for SE16?
08-14-2006 4:33 PM
I would suggest trying to submit the program which drives the browser for MARA.
report zrich_0001.
tables: mara.
constants: c_table(20) type c value 'MARA'.
data: program_name(50) type c.
ranges: r_matnr for mara-matnr.
concatenate '/1BCDWB/DB' c_table into program_name.
r_matnr-sign = 'I'.
r_matnr-option = 'EQ'.
r_matnr-low = '000000000060001262'.
append r_matnr.
r_matnr-sign = 'I'.
r_matnr-option = 'EQ'.
r_matnr-low = '000000000060001263'.
append r_matnr.
submit (program_name) via selection-screen
with I1 in r_matnr
and return.
REgards,
Rich Heilman
08-14-2006 9:42 PM
When you find that you have entries greater than 8 you need to advance the current entries before inserting additional entries. For example:
Loop at record.
if help gt '08'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPLALDB'
'3000'.
perform bdc_field using 'BDC_CURSOR'
'RSCSEL-SLOW_I(01)'.
move '01' to help.
endif.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=ACPT'.