2007 Feb 01 12:21 PM
Hi,
,that why iam using MB_CREATE_GOODS_MOVEMENT'
.so,plz tell me which parameters should i pass in to that FM?
Helpful ansews get rewaded
Thanks
Message was edited by:
skk
2007 Feb 01 12:31 PM
See the below sample code:
CALL FUNCTION 'MB_CREATE_GOODS_MOVEMENT'
EXPORTING
imkpf = l_imkpf
xallp = c_kreuz
xallr = c_kreuz
xallb = c_kreuz
ctcod = 'MB01'
IMPORTING
emkpf = l_emkpf
TABLES
emseg = l_emsegtab
imseg = l_imsegtab.
IF l_emkpf-subrc GE 1.
No error if L_emkpf-xbfwms is not initial.
IF NOT l_emkpf-xbfwms IS INITIAL.
ignorate L_emkpf-subrc.
IF l_emkpf-msgno = '514'.
only one delivery was created
MOVE l_emkpf-msgv1 TO g_return_delivery.
MESSAGE s180(qm) WITH g_return_delivery.
ELSEIF l_emkpf-msgno = '515'.
several deliverys have been created
MOVE l_emkpf-msgv2 TO g_return_delivery.
MESSAGE s181(qm) WITH l_emkpf-msgv1 l_emkpf-msgv2 l_emkpf-msgv3.
ENDIF.
2007 Feb 01 12:24 PM
Hi Skk,
Put a breakpoint at the call to the fm MB_CREATE_GOODS_MOVEMENT inside the bapi: BAPI_GOODSMVT_CREATE. Then test the bapi in se37.
It would reach the fm MB_CREATE_GOODS_MOVEMENT, which would let you know what are all the parameters that are needed to be passed.
MOst of the parameters and tables will be the same.
Regards,
Ravi
2007 Feb 01 1:11 PM
Hi ravi,
i have another doubt that if the matrial document is created but goods issue not created then how can get that we get the materil document reversal?is there any function module available for the same?
Thanks
2007 Feb 01 1:27 PM
Hi Skk,
The document that gets created when Goods issue is done, it itself the material document. Its not possible to create a material document without actually doing a Goods Issue.
Can you explain what exactly are you trying to do?
Regards,
Ravi
2007 Feb 01 1:47 PM
Hi Ravi,
here is my reqirement
by the BADI_LE_SHP_GOODSMOVEMENT on the delivery that rebrands subitems into header item and with the header item i will do post goods issue,this needs when item category is ZTAQ.
The sales BOM functionalty needs to generate movement types 309/310 rebrands for the component material and 601 on the header or additized materal.
so,here inside badi iam calling FM MB_CREATE_GOODS_MOVEMENT.Here iam assigning the movement type 309 for header material.
here i am writing the code for the same.plz correct me.I have doubt at appending table <b>lt_imseg.</b> in that table iam getting the valuse that need to pass to MB_CREATE_GOODS_MOVEMENT.
method IF_EX_LE_SHP_GOODSMOVEMENT~CHANGE_INPUT_HEADER_AND_ITEMS .
DATA : ls_EMSEG TYPE EMSEG.
DATA : lt_EMSEG TYPE TABLE OF EMSEG.
DATA : ls_imseg TYPE IMSEG.
DATA : lt_IMSEG TYPE TABLE OF IMSEG.
DATA : ls_lips TYPE LIPS.
data: ls_IMKPF type IMKPF.
data: lt_MSEGO1 type table of MSEGO1.
data: lt_MSEGO2 type table of MSEGO2.
data:ls_MATERIALDOCUMENT type BAPI2017_GM_HEAD_02-MAT_DOC.
data: ls_MATDOCUMENTYEAR type BAPI2017_GM_HEAD_02-DOC_YEAR.
data: lt_return type table of BAPIRET2.
data : ls_EMKPF type EMKPF.
*data: ls_mkpf type table of MKPF.
data:ls_OLD_SUBRC type sy-subrc.
data:ls_PKCOM type PKCOM.
constants: c_bwart type lips-bwart value '309'.
CONSTANTS: X VALUE 'X',
BLANK VALUE ' '.
constants: L_TCODE like SY-TCODE VALUE 'MB11'.
ls_imkpf-budat = sy-datum.
ls_imkpf-BLDAT = IS_LIKP-bldat.
ls_imkpf-USNAM = sy-uname.
loop at it_xlips into ls_lips where OIC_MOT = 'PK'.
if (ls_lips-uepos is initial and ls_lips-pstyv = 'ZTAQ')OR
( not ls_lips-uepos is initial and ls_lipS-pstyv = 'ZTAE').
if ls_lips-uepos is initial and ls_lips-pstyv = 'ZTAQ'.
MOVE ls_lips-MATNR TO ls_imseg-UMMAT.
MOVE ls_lips-WERKS TO ls_imseg-UMWRK.
MOVE ls_lips-LGORT TO ls_imseg-UMLGO.
MOVE c_bwart TO ls_imseg-bwart.
move ls_lips-POSNR to ls_imseg-POSNR.
MOVE LS_LIPS-LFIMG TO LS_IMSEG-MENGE.
ELSE.
IF ls_lips-uepos is not initial and ls_lipS-pstyv = 'ZTAE'.
MOVE ls_lips-MATNR TO ls_imseg-matnr.
MOVE ls_lips-WERKS TO ls_imseg-werks.
MOVE ls_lips-LGORT TO ls_imseg-lgort.
MOVE LS_LIPS-LFIMG TO LS_IMSEG-MENGE.
move ls_lips-POSNR to ls_imseg-POSNR.
move ls_lips-VOLEH to ls_imseg-ERFME.
ENDIF.
ENDIF.
append ls_imseg to lt_imseg.
endloop.
CALL FUNCTION 'MB_CREATE_GOODS_MOVEMENT'
EXPORTING
IMKPF = ls_IMkpf
XALLP = 'X'
XALLB = ' '
XALLR = 'X'
CTCOD = L_TCODE
XQMCL = ' '
OLD_SUBRC = ls_OLD_SUBRC
IPKCOM = ls_PKCOM
XLISU = 'X'
XQMSR = ' '
OI_SHPMT = ' '
OIA_PASS = 'X'
IMPORTING
EMKPF = ls_EMKPF
ES_MKPF = ls_mkpf
TABLES
EMSEG = lt_EMSEG
IMSEG = lt_IMSEG
T_MS1INT = lt_MSEGO1
T_MS2INT = lt_MSEGO2.
IF lt_EMSEG IS NOT INITIAL.
LOOP AT lt_EMSEG into ls_EMSEG.
ls_MATERIALDOCUMENT = ls_EMSEG-MBLNR.
ls_MATDOCUMENTYEAR = ls_EMSEG-MJAHR.
CALL FUNCTION 'BAPI_GOODSMVT_CANCEL'
EXPORTING
MATERIALDOCUMENT = ls_MATERIALDOCUMENT
MATDOCUMENTYEAR = ls_MATDOCUMENTYEAR
TABLES
RETURN = lt_return.
ENDLOOP.
endif.
ENDMETHOD.
Helpful answers get rewared
thanks
2007 Feb 02 7:21 AM
for the above code iam getting the error in display log that<b>"deficit of SL Unrestricted-use for that pariculer quantity for particule material and pariculer plant"</b>
plz tell me why this error is coming how can i overcome this error
plz help me
thanks'
2007 Feb 02 8:04 AM
Skk,
This could be caz the material do not have any unrestricted qty for that plant... you can check this using transaction MMBE... If there is no stock you can create it using MB1C... There is nothing wrong with ur code its the Data problem!!!
2007 Feb 02 9:04 AM
if the maetrial i snot extended to speified plant or stock quantity is less the error message would.
Use the fm after create kindly reward points
CALL FUNCTION 'MB_POST_GOODS_MOVEMENT'
EXPORTING
XBLNR_SD = EMKPF-MBLNR
IMPORTING
EMKPF = EMKPF.
COMMIT WORK AND WAIT.
2007 Feb 02 9:15 AM
where should i pass the FM? Is it before using the function module 'MB_CREATE_GOODS_MOVEMENT' or after using it?
2007 Feb 01 12:31 PM
See the below sample code:
CALL FUNCTION 'MB_CREATE_GOODS_MOVEMENT'
EXPORTING
imkpf = l_imkpf
xallp = c_kreuz
xallr = c_kreuz
xallb = c_kreuz
ctcod = 'MB01'
IMPORTING
emkpf = l_emkpf
TABLES
emseg = l_emsegtab
imseg = l_imsegtab.
IF l_emkpf-subrc GE 1.
No error if L_emkpf-xbfwms is not initial.
IF NOT l_emkpf-xbfwms IS INITIAL.
ignorate L_emkpf-subrc.
IF l_emkpf-msgno = '514'.
only one delivery was created
MOVE l_emkpf-msgv1 TO g_return_delivery.
MESSAGE s180(qm) WITH g_return_delivery.
ELSEIF l_emkpf-msgno = '515'.
several deliverys have been created
MOVE l_emkpf-msgv2 TO g_return_delivery.
MESSAGE s181(qm) WITH l_emkpf-msgv1 l_emkpf-msgv2 l_emkpf-msgv3.
ENDIF.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |