‎2006 Oct 26 9:14 PM
‎2006 Oct 26 9:16 PM
‎2006 Oct 26 9:20 PM
A simple call transaction report using batch input may look simular to this. You can record the transaction using transaction SHDB, then copy the code to your program(just the PERFORM statements), then you can simply call the transaction using BDCDATA.
In this case, this program updates new standard prices for materials from a file on the PC which has material, plant and the new standard price, it uses transaction MR21 to update the system.
report zrich_0002
no standard page heading
line-size 132.
data: iflat type table of string with header line.
data: begin of itab occurs 0,
matnr type marc-matnr,
werks type marc-werks,
stdpr(10) type c,
end of itab.
data: pdate(10) type c.
data: bdcdata like bdcdata occurs 20 with header line,
mode(1) type c value 'N'.
selection-screen skip 1.
parameters: p_file type localfile default
'C:Std_Price.txt'.
parameters: p_date like sy-datum.
selection-screen skip 1.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
perform upload_data.
perform process_records.
************************************************************************
* Upload_Data
************************************************************************
form upload_data.
clear iflat. refresh iflat.
clear itab. refresh itab.
call function 'GUI_UPLOAD'
exporting
filename = p_file
tables
data_tab = iflat.
loop at iflat.
split iflat at ',' into itab-matnr itab-werks itab-stdpr.
call function 'CONVERSION_EXIT_MATN1_INPUT'
exporting
input = itab-matnr
importing
output = itab-matnr.
append itab.
endloop.
endform.
************************************************************************
* Process_Records
************************************************************************
form process_records.
concatenate p_date+4(2) '/' p_date+6(2) '/' p_date(4)
into pdate.
loop at itab.
<b>
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_CURSOR'
'MR21HEAD-WERKS'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MR21HEAD-BUDAT'
pdate.
perform bdc_field using 'MR21HEAD-BUKRS'
'0010'.
perform bdc_field using 'MR21HEAD-WERKS'
itab-werks.
perform bdc_field using 'MR21HEAD-SCREEN_VARIANT'
'MR21_LAGERMATERIAL_0250'.
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'BDC_CURSOR'
'CKI_MR21_0250-NEWVALPR(01)'.
perform bdc_field using 'MR21HEAD-SCREEN_VARIANT'
'MR21_LAGERMATERIAL_BWKEY_0250'.
perform bdc_field using 'CKI_MR21_0250-MATNR(01)'
itab-matnr.
perform bdc_field using 'CKI_MR21_0250-NEWVALPR(01)'
itab-stdpr.
perform bdc_dynpro using 'SAPRCKM_MR21' '0201'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'BDC_CURSOR'
'CKI_MR21_0250-MATNR(02)'.
perform bdc_field using 'MR21HEAD-SCREEN_VARIANT'
'MR21_LAGERMATERIAL_BWKEY_0250'.
call transaction 'MR21' using bdcdata mode mode
update 'S'.</b>
if sy-subrc = 0.
write:/ 'S', itab-matnr, itab-werks,
'updated successfully'.
else.
write:/ 'E', itab-matnr, itab-werks,
'error trying to update'.
endif.
clear bdcdata. refresh bdcdata.
endloop.
endform.
<b>
************************************************************************
* Form BDC_DYNPRO
************************************************************************
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform.
************************************************************************
* Form BDC_FIELD
************************************************************************
form bdc_field using fnam fval.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform.</b>
Regards,
Rich Heilman
‎2006 Oct 26 9:23 PM
This may also be helpful.
http://www.sap-img.com/abap/difference-between-batch-input-and-call-transaction-in-bdc.htm
Regards,
Rich Heilman
‎2006 Oct 27 4:33 AM
Just incase you are reffering to type BINP, below info might be helpful.
1. Each BINP refers to a program.
2. We can use SUBMIT statement for calling the program with the dataset name i.e path and file with data for uploading.
3. Each BINP Program has multi structures and can identified by record types.
4. For more on this you can refer to transactions: SXDA, SXDB and use menupath Goto->DX Tools.
Kind Regards
Eswar
‎2007 Aug 05 6:29 PM
Hello ,
I am going into the process of BATCH INPUT .And I need to load up students's table where his data come from a file excel and no himself like to program it
Thanks FOR HELP