Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

error while creating order in PP in cs02.

mohit_mantoo
Explorer
0 Kudos
600

Hello.

I am making a class builder for the base quantity and required quantity should be same in PP. But if shows error

Please help.

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; }

METHOD IF_EX_BOM_UPDATE~CHANGE_AT_SAVE.
*** BREAK-POINT.
DATA :
LS_STPOB LIKE LINE OF DELTA_STPOB, "BOM item document table
LS_STPOB_1 LIKE LINE OF DELTA_STPOB, "
LS_STKOB LIKE LINE OF DELTA_STKOB, "BOM Header Document Table
LV_MENGE TYPE MENGE_D, "Material Master View: Alternative Quantity of Material
LV_MENGE1 TYPE MENGE_D, "
LS_MASTB LIKE LINE OF DELTA_MASTB, "Document table for MAST records
LT_PLANT TYPE RANGE OF CHAR50, "Sequence table for MRP units - scope of planning
LS_STASB LIKE LINE OF DELTA_STASB, "Document Table for STAS Records
LT_STASB TYPE CS01_STASB_TAB. "
DATA:V_ANSWER(1). " ADDED ON 23.09.2019
* IF SY-UCOMM EQ 'FCBU'.
CLEAR :LV_MENGE,LV_MENGE1.
SELECT
SIGN
OPTI
LOW
HIGH
INTO TABLE LT_PLANT
FROM TVARVC
WHERE NAME = 'ZMM_FEED_PLANT'
AND TYPE = 'S'.
IF SY-SUBRC IS INITIAL.
READ TABLE DELTA_MASTB INTO LS_MASTB INDEX 1.
IF SY-SUBRC IS INITIAL.
IF LS_MASTB-WERKS IN LT_PLANT.
BREAK-POINT.
IF SY-TCODE EQ 'CS02'.
READ TABLE DELTA_STKOB INTO LS_STKOB WITH KEY SELKZ = 'X'.
IF SY-SUBRC IS INITIAL.
LT_STASB = DELTA_STASB.
DELETE LT_STASB WHERE STLAL NE LS_STKOB-STLAL.
LOOP AT LT_STASB INTO LS_STASB WHERE STLAL EQ LS_STKOB-STLAL.
READ TABLE DELTA_STPOB INTO LS_STPOB WITH KEY STLKN = LS_STASB-STLKN
MEINS = 'KG'.
IF SY-SUBRC IS INITIAL.
READ TABLE DELTA_STPOB INTO LS_STPOB_1 WITH KEY
STLTY = LS_STPOB-STLTY
STLNR = LS_STPOB-STLNR
AEDAT = LS_STPOB-AEDAT
AENAM = LS_STPOB-AENAM
IDNRK = LS_STPOB-IDNRK
POSNR = LS_STPOB-POSNR
STVKN = LS_STPOB-STVKN
EFSRT = LS_STPOB-EFSRT
VBKZ = 'U'.

* DATA: l_num TYPE CMS_DTE_SEQNO.
* CALL FUNCTION 'NUMBER_GET_NEXT'
* EXPORTING
* nr_range_nr = '01'
* object = 'ZAUTO'
* IMPORTING
* number = l_num
* EXCEPTIONS
* interval_not_found = 1
* number_range_not_intern = 2
* object_not_found = 3
* quantity_is_0 = 4
* quantity_is_not_1 = 5
* interval_overflow = 6
* buffer_overflow = 7
* OTHERS = 8.


IF SY-SUBRC IS INITIAL.
LV_MENGE1 = LV_MENGE1 + LS_STPOB_1-MENGE.
ELSE.
LV_MENGE = LV_MENGE + LS_STPOB-MENGE.
ENDIF.
ENDIF.
ENDLOOP.
LV_MENGE = LV_MENGE + LV_MENGE1.
BREAK-POINT.
IF LV_MENGE NE LS_STKOB-BMENG.
MESSAGE : 'Bill of material Base Quantity and requirement quantity should be same' TYPE 'E'. " COMMENT ON 23.09.2019
ENDIF.
ENDIF.
ELSE.
LOOP AT DELTA_STPOB INTO LS_STPOB WHERE MEINS = 'KG'.
LV_MENGE = LV_MENGE + LS_STPOB-MENGE.
ENDLOOP.
READ TABLE DELTA_STKOB INTO LS_STKOB INDEX 1.
IF SY-SUBRC IS INITIAL.
IF LV_MENGE NE LS_STKOB-BMENG.
MESSAGE : 'Bill of material Base Quantity and requirement quantity should be same' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*ENDIF.
* ENDIF.
ENDMETHOD.

5 REPLIES 5

FredericGirod
Active Contributor
443

Use CODE button to format your code

Please, give us the error message

mohit_mantoo
Explorer
0 Kudos
443

error is

Bill of material base quantity and requirement quantity should be same

0 Kudos
443

use 'Comment' not 'Answer', answer is for a proposed solution

FredericGirod
Active Contributor
443

You have your answer, there is a BOM with a definied quantity and you put a different quantity.

The transaction for BOM are CS01 / CS02 / CS03. Maybe you could find the tables behind using ST05 (SQL trace).

After this, put a trace on your program to find witch BOM is accessed, and you will be able to find witch quantity you need to set.

Maybe this control is a customizing, your functional should be able to explain it

mohit_mantoo
Explorer
0 Kudos
443

OK.

can you resolve this issue