‎2013 Jun 24 10:23 AM
Hi,
I recently added additional checks, when inserting new components into a production order. Therefore I used PPC00008 which works fine when components are added manually by a user. I am able to reject the inserting of specific components.
Now the problem is that we want to have the same logic included in function "Read PP Master Data". So if a user executes this function and checks "New BOM" we want the same logic to be applied. Unfortunately PPC00008 is not being called when executing "Read PP Master Data".
I didn't find an appropriate user exit/BADI/enhancement to reject specific components when performing "Read PP Master Data".
Thanks a lot for your help.
Regards
Thorsten
‎2013 Jun 24 11:04 AM
‎2013 Jun 24 11:04 AM
‎2013 Jun 24 11:41 AM
EXIT_SAPLCOMK_006 is the name of the FM which allows me to reject the insertion of specific components when trying to add them manually in CO02. "Read PP Master Data" is the function we execute within a production order (CO02 --> Functions --> Read PP Master Data --> "New Bom" checked). Basically we want to reject sepcific components which will be inserted after "Read PP Master Data" like we can reject them when adding them manually.
‎2013 Jun 24 2:30 PM
Hi Thorsten
I cannot assure you but....
PPCO0023 Checks Changes to Order Components
This should help you.
Regards,
‎2013 Jun 25 11:42 AM
Hi Mohammed,
thanks for your reply. Unfortunately this Exit is not being called when executing function 'Read PP Master Data'.
Any further ideas?
Regards
‎2013 Jun 25 3:29 PM
In that case you will need to write an implicit enhancement.
Check for perform call in this and embed your logic there.
‎2013 Jun 28 9:58 AM
Hi Mohammed,
thanks for your proposal.
I found a suitable spot at the beginning of form bom_stb_transfer within include LCOSDF11 It now works perfectly fine. I just had to copy the coding for sorting STPOX itab stb. I reused the logic I already implemented in User-Exit PPC00008.
Here is my code:
FORM bom_stb_transfer USING prod_cost LIKE rc27x-flg_sel
no_ops
extern LIKE rc27x-flg_sel.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Form BOM_STB_TRANSFER, Anfang A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZPP_CO02_KOMP_EINFUEGEN_CHECK. "active version
*
**********************************************************************
* Begin TWX130627
* Der SAP Standard ermöglicht keine zusätzlichen Checks der Komponenten
* die über die Funktion "PP Stammdaten lesen" in den Auftrag übernommen
* werden. Wohl aber beim manuellen einfügen der Komponenten. Um diese
* zusätzlichen Checks auch in "PP Stammdaten lesen" zu ermöglichen,
* wurde dieses implizite Enhancement angelegt.
IF zcl_pp_ppauf_freigabe_checks=>cat_ins_ko_ppauf IS INITIAL.
SELECT * FROM zpp_ins_ko_ppauf
INTO TABLE zcl_pp_ppauf_freigabe_checks=>cat_ins_ko_ppauf.
ENDIF.
* Ist der erweiterte Check für dieses Werk aktiviert?
READ TABLE zcl_pp_ppauf_freigabe_checks=>cat_ins_ko_ppauf
WITH TABLE KEY werks = caufvd-werks
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
* Folgendes Coding wurde von SAP kopiert um die stb itab korrekt
* zu sortieren.
* Stücklistentabelle nach Auftragsstufe und -weg sortieren, so daß
* eine Dummy-Baugruppe immer vor ihren Komponenten steht
* Das Unterprogramm plmz_stpo_chk setzt diese Sortierung voraus
IF extern IS INITIAL "external calls don't fill awgov
AND ( caufvd-autyp = auftragstyp-fert
OR caufvd-autyp = auftragstyp-bord ).
SORT stb BY aufst astov aufwg baust posnr.
* check for overflow in AUFST/AUFWG
READ TABLE stb WITH KEY aufst = 0 astov = 1 BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
* get next entry (aufst > 0 or astov > 1)
READ TABLE stb INDEX sy-tabix.
ENDIF.
IF sy-subrc IS INITIAL
AND stb-aufst <> stb-astov.
* overflow in AUFST/AUFWG => try to renumber
PERFORM stufe_weg_renumber TABLES stb.
ENDIF.
ELSE.
SORT stb BY aufst aufwg baust posnr.
ENDIF.
* Hier beginnt die Logik für die individuellen Checks -->
DATA: zz_tabix TYPE sy-tabix,
zz_lt_check_group TYPE zpp_matcat_t,
zz_ls_message TYPE message_struct,
zz_ls_message_cast TYPE cmimsg.
FIELD-SYMBOLS: <zz_ls_stb> LIKE LINE OF stb.
LOOP AT stb WHERE stufe = 1 AND dumps = 'x'.
* Über alle Dummybaugruppen der ersten Stufe loopen
CLEAR: zz_lt_check_group, zz_ls_message, zz_ls_message_cast.
zz_tabix = sy-tabix + 1.
READ TABLE stb ASSIGNING <zz_ls_stb> INDEX zz_tabix.
CHECK <zz_ls_stb>-stufe > 1 .
APPEND stb TO zz_lt_check_group.
* Es gibt Komponenten für diese Dummy-Baugruppe
LOOP AT stb ASSIGNING <zz_ls_stb> FROM zz_tabix.
IF <zz_ls_stb>-stufe = 1.
EXIT.
ENDIF.
APPEND <zz_ls_stb> TO zz_lt_check_group.
ENDLOOP.
zcl_pp_ppauf_freigabe_checks=>check_insert_allowed(
EXPORTING it_stb = zz_lt_check_group
IMPORTING es_message = zz_ls_message
EXCEPTIONS error = 1
material_rejected = 2
OTHERS = 3 ).
IF sy-subrc = 2.
zz_ls_message_cast-msgty = zz_ls_message-msgty.
zz_ls_message_cast-msgnr = zz_ls_message-msgno.
zz_ls_message_cast-arbgb = zz_ls_message-msgid.
CALL FUNCTION 'CM_F_MESSAGE'
EXPORTING
object_dependent = 'X'
arbgb = zz_ls_message_cast-arbgb
msgnr = zz_ls_message_cast-msgnr
msgty = zz_ls_message_cast-msgty
msgv1 = zz_ls_message-msgv1
msgv2 = zz_ls_message-msgv2
msgv3 = zz_ls_message-msgv3
msgv4 = zz_ls_message-msgv2.
LOOP AT zz_lt_check_group ASSIGNING <zz_ls_stb>.
READ TABLE stb FROM <zz_ls_stb>.
IF sy-subrc = 0.
DELETE stb INDEX sy-tabix .
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*