cancel
Showing results for 
Search instead for 
Did you mean: 

BATCH Management

Former Member
0 Kudos

Dear Expert

Am facing issue in batch split qty , the system is picking the decimal quantity, with different batches for e.g If  sales order quantity is 50 , but while creating delivery it is Spliting in two batches like 24.50 and 25.50 for single  line item,  the batch split is happening FMFO basis.

i have assign the Routine 2 in - Batch Search Strategy and No splitting -999.

I have also search on forum but there is not specific answer.  also if the assignment Routine is 3 ( Qty Proposal ) and Display Um - B  in VCH1 then system is not allowing to create delivery if stock available in 2 batches .

Request you to kindly guide me who to restrict the qty split in delivery or while creating the invoice .

Regards

Avinash

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

closing incident.

Former Member
0 Kudos

Hi Avinash,

Batch split happens when sufficient quantity is not in one batch. Kindly check if entire 50 units are available in single batch.

Please change No. splitting to '1' instead of '999' since it is 'number of batch splits allowed', not 'No splitting'.

If your requirement is that you want to pick quantities from one batch which has sufficient quantity, then your need to write a new routine (Qty Proposal).

Kindly clarify if I have not given you required inputs.

Regards

SD

Former Member
0 Kudos

Dear Samier

Thanks for the revert, we have already done the modification in 003 routine  but the still system splitting the qty in decimal. As per FMFO system taking the batches. Also just want to know is it possible to change the sales order qty in delivery automatically Eg ( 1CS to 25 Nos and 25 Nos if different batch)

Also as per your suggestion will check and Modify routine.

Regards

Avinash

Former Member
0 Kudos

Hi Avinash,

Is it possible for you to paste the codes here?

I don't think so that it is feasible to convert the UoM in delivery.

If you don't want decimals, you can define in your codes in Qty proposal routine to consider only integers.

Regards

SD

Lakshmipathi
Active Contributor
0 Kudos
but the still system splitting the qty in decimal.

Once any configuration / customization changes are happened, you should try to test by creating new documents and not with the existing documents.  I presume, after modifying the routine, you are trying with the existing document which won't work.

G. Lakshmipathi

Former Member
0 Kudos

Hi

Please check the below program

Routine to distribute the available quantities of batches.
* The distribution is an example for a TOP-DOWN distribution
* with regard to the sort sequence.
* To set up your own distribution rules, sort the following table
* according to your requirements.
*
* Structure of internal table DISQTY (significant fields):
* --------------------------------------------------------
*    DATA: BEGIN OF DISQTY OCCURS 0,
*            MATNR     LIKE BDBATCH-MATNR,    -> material number
*            CHARG     LIKE BDBATCH-CHARG,    -> batch number
*            WERKS     LIKE BDBATCH-WERKS,    -> plant
*            LGORT     LIKE BDBATCH-LGORT,    -> storage location
*            AVAL_QUAN LIKE V01FDK-VRFMG,     -> available quantity
*            QUANTITY  LIKE BDBATCH-MENGE,    -> target quantity
*            RES_TABIX LIKE SY-TABIX.         ->internal use
*    DATA: END OF DISQTY.
*
* Additional fields for distribution:
* -----------------------------------
* NO_OF_SPLIT -> The number of possible batch quantity splits
* QUAN_TO_DIS -> The quantity to be distributed (ordered quantity)
*
* Restrictions!
* -------------
* 1) Don't add or delete any entries from the internal table
* 2) Don't modify fields MATNR, CHARG, WERKS, LGORT, AVAL_QUAN and
*    RES_TABIX.
* 3) Don't change values of NO_OF_SPLIT and QUAN_TO_DIS
* 4) The only field that can be modified is the DISQTY-QUANTITY field
************************************************************************
FORM CHMVS_003.

* DATA-Definitions
DATA: FLAG                  TYPE C.
DATA: ACTIVE                TYPE C VALUE 'A'.
DATA: QUAN_TO_DIS_CHARG     LIKE QUAN_TO_DIS.
DATA: LOC_UMREZ             LIKE UMREZ.
DATA: LOC_UMREN             LIKE UMREN.
DATA: QUAN_TO_DIS_ERFME     LIKE QUAN_TO_DIS.
DATA: DISQTY_QUANTITY_ERFME LIKE QUAN_TO_DIS.

DATA: BEGIN OF F_MARM OCCURS 0.
INCLUDE STRUCTURE MARM.
DATA: END OF F_MARM.

