Article Overview
I have written a few articles about ideas for production and picking before, including codes. If you are interested, you can read the articles I posted before. Recently, I have encountered the business model of combined picking of existing project-specific materials, special materials according to the order, and general materials, so the type of inventory for picking involves special inventory: Q inventory, E inventory, and the three types of inventory will be in one delivery. appears in the bill of materials. If the solution is biased toward standard functions rather than custom tables, it can be solved directly by using UB orders, but the problem is that this is a material movement with a factory code and different storage locations, and only the UB order method involves the interface. There are too many documents generated continuously. So I want to realize it through the standard 311 reservation. Final effect: a reservation contains both WBS reservations, sales order reservations and general inventory reservations
This article is actually a further exploration of the standard reservation to realize the picking function. I thought about it and wrote some enhanced code to get the function of the business segment. After all, the logic of the standard has been changed, and I don’t know if it will affect it. to financial data.
1. Ideas
The standard MB21 creation reservation does not have the input item of special inventory, and the standard function cannot enter the sales order number and WBS number when creating a 311 reservation. However, judging by the following conditions, the special reservation of 311 can be realized:
1.221 can input the item number, and the input position is in the reserved header information, and the reserved special inventory identification generated by the component is based on the header WBS+ Generated by separate centralized fields for materials.
2. Reserved line item data table: RESB contains sales order and WBS number information
3. The reserved Chinese style of production order can have special inventory and general inventory reservation at the same time
Therefore, the goal to be achieved is as follows:
The reservation creation screen of 311 gets out the configuration of the sales order number and WBS number, and it is not necessary to enter
311. When posting the reservation, it is automatically brought out according to the special inventory identification of the line item and the account allocation information according to the reservation
Two, the process
2.1 The main process of the foreground:
OMJJ sets the screen field of the mobile type, and the sales order and WBS settings are not optional. And set a custom sub-screen block so that the sub-screens of sales order and WBS have the highest priority. Effect:
create interface:
Reserve the HUD interface:
Reserved line item details:
There is a problem found in the MIGO posting interface, that is, the header sales order or WBS will cover all line items. Therefore, it is necessary to do == implicit enhancement == in the standard program for updating reservations , and before the system replaces the equivalent value of the sales order of RESB with the value of the RKPF header, the data information of the header is first overwritten with the line item data.There are a lot of methods and locations for this enhancement. Everyone should make their own decisions carefully, and also pay attention to the conditions for the control to take effect. In order not to affect other people during the test period, the restrictions on their own accounts have been specially added.
In order to finally achieve the effect of multiple special stocks in a reservation order, the standard functions are not enhanced here, and the curve to save the country is realized by using BAPI.
2.2 Implementation process of BAPI:
The main process implemented through BAPI is adopted, and the function of BAPI needs to be enhanced here, because the standard creation of reserved BAPI line items cannot be passed in to the sales order and WBS number.
Enhancement point of reserved BAPI: MB_RES_BAPI_CREATE1
DATA:lt_item_resb TYPE TABLE OF zresb_item,
lw_item_resb TYPE zresb_item.
"CS_RKPF
"获取增强字段
REFRESH lt_item_resb.
LOOP AT it_extension_in INTO DATA(lw_extension_in).
IF lw_extension_in-structure = 'ZRESB_ITEM'.
lw_item_resb = lw_extension_in-valuepart1.
APPEND lw_item_resb TO lt_item_resb.
CLEAR lw_item_resb.
ENDIF.
ENDLOOP.
"通过扩展字段值更改标准字段
LOOP AT resb ASSIGNING FIELD-SYMBOL(<fs_resb>).
lw_item_resb-rspos = sy-tabix.
READ TABLE lt_item_resb INTO lw_item_resb WITH KEY rspos = lw_item_resb-rspos.
<fs_resb>-kdauf = lw_item_resb-kdauf.
<fs_resb>-kdpos = lw_item_resb-kdpos.
<fs_resb>-pspel = lw_item_resb-pspel.
<fs_resb>-sobkz = lw_item_resb-sobkz.
IF lw_item_resb-sobkz IS NOT INITIAL.
<fs_resb>-KZBWS = 'M'."特定库存的评估-带参照销售凭证/项目的单独评估
ENDIF.
IF lw_item_resb-sobkz = 'E'.
<fs_resb>-KNTTP = 'M'.
ELSEIF lw_item_resb-sobkz = 'Q'.
<fs_resb>-KNTTP = 'Q'.
ENDIF.
CLEAR lw_item_resb.
ENDLOOP.
Reservation BAPI: BAPI_RESERVATION_CREATE1
DATA:reservationheader TYPE bapi2093_res_head,
reservationitems TYPE TABLE OF bapi2093_res_item WITH HEADER LINE,
profitabilitysegment TYPE TABLE OF bapi_profitability_segment WITH HEADER LINE,
return TYPE TABLE OF bapiret2 WITH HEADER LINE,
reservation TYPE bapi2093_res_key-reserv_no,
extensionin TYPE TABLE OF bapiparex WITH HEADER LINE.
DATA:lw_item_resb TYPE zresb_item.
"抬头数据
reservationheader-res_date = sy-datum."需求日期
reservationheader-move_type = '311'.
reservationheader-orderid = '000001001408'.
reservationheader-move_plant = '6102'."接收工厂
reservationheader-move_stloc = '4001'."接收库位
"行项目数据
"第一行
reservationitems-material = 'A803YX1000035H'.
reservationitems-plant = '6102'."发出工厂
reservationitems-entry_qnt = '1'.
reservationitems-movement = 'X'.
reservationitems-item_text = '备注'.
APPEND reservationitems.
CLEAR reservationitems.
"第二行
reservationitems-material = 'A803YX1000035H'.
reservationitems-plant = '6102'."工厂
reservationitems-entry_qnt = '1'.
reservationitems-movement = 'X'.
reservationitems-item_text = '备注'.
APPEND reservationitems.
CLEAR reservationitems.
"第三行
reservationitems-material = 'A803YX1000035H'.
reservationitems-plant = '6102'."工厂
reservationitems-entry_qnt = '1'.
reservationitems-movement = 'X'.
reservationitems-item_text = '备注'.
APPEND reservationitems.
CLEAR reservationitems.
"第4行
reservationitems-material = 'A803YX1000035H'.
reservationitems-plant = '6102'."发出工厂
reservationitems-entry_qnt = '1'.
reservationitems-movement = 'X'.
reservationitems-item_text = '备注'.
APPEND reservationitems.
CLEAR reservationitems.
"增强数据
LOOP AT reservationitems.
DATA(lv_count) = sy-tabix.
extensionin-structure = 'ZRESB_ITEM'.
lw_item_resb-rspos = lv_count.
IF lv_count = 1."销售订单库存
lw_item_resb-kdauf = '0000004244'.
lw_item_resb-kdpos = '000020'.
lw_item_resb-sobkz = 'E'.
ELSEIF lv_count = 2."通用库存
ELSEIF lv_count = 3."项目库存
lw_item_resb-pspel = '00000581'.
lw_item_resb-sobkz = 'Q'.
ELSEIF lv_count = 4."项目库存
lw_item_resb-kdauf = '0000004244'.
lw_item_resb-kdpos = '000010'.
lw_item_resb-sobkz = 'E'.
ENDIF.
extensionin-valuepart1 = lw_item_resb.
APPEND extensionin.
CLEAR: reservationitems,extensionin,lw_item_resb.
ENDLOOP.
CLEAR reservation.
CALL FUNCTION 'BAPI_RESERVATION_CREATE1'
EXPORTING
reservationheader = reservationheader
* TESTRUN =
* ATPCHECK =
* CALCHECK =
* RESERVATION_EXTERNAL =
IMPORTING
reservation = reservation
TABLES
reservationitems = reservationitems
profitabilitysegment = profitabilitysegment
return = return
extensionin = extensionin.
IF reservation IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
MESSAGE reservation TYPE 'I'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
BREAK-POINT.
ENDIF.
After this step, the effect of reservation and front-end creation is the same.
Although it is done, when MB23 is displayed, the sales order cannot be displayed. Therefore, if the effect is better, the access logic of the block screen before display must be enhanced. . . . .