‎2008 Jul 31 5:51 AM
hi,
Iam trying to do post goods issue using bapi_goodsmvt_create. please let me know what are the mandatory fields to be passed?
‎2008 Jul 31 5:56 AM
hi,
&----
*& Report ZRPT_SUB_KO01GOODSMOVEMENT
*&
&----
*&
*&
&----
REPORT ZRPT_SUB_KO01GOODSMOVEMENT.
PARAMETERS : P_BAG(17) TYPE C,
P_ZZORG LIKE zaUFK-ZZORG,
P_MATNR LIKE MARA-MATNR,
P_WERKS LIKE AUFK-WERKS,
P_WERK LIKE AFPO-PWERK,
P_DATE LIKE MKPF-BUDAT,
P_LGORT LIKE GOITEM-LGOBE.
DATA : BDC_DATA TYPE STANDARD TABLE OF BDCDATA. "internla table for bdc data
DATA : WA_BDC_DATA TYPE BDCDATA . "work area for bdc data
DATA : T_XMSEG TYPE MSEG.
DATA : T_XMKPF TYPE MKPF.
DATA : V_BAGS1(17) TYPE C.
DATA : BEGIN OF WA_MB1B,
ZZGCODE TYPE ZMIGO-ZZGCODE,
ZZGBAGS TYPE ZMIGO-ZZGBAGS,
WERKS TYPE AUFK-WERKS,
LGORT TYPE VBRP-LGORT,
ZZORG TYPE zAUFK-ZZORG,
END OF WA_MB1B.
DATA : V_MATERIAL TYPE BAPI2017_GM_HEAD_RET-MAT_DOC.
data : v_date(10) type c.
DATA : T_GOODSMVT_HEADER TYPE BAPI2017_GM_HEAD_01,
T_GOODSMVT_CODE TYPE BAPI2017_GM_CODE,
T_GOODSMVT_ITEM TYPE STANDARD TABLE OF BAPI2017_GM_ITEM_CREATE,
T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA : WA_GOODSMVT_ITEM TYPE BAPI2017_GM_ITEM_CREATE.
DATA : BEGIN OF S_MARA,
MEINS LIKE MARA-MEINS,
END OF S_MARA.
DATA : MATERIALDOCUMENT TYPE BAPI2017_GM_HEAD_RET-MAT_DOC.
*FORM GOODSMOVEMENT TABLES T_RETURN
USING WA_MB1B LIKE WA_MB1B.
SELECT SINGLE MEINS
FROM MARA
INTO S_MARA
WHERE MATNR = P_MATNR.
CONCATENATE p_date6(2) p_date4(2) p_date+0(4) INTO V_DATE SEPARATED BY '.'.
T_GOODSMVT_HEADER-PSTNG_DATE = P_DATE.
T_GOODSMVT_HEADER-DOC_DATE = P_DATE.
T_GOODSMVT_CODE-GM_CODE = '04'.
WA_GOODSMVT_ITEM-MATERIAL = P_MATNR. "'000000000000001556'.
WA_GOODSMVT_ITEM-PLANT = P_WERK. " '1000'.
WA_GOODSMVT_ITEM-STGE_LOC = P_LGORT. " '0001'.
WA_GOODSMVT_ITEM-MOVE_TYPE = 'Z42'.
WA_GOODSMVT_ITEM-VENDOR = P_ZZORG. "'0000100224'.
WA_GOODSMVT_ITEM-ENTRY_QNT = P_BAG. " '1'.
WA_GOODSMVT_ITEM-ENTRY_UOM = S_MARA-MEINS.
WA_GOODSMVT_ITEM-ENTRY_UOM_ISO = S_MARA-MEINS.
WA_GOODSMVT_ITEM-MOVE_PLANT = P_WERKS.
APPEND WA_GOODSMVT_ITEM TO T_GOODSMVT_ITEM.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = T_GOODSMVT_HEADER
GOODSMVT_CODE = T_GOODSMVT_CODE
IMPORTING
MATERIALDOCUMENT = V_MATERIAL
TABLES
GOODSMVT_ITEM = T_GOODSMVT_ITEM
RETURN = T_RETURN.
BREAK shailajaa.
EXPORT t_return to MEMORY ID '123'.
EXPORT V_MATERIAL TO MEMORY ID 'MAT'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = ' '.
*ENDFORM.
‎2008 Jul 31 5:59 AM
Hi Sunil,
Check this link:
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
Regards,
Chandra Sekhar
‎2008 Aug 07 4:39 AM
Hi Sunil,
you can see instructions of this bapi in its document (SE37 --> enter name of the BAPI and press F9).
Here are fields should be provided in order to post Goods Issue
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header =
goodsmvt_code =
IMPORTING
GOODSMVT_HEADRET =
MATERIALDOCUMENT =
MATDOCUMENTYEAR =
tables
goodsmvt_item =
GOODSMVT_SERIALNUMBER =
return =.
1. goodsmvt_header
Posting Date
Document Date
2. goodsmvt_code
GM_Code = 03: Goods issue
3. goodsmvt_item
There are 2 cases.
Goods issue without reference to a reservation
The following fields have to be filled:
- Material number
- Plant
- Storage location
- Movement type
- Movement indicator
- Quantity in unit of entry
- ISO code unit of measurement for unit of entry
The following fields may have to be filled in some cases (incomplete listing):
- Special stock (e.g. sales order, project, vendor etc.)
- Shelf life expiration date (if the system is configured like this)
- Reason for movement (if the system has been configured like this)
- Batch (if the material is handled in batches and automatic batch number assignment is not set)
- Account assignment fields
The following fields can be filled (incomplete listing):
- Special stock indicator
- Item text
- Unloading point
- Goods recipient
The following fields cannot be filled (incomplete listing):
- Reservation
- Receiving/issuing material
- Receiving/issuing plant
- Receiving/issuing storage location
- Receiving/issuing batch
-
Goods issue with reference to a reservation
The following fields have to be filled:
- Reservation number
- Reservation item
- Record type of the reservation
- Movement indicator
- Quantity in unit of entry
- ISO code unit of measurement for unit of entry
The following fields may have to be filled in some cases (incomplete listing):
- Shelf life expiration date (if this has been configured in the system)
- Reason for movement (if this has been configured in the system)
- Batch (if the material is handled in batches and automatic batch number assignment is not set)
- Storage location (if not planned in the reservation)
The following fields can be filled (incomplete listing):
- Special stock indicator
- Item text
- Unloading point
- Goods recipient
The following fields cannot be filled (incomplete listing):
- Movement type
- Material
- Plant
- Account assignment fields
Note: Movement Indicator is not required in case of Goods Issue. You should leave it blank.
Hope it helps
‎2008 Aug 07 5:40 AM
Dear Solaries,
Thats great.This answer is very Helpful to us.
Can you tell me How to find out BAPI ?????
regards
somesh.
‎2008 Aug 07 6:47 AM
Hi Venkat,
What do you mean with finding out BAPI ? Do you need specific BAPIs for some requirements?
Actually, you can consider BAPIs as FMs (the main difference is BAPI is attached with business objects).
To find BAPIs, you can:
1. go to SE37 --> enter BAPI* and press F4 to see more.
2. transaction code: BAPI. Here you can see BAPIs organized by business objects (logistics, material management...)
In case you want to find BAPIs for specific tasks (i.e: post or cancel GI...) you can ask for help in SAP forums (like this one).
Hope it helps