Modify Production Order
Hi All,
I need to modify an existing Production order, I want add some operations and components to the order. Is there any FM or BAPI to achieve the same.
Thanks and Regards,
Navneeth K.
Hi Navneeth
1.)You can add the operations and the componenets in routing (ca02)
2.)then Come to the production order- change mode (c0o2) and Click on function - Read PP master Data
3.) This will automatically read your BOM,routing and change the production order
This may solve your problem
reward points, if usefull
Regards
palaniappan
Similar Messages
-
Modify production order tolerance limits through BAPI
Hi experts,
I need to modify tolerance limits at production orders, but I can't find a BAPI that acomplishes my needs. Nor BAPI_ALM_ORDER_MAINTAIN, neither BAPI_PRODORD_CHANGE have those fields (AFPO-UNTTO and AFPO-UEBTO).
Could anybody help me?
Thanks in advance.
Maite.Hi,
if you are using this BAPI, you must ensure the following,
o All the necessary master data has been created correctly (for
example, material master, BOM, routing or recipe, work centers or
resources).
o All the necessary Customizing settings have been made to the orders.
For more information refer the BAPI Document in SE37. it is helpful to find out the which are the parameters are obligatory.
Refer the below link.
[Re: Can not display the Long Text in PO creation|Re: Can not display the Long Text in PO creation]
Reward if found helpful.
Regards,
Boobalan Suburaj -
Production Order - Modify field Material Provision Indicator for component in the production order
Good afternoon,
I have a component in the bill of material, that has the option Material Provision Indicator activated.
When i create the production order, the component automaticaly is activated with the Material Provision Indicator option.
However, in the production order, this field isn't possible to modify, because is closed.
Anybody knows way the modify this field? Configure to open?
Thanks.
Kind Regards,
António PinhoHello Amar,
I am also getting the same error while Releasing Production Order and Costing (CO11N). This error is related to EHP7 in our case.
Please try one of the following solution and see whether the error is gone or not.
1. Implement the SAP Note 1317551 - Error AD_SUBCON 141 / 143 / 144 (T417)
OR
2. Complete the customizing of Material Provision Indicator (T Code OICO) as per the attachment.
Regards,
Prashant Karanjgaonkar -
Issue in production orders confimations, when any component is modified.
Hi Experts,
I'm facing with the follow situation:
- I've created and released one production order
- Then, I've changed one component quantity in production order.
- Finally, I've tried to confim this order.
Does anyone know why this component (wich was modified before) "disappear" in the confirmation?
Thanks in advance
Adrian AbateHi Experts,
Thank's for your responses.
So, I 'd to increase some informations:
- This component has enough quantity in stock;
- Back flush is activated;
- Final issue is not ticked (also is not allowed to edit). This bahavior always happend when any component has the quantity modified.
Could anyone help me?
Regards
Abate -
Field audisp MRP-relevant not modified in Production Order.
I would like to know if there is a way (Exit, BADI, customizing, etc) to modify the field Field audisp MRP-relevant before or after add a new component or operation in a production order. The system always get the value form the customizing of the production order type and I would like to change this field to other value 1 to 3 for example.
Thank you in advance.
Regards.Hi Alberto
Can you please provide more details of your business requirement? On which table would you like to change this field? Do you want to make an order not relevant to MRP or a reservation?
You can make any MRP element not revelant to MRP dynamically (don't neet to change anything on the table) using BAdI MD_CHANGE_MRP_DATA.
See this blog for more details:
Making an element not relevant to MRP or MD04 using BAdI MD_CHANGE_MRP_DATA
BR
Caetano -
Modifying the production order from VBAP
Hi Expers
I need some modification and write a code so how to proceed with the following comments as below
Modification to processing of Command Orders & Tickets
Currently there is an assumption that every sales order (and its deliveries) will include a product which is made to order, i.e. for which a production order will be required.
In ZINT_CSTPORD_ROUTINES, a check is made to identify the production order linked to the sales order. If there is no such production order (usually because of the customeru2019s credit status) then processing of the ticket is terminated.
This assumption would fall down if an order was to be raised (in Command) on which there is no concrete material. For example, if we sold a bag of pigment or a screed to a customer. In this case the item would be sold from stock and there would be no need for a production order.
The solution
In the routine which checks for the existence of a production order, modify the code as follows:
u2022 Inspect each item on the sales order
u2022 If (and only if) there is at least one item with a category of u201CZTACu201D then check for a production order, otherwise process the order in the usual manner.
Regards
PirozThread closed
-
Consumption acct of materia which issue to maint. ord. and production order
Hi all,
I have one problem with the cost report for maintenance orders.
I have one material code, such as we call A.
Mat. A is issued to production order and also maintenance order.
For production order, consumption account is 123
For maintenance order, consumption account is 456
I have defined new movement type for issuing to Maintenance order is ZB1
in OBYC:
GBB - VRB --> 123
ZB1 --> 456
So for accounting purpose, I can slit these consumption accounts
However, when I go to maintenance order cost reports, systems slit these cost into 2 line
Material A Acct. Cons 123 Plan cost 100 Actual cost 0
Material A Acct. Cons 456 Plan cost 0 Actual cost 120
How can I group into 1 line ?
Edited by: Emily Nguyen on Jun 2, 2009 12:15 PMHi Emily
In OBYC you can configure GL accounts per valuation class.
You cannot configure Movement type wise. Each General modifier is linked with movement types.
We cannot give two consumption accounts for one valuation class in VBR.
Run your plan cost again.
Thanks
Kiran A -
Open Production Order with Mark for deletion
Hi
Friends again stuck in open production order
i want to calculate production order quantity for open production order,
only those production order which dont have mark for deletion.
I find a field in afpo XLOEK ..but it wont get reflects when done changes in CO02
Then i used the table JEST and i want to delete those aufnr which has deletion flag i wrote the folowing code pls do correct me where iam wrong .
IN this code deletes aufnr which are marked as deletion ?
SELECT afko~aufnr
afko~gamng
afko~plnbez
afpo~dwerk
afpo~psmng
afpo~matnr
INTO CORRESPONDING FIELDS OF TABLE i_afko
FROM afko INNER JOIN
afpo ON afpoaufnr = afkoaufnr
WHERE afpo~dwerk = s_werks
AND afpo~matnr IN s_matnr
AND afpo~elikz = space.
LOOP AT i_afko.
CONCATENATE 'OR' i_afko-aufnr INTO i_afko-aufnr.
MODIFY i_afko.
ENDLOOP.
IF NOT i_afko[] IS INITIAL.
SELECT jest~objnr
jest~stat
jest~inact
INTO CORRESPONDING FIELDS OF TABLE i_jest
FROM jest
FOR ALL ENTRIES IN i_afko
WHERE objnr = i_afko-aufnr.
ENDIF.
LOOP AT i_jest INTO wa_ijest.
IF wa_ijest-stat = 'I0076' and ( wa_ijest-inact = SPACE ).
DELETE i_afko WHERE aufnr = wa_ijest-objnr.
ENDIF.
ENDLOOP.
i_afko1[] = i_afko[].
SORT i_afko BY matnr dwerk.
DELETE ADJACENT DUPLICATES FROM i_afko COMPARING matnr dwerk.
loop ....
calculate :quantity
endloop.
Regards and answers will be rewarded pointsthnks
solved the problem
regards -
WM-production order-need change the open quantity in Transfer order
Hi,
I created the production order (order quantity 1000). i did material staging and generated TR. .
But i need to change the open quantity in transfer order . i need to create the partial Transfer order
against TR..
KINDLY SUGGEST ME
WITH REGARDS
DineshHi Dinesh,
TO for partial qty is possible.
When you are doing material staging with 319 mov.type, you create a transfer order for partial quantity as follows:
You first create a manual transfer order using transaction LT04.
You specify the TR number in the intial screen and navigate to the detail screen, system shows the Open TR quantity and the proposed TO quantity. By default, both these quantities are equal to the TR quantity.
However, when you create by clicing the "Create TO button" (the icon with a plus sign in the tool bar of LT04 screen), system takes you to another screen where it asks for the "Requested Qty" on the top of the screen. Here you can modify the qty as per your requirement; then you can check and confirm the storage type and storage bin for source and destination stocks & save.
It is important that you give the correct source storage type & storage bin that is having stock or otherwise system might give error message.
System will create a TO line item with the entered qty and propose the balance TR qty as the 2nd TO line item. You can skip this 2nd TO item or delete it from the TO.
Once again, if you click the Save button, system will save the TO with the partial quantity.
The balance quantity will be available in the TR as open quantity and this can be seen in the header data of transaction LB03.
Regards
Prabhu -
Production Order with follow-up material unble to save due to error CKBK009
Dear Expert,
When we apply discontintion/follow-up material setting, production order is not able to save. <b>Error message "CKBK009 - No price could be determine for material....."</b>.
<b><u>SAP Help indicates :</u></b>
"No price could be determined for material .......... Message no. CKBK009
<b>Diagnosis :</b>
The system could not determine a price for valuation view 0, because no valuation
strategy succeeded from valuation variant 006.
<b>System Response :</b>
Since the input quantity is zero for this material item, the costing result is not
affected by this error at the pricing stage.
The standard system defines this message as an error message. However, you
can use user-defined error management to specify that the message is a warning
or an information message, or that it is not issed at all.
<b>However, in Controlling's User-Defined Error Management, CKBK009 is already warning only.
What other setting is needed ?</b>
Thanks for helping !Dear all,
Manage to solve the problem via Note 1008643, per following.
<b> THANK YOU for all your guidance & Have a nice day !</b>
<u><b>NOTE 1008643 :</b></u>Symptom
In a production order error message CKBK-009 is raised during cost calculation.
This message cannot be modified into a warning or information message.
Other terms
CKBK009, CO01, CO02, CO03
Reason and Prerequisites
System design
Solution
Please make a new entry in TA OPR8 with the following characteristics:
ErrorManagID ApplicationArea MsgNo MinMsgType MaxMsgType
PPCO CKBK 009
Then run TA OPR4_PPCO to modify the message type for CKBK009. -
Different GL accunts during GR for PO and GR for production order
Hi
For posting GR for PO and GR for Production order we use movement 101 only then how we can define or e different GL accounts for both the transactions ?Hi,
As per my undestanding
If you want to hit different GL for same material type for e.g. GR for PO and GR for Production order.
you can define split valuation, Suppose material A has two Split valuation External Procurement or Inhouse Production.
Now For valuation type External Procurement assign valuation class 1000 and for Inhouse Production 2000.
Now in GBB for valuation modifier BSX assign two separate GL
Like
GBB BSX 1000 120000(External Procurement)
GBB BSX 2000 130000(Inhouse Production)
Solution 2 :-
Define other movement type for Production create and create a new event key and assign GL to that one.
Hope HElp U !
Regards,
Pardeep Malik -
How to attempt production orders and get feedback by using IDocs
Hi,
I'm new new to SAP and R3 respectively mySAP. I need to know how to use IDocs (over file system) to attempt production orders to an extern application and how to get the feedback of the whole orders and single operations.
I found the IDoc-base-type "PPCC2RECORDER01" to send production orders. Is that the right base type for production orders?
(In consideration of compatibility and support me was recommend to avoid the old types OPERA2 and CONF21.)
What IDoc-types do I need to get feedback about a production order and its operations?
I hope someone is understanding my questions is able to help me. Please apologize my broken English.
Thanks!
HannesPROGRAM....... ZRCCLORDPROC
TITLE......... Production Odrer Idocs
AUTHOR........ Aveek Ghose
DATE WRITTEN.. 15/09/2006
R/3 RELEASE... 4.6C
=====================================================================*
COPIED FROM... N/A
DESCRIPTION...
*& Creation of production order IDOCs to a given selection
*& This program selects to an input given via the selection screen the *
*& corresponding production orders from the database. Then the function
*& module for creation of planned order idocs is called. *
*& In general this report is called from the report RCCLTRAN, but it *
*& can also be used for its own. *
=====================================================================*
PROGRAM TYPE.. Outbound Interface
DEV. CLASS.... ZPD1
LOGICAL DB.... N/A
=====================================================================*
SCREENS....... N/A
GUI TITLE..... N/A
GUI STATUS.... N/A
TRANSACTIONS.. N/A
USER EXITS.... N/A
=====================================================================*
CHANGE HISTORY *
Date By Correction Number & Brief Description Release
Tables / Structures
REPORT zrcclordproc
NO STANDARD PAGE HEADING
MESSAGE-ID ZCUST
LINE-COUNT 65(0)
LINE-SIZE 255.
INCLUDE RCORDO01. " PBO-Modules *
INCLUDE RCORDI01. " PAI-Modules *
INCLUDE RCORDF01. " FORM-Routines *
--> Global data
TYPE-POOLS: cloi.
include zprodata. "Types / constants for Orderselection
include zrcordtop. "Tables / Data for this report
include zrcordtop1.
include yrccl_constants.
TABLES : jcds,
tvarv,
zzzz_xref_data.
TYPES: BEGIN OF ty_date,
aufnr TYPE aufnr,
aedat TYPE aufaedat,
aezeit TYPE co_chg_time,
erdat TYPE auferfdat,
erfzeit TYPE co_ins_time,
loekz TYPE aufloekz,
indicator(1) TYPE c,
END OF ty_date.
DATA: is_enhancement type isu_ord_segments_determine.
DATA: itab_date TYPE STANDARD TABLE OF ty_date
INITIAL SIZE 0 WITH HEADER LINE.
DATA: f_objnr TYPE j_objnr.
DATA: g_report_sub_head(72) TYPE c, "Sub-Header hold area
g_report_head(72) TYPE c, "Header hold area
g_run_date(72) TYPE c, "Holds message for Run date
g_run_time(72) TYPE c. "Holds message for Run time
DATA:
f_old_date TYPE datum,
f_old_time TYPE uzeit,
f_continue(1) TYPE c.
END OF INSERTION DS001
--> Überschrift für sonstige Einstellungen
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK miscellaneous WITH FRAME.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN COMMENT 1(30) text-001. "#EC
SELECTION-SCREEN SKIP 1.
*>> Logical system comes from Report RCCLTRANS
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(30) text-002.
SELECTION-SCREEN POSITION 35.
PARAMETERS opt_sys LIKE tbdlst-logsys.
SELECTION-SCREEN END OF LINE.
*>> Messagetype comes from Report RCCLTRANS
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(30) text-003.
SELECTION-SCREEN POSITION 35.
PARAMETERS mestyp LIKE tbdme-mestyp.
SELECTION-SCREEN END OF LINE.
*>> Messagetype comes from Report RCCLTRANS
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(30) text-004.
SELECTION-SCREEN POSITION 35.
PARAMETERS: p_date TYPE sydatum. "last run date
SELECTION-SCREEN END OF LINE.
*>> Messagetype comes from Report RCCLTRANS
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(30) text-005.
SELECTION-SCREEN POSITION 35.
PARAMETERS: p_time TYPE syuzeit. "last run time
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK MISCELLANEOUS.
*MOD-006
*>> Messagetype comes from Report RCCLTRANS
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(30) text-006.
SELECTION-SCREEN POSITION 35.
PARAMETERS: p_update AS CHECKBOX DEFAULT space.
SELECTION-SCREEN END OF LINE.
*MOD-006
*MOD-006
*>> Messagetype comes from Report RCCLTRANS
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(30) text-007.
SELECTION-SCREEN POSITION 32.
SELECT-OPTIONS: s_rundt FOR sy-datum NO-EXTENSION.
SELECTION-SCREEN END OF LINE.
*MOD-006
*MOD-006
*>> Messagetype comes from Report RCCLTRANS
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(30) text-008.
SELECTION-SCREEN POSITION 32.
SELECT-OPTIONS: s_runtm FOR sy-uzeit NO-EXTENSION.
SELECTION-SCREEN END OF LINE.
*MOD-006
**MOD-006
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT 3(30) text-009.
*SELECTION-SCREEN POSITION 32.
*SELECT-OPTIONS: s_emat FOR zzzz_xref_data-z_in_value.
*SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK miscellaneous.
**MOD-006
Write selected AUFPL numbers via ranges table to memory ?
PARAMETERS:
ordtomem TYPE cloi_x DEFAULT '' NO-DISPLAY. "X: yes
do not select from MARC, but use ranges tables directly. MK 4.0C
matnr_gl and werks_gl must have the same length.
PARAMETERS: no_sel TYPE c DEFAULT ' ' NO-DISPLAY.
--> Normal selection parameters for ORD comes from the logical db
*& Event START-OF-SELECTION
START-OF-SELECTION.
--> Select the ORD according to the selected
MRP controller, Material, work center and plant
*MOD-006
Validate the last run date & Time
PERFORM validate_last_run_date_time.
*MOD-006
BEGIN OF INSERTION DS001
get the entry of the last program run
select single * for update from ycloidownlprot
where logsys = OPT_SYS and
downloadtype eq C_DOWNL_PROCESS_ORDERS.
if YCLOIDOWNLPROT-IN_PROGRESS eq CLOI_TRUE.
program is already running, do not allow to start again
write : / text-004, YCLOIDOWNLPROT-USERNAME.
exit.
endif.
YCLOIDOWNLPROT-MANDT = SY-MANDT.
YCLOIDOWNLPROT-LOGSYS = OPT_SYS.
YCLOIDOWNLPROT-START_DATE = SY-DATUM.
YCLOIDOWNLPROT-START_TIME = SY-UZEIT.
YCLOIDOWNLPROT-USERNAME = SY-UNAME.
YCLOIDOWNLPROT-DOWNLOADTYPE = C_DOWNL_PROCESS_ORDERS.
YCLOIDOWNLPROT-IN_PROGRESS = CLOI_TRUE.
insert or update entry (dependant if entry already exists)
MODIFY YCLOIDOWNLPROT.
COMMIT WORK.
CLEAR CREATED_MASTERIDOCS_PRO.
EXPORT CREATED_MASTERIDOCS_PRO TO MEMORY ID 'YLOI001'.
END OF INSERTION DS001
BEGIN OF INSERTION DS001
if not sscrfields-ucomm = 'ONLI'. mk zu 4.0
exit.
endif.
if s_dispo is initial and
s_matnr is initial and
s_arbpl is initial and
s_werks is initial.
exit.
endif.
Send only orders with type 40 - process orders
p_autyp = '40'.
END OF INSERTION DS001
*>> Put the ranges tabs back into matwrk list if no selection (NO_SEL)
IF no_sel = cloi_true.
CLEAR t_matwrk_key. REFRESH t_matwrk_key.
LOOP AT s_matnr.
t_matwrk_key-matnr = s_matnr-low.
READ TABLE s_werks INDEX sy-tabix.
t_matwrk_key-werks = s_werks-low.
APPEND t_matwrk_key.
ENDLOOP.
SORT t_matwrk_key BY matnr werks.
DELETE ADJACENT DUPLICATES FROM t_matwrk_key.
delete duplicate duplicates from ranges table. Therfore sort by LOW
(HIGH is not used in this case).
SORT s_matnr BY low.
DELETE ADJACENT DUPLICATES FROM s_matnr.
SORT s_werks BY low.
DELETE ADJACENT DUPLICATES FROM s_werks.
ENDIF.
--> Determine which segments are selected in the message type
PERFORM ord_segments_determine
USING mestyp
CHANGING afpo_x
jstk_x
afab_x
affl_x
afvo_x
kbed_x
jstv_x
resb_x
kbeu_x
afuv_x
is_enhancement
jstu_x.
Export the flags to the memory, because the following subroutine
must not have any parameters !!!
EXPORT affl_x
afvo_x
kbed_x
resb_x
kbeu_x
afuv_x
TO MEMORY ID 'LOI03'.
MK 19980326 enhanced selections on header/operation level
get selection profile for log system from customizing if available
SELECT SINGLE * FROM tcloi9 WHERE logsys = opt_sys.
if entry exists for the logical system
IF sy-subrc = 0.
if an selection profile for the order is entered, use it for selection
IF NOT tcloi9-ord_selid IS INITIAL.
p_selid = tcloi9-ord_selid.
ENDIF.
IF NOT tcloi9-ord_opr_selid IS INITIAL AND
NOT afvo_x IS INITIAL AND NOT affl_x IS INITIAL.
ord_opr_selid = tcloi9-ord_opr_selid.
ENDIF.
ENDIF.
initialize control key table for selections
CALL FUNCTION 'CLOI_STEUS_GET'
EXPORTING
logsys_to_init = opt_sys
IMPORTING
no_entry_for_logsys = no_entry_for_logsys
TABLES
t_steus = t_steus
EXCEPTIONS
logsys_not_initialized = 1
OTHERS = 2.
Write structure information into the memory
perform fill_memory_selobj.
-> import table with already sent orders
IMPORT gt_aufnrdone FROM MEMORY ID 'LOIAUFNRTAB'. "N599845
SORT gt_aufnrdone BY low. "N599845
--> Read header information
GET ioheader.
Check if material/plant combination is selected MK 4.0C
CLEAR check_flg.
IF no_sel = cloi_true.
READ TABLE t_matwrk_key
WITH KEY matnr = ioheader-matnr
werks = ioheader-werks BINARY SEARCH.
IF sy-subrc <> 0.
check_flg = cloi_true.
ENDIF.
ENDIF.
-> check if order was already sent
IF NOT gt_aufnrdone[] IS INITIAL. "N599845
READ TABLE gt_aufnrdone WITH KEY "N599845
low = ioheader-aufnr "N599845
TRANSPORTING NO FIELDS "N599845
BINARY SEARCH. "N599845
IF sy-subrc = 0. "N599845
-> order already sent
check_flg = cloi_true. "N599845
ENDIF. "N599845
ENDIF. "N599845
leave GET routine if check_flg is set.
CHECK check_flg IS INITIAL.
CLEAR t_afpo. REFRESH t_afpo.
CLEAR t_affl. REFRESH t_affl.
MOVE-CORRESPONDING ioheader TO t_afko.
GET ioheader LATE.
BEGIN OF INSERTION DS001
Check whether the process order has been changed since the last
run of the program
clear f_continue.
if the CHANGED date is greater than the last run or initial
IF IOHEADER-AEDAT GT F_OLD_DATE OR
( ioheader-aedat is initial and
ioheader-aezeit is initial ).
if the CHANGED date is initial check the creation date
if ioheader-aedat is initial.
if the creation date is greater than or equal to the date of the last
run, if it is equal the creation time must be later or equal to the
start time of the last run
IF IOHEADER-ERDAT GT F_OLD_DATE OR
( IOHEADER-ERDAT EQ F_OLD_DATE AND
IOHEADER-ERFZEIT GE F_OLD_TIME ).
f_continue = 'X'.
endif.
else.
f_continue = 'X'.
endif.
if the CHANGED dat is not initial check it against the last run
ELSEIF IOHEADER-AEDAT EQ F_OLD_DATE AND
IOHEADER-AEZEIT GE F_OLD_TIME.
f_continue ='X'.
endif.
Aenderung 295/99 Selektions-Aenderung vom 26. August 99
Wenn Auftrag bereits techn. abgeschlossen ist, so darf kein IDOC
erzeugt werden, wenn Auftrag zum löschen vorgemerkt wird.
CONCATENATE 'OR' IOHEADER-AUFNR INTO F_OBJNR.
SELECT SINGLE * FROM JEST
WHERE OBJNR = F_OBJNR
AND STAT = 'I0045'.
IF JEST-INACT EQ SPACE AND SY-SUBRC EQ 0.
SELECT * FROM JCDS WHERE OBJNR EQ F_OBJNR AND
STAT EQ 'I0045' AND
INACT EQ SPACE.
letzte Aenderung des Status TABG wird geprueft Beg. WA 354/99
ENDSELECT.
IF ( F_OLD_DATE GT JCDS-UDATE OR " Beg JB_02
( F_OLD_DATE EQ JCDS-UDATE AND
F_OLD_TIME GT JCDS-UTIME ) ) AND " End JB_02
SY-SUBRC EQ 0.
CLEAR F_CONTINUE.
ENDIF.
ENDIF.
Ende 295/99
check f_continue eq 'X'.
END OF INSERTION DS001
t_afko-t_afpo = t_afpo[].
t_afko-t_jstk = t_jstk[].
t_afko-t_affl = t_affl[].
t_afko-t_afab = t_afab[].
APPEND t_afko.
IF jstk_x = cloi_x.
t_objnr-objnr = ioheader-objnr.
APPEND t_objnr.
ENDIF.
*---> Remember the orders that are already selected for the global
selection parameters
IF ordtomem = cloi_x. "write order numbers to memory
t_aufnr_range_done-sign = 'I'.
t_aufnr_range_done-option = 'NE'.
t_aufnr_range_done-low = ioheader-aufpl.
APPEND t_aufnr_range_done.
ENDIF.
*---> Remember the orders internal/external keys for AFAB (relationship)
IF afab_x = cloi_x.
MOVE-CORRESPONDING ioheader TO t_aufpl_aufnr.
APPEND t_aufpl_aufnr.
ENDIF.
check afpo_x = cloi_x.
GET ioitem.
BEGIN OF INSERTION DS001
Check whether the process order has been changed since the last
run of the program
CLEAR F_CONTINUE.
if the CHANGED date is greater than the last run or initial
IF IOHEADER-AEDAT GT F_OLD_DATE OR
( ioheader-aedat is initial and
ioheader-aezeit is initial ).
if the CHANGED date is initial check the creation date
if ioheader-aedat is initial.
if the creation date is greater than or equal to the date of the last
run, if it is equal the creation time must be later or equal to the
start time of the last run
IF IOHEADER-ERDAT GT F_OLD_DATE OR
( IOHEADER-ERDAT EQ F_OLD_DATE AND
IOHEADER-ERFZEIT GE F_OLD_TIME ).
f_continue = 'X'.
endif.
else.
f_continue = 'X'.
endif.
if the CHANGED date is not initial check it against the last run
ELSEIF IOHEADER-AEDAT EQ F_OLD_DATE AND
IOHEADER-AEZEIT GE F_OLD_TIME.
f_continue ='X'.
endif.
Aenderung 295/99 Selektions-Aenderung vom 26. August 99
Wenn Auftrag bereits techn. abgeschlossen ist, so darf kein IDOC
erzeugt werden, wenn Auftrag zum löschen vorgemerkt wird.
CONCATENATE 'OR' IOHEADER-AUFNR INTO F_OBJNR.
SELECT SINGLE * FROM JEST
WHERE OBJNR = F_OBJNR
AND STAT = 'I0045'.
IF JEST-INACT EQ SPACE AND SY-SUBRC EQ 0.
SELECT * FROM JCDS WHERE OBJNR EQ F_OBJNR AND
STAT EQ 'I0045' AND
INACT EQ SPACE.
letzte Aenderung des Status TABG wird geprueft
ENDSELECT.
IF ( F_OLD_DATE GT JCDS-UDATE OR " Beg JB_02
( F_OLD_DATE EQ JCDS-UDATE AND
F_OLD_TIME GT JCDS-UTIME ) ) AND " End JB_02
SY-SUBRC EQ 0.
CLEAR F_CONTINUE.
ENDIF.
ENDIF.
Ende 295/99
check f_continue eq 'X'.
END OF INSERTION DS001
IF afpo_x = cloi_x.
MOVE-CORRESPONDING ioitem TO t_afpo.
APPEND t_afpo.
ENDIF.
Put matnr and ltrmi in a help structure, which later goes to t_afpo
IF ioitem-posnr = '0001'.
MOVE-CORRESPONDING ioitem TO help_afpo.
APPEND help_afpo.
put PSP element (internal key) into order header. Unique for positions
IF t_afko-pspel IS INITIAL.
t_afko-pspel = ioitem-projn.
ENDIF.
ENDIF.
CHECK affl_x = cloi_x.
GET iosequen.
CLEAR t_afvo. REFRESH t_afvo.
MOVE-CORRESPONDING iosequen TO t_affl.
GET iosequen LATE.
t_affl-t_afvo = t_afvo[].
APPEND t_affl.
CHECK afvo_x = cloi_x.
GET iooper.
CLEAR t_kbed. REFRESH t_kbed.
CLEAR t_afuv. REFRESH t_afuv.
CLEAR t_resb. REFRESH t_resb.
MOVE-CORRESPONDING iooper TO t_afvo.
"Temporary storing of operation information if for a phase
"the corresponding operation has is needed
MOVE-CORRESPONDING iooper TO t_aufpl_aplzl_vornr.
APPEND t_aufpl_aplzl_vornr.
check, if selection profile (if exists) for the operation is ok
IF NOT ord_opr_selid IS INITIAL.
CALL FUNCTION 'STATUS_CHECK_BY_SELSCHEM'
EXPORTING
objnr = iooper-objnr
selid = ord_opr_selid
IMPORTING
fullfill = status_ok
EXCEPTIONS
no_stat_tab = 1
no_stat_scheme = 2
OTHERS = 3.
IF sy-subrc <> 0.
status_ok = cloi_x.
ENDIF.
ELSE.
status_ok = cloi_x.
ENDIF.
check if control key (STEUS) should not be selected.
control_key_ok = cloi_x.
IF no_entry_for_logsys IS INITIAL.
READ TABLE t_steus WITH KEY
steus = iooper-steus BINARY SEARCH.
IF sy-subrc <> 0.
CLEAR control_key_ok.
ENDIF.
ENDIF.
CHECK NOT status_ok IS INITIAL.
CHECK NOT control_key_ok IS INITIAL.
GET iooper LATE.
t_afvo-t_kbed = t_kbed[].
t_afvo-t_afuv = t_afuv[].
t_afvo-t_resb = t_resb[].
APPEND t_afvo.
IF jstv_x = cloi_x.
t_objnr-objnr = iooper-objnr.
APPEND t_objnr.
ENDIF.
CHECK kbed_x = cloi_x.
GET ioopcap.
MOVE-CORRESPONDING ioopcap TO t_kbed.
APPEND t_kbed.
CHECK resb_x = cloi_x.
GET ioopcomp.
do not transfer RESB entries with deletion flag
CHECK ioopcomp-xloek IS INITIAL.
MOVE-CORRESPONDING ioopcomp TO t_resb.
APPEND t_resb.
CHECK afuv_x = cloi_x.
GET iosoper.
CLEAR t_kbeu. REFRESH t_kbeu.
MOVE-CORRESPONDING iosoper TO t_afuv.
check if control key (STEUS) should not be selected.
control_key_ok = cloi_x.
IF no_entry_for_logsys IS INITIAL.
READ TABLE t_steus WITH KEY
steus = iooper-steus BINARY SEARCH.
IF sy-subrc <> 0.
CLEAR control_key_ok.
ENDIF.
ENDIF.
CHECK NOT control_key_ok IS INITIAL.
GET iosoper LATE.
t_afuv-t_kbeu = t_kbeu[].
APPEND t_afuv.
IF jstv_x = cloi_x.
t_objnr-objnr = iosoper-objnr.
APPEND t_objnr.
ENDIF.
CHECK kbeu_x = cloi_x.
GET iosocap.
MOVE-CORRESPONDING iosocap TO t_kbeu.
APPEND t_kbeu.
*& Event END-OF-SELECTION
END-OF-SELECTION.
*MOD-006
DATA: itab_matnr TYPE zzzz_xref_data OCCURS 0.
DATA: l_wa_matnr TYPE zzzz_xref_data.
DATA: l_wa_matnr_value TYPE zzzz_xref_data-z_in_value.
DATA: l_wa_afko TYPE cloi_afko_struct.
SELECT *
FROM zzzz_xref_data
APPENDING TABLE itab_matnr
WHERE trans_id = 'ZELCUSMATLOOKUP' AND
( z_in_value IN s_matnr OR
z_out_value IN s_matnr ).
IF sy-subrc = 0.
LOOP AT ITAB_MATNR INTO L_WA_MATNR.
L_WA_MATNR_VALUE = L_WA_MATNR-z_OUT_VALUE.
S_MATNR-LOW = L_WA_MATNR_VALUE.
S_MATNR-SIGN = 'I'.
S_MATNR-OPTION = 'EQ'.
APPEND S_MATNR.
ENDLOOP.
DELETE itab_matnr WHERE NOT in_value IN s_emat.
SORT itab_matnr BY out_value.
ENDIF.
CLEAR: l_wa_matnr.
**MOD-010
Data which is not in the material lookup table but in the T_AFKO.
LOOP AT t_afko INTO l_wa_afko.
READ TABLE S_MATNR WITH KEY LOW = L_WA_AFKO-MATNR BINARY SEARCH.
READ TABLE itab_matnr INTO l_wa_matnr
WITH KEY z_out_value = l_wa_afko-matnr BINARY SEARCH.
IF sy-subrc NE 0.
l_wa_afko-rgekz = 'X'.
MODIFY t_afko FROM l_wa_afko TRANSPORTING rgekz.
ENDIF.
IF NOT P_DATE IS INITIAL.
IF T_AFKO-GSTRP < p_date OR
( T_AFKO-GSTRP = p_date AND
T_AFKO-GSUZP > p_time ).
L_WA_AFKO-RGEKZ = 'X'.
MODIFY T_AFKO FROM L_WA_AFKO TRANSPORTING RGEKZ.
ENDIF.
ENDIF.
ENDLOOP.
Delete Data which is not in the material lookup
table but in the T_AFKO.
DELETE t_afko WHERE rgekz = 'X'.
*MOD-010
*MOD-006
BEGIN OF INSERTION DS001
DATA: l_wa_itab_date TYPE ty_date.
Check whether the process order has been changed since the last
run of the program
CLEAR f_continue.
IF NOT t_afko IS INITIAL.
SELECT aufnr aedat aezeit erdat erfzeit loekz
INTO TABLE itab_date
FROM aufk
FOR ALL ENTRIES IN t_afko
WHERE aufnr = t_afko-aufnr.
IF sy-subrc = 0.
IF NOT p_date IS INITIAL.
CLEAR: itab_date.
Check whether the process order has been changed since the last
run of the program
LOOP AT itab_date INTO l_wa_itab_date.
if the CHANGED date is greater than the last run or initial
IF l_wa_itab_date-aedat GT p_date OR
( l_wa_itab_date-aedat IS INITIAL AND
l_wa_itab_date-aezeit IS INITIAL ).
if the CHANGED date is initial check the creation date
IF l_wa_itab_date-aedat IS INITIAL.
if the creation date is greater than or equal to the date of the last
run, if it is equal the creation time must be later or equal to the
start time of the last run
IF l_wa_itab_date-erdat GT p_date OR
( l_wa_itab_date-erdat EQ p_date AND
l_wa_itab_date-erfzeit GE p_time ).
f_continue = 'X'.
ELSE.
l_wa_itab_date-indicator = 'X'.
MODIFY itab_date FROM l_wa_itab_date TRANSPORTING indicator.
ENDIF.
ELSE.
f_continue = 'X'.
ENDIF.
if the CHANGED dat is not initial check it against the last run
ELSEIF l_wa_itab_date-aedat EQ p_date AND
l_wa_itab_date-aezeit GE p_time.
f_continue ='X'.
ELSE.
l_wa_itab_date-indicator = 'X'.
MODIFY itab_date FROM l_wa_itab_date TRANSPORTING indicator.
ENDIF.
ENDLOOP.
*MOD-006
ELSE.
CLEAR: ITAB_DATE.
LOOP AT ITAB_DATE INTO L_WA_ITAB_DATE.
if the CHANGED date is greater than the last run or initial
IF L_WA_ITAB_DATE-AEDAT GT P_RUNDT OR
( L_WA_ITAB_DATE-aedat is initial and
L_WA_ITAB_DATE-aezeit is initial ).
if the CHANGED date is initial check the creation date
if l_wa_itab_date-aedat is initial.
if the creation date is greater than or equal to the date of the last
run, if it is equal the creation time must be later or equal to the
start time of the last run
IF L_WA_ITAB_DATE-ERDAT GT P_RUNDT OR
( L_WA_ITAB_DATE-ERDAT EQ P_RUNDT AND
L_WA_ITAB_DATE-ERFZEIT GE S_RUNTM-LOW OR
L_WA_ITAB_DATE-ERFZEIT LE S_RUNTM-HIGH ).
f_continue = 'X'.
else.
l_wa_itab_date-indicator = 'X'.
MODIFY ITAB_DATE FROM L_WA_ITAB_DATE
TRANSPORTING INDICATOR.
endif.
else.
f_continue = 'X'.
endif.
if the CHANGED dat is not initial check it against the last run
ELSEIF L_WA_ITAB_DATE-AEDAT EQ P_RUNDT AND
L_WA_ITAB_DATE-AEZEIT GE S_RUNTM-LOW.
f_continue ='X'.
ELSE.
l_wa_itab_date-indicator = 'X'.
MODIFY ITAB_DATE FROM L_WA_ITAB_DATE
TRANSPORTING INDICATOR.
endif.
ENDLOOP.
*MOD-006
ENDIF.
ENDIF.
ENDIF.
DELETE ITAB_DATE WHERE INDICATOR = 'X'.
*MOD-006
CLEAR: itab_date.
IF s_rundt-high IS INITIAL AND NOT s_rundt IS INITIAL.
s_rundt-high = sy-datum.
ENDIF.
LOOP AT itab_date INTO l_wa_itab_date.
IF NOT s_rundt IS INITIAL.
if the CHANGED date is greater than the last run or initial
IF ( l_wa_itab_date-aedat IS INITIAL AND
l_wa_itab_date-aezeit IS INITIAL ).
if the CHANGED date is initial check the creation date
IF l_wa_itab_date-aedat IS INITIAL.
if the creation date is greater than or equal to the date of the last
run, if it is equal the creation time must be later or equal to the
start time of the last run
IF ( l_wa_itab_date-erdat GT s_rundt-low AND
l_wa_itab_date-erfzeit GT s_runtm-low ) AND
( l_wa_itab_date-erdat LT s_rundt-high AND
l_wa_itab_date-erfzeit LT s_runtm-high ).
f_continue = 'X'.
ELSE.
l_wa_itab_date-indicator = 'X'.
MODIFY itab_date FROM l_wa_itab_date
TRANSPORTING indicator.
ENDIF.
ELSE.
f_continue = 'X'.
ENDIF.
if the CHANGED dat is not initial check it against the last run
ELSEIF ( l_wa_itab_date-aedat GE s_rundt-low AND
l_wa_itab_date-aezeit GE s_runtm-low ) AND
( l_wa_itab_date-aedat LE s_rundt-high AND
l_wa_itab_date-aezeit LE s_runtm-high ).
f_continue ='X'.
ELSE.
l_wa_itab_date-indicator = 'X'.
MODIFY itab_date FROM l_wa_itab_date
TRANSPORTING indicator.
ENDIF.
ENDIF.
ENDLOOP.
DELETE itab_date WHERE indicator = 'X'.
*MOD-006
**MOD-006
LOOP AT t_afko INTO l_wa_afko.
READ TABLE itab_date INTO l_wa_itab_date
WITH KEY aufnr = l_wa_afko-aufnr BINARY SEARCH.
IF sy-subrc NE 0.
l_wa_afko-rgekz = 'X'.
MODIFY t_afko FROM l_wa_afko TRANSPORTING rgekz.
ENDIF.
ENDLOOP.
DELETE t_afko WHERE rgekz = 'X'.
**MOD-006
-> initialize logical data base to reduce memory consumption
PERFORM ldb_process_init(sapdbioc)
CHANGING
lv_subrc.
--> add information to the order structure that is not
selected via logical database:
- if AFVO-entry is a phase (phflg) --> fill field for
corresponding operation number (PVZNR)
The internal node number (aplzl) of the corresponding operation
is in field PVZKN of the phase
- relationship information: E1AFABL
especially: select external numbers for the used
internal numbers in the table AFAB
- status information of the order header: E1JSTKL
- status information of the operation: E1JSTVL
--> Put matnr and ltrmi in the table t_afko
SORT t_afko BY aufnr.
LOOP AT help_afpo.
READ TABLE t_afko WITH KEY aufnr = help_afpo-aufnr
ASSIGNING -gltri = help_afpo-ltrmi.
ENDIF.
ENDLOOP.
--> Select entries for order and operation status
IF NOT t_objnr[] IS INITIAL.
SELECT objnr stat FROM jest INTO TABLE t_jest2
FOR ALL ENTRIES IN t_objnr
WHERE objnr = t_objnr-objnr
AND inact <> 'X'.
ENDIF.
--> Select entries for relationships from afab for all orders
into table t_afab_tmp
SORT t_aufpl_aplzl_vornr BY aufpl aplzl.
IF afab_x = cloi_x AND NOT t_aufpl_aufnr[] IS INITIAL.
-> select afab data
SELECT * FROM afab INTO TABLE t_afab_tmp
FOR ALL ENTRIES IN t_aufpl_aufnr
WHERE aufpl_vor = t_aufpl_aufnr-aufpl.
SELECT * FROM afab APPENDING TABLE t_afab_tmp
FOR ALL ENTRIES IN t_aufpl_aufnr
WHERE aufpl_nch = t_aufpl_aufnr-aufpl.
SORT t_afab_tmp
BY aufpl_vor aplzl_vor aufpl_nch aplzl_nch aobar mimax.
DELETE ADJACENT DUPLICATES FROM t_afab_tmp
COMPARING aufpl_vor aplzl_vor aufpl_nch aplzl_nch aobar mimax.
-> read external order numbers out of data base
CLEAR t_aufpl. REFRESH t_aufpl.
LOOP AT t_afab_tmp ASSIGNING -aufpl_nch.
COLLECT t_aufpl.
ENDLOOP.
CLEAR t_aufpl_aufnr. REFRESH t_aufpl_aufnr.
IF NOT t_aufpl[] IS INITIAL.
SELECT aufpl aufnr FROM afko INTO TABLE t_aufpl_aufnr
FOR ALL ENTRIES IN t_aufpl
WHERE aufpl = t_aufpl-aufpl.
SORT t_aufpl_aufnr BY aufpl.
ENDIF.
-> add order numbers to afab data
LOOP AT t_afab_tmp ASSIGNING -aufnr_nch = t_aufpl_aufnr-aufnr.
ENDIF.
ENDLOOP.
-> read operation numbers out of data base
CLEAR t_aufpl_aplzl. REFRESH t_aufpl_aplzl.
LOOP AT t_afab_tmp ASSIGNING -aplzl_nch.
COLLECT t_aufpl_aplzl.
ENDLOOP.
IF NOT t_aufpl_aplzl[] IS INITIAL.
SELECT aufpl aplzl vornr FROM afvc
APPENDING TABLE t_aufpl_aplzl_vornr
FOR ALL ENTRIES IN t_aufpl_aplzl
WHERE aufpl = t_aufpl_aplzl-aufpl
AND aplzl = t_aufpl_aplzl-aplzl.
SORT t_aufpl_aplzl_vornr BY aufpl aplzl.
ENDIF.
-> add operation numbers to afab data
LOOP AT t_afab_tmp ASSIGNING -vornr_nch = t_aufpl_aplzl_vornr-vornr.
ENDIF.
ENDLOOP.
ENDIF. "afab_x
--> fill AFAB (relationship information) and status information
SORT t_aufpl_aufnr BY aufnr.
LOOP AT t_afko ASSIGNING .
-> fill order head status information
IF jstk_x = cloi_x.
CLEAR t_jstk. REFRESH t_jstk.
LOOP AT t_jest2 INTO wa_tjest2 WHERE objnr = -t_jstk = t_jstk[].
ENDIF.
-> fill afab information
IF afab_x = cloi_x.
CLEAR t_aufpl_aufnr.
READ TABLE t_aufpl_aufnr WITH KEY
aufnr = -t_afab = t_afab[].
ENDIF.
-> fill operation and suboperation status information
IF jstv_x = cloi_x OR afvo_x = cloi_x.
LOOP AT .
-> read status information of suboperation
IF jstu_x = cloi_x.
LOOP AT -t_jstu = t_jstu[].
ENDLOOP.
ENDIF.
-> read status information of operation
IF jstv_x = cloi_x.
CLEAR t_jstv. REFRESH t_jstv.
LOOP AT t_jest2 INTO wa_tjest2 WHERE objnr = -t_jstv = t_jstv[].
ENDIF.
-> Read operation for a phase
IF NOT -pvznr = t_aufpl_aplzl_vornr-vornr.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
-> collect order numbers
CLEAR wa_aufnrdone.
wa_aufnrdone-low = -aufnr.
APPEND wa_aufnrdone TO lt_aufnrdone.
ENDLOOP.
-> append collected order numbers to global table
APPEND LINES OF lt_aufnrdone TO gt_aufnrdone.
EXPORT gt_aufnrdone TO MEMORY ID 'LOIAUFNRTAB'.
-> free large tables
CLEAR t_jest2. REFRESH t_jest2.
CLEAR t_afab_tmp. REFRESH t_afab_tmp.
CLEAR t_aufpl. REFRESH t_aufpl.
CLEAR t_aufpl_aufnr. REFRESH t_aufpl_aufnr.
CLEAR t_aufpl_aplzl. REFRESH t_aufpl_aplzl.
CLEAR t_aufpl_aplzl_vornr. REFRESH t_aufpl_aplzl_vornr.
-> create idocs
CALL FUNCTION 'CLOI_MASTERIDOC_CREATE_LOIPRO'
EXPORTING
opt_sys = opt_sys
message_type = mestyp
TABLES
order_data = t_afko
EXCEPTIONS
OTHERS = 1.
-> export already selected order numbers via ranges tab to memory
EXPORT t_aufnr_range_done TO MEMORY ID 'LOI002'.
**MOD-006
IMPORT created_masteridocs_pro FROM MEMORY ID 'YLOI001'.
ycloidownlprot-end_date = sy-datum.
ycloidownlprot-end_time = sy-uzeit.
ycloidownlprot-idocs_selected = created_masteridocs_pro.
ycloidownlprot-in_progress = cloi_false.
insert or update entry (dependant if entry already exists)
MODIFY ycloidownlprot.
COMMIT WORK.
MESSAGE i967(z001) WITH created_masteridocs_pro.
**MOD-006
Update last run date and time
IF p_update = 'X'.
PERFORM update_last_run.
ELSE.
MESSAGE s000 WITH text-022.
"Last Run Date and Last Run Time not updated
LEAVE LIST-PROCESSING.
ENDIF.
INCLUDE rcordf01.
*& Form validate_last_run_date_time
text
--> p1 text
<-- p2 text
*FORM validate_last_run_date_time.
IF p_date IS INITIAL OR
p_time IS INITIAL.
IF sy-batch IS INITIAL.
MESSAGE s000 WITH text-017.
"Last Run date & Last Run Time can not be blank
LEAVE LIST-PROCESSING.
ELSE.
MESSAGE e000 WITH text-017.
"Last Run date & Last Run Time can not be blank
ENDIF.
ENDIF.
*ENDFORM. " validate_last_run_date_time
*& Form update_last_run
text
--> p1 text
<-- p2 text
FORM update_last_run.
CONSTANTS:
l_c_name TYPE rvari_vnam VALUE 'Z_PROC_DATE',
l_c_name1 TYPE rvari_vnam VALUE 'Z_PROC_TIME',
l_c_type TYPE rsscr_kind VALUE 'P',
l_c_numb TYPE tvarv_numb VALUE '0000'.
Update last run date
UPDATE tvarv SET low = sy-datum
WHERE name = l_c_name AND
type = l_c_type AND
numb = l_c_numb.
IF sy-subrc = 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
g_run_date = text-015. "#EC
"Updation of TVARV table failed for ZLAST_RUN_DATE. Update manually
ENDIF.
Update last run time
UPDATE tvarv SET low = sy-uzeit
WHERE name = l_c_name1 AND
type = l_c_type AND
numb = l_c_numb.
IF sy-subrc = 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
g_run_time = text-016. "#EC
"Updation of TVARV table failed for ZLAST_RUN_TIME. Update manually
ENDIF.
ENDFORM. " update_last_run -
How to check the Production order exits
Hi Experts
Modification to processing of Command Orders & Tickets
We require a modification to the processing being performed on sales data originating from the Command Concrete system and potentially from other systems yet to come online (e.g. Pinkenba Cement plant).
The Sap process involved is ZINT_INBOUND_POLLING and within that, ZINT_CSTPORD_ROUTINES.
The problem
Currently there is an assumption that every sales order (and its deliveries) will include a product which is made to order, i.e. for which a production order will be required.
In ZINT_CSTPORD_ROUTINES, a check is made to identify the production order linked to the sales order. If there is no such production order (usually because of the customeru2019s credit status) then processing of the ticket is terminated.
This assumption would fall down if an order was to be raised (in Command) on which there is no concrete material. For example, if we sold a bag of pigment or a screed to a customer. In this case the item would be sold from stock and there would be no need for a production order.
The solution
In the routine which checks for the existence of a production order, modify the code as follows:
Inspect each item on the sales order
If (and only if) there is at least one item with a category of u201CZTACu201D then check for a production order, otherwise process the order in the usual manner.
---- ZINT_CSTPORD_ROUTINES -
*& Form process_inbound_data
Create prod. orders from ticket data extracted from the COMMAND
system. Note that large portions of the code in this routine
have been copied from the retired ZPPU_COMMAND_PRODUCTION
interface program. This was done (1) because the old code works
and (2) to save development time.
-->T_ZINT_IDATA Internal table of interface data
-->T_ZINT_PARAM Internal table of interface parameters
-->T_ZINT_MSLOG Internal table of messages
-->P_ZINT_ID Interface ID
-->P_ZINT_TY Inteface type
-->P_ZINT_IS IDOC group for interface
-->P_ZINT_DL Flag: delete IDOC group when complete
-->P_ZINT_AL Flag: run in standalone mode
-->P_ZINT_NW Flag: do not log warning messages
-->P_ZINT_SQ Interface sequence number
<--P_ZINT_RC Return code (<>0=>error)
form process_inbound_data tables t_zint_idata structure zint_idata
t_zint_param structure zint_param
t_zint_mslog structure zint_mslog
using p_zint_id type zint_id
p_zint_ty type zint_ty
p_zint_is type zint_is
p_zint_dl type zint_dl
p_zint_al type zint_al
p_zint_nw type zint_nw
p_zint_sq type zint_sq
changing p_zint_rc type zint_rc.
program is continuing .............
I WANT TO WRITE A CODING HERE **********************
CHECK IF PRODUCTION ORDER REQUIRED
IF NOT THEN GO TO PERFORM UPDATE DATA
if production order required then check
for each item on sales order item list
with item category = 'ZTAC' then
return true
next
end function
if there is no production code
these has to be check from VBAP TABLE field VBELN and PSTYV (ZTAC,ZTAN Etc)
select * from Vbap WHERE VBELN = '00000269951' and VBAP.PSTYV = 'ZTAC','ZTAN' Etc
No production order?
elseif lva_prodord is initial.
clear v_messg.
call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
exporting
input = lva_filemat
importing
output = lva_filemat.
No production order found - log a warning message.
concatenate 'Production Order not be found for'
'Command order' lva_cmdord
'Material' lva_filemat
'Customer' lwa_02-customer
into v_messg separated by space.
perform write_log_entry
tables t_zint_mslog
using 'E' 'ZINT_CSTPORD_ROUTINES'
'FIND_SAP_PRODORD'
v_messg
p_zint_nw
lwa_01-ticketnumber. " RJS
continue.
endif.
Production Order WAS found... Continue creating IDOCS
lwa_hdrlevel-postg_date = lwa_01-ticketdate.
Obtain the storage location parameter value.
read table t_zint_param with key zint_fn = 'LGORT'.
if sy-subrc ne c_noerr.
perform write_log_entry
tables t_zint_mslog
using 'E' 'ZINT_CSTPORD_ROUTINES'
'PROCESS_INBOUND_DATA'
'Parameter LGORT is missing from ZINT_PARAM'
p_zint_nw
lwa_01-ticketnumber. " RJS
exit.
endif.
loop at l_it_05 into lwa_05
where ticketnumber = lwa_01-ticketnumber.
clear lwa_gm_item_create.
lva_filemat = lwa_05-material.
if lva_filemat eq lva_prodmat.
concatenate 'Command ticket-' lwa_05-ticketnumber
into lwa_hdrlevel-conf_text.
lwa_hdrlevel-conf_quan_unit = lwa_05-unitofmeasure.
lwa_hdrlevel-yield = lwa_05-quantity.
check whether the confirmed value + current delivery value is equal *
the production order qty. If the production order value is less
than the total delivered value, set final conf indicator and clear
reservations
lva_wemng = lva_wemng + lwa_05-quantity.
if lva_wemng < lva_psmng.
lwa_hdrlevel-clear_res = c_false.
lwa_hdrlevel-fin_conf = ' '.
else.
lwa_hdrlevel-clear_res = c_true.
lwa_hdrlevel-fin_conf = 'X'.
endif.
move: 'Z1BP_PP_HDRLEVEL' to t_idoc_data-segnam,
lwa_hdrlevel to t_idoc_data-sdata.
append t_idoc_data.
clear lva_formmat.
lva_formmat = lwa_05-material.
lwa_gm_item_create-material = lva_formmat.
lwa_gm_item_create-plant = lwa_03-plant.
lwa_gm_item_create-ref_date = lwa_01-ticketdate.
lwa_gm_item_create-prod_date = lwa_01-ticketdate.
lwa_gm_item_create-move_type = '101'.
lwa_gm_item_create-spec_stock = 'E'.
lwa_gm_item_create-sales_ord = lva_saleord.
lwa_gm_item_create-entry_qnt = lwa_05-quantity.
lwa_gm_item_create-entry_uom = lwa_05-unitofmeasure.
lwa_gm_item_create-orderid = lva_prodord.
lwa_gm_item_create-move_mat = lva_formmat.
lwa_gm_item_create-move_plant = lwa_03-plant.
lwa_gm_item_create-mvt_ind = 'F'.
clear t_idoc_data.
move: 'E1BP2017_GM_ITEM_CREATE' to t_idoc_data-segnam,
lwa_gm_item_create to t_idoc_data-sdata.
append t_idoc_data.
else.
clear: lva_loggr,
lva_formmat.
lva_formmat = lwa_05-material.
select single loggr into lva_loggr from marc
where matnr = lva_formmat
and werks = lwa_03-plant.
if sy-subrc ne 0.
clear v_messg.
No logistics handling group - log a warning message.
concatenate 'No logistics handling group for material'
lva_formmat
'in plant'
lwa_03-plant
into v_messg separated by space.
perform write_log_entry
tables t_ldata
using 'W' 'ZINT_CSTPORD_ROUTINES'
'PROCESS_INBOUND_DATA'
v_messg
p_zint_nw
lwa_01-ticketnumber. " RJS
clear lva_loggr.
endif.
if lwa_03-satsur eq 'T'.
lwa_e1edl21-lprio = 30.
else.
lwa_e1edl21-lprio = 20.
endif.
else.
if lwa_03-satsur eq 'T'.
lwa_e1edl21-lprio = 10.
else.
lwa_e1edl21-lprio = ' '.
endif.
endif.
lwa_e1edl21-berot = lwa_04-driver.
move: 'E1EDL21' to t_idoc_data-segnam,
lwa_e1edl21 to t_idoc_data-sdata.
append t_idoc_data.
lwa_e1edl55-qualf = '001'.
lwa_e1edl55-refnr = lva_saleord.
move: 'E1EDL55' to t_idoc_data-segnam,
lwa_e1edl55 to t_idoc_data-sdata.
append t_idoc_data.
Loop at materials - create delivery entry for each
loop at l_it_05 into lwa_05
where ticketnumber = lwa_01-ticketnumber.
clear t_idoc_data.
lwa_e1edl24-matnr = lwa_05-material.
lwa_e1edl24-werks = lwa_03-plant.
lwa_e1edl24-vfdat = lwa_01-ticketdate.
lwa_e1edl24-lfimg = lwa_05-quantity.
lwa_e1edl24-vrkme = lwa_05-unitofmeasure.
lwa_e1edl24-lgort = t_zint_param-zint_fv.
clear lva_loggr.
lva_formmat = lwa_05-material.
clear lva_loggr.
select single loggr into lva_loggr from marc
where matnr = lva_formmat
and werks = lwa_03-plant.
if sy-subrc ne 0.
No logistics handling group - log a warning message.
concatenate 'No logistics handling group for material'
lva_formmat
'in plant'
lwa_03-plant
into v_messg separated by space.
perform write_log_entry
tables t_ldata
using 'W' 'ZINT_CSTPORD_ROUTINES'
'PROCESS_INBOUND_DATA'
v_messg
p_zint_nw
lwa_01-ticketnumber. " RJS
lva_loggr = 'BBIN'.
endif.
if lva_loggr is initial.
move: 'E1EDL24' to t_idoc_data-segnam,
lwa_e1edl24 to t_idoc_data-sdata.
append t_idoc_data.
endif.
endloop.
clear: lva_xabln,
lva_vbeln,
l_vbfa.
Matching ticket against a Delivery?
select single xabln vbeln into (lva_xabln,lva_vbeln) from likp
where xabln = lwa_01-ticketnumber.
if sy-subrc = 0.
If found, does this delivery match the sales order?
select * from vbfa into l_vbfa
where vbelv = lva_saleord
and vbeln = lva_vbeln.
exit.
endselect.
endif.
No matching delivery found, or Matching delivery, but for other Sls Ord
if lva_xabln is initial
or ( lva_vbeln <> space and l_vbfa is initial ).
if not lva_saleord is initial.
perform create_delivery_idocs tables t_zint_mslog
using s_idcgp
lwa_01-ticketnumber
p_zint_nw.
else.
concatenate 'Error finding a Sales Order for ticket "'
lwa_01-ticketnumber
'" reprocess the file AFTER'
' the sales order issues have been fixed'
into lva_outtext.
perform write_log_entry tables t_zint_mslog
using 'E'
'ZINT_CSTPORD_ROUTINES'
'PROCESS_INBOUND_DATA'
lva_outtext
p_zint_nw
lwa_01-ticketnumber. " RJS
endif.
else.
concatenate 'Command Ticket "'
lwa_01-ticketnumber
'" has already been processed into delivery "'
lva_vbeln
into lva_outtext.
perform write_log_entry tables t_zint_mslog
using 'I'
'ZINT_CSTPORD_ROUTINES'
'PROCESS_INBOUND_DATA'
lva_outtext
p_zint_nw
lwa_01-ticketnumber. " RJS
refresh t_idoc_data.
endif.
endif.
refresh t_idoc_data.
Write out all messages collected so far
perform update_data tables t_zint_mslog
using p_zint_id p_zint_ty.
endloop.
Write out all messages collected so far
perform update_data tables t_zint_mslog
using p_zint_id p_zint_ty.
endform. " process_inbound_data
Thnaks
RegardsThanks
Thread closed -
IDoc creation on save and change of production order
I am looking for a way to create, and send if possible (if not I'll send with a batch job), on the save (creation and change) of production orders. This will be a modified LOIPRO iDoc. Currently we have a customer exit on the save of the production order but because it is before the save we must predict the number of the prod order. This has worked but now we are creating one production order per line item in a sales order (automatically) so this is causing us to predict the same production order number twice. We need a way to automatically create and send an iDoc for all production orders for given plants. Right now the solution we are looking at is creating an output type and running through those output types a few times a day, sending them down to the Shop Floor system (proprietary system).
Is there anything setup in SAP that we can utilize?
Regards,
DavisHi Rick,
Follow the below sample steps for changing component quantity:
DATA:
l_methods TYPE bapi_alm_order_method,
it_boperations TYPE STANDARD TABLE OF bapi_alm_order_operation_e WITH HEADER LINE,
it_components TYPE STANDARD TABLE OF bapi_alm_order_component_e WITH HEADER LINE,
it_components1 TYPE STANDARD TABLE OF bapi_alm_order_component WITH HEADER LINE.
1. Call BAPI :BAPI_ALM_ORDER_GET_DETAIL , it will give existing order component details.
CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'
EXPORTING
number = <production order number>
TABLES
et_operations = it_boperations
et_components = it_components
return = it_bapiret2.
2. Move it_components to components table compatibel to BAPI "BAPI_ALM_ORDER_MAINTAIN".
LOOP AT it_components.
MOVE-CORRESPONDING it_components TO it_components1.
_*"Note here while moving change the component quantity"*_
APPEND it_components1.
CLEAR it_components1.
ENDLOOP.
3. Build the methods table for change production order :
it_methods-refnumber = v_refnumber.
it_methods-objecttype = 'COMPONENT'.
it_methods-method = 'CHANGE'.
it_methods-objectkey = v_objectkey.
APPEND it_methods.
"Note v_refnumber has 1 to 1 relation ship with the components table, if you want to change First component in it_components1 then you have to enter value '1' here for v_refnumber.
it_methods-method = 'SAVE'.
APPEND it_methods.
4 . Call
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = it_methods
it_component = it_components1
return = it_bapiret2.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. -
Report based on Serial Number generated in the Production Order
Hi,
I wish to generate a Customized report, which shall include the total consumption based on Sales Order/Line Item/Serial Number/Production Order matching the Serial Number generated in the Production Order where in we can get the required data.
Need your help and suggestions in creating this report..
Thanks in advance..
Ashok Vardhan
Edited by: Ashok T Vardhan on Jan 19, 2012 11:38 AMHello Tman,
This is a slightly tricky question. The reason being, the report options like the report path etc, are set before you see the serial number prompt when you run your UUT. There might be other ways of getting around this, but a quick solution would be modifying the process model.
I modified the PreUUT callback to set the report options. I passed the reportOptions as a parameter to this sequence. In the PreUUT sequence, I set the following fields:
Parameters.ReportOptions.GeneratePath=False
Parameters.ReportOptions.ReportFilePath= "c:\\"+ Locals.SerialNumber +"\\report.xml"
I hope this would give you an idea.
SijinK
Maybe you are looking for
-
Get UserName / Userid Connected
Hello guys, Im' trying to get the name of the user currently connected in my app for using this username as a bind variable in a view object Query. I have set "Authentication type" and "Authorization type" to "Custom", so I have an administration mod
-
License Key installation - Error from database layer
when i am trying to install license key i am getting the following error message <b>"Error from database layer"</b> following are the values passed. SAP system = NSP Inst. Number = DEMOSYSTEM Hardware Kye = XXXXXX System Number = left balnk Expires o
-
Error when trying to use movers coupon
I have a movers coupon that I used earlier this week on a purchase that I then had to cancel (before it shipped). When I tried to reuse the coupon on the same day, for the corrected purchase the system told me that the coupon was used and cannot be r
-
Any way to acquire/install an older version of an app??
I have an original iPhone that I believe the last OS is 3.1.3? I did a check for update and it says there's nothing more so .... What I have an issue with is if I have an App that works on 3.1.3 and then the developer updates it to require 3.2, I ess
-
HP1536dnf Scan problem with Mac OSX 10.7.5
I have just installed the HP online download driver for my Mac computer (running Mac OSX 10.7) and the subject HP 1536dnf MFP; when attempting to operate the HP1536dnf Scan function from my MacBookPro; I get the following message: 192.168.0.6 is curr