资源描述:
《用BDC实现EXCEL导入SAP》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、用BDC实现EXCEL导入SAPreportZZTESTnostandardpageheadingline-size255.includebdcrecx1.*parameters:pc_file(30)typec.TYPE-POOLSkcde. "typegroup定义DATA:inputTYPEkcde_intern_strucOCCURS0WITHHEADERLINE.FIELD-SYMBOLS."定义field标志parameters:pc_filelikerlgra
2、p-filenameobligatory,p_modelikectu_params-dismodeobligatorydefault'N'.DATA:BEGINOFgi_tabOCCURS0, V01(10)TYPEC, V02(10)TYPEC,v03LIKE ztest-CODE,"移动平均价v04 LIKEztest-PCODE,"标准价格v05 LIKEztest-NEWCODE,"价格单位ENDOFgi_tab.*parameters:dataset(132)lowe
3、rcase.*** DONOTCHANGE-thegenerateddatasection-DONOTCHANGE ***** Ifitisnessesarytochangethedatasectionusetherules:* 1.)Eachdefinitionofafieldexistsoftwolines* 2.)Thefirstlineshowsexactlythecomment* '*dataelement:'followedwiththedataelement*
4、 whichdescribesthefield.* Ifyoudon'thaveadataelementusethe* commentwithoutadataelementname* 3.)Thesecondlineshowsthefieldnameofthe* structure,thefieldnamemustconsistof* afieldnameandoptionalthecharacter'_'and* threenumbersandthefieldl
5、engthinbrackets* 4.)EachfieldmustbetypeC.****Generateddatasectionwithspecificformatting-DONOTCHANGE ****data:beginofgi_tabOCCURS0,*dataelement:TABNAME* V01(030),*dataelement:TABNAME* TABLENAME_002(030),*dataelement:* CODE_003(020),*d
6、ataelement:* PCODE_004(020),*dataelement:* NEWCODE_005(020),* endofgi_tab.***Endgenerateddatasection****data:it_record likeTABLEOFgi_tabwithheaderline.CONSTANTS:pv_type(30)TYPEcVALUE'*.xls,*.xls,*.txt,*.txt.', pv_path(03)TYPE c V
7、ALUE'c:', pv_data(03)TYPE cVALUE'DAT', pv_x(01) TYPE cVALUE'X'.atselection-screenonvalue-requestforpc_file.performbbusingpc_filepv_pathchangingpc_file.start-of-selection. datagv_check(1)typec. callfunction'POPUP_TO_CONFIRM_WITH_MESSAG
8、E' exporting diagnosetext1=text-m01 textline1 =text-m02 titel =text-m03 importing answer =gv_check.*performopen_datasetusingdataset. ifgv_check='J'.performfrm_load_file_inputusingpc_file. "文件上载*messagei005(ymess)wit