Reworking Procedure in REM
Dear Friends,
I have confusion regarding rework order in case of REM :
How GR to be done against Rework Order in case of REM because I dont have parent Order as it is in the case of Discrete & further what should be the settlement receiver in case of REM scenario which we use Main order as settlement receiver in discrete.
Pls. guide me the detailed reworking procedure for REM.
Thanks & Regards,
Tejas
Dear Tejas Pujara,
Here you have 2 options,
Either try to book the component's and the activities consumed using component & activity backflush
respectively.
or else you have to go for a production order creation without material in CO07.Say you have made a GR
in backflush and found some problem in the quality check and you want to make some rework on the
same.So you can create a Prod.Order without material and assign the settlement rule and reciever
which can be a cost center or an order or the material.This you can decide as per your business
requirement.
You can confirm the order and close it,and no need to make a GR for this one.
Check and revert back.
Regards
Mangalraj.S
Similar Messages
-
hi,
how can i confirm rework operation in rem manufacturing.
already backflush happened.Dear Prakash,
Do you want to post the activities that have been used for the extra operation of a HALB or FERT material?
Then enter the material Part no and the radio button for activity backflush and by the options fetch Planned activites from routing or No
Planned activities from routing.
This extra amount spent can be checked in KKF6N in Product Cost collector of that material.
Regards
Mangalraj.S -
Rework Procedure for production order
Hi Gurus,
I'm creating order for rework thru CO07 n giving input, plant, order type n parent order but it's giving me error
Order type RW01 has internal number assignment (entry not required)
when I'm removing parent order from input normal rework order is getting created but not with reference to parent order
any suggestion?Hi,
The belows steps will be useful if u made GR for orginal order with total order qty & u want to rework for some of them
1.Create Rework order without material at CO07 with out material .
2. Assign the settlement receiver as orginal production order at settlement rule.
3. Assign the rework material & component if needed at rework order & assign the issue storage location (unrest- use storage location above).
4. Do the confirmation for rework order & rework material will be issued from stock to order
5. GR will not be done for rework order.To get stock for reworked material Do the GR for orginal order
6. Settle the rework order first & and orginal order.
Hope this helps.
Regards,
Tejas -
REM: production tracking, rework, and in-process inspection
Gurus,
I have three issues with REM, and I have my own views on them:
1. Rework: In case of discrete manufacturing with the help of trigger functions we can generate an operation (in the same order) or a rework order to cary out reprocessing. But in case of REM we cannot achieve this because there would be no order for inserting new operation and since it is REM we should not generate a new order. The only way is to manually backflush the activities and components (without any reporting point).
2. Tracking: In case of discrete we have a set of system generated production orders through we can track the GRs, confirmations and issues. But in case of REM we can track those parameters only against cost collector. Only way to know the pending activities is to carry out backflushing against planned orders (which are subjected to reduction) and check pending GR/GI/Operations with the help of the remaining planned orders. Are there any standard reports on that?
3. In-process Inspection: Can be achieved through inspection type 13 and lot needs to be generated through t-code MFPR.
Kindly let me know if my understandings are correct. Please let me know if there are other way arounds in Standard SAP.
Thanks in advance!
SnigdhoHI
As In discrete there is no Rework order in REM.For Tracking you need to assign the Planned order to the Prdocution versions in Planning table thru MF50 and then Backflush against the planned order .Check report MCP6/ MCP8 for GR against planned orders.
Inprocess inspection can be done thru 13 and lot generation is done thru MFPR.
hope it is useful.
Regards
Anupam Sharma -
Dear Gurus,
I am working in REM scenario and i have to map rework scenario in REM.
Following is the scenario1:
1) Final Assembly got rejected in quality inspection.
2) Some rework is required on the Assembly to make it OK which requires some material and operation.
___Scenario2___
1) Final Assembly got rejected in quality inspection and it is found that it cant be repaired rather it can be dismantle and some components can be retrieved so that they can be utilized in future for the regular production and to be sent back to store department.
Kindly give your valuable suggestions to map above mentioned scenario.
With Regards.Hi,
Rework is can not be handled in REM like that in Descrete Manufacturing.
If you have consumed additional components then do the Component Backflush.
Same for additional activity in Activity Backflush in MFBF.
If not you can have a Rework Production Order created fo this to capture the addtionl components and Activities..
Hope his helps,,
Regards,
Siva -
Unable to automatically assign batch numbers in REM upon confirmation
Hi expert,
I did all required configuration:
the batch level is Material (OMCT)
internal Batch Number Assignment is activated (OMCZ)
Define Batch Creation For Mvt is set to C for type 131
Define Initial Creation of Data for Batch Master Transactions is set to C for my material type
the indicator for BM is set in the view Plant Data/Storage Location for the material/SL
But still when I confirme my production with MF42N, the system is not getting the internal number range for the batch.
Any idea why?Hi,
U can assign the Batch Number for Finished material at MFBF screen . For Components batch number check with "Postwith correction screen " of MFBF. If u set bacth search procedure at REM profile batch number for Components will com automatically.
SPRO>LOGISTICS>PRODUCTION>REM>BACKFLUSHING>MAINTAIN GLOBAL SETTINGS FOR CONFIRM. & LIS> BATCH CLASSIFICATION ACTIVE FIELD.
Use the field value as '1'.
Maintain Batch search procedure at control data tap2 in REM profile (SPRO) which will be assigned to Finished material.
Please try and come back.
Regards,
R.Brahmankar -
Rework process order without price calculation
Hi friends,
Our client at present rework process order done through edit or change or add the a BOM manually from the T.code COR1, because of that my costing has been changed hugely it will hit my price diff account, After Costing run price will change 10 to 50 Rs like that.
How to do without price calculation for the rework process order ,please provide the solution for this requirements.
Thanks &Regards,
Sabhapathy Rhi
the purpose of process order w/o material
If you want to use a process order for a reworking procedure
If you want to use a cleanout recipe
t code CORO
create a order w/o material for rework qty
Make the same entries as described under Creating a Process Order With a Material. Once you have created the process order, the system will copy all the data from your master recipe, but not the material list.
maintain settlement cat,receiver and % in parent order
carryout goods movement for rework qty
deva -
Hello All,
Can someone tell me where do I specify Batch Numbers for Components and Final Assembly in Repetetive Manufacturing. In discrete Manufacturing (inside Production Order), when I click BOM, the bom shows up and Batch number field shows next to components which are Batch Managed. But in Repetetive manufacturing inside 'Planned Order', when I clicked BOM, it showed me the BOM components, but did not show me the field next to them where I could put a Batch number for the components, managed by batches.
Can someone throw some light.
thanks in advance,
SachinHi,
U can assign the Batch Number for Finished material at MFBF screen . For Components batch number check with "Postwith correction screen " of MFBF. If u set bacth search procedure at REM profile batch number for Components will com automatically.
Pradeep -
While running utlrp in 11.2.0.2 database, errors are seen
SQL> @utlrp.sql
TIMESTAMP
COMP_TIMESTAMP UTLRP_BGN 2011-06-10 22:13:37
DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
PL/SQL procedure successfully completed.
TIMESTAMP
COMP_TIMESTAMP UTLRP_END 2011-06-10 22:16:18
DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
71
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
ERRORS DURING RECOMPILATION
22
Function created.
PL/SQL procedure successfully completed.
Function dropped.
ORDIM registered 0 XML schemas.
The following XML schemas are not registered:
http://xmlns.oracle.com/ord/dicom/UIDdefinition_1_0
http://xmlns.oracle.com/ord/dicom/anonymity_1_0
http://xmlns.oracle.com/ord/dicom/attributeTag_1_0
http://xmlns.oracle.com/ord/dicom/constraint_1_0
http://xmlns.oracle.com/ord/dicom/datatype_1_0
http://xmlns.oracle.com/ord/dicom/manifest_1_0
http://xmlns.oracle.com/ord/dicom/mapping_1_0
http://xmlns.oracle.com/ord/dicom/mddatatype_1_0
http://xmlns.oracle.com/ord/dicom/metadata_1_0
http://xmlns.oracle.com/ord/dicom/orddicom_1_0
http://xmlns.oracle.com/ord/dicom/preference_1_0
http://xmlns.oracle.com/ord/dicom/privateDictionary_1_0
http://xmlns.oracle.com/ord/dicom/rpdatatype_1_0
http://xmlns.oracle.com/ord/dicom/standardDictionary_1_0
http://xmlns.oracle.com/ord/meta/dicomImage
http://xmlns.oracle.com/ord/meta/exif
http://xmlns.oracle.com/ord/meta/iptc
http://xmlns.oracle.com/ord/meta/ordimage
http://xmlns.oracle.com/ord/meta/xmp
ORDIM DICOM repository has 0 documents.
The following default DICOM repository documents are not installed:
ordcman.xml
ordcmcmc.xml
ordcmcmd.xml
ordcmct.xml
ordcmmp.xml
ordcmpf.xml
ordcmpv.xml
ordcmsd.xml
ordcmui.xml
PL/SQL procedure successfully completed.
Please suggest .
RegardsI am also facing below issue while running UTLRP in 11.1.0.7
SQL> Rem Run component validation procedure
SQL> Rem =====================================================================
SQL>
SQL> EXECUTE dbms_registry_sys.validate_components;
ORDIM INVALID OBJECTS: CODE_SEQUENCE253_T - 5 - 13
ORDIM INVALID OBJECTS: CODE_SEQUENCE255_COLL - 5 - 13
ORDIM INVALID OBJECTS: CODE_SQ254_T - 5 - 13
ORDIM INVALID OBJECTS: ORD_DICOM_HEADER257_T - 5 - 13
ORDIM INVALID OBJECTS: MEDIA_STORAGE_SOP_CLASS259_T - 5 - 13
ORDIM INVALID OBJECTS: MEDIA_STORAGE_SOP_INSTA260_T - 5 - 13
ORDIM INVALID OBJECTS: TRANSFER_SYNTAX_UID261_T - 5 - 13
ORDIM INVALID OBJECTS: IMPLEMENTATION_CLASS_UI262_T - 5 - 13
ORDIM INVALID OBJECTS: IMPLEMENTATION_VERSION_263_T - 5 - 13
ORDIM INVALID OBJECTS: SOURCE_APPLICATION_ENTI264_T - 5 - 13
ORDIM INVALID OBJECTS: FILE_META_HEADER258_T - 5 - 13
ORDIM INVALID OBJECTS: NAME267_T - 5 - 13
ORDIM INVALID OBJECTS: ID268_T - 5 - 13
ORDIM INVALID OBJECTS: BIRTH_DATE269_T - 5 - 13
ORDIM INVALID OBJECTS: SEX270_T - 5 - 13
ORDIM INVALID OBJECTS: PATIENT266_T - 5 - 13
ORDIM INVALID OBJECTS: INSTANCE_UID272_T - 5 - 13
ORDIM INVALID OBJECTS: DATE273_T - 5 - 13
ORDIM INVALID OBJECTS: TIME275_T - 5 - 13
ORDIM registered 0 XML schemas.
The following XML schemas are not registered:
http://xmlns.oracle.com/ord/dicom/UIDdefinition_1_0
http://xmlns.oracle.com/ord/dicom/anonymity_1_0
http://xmlns.oracle.com/ord/dicom/constraint_1_0
http://xmlns.oracle.com/ord/dicom/datatype_1_0
http://xmlns.oracle.com/ord/dicom/mapping_1_0
http://xmlns.oracle.com/ord/dicom/mddatatype_1_0
http://xmlns.oracle.com/ord/dicom/metadata_1_0
http://xmlns.oracle.com/ord/dicom/orddicom_1_0
http://xmlns.oracle.com/ord/dicom/preference_1_0
http://xmlns.oracle.com/ord/dicom/privateDictionary_1_0
http://xmlns.oracle.com/ord/dicom/rpdatatype_1_0
http://xmlns.oracle.com/ord/dicom/standardDictionary_1_0
http://xmlns.oracle.com/ord/meta/dicomImage
http://xmlns.oracle.com/ord/meta/exif
http://xmlns.oracle.com/ord/meta/iptc
http://xmlns.oracle.com/ord/meta/ordimage
http://xmlns.oracle.com/ord/meta/xmp
ORDIM DICOM repository has 0 documents.
The following default DICOM repository documents are not installed:
ordcman.xml
ordcmcmc.xml
ordcmcmd.xml
ordcmct.xml
ordcmmp.xml
ordcmpf.xml
ordcmpv.xml
ordcmsd.xml
ordcmui.xml
Invoking Ultra Search Install/Upgrade validation procedure VALIDATE_WK
Ultra Search VALIDATE_WK done with no error
PL/SQL procedure successfully completed.
Elapsed: 00:00:01.09
SQL> SET serveroutput off
SQL>
SQL>
SQL> Rem ===========================================================================
SQL> Rem END utlrp.sql
SQL> Rem ===========================================================================
Please suggest how to solve this.
manually compilation also not helping
Regards,
-Ravi. -
Hi, I really searched for the sample code for HR schema, I could not find it, does anybody have the code with him?
I really need it :)
thank you.Hi,
for Oracle10g ... it should be written to the [ORACLE_HOME]\demo\schema\human_resources\hr_code.sql
Anyway....
Rem
Rem $Header: hr_code.sql 29-aug-2002.11:44:01 hyeh Exp $
Rem
Rem hr_code.sql
Rem
Rem Copyright (c) 2001, 2002, Oracle Corporation. All rights reserved.
Rem
Rem NAME
Rem hr_code.sql - Create procedural objects for HR schema
Rem
Rem DESCRIPTION
Rem Create a statement level trigger on EMPLOYEES
Rem to allow DML during business hours.
Rem Create a row level trigger on the EMPLOYEES table,
Rem after UPDATES on the department_id or job_id columns.
Rem Create a stored procedure to insert a row into the
Rem JOB_HISTORY table. Have the above row level trigger
Rem row level trigger call this stored procedure.
Rem
Rem NOTES
Rem
Rem CREATED by Nancy Greenberg - 06/01/00
Rem
Rem MODIFIED (MM/DD/YY)
Rem hyeh 08/29/02 - hyeh_mv_comschema_to_rdbms
Rem ahunold 05/11/01 - disable
Rem ahunold 03/03/01 - HR simplification, REGIONS table
Rem ahunold 02/20/01 - Created
Rem
SET FEEDBACK 1
SET NUMWIDTH 10
SET LINESIZE 80
SET TRIMSPOOL ON
SET TAB OFF
SET PAGESIZE 100
SET ECHO OFF
REM **************************************************************************
REM procedure and statement trigger to allow dmls during business hours:
CREATE OR REPLACE PROCEDURE secure_dml
IS
BEGIN
IF TO_CHAR (SYSDATE, 'HH24:MI') NOT BETWEEN '08:00' AND '18:00'
OR TO_CHAR (SYSDATE, 'DY') IN ('SAT', 'SUN') THEN
RAISE_APPLICATION_ERROR (-20205,
'You may only make changes during normal office hours');
END IF;
END secure_dml;
CREATE OR REPLACE TRIGGER secure_employees
BEFORE INSERT OR UPDATE OR DELETE ON employees
BEGIN
secure_dml;
END secure_employees;
ALTER TRIGGER secure_employees DISABLE;
REM **************************************************************************
REM procedure to add a row to the JOB_HISTORY table and row trigger
REM to call the procedure when data is updated in the job_id or
REM department_id columns in the EMPLOYEES table:
CREATE OR REPLACE PROCEDURE add_job_history
( p_emp_id job_history.employee_id%type
, p_start_date job_history.start_date%type
, p_end_date job_history.end_date%type
, p_job_id job_history.job_id%type
, p_department_id job_history.department_id%type
IS
BEGIN
INSERT INTO job_history (employee_id, start_date, end_date,
job_id, department_id)
VALUES(p_emp_id, p_start_date, p_end_date, p_job_id, p_department_id);
END add_job_history;
CREATE OR REPLACE TRIGGER update_job_history
AFTER UPDATE OF job_id, department_id ON employees
FOR EACH ROW
BEGIN
add_job_history(:old.employee_id, :old.hire_date, sysdate,
:old.job_id, :old.department_id);
END;
COMMIT;My greetings,
Sim -
hi
in rem at mfbf screen where we can confirm rework quantity
and how to see confirmations after mfbf
plz suggest how to perdorm rework at rem
regards
sasikanthHello,
sending herewith earlier thread on the same issue.
activation of failure cost in REM with Rework
Posted: Sep 3, 2007 10:56 AM E-mail this message Reply
Hello PP experts ,
Please let me know How to activate the failure cost ( FCOST) in REM scenario.
We have a scenario, where we want to start failure cost accounting in REM.
The production person is using MFBF for production confirmation.
In MFBF, the production person will do the confirmation under rework and then the same material no will appear in FCOST for further work.
Here in FCOST, you can confirm the same as scrap OR good ( from rework).
Waiting for your reply.
Regards,
Ravindra Deokule
Mangalraj
Posts: 1,660
Registered: 5/8/07
Forum Points: 3,310
Solved problem (10)
Very helpful answer (6)
Helpful answer (2)
Re: activation of failure cost in REM with Rework
Posted: Sep 3, 2007 11:24 AM in response to: ravindra deokule E-mail this message Reply
Dear Mr.Ravindra,
Do you want to track the amount for the extra activities done for a material apart
from the planned activities?
Can you explain me,what's the meaning for Failure cost?
Regards
Mangal
ravindra deokule
Posts: 61
Registered: 8/28/07
Forum Points: 0
Re: activation of failure cost in REM with Rework
Posted: Sep 3, 2007 11:37 AM in response to: Mangalraj E-mail this message Reply
Yes , you are right. I want to track the extra material and extra activities required for manufacturing.
These are the activities , which are additional from the planned ones.
This will be considered as a failure cost.
Prasobh Karunak...
Posts: 2,451
Registered: 9/1/06
Forum Points: 4,476
Unassign
Solved problem (10)
Very helpful answer (6)
Helpful answer (2)
Re: activation of failure cost in REM with Rework
Posted: Sep 3, 2007 11:45 AM in response to: ravindra deokule E-mail this message Reply
Ravindra,
I have not configured, but here is the theory behind this, Hope this helps
Making Settings for Failure Cost Processing ...
Use
A few basic settings need to be made before you can use the functions in failure cost processing.
For production orders, carry out the step Activating Failure Cost Processing for Production Orders.
For repetitive manufacturing, carry out the step Activating Failure Cost Processing for Repetitive Manufacturing.
To control the valuation of rework quantities, carry out the step Settings for Failure Cost Processing. These settings are optional.
The step User-Defined Error Management enables you to customize how messages are output in the valuation of failure cost documents. These settings are optional.
Prerequisites
For the failure cost cockpit and for reporting, activate the BAdI FCO_COCKPIT_FUNCT.
Production Orders
For confirmations, activate the BAdI WORKORDER_CONFIRM with the implementation FCO_CREATE_DOCUMENT.
For processing rework quantities, activate the BAdI WORKORDE_REWORK with the implementation FCO_GET_REWORK_QUANT.
Repetitive Manufacturing
For repetitive manufacturing, the following BAdIs must be activated:
FCO_CO_FUNCTIONS
FCO_CUSTOMER_SPECIF
Procedure To Activate Failure Cost Processing for Production Orders
Start transaction FCOACTIV_SFC Activate Failure Cost Processing.
Activate Failure Cost Processing for the required plants and order types.
Choose Save.
To Activate Failure Cost Processing for Repetitive Manufacturing
Start transaction FCOACTIV_REM Activate Failure Cost Processing.
Activate failure cost processing for the required plants.
Choose Save.
Settings for Failure Cost Processing
Performance considerations may make it advisable not to valuate rework quantities. In this step you can define how the rework quantities ? and consequently the failure cost documents ? are valuated.
Start transaction FCOSETTINGS Settings for Failure Cost Processing.
If you select the indicator No Valuation, the rework quantities are not valuated.
You can choose whether valuation is executed with or without planned scrap.
You can choose whether summarization is performed.
Choose Save.
User-Defined Error Management
For each message displayed in the valuation of failure cost documents, you can specify here whether the message is output with one of the following message types or is suppressed completely:
Information
Warning
Error
Termination
Start transaction OPR4_FCO User-Defined Messages: Failure Cost Cockpit.
The list shows the application area and the message text for each message.
You can assign the message types in the Message Type column using the input help.
Restore Default restores the original default settings.
You do not need to save the settings.
Result
If you have activated failure cost processing for production orders or repetitive manufacturing, then:
A failure cost document is generated for each scrap backflush. This document can be displayed and valuated in failure cost processing.
Rework processing is activated with the failure cost cockpit.
If you activate Failure Cost Processing, you cannot use the classical rework functionality for production orders. -
Error while creating a procedure (PLS-00103)
Hi Am create the follwing Procedure:-
create or replace PROCEDURE XL_SP_ROGUEUSERS (
csrresultset_inout IN OUT sys_refcursor,
intuserkey_in IN NUMBER,
strsortcolumn_in IN VARCHAR2,
strsortorder_in IN VARCHAR2,
intstartrow_in IN NUMBER,
intpagesize_in IN NUMBER,
intdocount_in IN NUMBER,
inttotalrows_out OUT NUMBER,
strfiltercolumnlist_in IN VARCHAR2,
strfiltercolumnvaluelist_in IN VARCHAR2,
strudfcolumnlist_in IN VARCHAR2,
strudfcolumnvaluelist_in IN VARCHAR2,
struserlogin_in IN VARCHAR2,
strfirstname_in IN VARCHAR2,
strlastname_in IN VARCHAR2,
strdate_in IN VARCHAR2
AS
BEGIN
DECLARE
whereclause VARCHAR2(8000);
select_stmt VARCHAR2(8000);
strColumnList VARCHAR2(4000);
strDateFormat VARCHAR2 (80);
strFromClause VARCHAR2(4000);
strWhereClause VARCHAR2(4000);
strOrderByClause VARCHAR2(2000);
intSortDirection_in PLS_INTEGER;
entsum varchar2(20) := 'Entitlements Summary';
str_row EXCEPTION;
do_cnt EXCEPTION;
no_logged_in_user EXCEPTION;
property_not_found EXCEPTION;
pragma exception_init(Str_row,-20001);
pragma exception_init(Do_cnt,-20002);
pragma exception_init(no_logged_in_user,-20003);
BEGIN
-- Throw exception if the start row or page size is either NULL or have
-- values less than or equal to zero
IF (intstartrow_in <= 0 OR intpagesize_in <= 0 OR intstartrow_in IS NULL OR intpagesize_in IS NULL)
THEN
RAISE str_row;
END IF;
-- Throw exception if the intdocount_in parameter is NULL or has a value
-- other than 0 and 1
IF intdocount_in NOT IN (0, 1, 2) OR intdocount_in IS NULL
THEN
RAISE do_cnt;
END IF;
-- Throw exception if the intuserkey_in (logged in user) parameter is NULL
IF intuserkey_in IS NULL or intuserkey_in <= 0
THEN
RAISE no_logged_in_user;
END IF;
-- Now, we start accumulating the whereclause based on the input
-- parameters, performing error checking along the way.
--Organization Permissioning.
/* whereclause := ' and usr.act_key IN (SELECT DISTINCT act2.act_key FROM '||
' act act2, aad, usg, ugp, usr usr5 '||
' WHERE act2.act_key = aad.act_key '||
' and aad.ugp_key = usg.ugp_key '||
' and ugp.ugp_key = usg.ugp_key'||
' and usg.usr_key = usr5.usr_key'||
' and usr5.usr_key = '||intuserkey_in||')'; */
IF strfiltercolumnlist_in IS NOT NULL AND
strfiltercolumnvaluelist_in IS NOT NULL THEN
whereclause := whereclause
|| xl_sfg_parseparams(strfiltercolumnlist_in,
strfiltercolumnvaluelist_in);
END IF;
IF struserlogin_in IS NOT NULL THEN
whereclause := whereclause
|| ' AND UPPER(usr.usr_login) LIKE '
|| UPPER (''''||struserlogin_in||'''')
|| ' ';
END IF;
IF strudfcolumnlist_in IS NOT NULL AND
strudfcolumnvaluelist_in IS NOT NULL THEN
whereclause := whereclause
|| xl_sfg_parseparams(strudfcolumnlist_in,
strudfcolumnvaluelist_in);
END IF;
-- Perform the count query and store the result in inttotalrows_out
inttotalrows_out := 0;
IF intdocount_in IN (1,2) THEN
EXECUTE IMMEDIATE ' select count(*) from((SELECT upper(rcd.RCD_VALUE) as "User ID" '|| ' FROM rce, obj, rcd, orf '||
' WHERE '||
' RCE_STATUS like 'No Match Found' '||
' AND ((orf.ORF_FIELDNAME like 'User ID') or (orf.ORF_FIELDNAME like 'User%Login')) '||
' AND rce.OBJ_KEY = obj.OBJ_KEY '||
' AND rce.RCE_KEY = rcd.RCE_KEY '||
' AND rcd.ORF_KEY = orf.ORF_KEY '||
' ) '||
' MINUS '||
' (SELECT usr.USR_LOGIN FROM usr '||
' WHERE '||
' usr.USR_STATUS like 'Active')) '||
whereclause INTO inttotalrows_out;
-- UI needs the SP to return result set always. The following is returned
-- when the indocount is 2 which does not return any result set but count
IF intdocount_in = 2 THEN
select_stmt := 'SELECT ''dummy'' FROM dual';
OPEN csrresultset_inout FOR select_stmt;
END IF;
END IF;
-- If intdocount_in is 2, UI just wants to get the totalrows to give
-- the warning to users if the result set exceeds the limit set by
-- UI. When ntdocount_in is 2, the following block won't be executed.
IF intdocount_in IN (0,1) THEN
-- Construct the select query by calling XL_SPG_GetPagingSql.
-- This is the main query for this stored procedure
strOrderByClause := ' usr.usr_login';
--strOrderByClause := ' req.req_key';
IF strsortorder_in = 'DESC' THEN
intSortDirection_in := 0;
ELSE
intSortDirection_in := 1;
END IF;
XL_SPG_GetPagingSql(strColumnList,
strFromClause,
whereclause,
strOrderByClause,
intSortDirection_in,
intStartRow_in,
intPageSize_in,
select_stmt
OPEN csrresultset_inout FOR select_stmt;
END IF;
-- Exception Handling
EXCEPTION
WHEN Str_row THEN
RAISE_APPLICATION_ERROR(sqlcode,
'Start Row/Page Size cannot be NULL OR less than or equal to zero ');
WHEN Do_cnt THEN
RAISE_APPLICATION_ERROR(sqlcode,
'Do Count must be 0, 1 or 2. ');
WHEN no_logged_in_user THEN
RAISE_APPLICATION_ERROR(sqlcode,
'Logged-in User Key cannot be NULL OR less than or equal to zero ');
END;
end XL_SP_ROGUEUSERS;
But Am getting the following error message, I couldn't figure wat it is.Can anyone help me:-
PLS-00103: Encountered the symbol "NO" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem return returning <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between into using || bulk member SUBMULTISET_Please use tags when posting code. Also please format the code so that blocks line up vertically - often that makes syntax errors like missing END IFs etc much easier to spot.
-
DDL statements and dynamic sql in stored procedure
I created a stored procedure to create and drop tables, using dynamic sql.
When I try to do the inserts using dynamic sql, i.e
v_string := 'INSERT statement';
EXECUTE IMMEDIATE v_string;
I get the following error message:
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at line 63
Line 63 happens to be the line that the EXECUTE IMMEDIATE v_string; statement is in.
I am able to describe the table that the inserts are being made into, so I know that the table exists.
Any idea why I'm getting this error message would be appreciated.Yes I do and I have been able to create other tables using dynamic sql.
The table that I am having problems with SELECTs data from another table to get its column values; within the SELECT statement, the CAST function is used:
ie. CAST(CASE SUBSTR(CAST(E_MOD AS VARCHAR(7)),2,3)
WHEN 'AAA' THEN 'A55'
ELSE ............
I get the following error message:
ERROR at line 18: (this line starts the CAST statement)
ORA-06550: line 18, column 13:
PLS-00103: Encountered the symbol "AAA" when expecting one of the following:
. ( * @ % & = - + ; < / > at in is mod not rem return
returning <an exponent (**)> <> or != or ~= >= <= <> and or
like between into using || bulk
When I remove the quotes or add another single quote, the same error cascades to 'A55'.
After doing the same for the next error, I get the error message below:
ERROR at line 1: (this line has the EXECUTE IMMEDIATE statement)
ORA-00936: missing expression
ORA-06512: at line 6
Any idea what the problem could be?
Also is there another way to have DDL statements as stored procedures other than using dynamic sql or the DBMS_SQL package? -
Returning 2D array from a stored procedure
hi,
i'm trying to return a nested table from a procedure.can any one help me out i'm getting the fallowing error.
SQL> ed
Wrote file afiedt.buf
1 declare
2 TYPE data_t IS TABLE OF NUMBER
3 INDEX BY PLS_INTEGER;
4 TYPE array_t IS TABLE OF data_t
5 INDEX BY PLS_INTEGER;
6 array array_t;
7 begin
8 Sp_test(123,'12-jan-08',array);
9 dbms_output.put_line(array (10) (1));
10* end;
11 /
Sp_test(123,'12-jan-08',array);
ERROR at line 8:
ORA-06550: line 8, column 1:
PLS-00306: wrong number or types of arguments in call to
'SP_TEST
ORA-06550: line 8, column 1:
PL/SQL: Statement ignored
The procedure is
CREATE OR REPLACE PROCEDURE Sp_test(S_KEY NUMBER,V_DATE DATE, array_out OUT array_t) as....Below is the error i got when using the above suggestion.
SQL> ED
Wrote file afiedt.buf
1 DECLARE
2 TYPE data_t IS TABLE OF NUMBER
3 INDEX BY PLS_INTEGER;
4 TYPE array_t IS TABLE OF data_t
5 INDEX BY PLS_INTEGER;
6 begin
7 Sp_test(123,'12-jan-08',array REPORT.ARRAY_T);
8 dbms_output.put_line(array (10) (1));
9* end;
10 /
Sp_test(123,'12-jan-08',array REPORT.ARRAY_T);
ERROR at line 7:
ORA-06550: line 7, column 32:
PLS-00103: Encountered the symbol "REPORT" when expecting one of the
following:
. ( ) , * @ % & | = - + < / > at in is mod not range rem =>
.. <an exponent (**)> <> or != or ~= >= <= <> and or like
between ||
The symbol "." was substituted for "REPORT" to continue. -
How to call a Oracle Stored Procedure from Excel?
Hi,
I am new to Oracle database programming.I have an application in excel which has to update info in every row to the database.I am calling a stored procedure in excel for this.The stored procedure is as follows which is executing without a hitch in Oracle:
CREATE OR REPLACE PROCEDURE APD_MASS_UPLOAD_UNITS
(PRODUCT_ID VARCHAR2,Product_Code VARCHAR2, str_Adpt_Grp VARCHAR2,str_Adpt_Type VARCHAR2,
str_PDC VARCHAR2,str_Release_ID VARCHAR2,str_Created_by VARCHAR2,
str_Last_Updated_By VARCHAR2, dt_created_Date VARCHAR2,dt_Last_Updated_Date VARCHAR2,
StrMonth1 VARCHAR2,strMth2 VARCHAR2,StrMth3 VARCHAR2,StrMth4 VARCHAR2,
StrMth5 VARCHAR2,StrMth6 VARCHAR2,Sample Varchar2,str_message OUT Varchar2)
AS
type Month_type is table of VARCHAR2(10) index by binary_integer;
str_month Month_Type;
Fac_ID VARCHAR2(20);
Org_ID VARCHAR2(20);
Cnt_Units NUMBER;
i_POS NUMBER;
i_Month NUMBER;
i_UNITS NUMBER;
CURSOR C1 IS
SELECT * FROM TBLLINE_ADOPT_PLAN WHERE SPEC_ID = Product_ID AND
ADOPT_GROUP = str_Adpt_Grp AND ADOPT_TYPE = str_Adpt_Type
AND RELEASE_ID = APD_Get_Release_ID(str_PDC,str_Release_Id);
CURSOR C2 IS
SELECT FACILITY_ID FROM TBLADOPT_GROUP_CSC WHERE ADOPT_GROUP = str_Adpt_Grp;
CURSOR C3 IS
SELECT ORG_ID FROM APD_DV_PRODUCT_V WHERE SPEC_ID = Product_ID;
CURSOR C4 IS
SELECT * FROM TBLPROD_CSC WHERE PROD_SPEC_ID = Product_ID;
Adopt_Rec C1%ROWTYPE;
Fac_Rec C2%ROWTYPE;
PMORG_REC C3%ROWTYPE;
CSC_Rec C4%ROWTYPE;
i_Count NUMBER;
Message VARCHAR2(20);
BEGIN
Message := APD_SPECID_VALIDATE(Product_ID,Product_code,Str_PDC, str_Release_ID);
IF TRIM(Message) is null then
OPEN C1;
FETCH C1 INTO Adopt_Rec;
IF C1%NOTFOUND THEN
INSERT INTO TBLLINE_ADOPT_PLAN (SPEC_ID,ADOPT_GROUP, ADOPT_TYPE,RELEASE_ID, SAMPLES,CREATED_BY,CREATED_DATE, LAST_UPDATED_BY,LAST_UPDATED_DATE,SAMPLE_ONLY_IND, GRID_TYPE_CD) VALUES
(Product_ID,str_Adpt_Grp ,str_Adpt_Type,
APD_Get_Release_ID(str_PDC,str_Release_Id), 0,str_Created_By,
TO_DATE(dt_Created_Date,'DD/MM/YYYY'),str_Last_Updated_By,
TO_DATE(dt_Last_Updated_Date,'DD/MM/YYYY'),'N','C');
END IF;
CLOSE C1;
str_Month(1) := strMonth1;
str_Month(2) := strMth2;
str_Month(3) := strMth3;
str_Month(4) := strMth4;
str_Month(5) := strMth5;
str_Month(6) := strMth6;
OPEN C2;
FETCH C2 INTO Fac_REC;
Fac_ID := Fac_Rec.FACILITY_ID;
CLOSE C2;
OPEN C3;
FETCH C3 INTO PMORG_Rec;
Org_ID := PMORG_Rec.Org_ID;
CLOSE C3;
OPEN C4;
FETCH C4 INTO CSC_Rec;
IF C4%NOTFOUND THEN
INSERT INTO TBLPROD_CSC(PROD_SPEC_ID,CSC_FACILITY_ID, PROFIT_CENTER_CD,DEFAULT_IND, CREATED_BY, CREATED_DATE, LAST_UPDATED_BY, LAST_UPDATED_DATE) VALUES
(Product_ID , Fac_ID,Org_id, 'N', str_Created_by ,
To_date ( dt_Created_Date,'DD/MM/YYYY') ,str_Last_updated_by ,
To_Date (dt_Last_Updated_Date ,'DD/MM/YYYY'));
END IF;
CLOSE C4;
IF Sample > 0 Then
UPDATE TBLLINE_ADOPT_PLAN
SET SAMPLES = Sample
WHERE SPEC_ID = Product_ID AND
ADOPT_GROUP = str_adpt_grp AND
ADOPT_TYPE = str_Adpt_Type AND
RELEASE_ID = APD_Get_Release_ID(str_PDC,str_Release_Id);
END IF;
str_Message := 'Updated';
END IF;
END;
The code to call the stored procedure in Excel is as follows:
Dim Conn As New ADODB.Connection
Dim InputParam1 As New ADODB.Parameter
Dim InputParam2 As New ADODB.Parameter
Dim InputParam3 As New ADODB.Parameter
Dim InputParam4 As New ADODB.Parameter
Dim InputParam5 As New ADODB.Parameter
Dim InputParam6 As New ADODB.Parameter
Dim InputParam7 As New ADODB.Parameter
Dim InputParam8 As New ADODB.Parameter
Dim InputParam9 As New ADODB.Parameter
Dim InputParam10 As New ADODB.Parameter
Dim InputParam11 As New ADODB.Parameter
Dim InputParam12 As New ADODB.Parameter
Dim InputParam13 As New ADODB.Parameter
Dim InputParam14 As New ADODB.Parameter
Dim InputParam15 As New ADODB.Parameter
Dim InputParam16 As New ADODB.Parameter
Dim InputParam17 As New ADODB.Parameter
Dim InputParam18 As New ADODB.Parameter
Dim OutputParam As New ADODB.Parameter
Dim Mth1, Mth2, Mth3, Mth4, Mth5, Mth6 As String
Dim Rs_data As New ADODB.Recordset
Conn.ConnectionString = ("Provider=MSDAORA.1;User ID=" & "cnbg" & ";PASSWORD=" & "cnbg" & ";Data Source=" & "DAQ01" & ";Persist Security Info=False")
Conn.Open
OraCmd.ActiveConnection = Conn
OraCmd.CommandText = "APD_MASS_UPLOAD_UNITS"
OraCmd.CommandType = adCmdStoredProc
Conn.CursorLocation = adUseClient
OraCmd.Parameters.Refresh
Set InputParam1 = OraCmd.CreateParameter("Product_ID", adVarChar, adParamInput, 20)
InputParam1.Value = spec_id
Set InputParam2 = OraCmd.CreateParameter("Product_code", adVarChar, adParamInput, 20)
InputParam2.Value = str_product_code
Set InputParam3 = OraCmd.CreateParameter("str_Adpt_Type", adVarChar, adParamInput, 10)
InputParam3.Value = Adopt_Group
Set InputParam4 = OraCmd.CreateParameter("str_Adpt_Type", adVarChar, adParamInput, 10)
InputParam4.Value = Adopt_Type
Set InputParam5 = OraCmd.CreateParameter("str_pdc", adVarChar, adParamInput, 10)
InputParam5.Value = ThisWorkbook.strDbPDC
Set InputParam6 = OraCmd.CreateParameter("str_Release_ID", adVarChar, adParamInput, 10)
InputParam6.Value = str_Release_Id
Set InputParam7 = OraCmd.CreateParameter("str_created_by", adVarChar, adParamInput, 10)
InputParam7.Value = ThisWorkbook.User_Name
Set InputParam8 = OraCmd.CreateParameter("str_last_updated_by", adVarChar, adParamInput, 10)
InputParam8.Value = ThisWorkbook.User_Name
Set InputParam9 = OraCmd.CreateParameter("dt_created_date", adVarChar, adParamInput, 10)
InputParam9.Value = Sheet1.Cells(8, 2)
Set InputParam10 = OraCmd.CreateParameter("dt_Last_Updated_Date", adVarChar, adParamInput, 10)
InputParam10.Value = Sheet1.Cells(8, 2)
Set InputParam11 = OraCmd.CreateParameter("strMonth1", adVarChar, adParamInput, 10)
InputParam11.Value = Mth1
Set InputParam12 = OraCmd.CreateParameter("strMth2", adVarChar, adParamInput, 10)
InputParam12.Value = Mth2
Set InputParam13 = OraCmd.CreateParameter("strMth3", adVarChar, adParamInput, 10)
InputParam13.Value = Mth3
Set InputParam14 = OraCmd.CreateParameter("strMth4", adVarChar, adParamInput, 10)
InputParam14.Value = Mth4
Set InputParam15 = OraCmd.CreateParameter("strMth5", adVarChar, adParamInput, 10)
InputParam15.Value = Mth5
Set InputParam16 = OraCmd.CreateParameter("strMth6", adVarChar, adParamInput, 10)
InputParam16.Value = Mth6
Set InputParam17 = OraCmd.CreateParameter("Sample", adInteger, adParamInput, 10)
InputParam17.Value = 0
Set InputParam18 = OraCmd.CreateParameter("str_message", adVarChar, adParamOutput, 10)
OraCmd.Parameters.Append InputParam1
OraCmd.Parameters.Append InputParam2
OraCmd.Parameters.Append InputParam3
OraCmd.Parameters.Append InputParam4
OraCmd.Parameters.Append InputParam5
OraCmd.Parameters.Append InputParam6
OraCmd.Parameters.Append InputParam7
OraCmd.Parameters.Append InputParam8
OraCmd.Parameters.Append InputParam9
OraCmd.Parameters.Append InputParam10
OraCmd.Parameters.Append InputParam11
OraCmd.Parameters.Append InputParam12
OraCmd.Parameters.Append InputParam13
OraCmd.Parameters.Append InputParam14
OraCmd.Parameters.Append InputParam15
OraCmd.Parameters.Append InputParam16
OraCmd.Parameters.Append InputParam17
OraCmd.Parameters.Append InputParam18
Set Rs_data = New ADODB.Recordset
Set Rs_data = OraCmd.Execute
I am getting an error at this point which
ORA-06550:line 1,column 54:
PLS-00103:Encountered the symbol ">" when expecting one of the following:
. ( ) * @ % & = - + < / > at in is mod not rem
<an exponent(**)> <> or != or ~= or >= <= <> and or like
between ||
Can anyone pls help me?Thanks.You do not need to code an explicit cursor for a single fetch. An implicit cursor is less code to write, read, maintain and execute.
E.g. Instead of all this:
CURSOR C2 IS
SELECT FACILITY_ID FROM TBLADOPT_GROUP_CSC WHERE ADOPT_GROUP = str_Adpt_Grp;
OPEN C2;
FETCH C2 INTO Fac_REC;
Fac_ID := Fac_Rec.FACILITY_ID;
CLOSE C2;
Simply code this:SELECT
Fac_Rec.FACILITY_ID INTO Fac_ID
FROM BLADOPT_GROUP_CSC
WHERE ADOPT_GROUP = str_Adpt_Grp;PL/SQL procedure calls have to be made (to Oracle) as anonymous PL/SQL blocks. This means that you need to wrap the procedure call into BEGIN..END tags.
So instead of coding this:
OraCmd.CommandText = "APD_MASS_UPLOAD_UNITS"
You need to code something like:
OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS; END;"
However, this will not work as APD_MASS_UPLOAD_UNITS expects a bunch of input parameters. And you're on the right track about attempting to bind your Excel variables' values to the PL/SQL procedure's parameters.
Unsure how ADO works, but typically you can bind by name or by position. Let's assume bind by position (typically in PHP):
OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS( ?, ?, ?, ?, ?. ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); END;"
Then you will bind values to positions 1 to 18 (did I count the number of params right?). Something like:
OraCmd.CreateParameterByPosition( 1, adVarChar, adParamInput, 20)
Or you can bind by name. E.g.
OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS( :pid, :pcode, ..etc.. ); END;"
And:
OraCmd.CreateParameterByName( 'pid', adVarChar, adParamInput, 20)
Read up on your OraCmd.CreateParameter() to see how to correctly use it.
A few more comments. 18 parameters in a call is something I would seriously reconsider. It is quite easy to get it wrong - transpose two parameters. It is very difficult to read and check. Very difficult to maintain. It is much safer to rather define a %ROWTYPE structure to pass, or a PL/SQL record structure.
You are passing date values as VARCHAR2. Rather pass the parameter as the correct data type. E.g.
create or replace procedure foo( custID number, invoiceDate date )...
And then when you call it (in your client code), you specify the date string and date format and make it into a date. E.g.
OraCmd.CommandText = "begin foo( :myCust, TO_DATE(:myDateString,:myDateFormat) ); end;"
Maybe you are looking for
-
How to see the whole description of a commodity code?
Hi expert, Is there a possiblity for a SAP user to see the complete description of a commodity code, which was entered in table T604T? When the commodity code is selected in the invoice, we only see an abbrevated description. Thank you. Kind regards,
-
How to arrange photographs by kind in mountain lion
since I have upgraded to mountain lion I cannot arrange my photos by kind any more (seperate jpegs from raws in a file for example) Also, when I select within a file I no longer have the indication of the number of items selected (also available at t
-
I'm using a Select List (with submit) in my application and it's a long list, the available select list search by the first letter (if I pressed two letters it would search for words begins with the second letter).... Can we find or create a Select L
-
Usage decision in QA11 through BAPI_INSPLOT_SETUSAGEDECISION
Hi Experts, I am trying to do Usage decision thorugh BAPI_INSPLOT_SETUSAGEDECISION. I gave the inputs inspection lot and UD code. I am getting error like this :E QV 045 You cannot make the UD because of 0001 non-valuated Physical sa
-
Hi, Ned to transfer my contacts and BBM contacts from Bold 5 to new Iphone 5S. Please advise.