Announcement:
wanna exchange links? contact me at sapchatroom@gmail.com.
Posted by
Admin at
Find below the code to implement "BAdI: Preselection of Batches Within Batch Determination" To implement this BADI do the following: 1. Create table YBATCH in se11 with the following fields and data element Field data element MANDT MANDT CLNT MATNR MATNR CHAR WERKS WERKS_D CHAR CHARG CHARG_D CHAR YCHARG2 CHARG_D CHAR 2. create message class Z000_MESSAGE and message 009 3. Copy the code below into the body of the implementing class. "method IF_EX_VB_BD_SELECTION~PRESELECT_BATCHES. DATA: itab TYPE TABLE OF MCHA_KEY, itab2 LIKE line of ET_MCHA_KEY, imatnr type MCHB-MATNR, icolor(2) type C, isplt(1) type C Value '-', ibatch type YBATCH, iresb type resb. SPLIT I_KOMPH-PMATN AT isplt into imatnr icolor. FIELD-SYMBOLS <fd> like line of ET_MCHA_KEY. select single * INTO ibatch FROM YBATCH where MATNR eq imatnr and WERKS eq I_KOMPH-PWERK. if sy-subrc ne 0. message I009(Z000_MESSAGE) WITH imatnr. RETURN. endif. move IT_MCHB_KEY to itab. loop at itab assigning <fd>. <fd>-charg = ibatch-charg. endloop. move itab to ET_MCHA_KEY. E_BADI_EXECUTED = 'X'. loop at ET_MCHA_KEY into itab2. update resb set charg = ITAB2-CHARG where RSNUM = I_BDCOM-DELNR and werks = I_KOMPH-PWERK and matnr = I_KOMPH-matnr and baugr = I_KOMPH-PMATN. endloop. ** APPEND ITAB TO ET_MCHA_KEY. endmethod." If u ever find this useful let me know. Cheers. | __.____._ Copyright © 2010 Toolbox.com and message author. Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251 | | Related Content White Papers In the Spotlight _.____.__ |