* determinating the situation when the distri. scenario becomes active
*{   INSERT         MIQK900215                                        1
************************************************************************
*----------------------------------------------------------------------*
*  This code inserted for auto proposal of batches based on first
*  manufactured and first out
*  For example : Batch number is KA0800. 08 = Month of manufacture
*                                        00 = Year of manufacture
*  This routine sorts data on last four digits i.e according to
*  month and year of manufacture
*

* Internal table for sorting batch number data - xresult
data: begin of i_xresult occurs 0.
include structure xresult.
data: i_charg like xresult-charg.
data : i_charg_MO like disqty-charg.      " new field for charge MONTH
data: end of i_xresult.
data : tmp_batch like xresult-charg.
* Internal table for sorting batch number data - disqty
data : begin of i_disqty occurs 0.
include structure disqty.
data : i_charg like disqty-charg.      " new field for charge YEAR
data : i_charg_MO like disqty-charg.      " new field for charge MONTH
data : end of i_disqty.

***--- copying the contents from disqty to i_disqty.
loop at disqty.
move-corresponding disqty to i_disqty.
append i_disqty.
endloop.
refresh disqty.
clear disqty.

***--- looping at i_disqty and modifying the same
loop at i_disqty.
i_disqty
-i_charg = i_disqty-charg.
*    shift i_disqty-i_charg by 2 places.
tmp_batch
= i_disqty-charg.
i_DISQTY
-i_charg = tmp_batch+4(2).

* data is in the form mmyydd()
concatenate tmp_batch+4(2) tmp_batch+2(2) tmp_batch+6(2) into i_DISQTY-i_charg_MO.
*     i_DISQTY-i_charg_MO = tmp_batch+2(2).

modify i_disqty.
endloop.

***--- sorting the contents of i_disqty on new batch number
sort i_disqty by I_CHARG_MO i_charg .

***--- copying back the sorted contents to xresult.
loop at i_disqty.
move-corresponding i_disqty to disqty.
* res_tabix is replaced by sy-tabix
disqty
-res_tabix = sy-tabix.
append disqty.
endloop.
***---
*----------------------------------------------------------------------*

*}   INSERT
CALL FUNCTION 'VBWS_UNITS_OF_MATERIAL'
EXPORTING
I_MATNR         
= DISQTY-MATNR
TABLES
WS_MARM_TAB     
= F_MARM
EXCEPTIONS
WRONG_CALL      
= 1
NO_UNITS        
= 2
UNITS_NOT_ACTIVE
= 3
OTHERS           = 4.

IF SY-SUBRC IS INITIAL.
IF ( X_BDCOM-ERFME NE X_BDCOM-MEINS ) AND
( XKONDH-KZAME EQ A ).
FLAG
= ACTIVE.
ENDIF.
ENDIF.

* active ingredient managed and MEINS <> ERFME
IF FLAG EQ ACTIVE.

*-- calculation of required quantity in UNITS OF ACTIVE INGREDIENT
CALL FUNCTION 'MENGE_UMRECHNEN'
EXPORTING
MATNR               
= DISQTY-MATNR
MEINH               
= X_BDCOM-ERFME
MEINS               
= X_BDCOM-MEINS
MGLME               
= QUAN_TO_DIS
IMPORTING
O_MGAME             
= QUAN_TO_DIS_ERFME
EXCEPTIONS
CONVERSION_NOT_FOUND
= 1
DIFFERENT_DIMENSION 
= 2
DIVISIONN_BY_ZERO   
= 3
OVERFLOW            
= 4
T006D_ENTRY_MISSING 
= 5
T006_ENTRY_MISSING  
= 6
OTHERS               = 7.

LOOP AT DISQTY.

CHECK SY-TABIX <= NO_OF_SPLIT.
IF QUAN_TO_DIS_ERFME > 0.

*------ calc. of (quantity to be distributed) in basis units of batch
PERFORM MENGE_UMRECHNEN USING A
QUAN_TO_DIS_ERFME
DISQTY
-CHARG
CHANGING QUAN_TO_DIS_CHARG
LOC_UMREZ
LOC_UMREN
.

*------ determing the quantity for the internal table
IF DISQTY-AVAL_QUAN > QUAN_TO_DIS_CHARG.
DISQTY
-QUANTITY = QUAN_TO_DIS_CHARG.
*{   DELETE         MIQK900215                                        6
*\        ELSEIF disqty-aval_quan > 0.
*}   DELETE
*{   INSERT         MIQK900215                                        7
ELSE.
*}   INSERT
DISQTY
-QUANTITY = DISQTY-AVAL_QUAN.
ENDIF.

MODIFY DISQTY.

*------ calc. of (distributed batch in basis) into ERFME
PERFORM MENGE_UMRECHNEN USING SPACE
DISQTY
-QUANTITY
DISQTY
-CHARG
CHANGING DISQTY_QUANTITY_ERFME
LOC_UMREZ
LOC_UMREN
.

