SAP MR21批量修改价格

2020-11-27 11:35:22 浏览数 (1)

前两天吃中饭时同事说MR21修改价格用LSMW导入,每次只能导入一条商品价格,而每一个商品价格的修改都会产生一个凭证,问是否能批量导入。先去找了下BAPI,看了下BAPI_MATVAL_PRICE_CHANGE和BAPI_M_REVAL_CREATEPRICECHANGE两个BAPI,发现前一个每次只能修改一个商品价格,后一个根本就跑不起来,不知道咋回事,只能回头用SHDB解决问题。

REPORT zmr21 NO STANDARD PAGE HEADING LINE-SIZE 255. INCLUDE bdcrecx1. 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 OCCURS 0, * data element: BUDAT budat_001(010), * data element: BUKRS bukrs_002(004), * data element: WERKS_D werks_003(004), * data element: SCREEN_VARIANT screen_variant_004(030), * data element: SCREEN_VARIANT screen_variant_005(030), * data element: MATNR matnr_01_006(018), * data element: VALPR newvalpr_01_007(015), END OF record. *** End generated data section *** START-OF-SELECTION. * PERFORM open_dataset USING dataset. PERFORM of_getexcel. PERFORM open_group. PERFORM of_processdata. PERFORM close_group. * PERFORM close_dataset USING dataset. FORM of_processdata. DATA: li_cur TYPE i VALUE 0, li_mod TYPE i, ls_fname(30) TYPE c, ls_temp(2) TYPE c, li_len TYPE i, li_inex TYPE i VALUE 0. li_mod = LINES( record ). break ypcheng. LOOP AT record. li_cur = li_cur 1. li_inex = li_inex 1. IF li_inex = 1. PERFORM bdc_dynpro USING 'SAPRCKM_MR21' '0201'. PERFORM bdc_field USING 'BDC_CURSOR' 'MR21HEAD-WERKS'. PERFORM bdc_field USING 'MR21HEAD-BUDAT' record-budat_001. PERFORM bdc_field USING 'MR21HEAD-BUKRS' record-bukrs_002.

0 人点赞