BAPI to update batch characteristics
Hi,
We have a requirement to update batch characteristics in SAP. I used the VB_BATCH_CHANGE to update the batch characteristics. Below is my code. After the call, I don't get any error from this BAPI/RFC, but batch chararacteristcis values are not updated. Any ideas?
FUNCTION Z_VB_CHANGE_BATCH.
*"*"Global Interface:
*" IMPORTING
*" VALUE(YMCHA) LIKE MCHA STRUCTURE MCHA
*" VALUE(YUPDMCHA) LIKE UPDMCHA STRUCTURE UPDMCHA OPTIONAL
*" VALUE(CHANGE_LGORT) LIKE MCHB-LGORT OPTIONAL
*" VALUE(BYPASS_LOCK) LIKE AM07M-XSELK DEFAULT SPACE
*" VALUE(BYPASS_POST) LIKE AM07M-XSELK DEFAULT SPACE
*" VALUE(X_BNCOM) LIKE BNCOM STRUCTURE BNCOM OPTIONAL
*" VALUE(KZCLA) LIKE T156-KZCLA OPTIONAL
*" VALUE(XKCFC) LIKE T156-XKCFC OPTIONAL
*" VALUE(CLASS) LIKE KLAH-CLASS OPTIONAL
*" VALUE(NO_CHECK_OF_QM_CHAR) LIKE AM07M-XSELK DEFAULT SPACE
*" VALUE(REF_MATNR) LIKE MCHA-MATNR OPTIONAL
*" VALUE(REF_CHARG) LIKE MCHA-CHARG OPTIONAL
*" VALUE(REF_WERKS) LIKE MCHA-WERKS OPTIONAL
*" VALUE(SET_OLD_BATCH) LIKE AM07M-XSELK DEFAULT 'X'
*" VALUE(BUFFER_REFRESH) LIKE AM07M-XSELK OPTIONAL
*" VALUE(NO_CHANGE_DOCUMENT) LIKE AM07M-XSELK DEFAULT SPACE
*" VALUE(GRUND) LIKE MSEG-GRUND DEFAULT SPACE
*" VALUE(NO_CFC_CALLS) LIKE AM07M-XSELK DEFAULT SPACE
*" VALUE(BATCH_DEL_FLAGS) LIKE BATCHDELFLG STRUCTURE BATCHDELFLG
*" DEFAULT SPACE
*" VALUE(SEND_SYS) TYPE LOGSYS DEFAULT SPACE
*" EXPORTING
*" VALUE(YMCHA) LIKE MCHA STRUCTURE MCHA
*" VALUE(EMKPF) LIKE EMKPF STRUCTURE EMKPF
*" TABLES
*" CHAR_OF_BATCH STRUCTURE CLBATCH OPTIONAL
*" CHANGED_BATCH STRUCTURE MCHA OPTIONAL
*" ZIMSEG STRUCTURE IMSEG OPTIONAL
*" RETURN STRUCTURE BAPIRET2 OPTIONAL
*" EXCEPTIONS
*" NO_MATERIAL
*" NO_BATCH
*" NO_PLANT
*" MATERIAL_NOT_FOUND
*" PLANT_NOT_FOUND
*" LOCK_ON_MATERIAL
*" LOCK_ON_PLANT
*" LOCK_ON_BATCH
*" LOCK_SYSTEM_ERROR
*" NO_AUTHORITY
*" BATCH_NOT_EXIST
*" NO_CLASS
*" ERROR_IN_CLASSIFICATION
*" ERROR_IN_VALUATION_CHANGE
DATA: F_TRANSACTION_ID LIKE ARFCTID.
CALL FUNCTION 'TRANSACTION_BEGIN'
IMPORTING
TRANSACTION_ID = F_TRANSACTION_ID.
CALL FUNCTION 'VB_CHANGE_BATCH'
EXPORTING
YMCHA = YMCHA
YUPDMCHA = YUPDMCHA
CHANGE_LGORT = CHANGE_LGORT
BYPASS_LOCK = BYPASS_LOCK
BYPASS_POST = BYPASS_POST
X_BNCOM = X_BNCOM
KZCLA = KZCLA
XKCFC = XKCFC
CLASS = CLASS
NO_CHECK_OF_QM_CHAR = NO_CHECK_OF_QM_CHAR
REF_MATNR = REF_MATNR
REF_CHARG = REF_CHARG
REF_WERKS = REF_WERKS
SET_OLD_BATCH = SET_OLD_BATCH
BUFFER_REFRESH = BUFFER_REFRESH
NO_CHANGE_DOCUMENT = NO_CHANGE_DOCUMENT
GRUND = GRUND
NO_CFC_CALLS = NO_CFC_CALLS
BATCH_DEL_FLAGS = BATCH_DEL_FLAGS
SEND_SYS = SEND_SYS
IMPORTING
YMCHA = YMCHA
EMKPF = EMKPF
TABLES
CHAR_OF_BATCH = CHAR_OF_BATCH
CHANGED_BATCH = CHANGED_BATCH
ZIMSEG = ZIMSEG
EXCEPTIONS
NO_MATERIAL = 1
NO_BATCH = 2
NO_PLANT = 3
MATERIAL_NOT_FOUND = 4
PLANT_NOT_FOUND = 5
LOCK_ON_MATERIAL = 6
LOCK_ON_PLANT = 7
LOCK_ON_BATCH = 8
LOCK_SYSTEM_ERROR = 9
NO_AUTHORITY = 10
BATCH_NOT_EXIST = 11
NO_CLASS = 12
ERROR_IN_CLASSIFICATION = 13
ERROR_IN_VALUATION_CHANGE = 14
OTHERS = 15.
IF SY-SUBRC IS INITIAL.
CALL FUNCTION 'TRANSACTION_END'
EXPORTING
TRANSACTION_ID = F_TRANSACTION_ID
EXCEPTIONS
OTHERS = 1.
ELSE.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = SY-MSGTY
CL = SY-MSGID
NUMBER = SY-MSGNO
PAR1 = SY-MSGV1
PAR2 = SY-MSGV2
PAR3 = SY-MSGV3
PAR4 = SY-MSGV4
IMPORTING
RETURN = RETURN.
APPEND RETURN.
CALL FUNCTION 'TRANSACTION_ABORT'
EXPORTING
TRANSACTION_ID = F_TRANSACTION_ID
EXCEPTIONS
OTHERS = 1.
EXIT.
ENDIF.
ENDFUNCTION.
Thanks,
Sara
Hi Subramani,
Thanks for your response.
BAPI_BATCH_CREATE will not work for us, because we are trying to update batch, not creating new batch.
Also, The function TRANSACTION_END, I am calling in the code is responsible for committing the transaction.
Thanks,
Sara
Similar Messages
-
Updated Batch Characteristics on Order Release is not available in MSC3N
Hi All,
I have maintained the Class (023) and characteristics for Finished Material. When I am releasing the production order, I am assigning the values for batch characteristics (Custom defined characteristic) after that, If I go and see the corresponding batch in display mode (MSC3N) the value for the characteristic is not updated (entered value not available its blank).
u2022 Automatic batch creation for the production order during the order releasing is happening exactly as per the configuration but the entered value for the characteristic is not available for the corresponding batch in change as well as display mode (MSC2N/MSC3N)
Please guide to solve out this issue
Thanks in AdvanceHi Sanil,
Thanks for your speedy reply.
For me characteristics and all available as per the expectations but the updated value for the characteristcs on release is not sticking with the batch.
Please guide me to solve out this issue.
Thanks in Advance -
MBCFC004 problem with updation of batch characteristics
hi,
I am facing a problem in updattion of batch charactristics using exit MBCFC004.. EXIT_SAPMM07M_004
in user exit interface EXIT_SAPMM07M_004 there is one table parameter 'Values' which is used to update batch characteristics.
i am able to add characteristics values but not able to delete or change batch characteristics.
please helpClass type 023 is classified as a type which allows multiple object types.
For this class you may have to use 'BAPI_OBJCL_CHANGE_KEY' (check out its code).
The key relationships for such class types are maintained in table INOB and can be fetched using the BAPI 'BAPI_OBJCL_GET_KEY_OF_OBJECT' .
Hope this helps.
Thanks and Regards,
Srihari -
Batch Characteristics update using MIGO
Hello Gurus - Need your valuable suggestions on the issue below.
I have a requirement to update only certain batch characteristics at the time of goods receipt using MIGO by clicking on the classification view. Users should have access to update only 4 out of 10 characteristics in a batch. I did assign authorization group to the characteristics & made the changes to the roles but i think that there is no auth. check performed for classification during goods receipt. Please let me know the possible options to fulfill this requirement.
Thanks for your time.Thanks for your reply Craig. I did set up the characteristic as 'Entry Required' & changed the config to update only required charac. in foreground. When i posted the GR, system did not give me any pop-up to update the characteristics but i got a warning message saying that the values are missing in classification. So i went to classification view but none of the required characteristics are highlighted. So how will the user know which characteristics are required?
Also to let you know, we are updating certain characteristics in the background using enhancement. Do you think will there be any conflict with this?
Thanks for your help. -
Wiping out Old Batch Characteristics in MSC2N
Hi,
I have a requirement where I have to do a Material-To-Material Transfer (VLMOVE) and update the Batch Characteristics in a Custom Inbound Posting Program. Now, I am able to update the batch Characteristics for the new Material with the Characteristic Values received in the Inbound IDoc.
However, I am unable to wipe out (Clear) all the Old Batch Characteristics for the Old material. Can somebody give me an idea as to how exactly do we go about clearing all the Batch Characteristics for a Material - Batch Number in MSC2N Transaction?
Thanks and Regards,
Venkat.Hi Konduri Venkata,
Did you try below FMs ??
BAPI_BATCH_CHANGE
BAPI_OBJCL_CHANGE
also search for BAPI_BATCH*
u will get other bapis from it...
OR else...
at last u can have one more option is LSMW...
because MSC2N is SAP Njoy Tcode so it wont allow BDC...
Hope it will solve ur problem
Reward points if useful...
Thanks & Regards
ilesh 24x7 -
Modifying batch characteristics value
Dear Experts,
We have created batch characteristics named 'POTENCY','LOD','ASSAY'.
Now the value of POTENCY is calculated based on the formula, that is LOD * ASSAY. There are chances that the value is sometimes calculated more than 100%. Now I want to put a restriction that if the value increases more than 100 than the value of POTENCY should be automatically be 100.
What should I do to resolve this issue.
NOTE - POINTS WILL BE REWARDED.......Hello,
You can write a specific FM called by the configurator (procedure which call a user FM). Input are your LOD andd ASSAY, output is POTENCY. Inside you can write your formula.
Parameters are given by std tables.
This is sample :
FUNCTION zsca_calcul.
*" IMPORTING
*" VALUE(GLOBALS) TYPE CUOV_00
*" TABLES
*" MATCH STRUCTURE CUOV_01
*" QUERY STRUCTURE CUOV_01
*" EXCEPTIONS
*" FAIL
*" INTERNAL_ERROR
DATA : w_met_cmin_r LIKE cuov_01-atflv.
CLEAR : w_matnr_paracheve, w_instance .
BREAK-POINT.
lecture des données en entrée dans la table query
LOOP AT query WHERE atcio = 'I'. "input parameter
vérification type num
IF query-atfor NE 'CHAR'.
MESSAGE ID 'ZSCA_CONFIGURATEUR' TYPE 'W' NUMBER '000' RAISING fail
ENDIF.
CASE query-varnam.
WHEN 'MET_NUMART_MLAZ'. ' my single input characteristic
w_matnr_paracheve = query-atwrt.
PERFORM lire_mara. ' process the input parameter
PERFORM lire_carac.
WHEN OTHERS..
MESSAGE ID 'ZSCA_CONFIGURATEUR' TYPE 'W' NUMBER '000' RAISING fail.
ENDCASE.
ENDLOOP.
update of the output characteristic MET_CODEMAT (it is numeric and contains value 9
READ TABLE query WITH KEY varnam = 'MET_CODEMAT'.
match = query.
match-atfor = 'NUM'.
match-atflv = 9.
APPEND match.
ENDFUNCTION.
Regards. -
Cannot update batch header MIGO GR in MB_DOCUMENT_BADI
I am trying to update next inspection date via MIGO when Goods Receipting a production order which is held in the batch header and in a classification we have set up. I have used function modules to try and perform the update.
I have used both 'VB_UPDATE_BATCH' and QEVA_BATCH_UPDATE both by themselves and in an update task to update field QNDAT. (1st one updating MCHA and MCH1 the second one to update MCHA).
I had the code before in POST_DOCUMENT of BADI MB_MIGO_BADI and this made no difference either. Sometimes it updates if I cancel the material document and redo the goods receipt with the same production number but this is very inconsistent. I need this to be done when I am posting the goods receipt.
Does anyone have any ideas as I am at the end of my tether with this one?
Many thanks
Regards
Larissa Maryniuki did not get total req .
but i came to know that u want to update batch.
rt .use this i did in this.
MB_MIGO_BADI
use this method LINE_MODIFY
where u can modify batch field.
and if u want to modify batch characteristics
use
MBCFC004
in this
EXIT_SAPMM07M_004
if nay clarification plz reply. -
Changing / Updating the Characteristics of Material in Inquiry Document
Hello
My requirement is to update the characteristics of the material of Inquiry line item (VA11/VA12/VA13). I searched the forum but the the only answer i found was using BAPI - BAPI_SALESORDER_CHANGE. But this is not updating the Inquiry Document even after using the BAPI_TRANSACTION_COMMIT.
Please can anyone let me know how I can update the characteristics in the Inquiry Document?check business object 2030 in SWO1
You will find
BAPI_CUSTOMERINQUIRY_CHANGE
BAPI_INQUIRY_CREATEFROMDATA
BAPI_INQUIRY_CREATEFROMDATA2 -
Error in Uploading Initial balance with Batch Characteristics!
Dear Gurus,
I have a material on which batch management and batch specific unit of measure is activated. I want to upload the initial balance thorugh MB1C. I have created a recording of MB1C. when i run the recording with the uplaod file, system opens a Coding block screen and does not open the Batch classification screen and does not take batch characteristics. Initially, in the recording there was no error.
Help me ikn this.
Thanks in advance.hi,
the characteristics screen behaves strangely during a recording. i suggest you create the batch record separately. when you do a recording for this, HIGHLIGHT ALL THE CHARACTERISTICS, click on the magniying glass, and enter the values one by one.
1) upload batch records (LSMW recording - as described above)
2) upload stock balances (LSMW using BAPI)
hope you figure this out. i recently did this in a project successfully.
regards,
marvin -
Production order, change/update batch
Hello,
I need to change the batch of a produciton order.
Is there a BAPI that can do the job?Hi,
try this way..
CALL FUNCTION BAPI_PRODORD_GET_DETAIL'
"is used to get the Production order detials later call the below fm to update the batch
w_poitem-po_item = '0001'.
CONCATENATE 'External Services - Batch-' w_e_7b1_view-batch_number INTO w_poitem-short_text. "here Update Batch
w_poitem-quantity = w_menge.
w_poitem-preq_no = w_banfn. "w_child-trans_doc_id .
w_poitem-preq_item = w_bnfpo. "w_child-trans_line_id.
APPEND w_poitem TO t_poitem.
* Do up to X times only when locking error
DO w_i_retry_count TIMES.
REFRESH t_po_return.
CALL FUNCTION BAPI_PRODORD_CHANGE'
EXPORTING
purchaseorder = w_expProductionOrder
TABLES
return = t_return
poitem = t_poitem
poitemx = t_poitemx.
prabhudas -
Update Batch Classification for a Material
Hello friends,
I'm facing the following problem : A specific BTCI wich simulates MB01 was calling another program called SAPLCTMS to update Batch classification for a Material, this program (SAPLCTMS ) seems to be not necessary after the support package Level 57 (we just installed SAP4.6C). I didn't find any note on OSS for this...
Now i'm trying to use this BAPI instead of BTCI for the Material batch classification :
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = l_objnum
objecttable = 'MCH1'
classnum = 'ZGB_TIDCLASS'
classtype = '022'
status = '1'
keydate = sy-datum
TABLES
allocvaluesnumnew = t_valuesnum
allocvaluescharnew = t_valueschar
allocvaluescurrnew = t_valuescurr
return = t_return.
But its not working, it keeps asking for a batch number. I guess i'm not using the right FM ?
Any ideas about this ?
Thank you in advance for your help !
Best Regards.
Edited by: Soufiane FAYSSAL on Jun 18, 2009 11:42 AMHello,
I am Ashok Chelikani. I am working on the same Issue.
i am getting following message:
TYPE ID NUMBER MESSAGE
E |C1 |003 |Characteristic DIMENSIONSCOLOR not found or not valid
I |CL |736 |Assignment was not created
my procedure as follows:
CLEAR: lv_objnum.
lv_objnum = I_MSEG-MATNR.
**Get Object Details
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = lv_objnum
objecttable = 'MARA'
classnum = 'Z_RMBCH1'
classtype = '001'
TABLES
allocvaluesnum = lt_alloc_num
allocvalueschar = lt_alloc_char
allocvaluescurr = lt_alloc_curr
return = lt_return.
IF NOT lt_return IS INITIAL.
CLEAR: lv_objnum.
lv_objnum(18) = I_MSEG-MATNR.
lv_objnum+18(10) = I_MSEG-CHARG.
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = lV_objnum
objecttable = 'MCH1'
classnum = 'Z_RMBCH1'
classtype = '023'
tables
allocvaluesnumnew = lt_alloc_num
allocvaluescharnew = lt_alloc_char
allocvaluescurrnew = lt_alloc_curr
return = lt_return.
lt_return returing error message. Kindly help me. -
Copy manufacturing date to batch characteristics in REM confirmation
Hi to everyone,
I have a situation that when goods receipt occurs with movement 131 in MFBF, manufacturing date is not updated in batch. How can I copy the value as batch characteristics?
please advice,
best regards..Hi,
If you want the value as batch characteristic you need to:
1. Create the characteristic in trn. CT04, with reference to field MCHA-ERSDA (or MCH1-ERSDA if your batch management is cross-plant)
2. Create a class in trn. CL02 and include the characteristic in it.
3. Assign the class to your material in Material Master.
Hope it helps.
Regards,
mr. -
Batch Characteristics copying from material HALB to FERT
Dear Experts ,
I have one typical scenario, in whcich we want copy the batch Characteristics semifinsihed product to finished product.
( these Characteristics recorded by quality dept for semifinshed products and updated in batch)
Please let me know the solutions.
Regards
SandeepHi Sandeep,
This can be achieved by Use of Batch Derivation Functionality.
Go to t.code DVSP and activate Batch Derivation.
Now ,First Create Sander Condition by usng T.code DVS1,
Assign Material type (Halb) and assign required characteristic for which you want to transfer Batch value to Fert Code.
Then create recipient condition by T.code DVR1.
Assign material Type Fert to it and Characteristic which you have assign in T.code DVS1.
This will work during Production Order or Process Order release.
And for this you have do Batch Determination for Halb in Order itself
Regards,
Dhaval -
Material and batch characteristics
Hi All..
For the material and the batch i want to retrieve the material characteristics and the batch characteristics.
Are there any function modules or bapi's available to achieve this..
Appreciate your help and will reward the helpful.Hi
Try BAPI_MATERIAL_GETLIST
BAPI_MATERIAL_GET_DETAIL
reward points if helpful
Regards
Srikanta Gope -
BAPI to update a single characteristic in IE02
Hi,
I am trying to update a single characteristic in IE02.I am able to do that with the BAPI "BAPI_OBJCL_CHANGE",but this BAPI is updating only 1 characteristic and is initializing all the remaining characteristcs.
Any pointers on this is highly appreciable.
NavinHi,
the documentation of the bapi says:
Caution
This BAPI only changes the parameters of an existing assignment (or creates a whole new assignment), but it does not delete the assignment to a class and replace it with an assignment to another class. If you want to reassign an object, the old assignments must be read with BAPI_OBJCL_GETCLASSES and deleted with BAPI_OBJCL_DELETE, then the new assignments must be created with BAPI_OBJCL_CREATE.
The information transferred by this BAPI replaces all old information. An empty field means "delete entry!", not "no change".
This BAPI does not change the database. To change the database, call BAPI BapiService.TransactionCommit afterwards.
You can only use this BAPI for objects that are not classes!
This BAPI only processes assigned values for classification - not for configuration
so i guess you have to pass all information you do not want to lose.
i´ve found this as well:
http://www.sapfans.com/forums/viewtopic.php?t=125320
Best regards.
Edited by: Pablo Casamayor on Jan 2, 2009 7:08 PM
Maybe you are looking for
-
Hello Experts, We have developed 1 SAP transaction (module pool) for our workflow which executes in backend completely workitems are accessed from SAP inbox. This transaction basically has 2 buttons - > approve n reject and 1 text box with rejection
-
We are implementing a classic scenario with direct procurement (PDP) in EBP 5.0 (SRM 4.0) with 4.7 as the backend. The problem is that the POs generated are not changeable in R/3 because the buyer who is responsible for direct materials has been crea
-
RH8 Hyperlink GUI not working on external links
Weird one, only on one of our machines! Clicking OK in the Hyperlink window does nothing if an external project file is selected (fine for an internal file). Entering the link manually is fine (works in Preview and output). However, the problem remai
-
Replace LightRoom's Quick Collection in Aperture 3
I moved over from LR 2.5 to Aperture 3 and would like to find the best way to replace the Quick Collection function in LR. To create a quick collection in LR you would simply hit the b key and any selected photos would automatically show up in a quic
-
Adobe After effect cs5.5 Problem at the start
the picture appear but its freeze on initializing mediacore , Can I Have a answer for this please ? Thanks