BAPI_GOODSMVT_CREATE for MB1C
Hi all,
i need the sample code for the BAPI_GOODSMVT_CREATE for Goods Receipts.
Document Date,
Posting Date,
Movement Type
Plant
Storage Location
GL Account
Material and
Quantity.
regards
Shareef
Please search the forum or do a where used list for "sample code".
Post locked.
Rob
Similar Messages
-
BAPI_GOODSMVT_CREATE for GRN posting
Hi Experts,
I am using BAPI_GOODSMVT_CREATE for posting GRN against Purchase Order.
I want to post Quantity in Delivery note(LSMNG) and Unit of Measure From Delivery Note(LSMEH) also.
I used itab-QUANTITY = '1'.
itab-BASE_UOM = 'L'.
but it is not getting updated properly.
I am getting document number and GRN has been done against Purchase Order using this BAPI.All other fields are properly getting updated except these 2 fields Qty in delivery note and unit of delivery note. Can i pass these 2 field values using this BAPI or do I need to use any other BAPI. Is there any BAPI for MIGO instead of MB01?
Can any one help me to pass these values through BAPI
Regards,
SamHi,
you can update LSMNG quantity using EXTENSIONIN structures of BAPI_GOODSMVT_CREATE.
The steps are the following:
Add LSMNG field in BAPI_TE_XMSEG structure create an appending structure (char field)
By SE19 transaction create the Enhancement Spot starting from MB_GOODSMOVEMENT
Define the Badi Implementation choosing MB_BAPI_GOODSMVT_CREATE Badi Definition implementing a new customer class.
Remember to choose to copy the class with the source code of methods.
In The method IF_EX_MB_Hi, you can update LSMNG quantity using EXTENSIONIN structures of BAPI_GOODSMVT_CREATE. The steps are the following: Add LSMNG field in BAPI_TE_XMSEG structure create an appending structure (char field) By SE19 transaction create the Enhancement Spot starting from MB_GOODSMOVEMENT Define the Badi Implementation choosing MB_BAPI_GOODSMVT_CREATE Badi Definition implementing a new customer class.
Remember to choose to copy the class with the source code of methods.
In the method IF_EX_MB_BAPI_GOODSMVT_CREATE~EXTENSIONIN_TO_MATDOC you will find the following source code:
DATA: c_lenstruc TYPE i VALUE 30,
wa_bapi_mb_header TYPE bapi_te_xmkpf,
wa_bapi_mb_item TYPE bapi_te_xmseg,
wa_extension_in TYPE bapiparex.
FIELD-SYMBOLS: TYPE imseg.
CHECK NOT extension_in[] IS INITIAL.
* Analyze IMSEG for document structure and assign LINE_IDs if necessary
CALL METHOD cl_mmim_line_id_manager=>analyze_mb_create
CHANGING ct_imseg = ct_imseg[]
EXCEPTIONS duplicate_line_id = 1
OTHERS = 2.
LOOP AT extension_in INTO wa_extension_in.
CASE wa_extension_in-structure.
* extension of MKPF
WHEN 'BAPI_TE_XMKPF'.
MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_header.
MOVE-CORRESPONDING wa_bapi_mb_header TO cs_imkpf.
* extension of MSEG
WHEN 'BAPI_TE_XMSEG'.
MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_item.
READ TABLE ct_imseg WITH KEY line_id = wa_bapi_mb_item-matdoc_itm ASSIGNING <fs_imseg>.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa_bapi_mb_item TO <fs_imseg>.
ENDIF.
ENDCASE.
ENDLOOP.
Then you have to call BAPI_GOODSMVT_CREATE using extensionin in the following way:
* Fill goodsmvt_header structures
goodsmvt_header-........
* Fill goodsmvt_item-position
Loop at it_position.
goodsmvt_item-..........
wf_line_id = wf_line_id + 1.
goodsmvt_item-line_id = wf_line_id.
APPEND goodsmvt_item.
CLEAR extensionin.
MOVE 'BAPI_TE_XMSEG' TO extensionin-structure.
MOVE wf_line_id+2(4) TO extensionin-valuepart1+14(4).
MOVE LSMNG TO extensionin-valuepart1+18(16).
APPEND extensionin.
endloop.
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = goodsmvt_header
goodsmvt_code = goodsmvt_code
* TESTRUN = ' '
goodsmvt_ref_ewm = goodsmvt_ref_ewm
IMPORTING
* GOODSMVT_HEADRET =
materialdocument = materialdocument
matdocumentyear = matdocumentyear
TABLES
goodsmvt_item = goodsmvt_item
* GOODSMVT_SERIALNUMBER =
return = return
extensionin = extensionin.
Hope it helps
Lorenzo -
BAPI_GOODSMVT_CREATE for GRN against GI material document in STO
Dear experts,
Please advice me how to use BAPI_GOODSMVT_CREATE for goods receipt against GI material document (351) in the case of UB stock transport order.
My requirement is to get the 101 document no. range in 49 series.
When i use GM code 01 then PO is must.
Please advise me which GM code/ Mov indicatot/ reference fields touse.
Or else to use any other BAPI.
sapmmlearnerplease share ur thoughts....
-
How to use the BAPI_GOODSMVT_CREATE for Transfer posting Sales order
Hi Friends,
How to use the Bapi BAPI_GOODSMVT_CREATE for transfer posting sales order to sales order.
pls, send the list of parameteres to pass to the bapi, if program avail please send it to me.
Thanks in advance
ShankarYou have to pass Header and GM code as the INput parameters for uing this BAPI....GM code would be structure.
Also you have to pass the INternal table Item for the goods mvt cxreate which will contains
BATCH.
MOVE_TYPE.
ENTRY_QNT.
MOVE_PLANT.
MOVE_STLOC.
MOVE_BATCH.
MOVE_REAS
these parameters.
Regards,
Sushil. -
BAPI_GOODSMVT_CREATE for production order,not update database
hi guru,
i am using BAPI_GOODSMVT_CREATE for production order.When i m testing this BAPI
at se37 it creates one mat doc no and i m not getting any return messages.Now i m
writing code for it at se38. but it does not update the database even though i used
bapi_transaction_commit. here sy-subrc = 0.bt when i m checking MSEG table showing
that mat doc no does not exists.
please help me out asap.
thanks and regurds,
manasiCHECK THIS CODE
REPORT ZBAPI_GOODSMVT_CREATE.
*DECLARING INTERNAL TABLE TO HOLD FILE DATA.
DATA: BEGIN OF itab OCCURS 0,
text(200),
END OF itab.
*DECLARING INTERNAL TABLE TO PASS FILE DATA.
TYPES: BEGIN OF tw_goodsmvt,
pstng_date TYPE budat,
doc_date TYPE bldat,
material TYPE matnr,
plant TYPE werks_d,
stge_loc TYPE lgort_d,
move_type TYPE bwart,
* entry_qnt TYPE erfmg,
costcenter TYPE kostl,
END OF tw_goodsmvt,
tt_goodsmvt TYPE STANDARD TABLE OF tw_goodsmvt.
DATA: lt_goodsmvt TYPE tt_goodsmvt,
lw_goodsmvt TYPE tw_goodsmvt.
*declaring internal table of bapi structure.
DATA:s_goodsmvt_header LIKE bapi2017_gm_head_01,
lt_goodsmvt_item TYPE STANDARD TABLE OF bapi2017_gm_item_create WITH HEADER LINE,
lt_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
DATA:str_filename TYPE string,
gm_code TYPE gm_code,
v_head_count TYPE i VALUE 0,
v_prev_count TYPE i VALUE 1,
v_qnt TYPE string,
v_dummy.
*selection screen
SELECTION-SCREEN BEGIN OF BLOCK bk with frame title text_001.
PARAMETERS:p_docdat TYPE bldat,
p_pstdat TYPE budat,
fname LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK bk.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR fname.
*to provide F4 functionality.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
IMPORTING
file_name = fname.
* start of selection
START-OF-SELECTION.
str_filename = fname.
gm_code = '06'.
* to upload data
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = str_filename
filetype = 'ASC'
has_field_separator = 'X'
read_by_line = 'X'
TABLES
data_tab = itab.
*SPLITING DATA TO INTERNAL TABLES.
LOOP AT itab.
IF itab+0(1) EQ 'H'.
v_head_count = v_head_count + 1.
IF v_head_count GT v_prev_count.
PERFORM bapi_upload.
ENDIF.
SPLIT itab-text AT ',' INTO v_dummy
lw_goodsmvt-pstng_date
lw_goodsmvt-doc_date.
s_goodsmvt_header-doc_date = lw_goodsmvt-doc_date.
s_goodsmvt_header-pstng_date = lw_goodsmvt-pstng_date.
v_prev_count = v_head_count.
ELSEIF itab+0(1) EQ 'L'.
SPLIT itab-text AT ',' INTO v_dummy
lw_goodsmvt-material
lw_goodsmvt-plant
lw_goodsmvt-stge_loc
lw_goodsmvt-move_type
v_qnt
lw_goodsmvt-costcenter.
* PASSING DATA TO INTERNAL TABLE TYPE BAPI STRUCTURE.
lt_goodsmvt_item-material = lw_goodsmvt-material.
lt_goodsmvt_item-plant = lw_goodsmvt-plant.
lt_goodsmvt_item-stge_loc = lw_goodsmvt-stge_loc.
lt_goodsmvt_item-move_type = lw_goodsmvt-move_type.
lt_goodsmvt_item-entry_qnt = v_qnt.
lt_goodsmvt_item-costcenter = lw_goodsmvt-costcenter.
APPEND lt_goodsmvt_item.
ENDIF.
v_prev_count = v_head_count.
ENDLOOP.
PERFORM bapi_upload.
*& Form bapi_upload
form bapi_upload .
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = s_goodsmvt_header
goodsmvt_code = gm_code
* TESTRUN = ' '
* IMPORTING
* GOODSMVT_HEADRET =
* MATERIALDOCUMENT =
* MATDOCUMENTYEAR =
tables
goodsmvt_item = lt_goodsmvt_item
* GOODSMVT_SERIALNUMBER =
return = lt_return.
PERFORM commit_work TABLES lt_return.
CLEAR : lw_goodsmvt, s_goodsmvt_header.
REFRESH: lt_goodsmvt[], lt_goodsmvt_item[].
endform. " bapi_upload
*& Form commit_work
* text
* -->P_LT_RETURN text
form commit_work tables p_lt_return structure bapiret2.
IF NOT lt_return[] IS INITIAL.
*error handling
loop at lt_return.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = lt_return-id
LANG = sy-langu
NO = lt_return-NUMBER
V1 = lt_return-message_v1
V2 = lt_return-message_v2
V3 = lt_return-message_v3
V4 = lt_return-message_v4
IMPORTING
MSG = lt_return-MESSAGE
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
WRITE: lt_return-id, lt_return-message, lt_return-message_v1, lt_return-message_v2,
lt_return-message_v3, lt_return-message_v4.
CLEAR lt_return.
ENDLOOP.
ELSE.
* commit work
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
IMPORTING
RETURN = lt_return.
WRITE: lt_return-id, lt_return-message, lt_return-message_v1, lt_return-message_v2,
lt_return-message_v3, lt_return-message_v4.
CLEAR lt_return.
endif.
endform. " commit_work -
How to populate cusotom fields using BAPI_GOODSMVT_CREATE for MIGO
Hi,
I was to update custom field using BAPI_GOODSMVT_CREATE for MIGO and store it is MSEG table.
Please tell me how to proceed.
Moderator message: last warning, if you continue to post the same thread again, I will submit your user ID for deletion. See my comments in your previous posts.
Edited by: Thomas Zloch on Jul 14, 2011 4:38 PMHi ANID,
Thanks for the reply.
I have checked in the documention of the bapi and no communication structure regarding to the bapi is there so i am not able to figure out where to add the custom field so that it can be added in the MKPF table.
Regads
Dipak -
BAPI_GOODSMVT_CREATE for Outbound delivery
Hi Gurus,
I am using BAPI_GOODSMVT_CREATE for creation of GRN against a Outbound delivery
I am able to create the same using MIGO,but not with the help of this bapi
i have passed GM_CODE as 01 and MVT_IND as L
and all relevant datas but it throws an error
E M7 226 Update control of movement type is incorrect (entry 101 X X _ L)
What shall i do??
Can any one help me?Hi,
Leave MVT_IND as blank.
And be sure to provide delivery number and item and other shipping details.
Leave rest part as it is.
Regards,
Sunny -
In BDC Page down command is not working for MB1C T. Code
Dear Experts,
I am writing BDC for MB1C, in this to enter serial number for material, when exceeds the limit, the page down command not woking.
i wrote the below
IF sn_count = 20.
PERFORM bdc_dynpro USING 'SAPLIPW1' '0200'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RIPW0-SERNR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=RWS'.
sn_count = 2.
ENDIF.
in my recording i got below
perform bdc_dynpro using 'SAPLIPW1' '0200'.
perform bdc_field using 'BDC_CURSOR'
'RIPW0-SERNR(07)'.
perform bdc_field using 'BDC_OKCODE'
'=RWS'.
please help me.sorry I missed this part with the serial numbers, I thought you were in the item overview.
-
Screen Exit for MB1C transaction with program :SAPMM07M and screen 410
I am working on a requirement which is to enhance the Functionality of transaction, MB1C. In Mb1c item details screen I want to add some additional text line (about 7 to 8) for client Materials. The requirement is to add details of drawings which we have to enter at the time of GR. One item text field is available but that is not enough. As the drawing specs, spool no, ... etc., have to be entered. My question is there any screen exit for MB1c Transaction?. If not how to proceed?. Could someone answer my query. I am working on ECC 6.0.
Thanks & Regds
Ariffu MohammedPlease explore the following exit and there documentation , inorder to
fulfill the requirement
MB1C SAPMM07M MBCF0002 E EXIT_SAPMM07M_001
MBCF0006 E EXIT_SAPMM07M_005
MBCF0009 E EXIT_SAPMM07M_009
MBCFC003 E EXIT_SAPMM07M_003
MBCFC004 E EXIT_SAPMM07M_004
MBCFC010 E EXIT_SAPMM07M_010
SAPMM07M MBCF0002 E EXIT_SAPMM07M_001
MBCF0006 E EXIT_SAPMM07M_005
MBCF0009 E EXIT_SAPMM07M_009
MBCFC003 E EXIT_SAPMM07M_003
MBCFC004 E EXIT_SAPMM07M_004
MBCFC010 E EXIT_SAPMM07M_010 -
BAPI BAPI_GOODSMVT_CREATE for Transaction MB01
Hi All,
I am using BAPI BAPI_GOODSMVT_CREATE for transaction MB01.
I have one problem while passing the value in BAPI.
Goods receipts for Schedule Agreements are not allow for delivery schedule lines with delivery date in the future.
Manual turn around for transaction MB01 is to check field "Suggest Zero Lines" from main selection screen:
I am not able to get the field name in BAPI for filling the value for check field "Suggest Zero Lines".
Kindly help me to find out the field name.
Thanks in advance.
Piyush Mathurdata flag(1) value 'X'.
set parameter ID 'NUL' field flag.
u can set the parameter 'Suggest zero lines' as 'X' by default and then call ur bapi..see if tht field is X now or not?
otherwise it can be possible tht u r not using the correct BAPI
amit -
BAPI_GOODSMVT_CREATE for movement 971 (TCode MB1B)
Dear all,
I try to use the BAPI_GOODSMVT_CREATE to create a good movement 971 but nothing seems to be created..
Below the parameters used :
Header
wa_goodsmvt_header-doc_date = sy-datum.
wa_goodsmvt_header-pstng_date = sy-datum.
wa_goodsmvt_header-pr_uname = sy-uname.
Code Movement
wa_goodsmvt_code-gm_code = '04'.
Items
wa_goodsmvt_item-material = . "Material
wa_goodsmvt_item-plant = . "Plant
wa_goodsmvt_item-stge_loc = . "Sotrage Location
wa_goodsmvt_item-entry_qnt = . "Quantity
wa_goodsmvt_item-entry_uom = . "Unity
wa_goodsmvt_item-move_type = '971'. "Code movement
wa_goodsmvt_item-move_stloc = . "Receiving Storage Location
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = wa_goodsmvt_header
goodsmvt_code = wa_goodsmvt_code
TABLES
goodsmvt_item = t_goodsmvt_item
return = t_return.
When I use the transaction M1B1 with this parameters, the document is created. Do you know if something missing?
Thank you very much in advance.
Best regards,
RobinFirst read my answers at Re: "BAPI_GOODSMVT_CREATE" for delivery
- Look in table T158B for transaction(s) allowed to movement '971' (is this a customer specific movement type, transaction OMJJ)
- Look in table T158G to find gm_code (MB1B is '04')
I hope you don't forget the COMMIT_WORK/BAPI_TRANSACTION_COMMIT and that you looked in table RETURN for error messages.
Regards,
Raymond -
BAPI_GOODSMVT_CREATE for code 04 and special ind E
Hi Everybody
My requirement is like when we create sales order and put Item category ZXLC local branch transfer and save the sale order..It creates purchase requisation and we pass supply plant there. It shold create document through MB1B. We are using BAPI BAPI_GOODSMVT_CREATE for that but it is not creating document.
We are passing code 04 goods movement code and special indicator E.
My problem is that where I have to call this BAPI. I mean user exit or enhancement and what are the parameter we should pass. Can any body send me the piece of code for that...I m calling this BAPI thru user exit USEREXIT_SAVE_DOCUMENT in the include program MV45AFZZ. I m passing posting date, doc date, user name movement type 412 at header level. I passed GOODSMVT_CODE as '04'.
LT_GOODSMVT_ITEM-material = xvbap-matnr.
LT_GOODSMVT_ITEM-plant = eban-RESWK.
if xvbap-lgort is initial.
LT_GOODSMVT_ITEM-stge_loc = '0001'.
else.
LT_GOODSMVT_ITEM-stge_loc = xvbap-lgort.
endif.
LT_GOODSMVT_ITEM-spec_stock = 'E'.
LT_GOODSMVT_ITEM-SALES_ORD = xvbap-vbeln.
LT_GOODSMVT_ITEM-S_ORD_ITEM = xvbap-POSNR.
LT_GOODSMVT_ITEM-VAL_SALES_ORD = xvbap-vbeln.
LT_GOODSMVT_ITEM-VAL_S_ORD_ITEM = xvbap-POSNR.
*quantity
LT_GOODSMVT_ITEM-entry_qnt = xvbap-KWMENG.
LT_GOODSMVT_ITEM-entry_uom = xvbap-meins.
AT ITEM LEVEL.
Is this the right place for calling this BAPI and for code 04 and special ind E r these the sufficient parameters. It shows error msg
pass the sales order number whereas I m passing the sales order no. correctly even I tested this with existing sales order in debug mode.. -
BAPI_GOODSMVT_CREATE For MB1A
Hi ,
I used BAPI_GOODSMVT_CREATE for MB1A. It is working fine.
Doc date & Posting Date format = 20091028.
Can we change it to DDMMYYYY ?
When I run bapi for for this month in back date it is working fine .but in the last month it is not generating material doc no.
Manually If I issue in last month using MB1A, then it is generating mat doc no. but using bapi it is not running for last month .
Plz reply for both the questions.
Thanks in Advance.
Already searched in SDN
SaiHi Sai,
Use following code to convert the date
data : final_date(8) type c,
test(8) type c,
dat(2) type c,
month(2) type c,
year(4) type c.
test = '20091028'.
dat = test+6(2).
month = test+4(2).
year = test+0(4).
concatenate dat month year into final_date.
In this case final_date will contain 28102009. -
BAPI_GOODSMVT_CREATE For MB1B
Hi Friends,
i wrote a program using BAPI_GOODSMVT_CREATE.
for MB1B stock transfer.
Its creating Material Document as well as Accounting document.
we dont want to create accounting document.
can anybody help me how to solve it.
regards,
MalikTry to use the BAPI BAPI_GOODSMVT_CREATE with GOODSMVT_CODE = 04
-
BAPI_GOODSMVT_CREATE for MB01
Hi,
i´m using
BAPI_GOODSMVT_CREATE for MB01.
The message i´m getting is as follows:
message type = 'E'
message ID = 'LB'
message num. = '031'
message text = 'of the required quantity of material
013F1RE1101PB000, 3,000 HOJ remain(s) open'.
What does this message mean?.Best regardsTry setting the 'Delivery completed indicator', if that is applicable in this situation. I think the system thinks that there is some residual amount left to be received and may be your config requires it to be received in total before issuing it.
Did you check if the unit of issue(in sales view, sales unit) and the unit of receipt(in purchasing view) are the same for this material?
Also, some of these messages are configurable, in the sense that a configuration person can set this message to be a warning or information message, instead of an error message. System will issue the message accordingly, instead of the error message that you are getting now.
Regards,
Srinivas
Maybe you are looking for
-
I am looking for an app for my aunt that had a stroke that she can type in and it speaks to us. Do not need internet. Thanks.
-
Shuffle not working on either mac or windows?
I've been trying forever to get my 1GB shuffle to work on my home PC. Re-installed and everything as per the instructions on the website, even tried to format the drive. Each time an application such as Itunes or windows explorer trys to access the s
-
I connect the MagSafe to my Macbook but Macbook cann't detected the Magsaf
I read about this problem in this web could be solved by reset power by remove battery but in my macbook model battery it can not remove by myself because it have warranty sticker. I want to know Do you have other way to reset power manager
-
Itunes acted up led to clearing of my whole library
so i was downloading cds a friend lent me was looking up names and artist of songs computer froze so i turned it off and restarted it i tunes got cleared anyway i can get back my library without having to download every cd i own over again
-
Help, ibook not booting after installing update 10.4.8 combo
Hi there, i just updated my ibook 500 dual usb, with 10.4.8 combo and when i restarted the screen was gray with a flashing question mark. I tried to boot in every mode (with x, with startup manager) and also i checked with disk warrior and disk utili