最近比较忙,此方案出后测试了很多种情况都存在问题,只能留待以后处理了......
1.进入SE11键入LIPS表,点击APPEND STRUCTURE创建结构ZPIKMG,在结构中添加字段ZZPIKMG,如下图;
2.进入SE38键入MV50AFZ1,找到 USEREXIT_MOVE_FIELD_TO_LIPS 这个FORM,写入程序,代码如下:
IF SY-TCODE = 'VL01N' OR SY-TCODE = 'VL01'.
BREAK GWANG.
DATA:lt_xlips LIKE XLIPS OCCURS 0 WITH HEADER LINE.
lo_lips-pikmg = LIPSD-PIKMG.
*--LIPS-ZZHIDE_QTY IS THE ACTUAL FIELD TO STORE THE HIDE QTY
lips-ZZPIKMG = LIPSD-PIKMG.
*--modify record back in xlips
lt_xlips[] = xlips[].
READ TABLE lt_xlips WITH KEY vbeln = lips-vbeln
posnr = lips-posnr.
IF sy-subrc EQ 0.
lt_xlips-pikmg = XLIPS-pikmg.
lt_xlips-ZZpikmg = LIPSD-PIKMG.
MODIFY lt_xlips INDEX SY-TABIX.
MODIFY xlips FROM lt_xlips INDEX sy-tabix TRANSPORTING PIKMG ZZpikmg."
ENDIF.
ELSE.
DATA:E_PIKMG TYPE PIKMG.
CLEAR E_PIKMG.
CALL FUNCTION 'WB2_GET_PICK_QUANTITY'
EXPORTING
i_vbeln = LIKP-VBELN
i_posnr = LIPS-POSNR
* I_MODE = ' '
IMPORTING
E_PIKMG = E_PIKMG
EXCEPTIONS
DOCUMENT_READ_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* DATA:lt_xlips LIKE XLIPS OCCURS 0 WITH HEADER LINE.
lo_lips-pikmg = E_PIKMG.
*--LIPS-ZZHIDE_QTY IS THE ACTUAL FIELD TO STORE THE HIDE QTY
lips-ZZPIKMG = E_PIKMG.
*--modify record back in xlips
lt_xlips[] = xlips[].
READ TABLE lt_xlips WITH KEY vbeln = lips-vbeln
posnr = lips-posnr.
IF sy-subrc EQ 0.
* lt_xlips-pikmg = XLIPS-pikmg.
lt_xlips-ZZpikmg = E_PIKMG.
MODIFY lt_xlips INDEX SY-TABIX.
MODIFY xlips FROM lt_xlips INDEX sy-tabix TRANSPORTING ZZpikmg."
ENDIF.
ENDIF.
这个FORM貌似在修改交货单数量回车后触发,因此创建交货单时出现问题,需要对交货单交货数量 按行项目顺序做修改才能得到正确结果,其他情况将无法得到LIPSD-PIKMG这个屏幕字段的值,如哪位兄弟有更好的方法,望赐教,谢谢!
阅读(1949) | 评论(0) | 转发(0) |