2007 Jun 19 9:25 AM
Hi,
I have to create a goods movement with movement type 343 and 344.
While using the transaction MB1B (Tranfer Posting), I give the following parameters.
Header
1. Document Date 2. Posting Date
Item
1. Movement Type 2. Plant 3. Storage Location
4. Material 5. Quantity
But while using the BAPI for creating the goods movement, it creates material document. But I am neither able to view the document nor see any change in the good movement of the material. The quantity remains same in transaction MMBE.
I feel that item details given as input to the BAPI needs changes. Can anyone suggest the fields to which each of the above item details needs to be given.
Thanks.
Regards,
Senthil G.
2007 Jun 19 9:32 AM
Hi,
After using the bapi for creating goods movement.
Commit the bapi by calling BAPI_TRANSACTION_COMMIT.
Thanks,
Deepti
Hi,
I have to create a goods movement with movement type 343 and 344.
While using the transaction MB1B (Tranfer Posting), I give the following parameters.
Header
1. Document Date 2. Posting Date
Item
1. Movement Type 2. Plant 3. Storage Location
4. Material 5. Quantity
But while using the BAPI for creating the goods movement, it creates material document. But I am neither able to view the document nor see any change in the good movement of the material. The quantity remains same in transaction MMBE.
I feel that item details given as input to the BAPI needs changes. Can anyone suggest the fields to which each of the above item details needs to be given.
Thanks.
Regards,
Senthil G.
2007 Jun 19 9:32 AM
Hi,
After using the bapi for creating goods movement.
Commit the bapi by calling BAPI_TRANSACTION_COMMIT.
Thanks,
Deepti
2007 Jun 19 9:32 AM
Hello Senthil,
Check this sample code
REPORT ZRICH_0001 .
* Structures for BAPI
DATA: GM_HEADER TYPE BAPI2017_GM_HEAD_01.
DATA: GM_CODE TYPE BAPI2017_GM_CODE.
DATA: GM_HEADRET TYPE BAPI2017_GM_HEAD_RET.
DATA: GM_ITEM TYPE TABLE OF
BAPI2017_GM_ITEM_CREATE WITH HEADER LINE.
DATA: GM_RETURN TYPE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: GM_RETMTD TYPE BAPI2017_GM_HEAD_RET-MAT_DOC.
CLEAR: GM_RETURN, GM_RETMTD. REFRESH GM_RETURN.
* Setup BAPI header data.
GM_HEADER-PSTNG_DATE = SY-DATUM.
GM_HEADER-DOC_DATE = SY-DATUM.
GM_CODE-GM_CODE = '04'. " MB1A
* Write 971 movement to table
CLEAR GM_ITEM.
MOVE '412' TO GM_ITEM-MOVE_TYPE .
MOVE 'Q' TO GM_ITEM-SPEC_STOCK.
MOVE '3800533484' TO GM_ITEM-MATERIAL.
MOVE '1' TO GM_ITEM-ENTRY_QNT.
*MOVE 'PC' TO GM_ITEM-ENTRY_UOM.
MOVE '1060' TO GM_ITEM-PLANT.
MOVE '0007' TO GM_ITEM-STGE_LOC.
*MOVE '0901' TO GM_ITEM-MOVE_REAS.
MOVE 'P203601001' TO GM_ITEM-WBS_ELEM.
MOVE 'P203601001' TO GM_ITEM-VAL_WBS_ELEM.
APPEND GM_ITEM.
* Call goods movement BAPI
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = GM_HEADER
GOODSMVT_CODE = GM_CODE
IMPORTING
GOODSMVT_HEADRET = GM_HEADRET
MATERIALDOCUMENT = GM_RETMTD
TABLES
GOODSMVT_ITEM = GM_ITEM
RETURN = GM_RETURN.
IF NOT GM_RETMTD IS INITIAL.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'.
ELSE.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'.
ENDIF.
WRITE:/ GM_RETMTD.
LOOP AT GM_RETURN.
WRITE:/ GM_RETURN.
ENDLOOP.
" Also after iu call the BAPI use the FM BAPI_TRANSACTION_COMMIT
If useful reward.
Vasanth
2007 Jun 19 9:32 AM
Hi,
Check the table MSEG to view the material Number which created from the Function module
Regards
Sudheer
2007 Jun 19 9:51 AM
Hi all,
Thanks for the prompt reply.
But still the issue is not solved. I used BAPI_TRANSACTION_COMMIT. I dont find the Material document number in the MSEG table. Rather the next material document created skips this number.
The Mat Doc created by BAPI is 4900002537. I find the numbers 4900002536 and 4900002538.
Any suggestions.
For your information, I am checking the BAPI for creation of Goods movement using transaction SE37.
Regards,
Senthil G.
2007 Jun 19 9:55 AM
If you are doing it from SE37
follow the steps.
go to SE37, and press SHIFT + F8
give the FM Name : BAPI_GOODSMVT_CREATE
next give the : BAPI_TRANSACTION_COMMIT
and then execute
but if u write a program make sure u also give the wait upto X seconds along with both the BAPI's
Hope this helps,reward all useful answers
Regards
Gopi
2007 Jun 19 11:09 AM
Hi Gopi,
Shift + F8 doesnot perform any action rather it displays a message "No operation found for the function code NTES".
Regards,
Senthil G.
2007 Jun 19 10:03 AM
Hi,
hi ,
DATA : V_HEADER_TXT LIKE X_GOODS_MVT_HEAD-HEADER_TXT.
DATA : X_GOODS_MVT_HEAD LIKE BAPI2017_GM_HEAD_01,
X_GOODS_MVT_CODE LIKE BAPI2017_GM_CODE,
IT_GOODS_MVT_ITEM LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER LINE,
IT_RETURN LIKE BAPIRET2 OCCURS 0
WITH HEADER LINE.
X_GOODS_MVT_HEAD-PSTNG_DATE = SY-DATUM.
X_GOODS_MVT_HEAD-DOC_DATE = SY-DATUM.
X_GOODS_MVT_HEAD-HEADER_TXT = V_HEADER_TXT.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = X_GOODS_MVT_HEAD
GOODSMVT_CODE = X_GOODS_MVT_CODE
IMPORTING
MATERIALDOCUMENT = P_MATDOC
TABLES
GOODSMVT_ITEM = IT_GOODS_MVT_ITEM
RETURN = IT_RETURN.
u need to call this fm if the above is successful
IF NOT P_MATDOC IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
V_BAPI_NO_ERR = 'X'.
ENDIF.
Please check this links for sample code.
http://www.sap-img.com/abap/bapi-goodsmvt-create-to-post-goods-movement.htm
http://www.4ap.de/abap/bapi_goodsmvt_create.php
<b>Reward points</b>
Regards
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |