Once I needed to make a report to present material reservations and after checking some tables, finally I found a series of BAPIs that helped me in this requirement. You can check the results of the code in transaction 'MMBE' with any material.
Let's code the program.
Let's code the program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | report zreservation. data wa_detail type bapi_mrp_stock_detail. data: begin of xtab1 occurs 10, werks like resb-werks, lgort like resb-lgort, charg like resb-charg, matnr like resb-matnr, bdmng like resb-bdmng, bdmns like resb-bdmng, erfme like resb-erfme, erfmg like resb-erfmg, end of xtab1. data: arbed like resb-bdart value 'AR', mtres like resb-bdart value 'MR'. ranges: xbdart for resb-bdart, ms_werks for marcv-werks. parameters: p_matnr type marc-matnr obligatory, p_werks type marc-werks obligatory. start-of-selection. CALL FUNCTION 'BAPI_MATERIAL_STOCK_REQ_LIST' EXPORTING MATERIAL = p_matnr PLANT = p_werks * MRP_AREA = * PLAN_SCENARIO = * SELECTION_RULE = * DISPLAY_FILTER = * PERIOD_INDICATOR = * GET_ITEM_DETAILS = * GET_IND_LINES = 'X' * GET_TOTAL_LINES = * IGNORE_BUFFER = * MATERIAL_EVG = IMPORTING * MRP_LIST = * MRP_CONTROL_PARAM = MRP_STOCK_DETAIL = wa_detail * RETURN = * TABLES * MRP_ITEMS = * MRP_IND_LINES = * MRP_TOTAL_LINES = * EXTENSIONOUT = . refresh xbdart. clear xbdart. xbdart-sign = 'I'. xbdart-option = 'EQ'. xbdart-low = arbed. append xbdart. xbdart-low = mtres. append xbdart. refresh ms_werks. clear ms_werks. ms_werks-sign = 'I'. ms_werks-option = 'EQ'. ms_werks-low = p_werks. append ms_werks. CALL FUNCTION 'MB_ADD_RESERVATION_QUANTITIES' EXPORTING X_KZEAR = space X_MATNR = p_matnr X_XLOEK = space * X_KZWSO = ' ' TABLES XBDART = xbdart XTAB1 = xtab1 XWERKS = ms_werks. write: 'Material:', p_matnr, 'Reservations:', wa_detail-reservations, /. loop at xtab1. write: 'Storage Location:', xtab1-lgort, 'Reservations:', xtab1-bdmng, /. endloop. |
See you in the next post.
Hope it helps
No comments :
Post a Comment