*------ reducing the required quantity in ERFME
QUAN_TO_DIS_ERFME
= QUAN_TO_DIS_ERFME - DISQTY_QUANTITY_ERFME.

ENDIF.
ENDLOOP.

* not active ingredient managed or MEINS = ERFME
ELSE.

LOOP AT DISQTY.
CHECK SY-TABIX <= NO_OF_SPLIT.
IF QUAN_TO_DIS > 0.
IF DISQTY-AVAL_QUAN > QUAN_TO_DIS.
DISQTY
-QUANTITY = QUAN_TO_DIS.
*{   DELETE         MIQK900215                                        2
*\        ELSEIF disqty-aval_quan > 0.
*}   DELETE
*{   INSERT         MIQK900215                                        3
ELSE.
*}   INSERT
DISQTY
-QUANTITY = DISQTY-AVAL_QUAN.
ENDIF.
QUAN_TO_DIS
= QUAN_TO_DIS - DISQTY-QUANTITY.
MODIFY DISQTY.
ENDIF.
ENDLOOP.
*{   INSERT         MIQK900215                                        4
*{   INSERT         MILK900142                                        2
************************************************************************
*----------------------------------------------------------------------*
*  This code inserted for auto proposal of batches based on first
*  manufactured and first out
*  For example : Batch number is KA0800. 08 = Month of manufacture
*                                        00 = Year of manufacture
*  This routine sorts data on 3rd to 6th digits i.e according to
*  month and year of manufacture
*----------------------------------------------------------------------*

***--- copying the contents from xresult to i_xresult.
loop at xresult.
move-corresponding xresult to i_xresult.
append i_xresult.
endloop.
refresh xresult.
clear xresult.

***--- looping at i_xresult and modifying the same
loop at i_xresult.
i_xresult
-i_charg = i_xresult-charg.
*    shift i_xresult-i_charg by 2 places. " Commented On 13/01/2014
***---Changed on 13th Jan 2014
tmp_batch
= i_xresult-charg.
i_xresult
-i_charg = tmp_batch+4(2).

concatenate tmp_batch+4(2) tmp_batch+2(2) tmp_batch+6(2) into i_xresult-i_charg_MO.
*     i_xresult-i_charg_MO = tmp_batch+2(2).
***---End Of addition
modify i_xresult.
endloop.

***--- sorting the contents of i_xresult on batch number
sort i_xresult by  I_CHARG_MO i_charg.

***--- copying back the sorted contents to xresult.
loop at i_xresult.
move-corresponding i_xresult to xresult.
append xresult.
endloop.
***--- end of second insertion by Guruprasad
*----------------------------------------------------------------------*
************************************************************************
*}   INSERT


*}   INSERT

ENDIF.
*{   INSERT         MIQK900215                                        5
*{   INSERT         MILK912712                                        3
***-------START OF INSERTION
***------ Insertion to check that batch Qty should be Whole Quantiy
***----- Change asked by   , done by on 22 Mar 2014
data: qty like bdbatch-menge.
data: v_mes(300).
loop at disqty.
clear qty.
qty
= floor( disqty-quantity ).
if ( qty ne disqty-quantity ).
concatenate 'Batch No. ' disqty-charg ' Mat ' space
disqty
-matnr+12(6' does not have whole Qty' into v_mes.

message e000(zmm) with v_mes.
endif.
endloop.
***-------END OF INSERTION
*}   INSERT

*}   INSERT
ENDFORM.

Former Member
0 Kudos
Former Member
0 Kudos

Dear Experts Can you please let me know what changes need to be done from my side or in code.

Former Member
0 Kudos

Hi Avinash,

I don't know that why in codes you are looking to pick batches based on FIFO (or FMFO in your case). You should have used 'sort sequence' of the batch condition record(s) to accomplish this.

I need one more clarification in regard to UoM: When you said "Also just want to know is it possible to change the sales order qty in delivery automatically Eg ( 1CS to 25 Nos and 25 Nos if different batch)", you meant that though order is in 'CS' but in delivery, it should become in 'units' if batch split is happening, right?


Regards

SD

Former Member
0 Kudos

Dear Samier, Yes, same thing am looking for or else system should split the quantity in integers not decimal. I have try to stop it in routine but its not working. Is it possible to stop the batch split in decimal. Regards Avinash

Former Member
0 Kudos

Hi Avinash,

Well, I have never tried 'UoM' thing.

What is the UoM which is resulting in decimals in delivery during batch split?

Instead of going for intergers, try for multiples of CS.

I mean if 1CS = 30 EA, then in 'Qty proposal' check for multiples of 30.

I don't know that how much feasible is it for your scenario.

Regards

SD

Former Member
0 Kudos

Thanks every one for your valuable input. closing this ticket since only option remain, to check the program and do the modification.