Stored Procedure to block DN for specified BP unless ODLN.NumAtCard contain 6-digit number

Hello experts
I am trying to us SPTN block delivery for specified BP unless supplier reference field contains 6 digit number (this is Customer PO number format)
--Block CCOR001 DN unless 6 figure number in ODLN.NumAtCard
IF @object_type = '15' AND @transaction_type = 'A'
BEGIN
IF EXISTS(SELECT T0.[Docentry] FROM ODLN T0 WHERE T0.[CardCode] = 'CCOR001' AND T0.[NumAtCard] != ###### AND T0.docentry = @list_of_cols_val_tab_del)
SELECT @error = 1, @error_message = N'Cannot deliver without 6 digit Purchase Order number'
END
I am working on above query needing assistance with how to specify 6-digit number here ###### ?
Regards,
Karen

Hi Nagarajan,
Thank you for assistance these queries are functioning well and due to improving knowledge I have added another condition to because when I tested I discover it is possible to add DN by putting "Verbal" in the field. Because we have many customers who do not require formal purchase orders it is necessary to block 'Verbal' and 'To be confirmed' 'TBC' 'follow' and so on.
Here is query: It seems to work fine with basic testing so far..
IF @object_type = '15' AND @transaction_type IN ('A','U')
BEGIN
IF EXISTS(SELECT T0.[Docentry] FROM ODLN T0 WHERE T0.[CardCode] = 'CCOR001' AND T0.[NumAtCard] is null AND ISNUMERIC( T0.NumAtCard ) = 0 OR LEN(CAST(T0.[NumAtCard] As nvarchar(4000))) <> 6 AND T0.docentry = @list_of_cols_val_tab_del)
SELECT @error = 1, @error_message = N'Cannot deliver without 6 digit Purchase Order number'
END

Similar Messages

  • How to use order by in stored procedure base block?

    How to use order by in stored procedure base block? I need to change order by dynamically

    Use SET_BLOCK_PROPERTY('BLOCK_NAME',ORDER_BY,'COLUMN_NAME1, COLUMN_NAME2');

  • Creating a Oracle 10g stored procedure as a datasource for  crystal 9 repor

    Can someone direct me to instructions or information on how to create a Oracle 10g stored procedure as a datasource for  my Crystal  Reports 9.0  report?

    i've found this example for you
    http://www.pdssoftware.com/newsletter/mar07/page6.htm
    and you could be able to get the guides from the SAP guide website for the products
    http://help.sap.com/businessobject/product_guides/
    hope this was helpful
    good luck
    Amr

  • Stored Procedure To Block if A/R Delivery Qty Qty in Sales Order

    Hi Experts,
    Can we Block to post the A/R Delivery Document if the quantity is greater than the quantity mentioned in the Sales order (Base Document).
    If We can Please Help me with the procedure
    With regards,
    G.Eshvanth Singh

    Hi,
    Here is a store procedure to block delivery creation if its qty is exceeding SO qty:
    IF @transaction_type IN (N'A', N'U') AND
    (@Object_type = N'20')
    begin
    if exists (SELECT T0.BaseEntry, SUM(T0.Quantity)
    FROM [dbo].[DLN1] T0 INNER
    JOIN [dbo].[RDR1] T1 ON T1.DOCENTRY =
    T0.BASEENTRY
    WHERE T0.BaseType = 22 AND T0.ItemCode =
    T1.ItemCode AND T0.BaseLine = T1.LineNum
    and T0.DOCENTRY = @list_of_cols_val_tab_del
    GROUP BY T0.BaseEntry
    HAVING (SUM(T0.Quantity) > SUM(T1.Quantity)) or sum(t0.quantity) > sum(t0.BaseOpnQty))
    begin
    select @Error = 10, @error_message = 'GRPO
    quantity is over PO quantity'
    end
    end
    you place the SP_TN into your SQL server SBO company database programmability --> system store procedures --> dbo.SBO_SP_TransactionNotification --> right click this dbo --> select Script stored Procedure as select Alter to New query editor,
    the result will be as follows:
    @object_type nvarchar(20), -- SBO Object Type
    @transaction_type nchar(1), -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose
    @num_of_cols_in_key int,
    @list_of_key_cols_tab_del nvarchar(255),
    @list_of_cols_val_tab_del nvarchar(255)
    AS
    begin
    -- Return values
    declare @error int -- Result (0 for no error)
    declare @error_message nvarchar (200) -- Error string to be displayed
    select @error = 0
    select @error_message = N'Ok'
    -- ADD YOUR CODE HERE
    -- Select the return values
    select @error, @error_message
    end
    GO
    There are five out parameters:
    Put the code I have given in the -- ADD YOUR CODE HERE part.
    let me know your e-mail address if you want to have SP_TN pdf file from SAP
    Rgds,

  • Error in stored procedure while using dbms_datapump for transportable

    Hi,
    I'm facing following issue:
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    ====================================================================================
    I'm trying to do transportable tablespace through stored procedure with help of DBMS_DATAPUMP, Following is the code :
    ==================================================================================
    create or replace
    procedure sp_tts_export(v_tbs_name varchar2) as
    idx NUMBER; -- Loop index
    JobHandle NUMBER; -- Data Pump job handle
    PctComplete NUMBER; -- Percentage of job complete
    JobState VARCHAR2(30); -- To keep track of job state
    LogEntry ku$_LogEntry; -- For WIP and error messages
    JobStatus ku$_JobStatus; -- The job status from get_status
    Status ku$_Status; -- The status object returned by get_status
         dts           varchar2(140):=to_char(sysdate,'YYYYMMDDHH24MISS');
         exp_dump_file varchar2(500):=v_tbs_name||'_tts_export_'||dts||'.dmp';
         exp_log_file varchar2(500):=v_tbs_name||'_tts_export_'||dts||'.log';
         exp_job_name varchar2(500):=v_tbs_name||'_tts_export_'||dts;
         dp_dir varchar2(500):='DATA_PUMP_DIR';
         log_file UTL_FILE.FILE_TYPE;
         log_filename varchar2(500):=exp_job_name||'_main'||'.log';
         err_log_file UTL_FILE.FILE_TYPE;
         v_db_name varchar2(1000);
         v_username varchar2(30);
         t_dir_name VARCHAR2(4000);
    t_file_name VARCHAR2(4000);
    t_sep_pos NUMBER;
         t_dir varchar2(30):='temp_0123456789';
         v_sqlerrm varchar2(4000);
    stmt varchar2(4000);
         FUNCTION get_file(filename VARCHAR2, dir VARCHAR2 := 'TEMP')
    RETURN VARCHAR2 IS
    contents VARCHAR2(32767);
    file BFILE := BFILENAME(dir, filename);
    BEGIN
              DBMS_LOB.FILEOPEN(file, DBMS_LOB.FILE_READONLY);
              contents := UTL_RAW.CAST_TO_VARCHAR2(
    DBMS_LOB.SUBSTR(file));
              DBMS_LOB.CLOSE(file);
              RETURN contents;
         END;
    begin
    --execute immediate ('drop tablespace test including contents and datafiles');
    --execute immediate ('create tablespace test datafile ''/home/smishr02/test.dbf'' size 10m');
    --execute immediate ('create table prestg.test_table (a number) tablespace test');
    --execute immediate ('insert into prestg.test_table values (1)');
    --commit;
    --execute immediate ('alter tablespace test read only');
    --dbms_output.put_line('11111111111111111111');
    dbms_output.put_line(log_filename||'>>>>>>>>>>>>>>>>>>>>>>>>>>>'|| dp_dir);
    log_file:=UTL_FILE.FOPEN (dp_dir, log_filename, 'w');
    UTL_FILE.PUT_LINE(log_file,'#####################################################################');
    UTL_FILE.PUT_LINE(log_file,'REPORT: GENERATED ON ' || SYSDATE);
    UTL_FILE.PUT_LINE(log_file,'#####################################################################');
    select global_name,user into v_db_name,v_username from global_name;
    UTL_FILE.PUT_LINE(log_file,'Database:'||v_db_name);
    UTL_FILE.PUT_LINE(log_file,'user running the job:'||v_username);
    UTL_FILE.PUT_LINE(log_file,'for tablespace:'||v_tbs_name);
    UTL_FILE.NEW_LINE (log_file);
    stmt:='ALTER TABLESPACE '||v_tbs_name || ' read only';
    dbms_output.put_line('11111111111111111111'||stmt);
    execute immediate (stmt);
    UTL_FILE.PUT_LINE(log_file,' '||v_tbs_name || ' altered to read only mode.');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,'#####################################################################');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Initiating the Datapump engine for TTS export..............');
    UTL_FILE.NEW_LINE (log_file);
    dbms_output.put_line('11111111111111111111');
    JobHandle :=
    DBMS_DATAPUMP.OPEN(
    operation => 'EXPORT'
    *,job_mode => 'TRANSPORTABLE'*
    *,remote_link => NULL*
    *,job_name => NULL*
    --,job_name => exp_job_name
    --        ,version => 'LATEST'
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Allocating dumpfile................');
    DBMS_DATAPUMP.ADD_FILE(
    handle => JobHandle
    ,filename => exp_dump_file
    ,directory => dp_dir
    ,filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE
    -- ,filesize => '100M'
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Allocating logfile................');
    DBMS_DATAPUMP.ADD_FILE(
    handle => JobHandle
    ,filename => exp_log_file
    ,directory => dp_dir
    ,filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Setting attributes................');
    DBMS_DATAPUMP.set_parameter(handle => JobHandle,
    name=>'TTS_FULL_CHECK',
    value=>1);
    DBMS_DATAPUMP.METADATA_FILTER(
    handle => JobHandle
    ,NAME => 'TABLESPACE_EXPR'
    ,VALUE => 'IN ('''||v_tbs_name||''')'
    -- ,object_type => 'TABLE'
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Now starting datapump job................');
    DBMS_DATAPUMP.START_JOB(JobHandle);
    UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Monitoring the job................');
    --------------Monitor the job
    PctComplete := 0;
    JobState := 'UNDEFINED';
    WHILE(JobState != 'COMPLETED') and (JobState != 'STOPPED')
    LOOP
    DBMS_DATAPUMP.GET_STATUS(
    handle => JobHandle
    ,mask => 15 -- DBMS_DATAPUMP.ku$_status_job_error + DBMS_DATAPUMP.ku$_status_job_status + DBMS_DATAPUMP.ku$_status_wip
    ,timeout => NULL
    ,job_state => JobState
    ,status => Status
    JobStatus := Status.job_status;
    -- Whenever the PctComplete value has changed, display it
    IF JobStatus.percent_done != PctComplete THEN
    DBMS_OUTPUT.PUT_LINE('*** Job percent done = ' || TO_CHAR(JobStatus.percent_done));
    PctComplete := JobStatus.percent_done;
    END IF;
    -- Whenever a work-in progress message or error message arises, display it
    IF (BITAND(Status.mask,DBMS_DATAPUMP.ku$_status_wip) != 0) THEN
    LogEntry := Status.wip;
    ELSE
    IF (BITAND(Status.mask,DBMS_DATAPUMP.ku$_status_job_error) != 0) THEN
    LogEntry := Status.error;
    ELSE
    LogEntry := NULL;
    END IF;
    END IF;
    IF LogEntry IS NOT NULL THEN
    idx := LogEntry.FIRST;
    WHILE idx IS NOT NULL
    LOOP
    DBMS_OUTPUT.PUT_LINE(LogEntry(idx).LogText);
    idx := LogEntry.NEXT(idx);
    END LOOP;
    END IF;
    END LOOP;
         --copy the datafiles to data dump dir     
         UTL_FILE.PUT_LINE(log_file,'Done');
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Copying datafiles to dump directory................');
    -- grant select on dba_directories to prestg;
    declare
    cnt number;
    begin
    select count(*) into cnt from dba_directories
    where directory_name=upper(t_dir);
    if cnt=1 then
    execute immediate('DROP DIRECTORY '||t_dir);
    end if;
    end;
         FOR rec in (select file_name from sys.dba_data_files where tablespace_name=v_tbs_name)
         LOOP
         t_sep_pos:=instr(rec.file_name,'/',-1);
    t_dir_name:=substr(rec.file_name,1,t_sep_pos-1);
    t_file_name:=substr(rec.file_name,t_sep_pos+1,length(rec.file_name));
    dbms_output.put_line(t_dir_name|| ' ' || t_dir);
    dbms_output.put_line(t_file_name);
         execute immediate('CREATE DIRECTORY '||t_dir||' AS '''||t_dir_name||'''');
         UTL_FILE.PUT_LINE(log_file,' Copying '||rec.file_name||'................');
         utl_file.fcopy(t_dir, t_file_name, dp_dir, t_file_name);
         UTL_FILE.PUT(log_file,'Done');
         execute immediate('DROP DIRECTORY '||t_dir);
         END LOOP;
    UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' Altering tablespace to read write................');
         execute immediate ('ALTER TABLESPACE '||v_tbs_name || ' read write');
    UTL_FILE.PUT(log_file,' Done');
         err_log_file:=utl_file.fopen(dp_dir, exp_log_file, 'r');
         UTL_FILE.NEW_LINE (log_file);
    UTL_FILE.PUT_LINE(log_file,' content of export logfile................');
         loop
    begin
         utl_file.get_line(err_log_file,v_sqlerrm);
         if v_sqlerrm is null then
         exit;
         end if;
         UTL_FILE.PUT_LINE(log_file,v_sqlerrm);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    END;
         end loop;
              utl_file.fclose(err_log_file);
    utl_file.fclose(log_file);
    END;
    I'm getting following error when DBMS_DATAPUMP.OPEN is called in procedure:
    SQL> exec sp_tts_export('TEST');
    BEGIN sp_tts_export('TEST'); END;
    ERROR at line 1:
    ORA-31626: job does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 938
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 4566
    ORA-06512: at "PRESTG.SP_TTS_EXPORT", line 78
    ORA-06512: at line 1
    ==============================================================================================
    This procedure is part of user ABC. I'm getting the above when I'm running this under ABC schema. However I have tested the same procedure under sys schema. When I'm creating same procedure in SYS schema it is running fine. I am clueless on this. Pls help
    Thanks
    Shailesh
    Edited by: shaileshM on Jul 28, 2010 11:15 AM

    Privileges acquired via ROLE do NOT apply within named PL/SQL procedures.
    Explicit GRANT is required to resolve this issue.

  • Stored procedure in purchase order for duplicate item for a vendor

    Hi all
    I have written a stored procedure for duplicate item for vendor the output i need from this SP is whenever for a vendor we will raise purchase order the system should check that their shouldn't be any po in the system for the same item by the selected vendor. Its working fine when only one item is selected but it is behaving wrongly when more than one item is selected.
    If (@object_type='22' and @transaction_type='A')
    BEGIN
    Declare @Vend as varchar(200)
    Declare @ItemCode as varchar(200)
    Select @Vend =CardCode From OPOR Where DocEntry = @list_of_cols_val_tab_del
    Select @ItemCode=ItemCode From POR1 Where DocEntry=@list_of_cols_val_tab_del
    IF 1 !=(Select Count(T0.DocEntry) From OPOR T0  Inner Join POR1 T1 On T0.DocEntry=T1.DocEntry  Where T0.CardCode=@Vend and T1.ItemCode=@ItemCode)
    Begin
    select @error =1
    select @error_message = 'Item Code Already Exists For This Vendor'
    end
    end
    Thanks
    Rashid.

    Hi Rashid,
    Try this,
    if @object_type = N'22' and @transaction_type in (N'A', N'U')
    begin
    declare @line1 int
    declare @lin1 int
    declare @out1 int
    Set @out1 = 0
    SET @lin1 = 0
    Declare @Vend as varchar(200)
    Declare @ItemCode as varchar(200)
    Select @Vend = CardCode From OPOR Where DocEntry = @list_of_cols_val_tab_del
    Select @line1 = Max (LineNum)FROM POR1 WHERE POR1.DocEntry = @list_of_cols_val_tab_del
    While @lin1 < @line1
    Begin
         Select @ItemCode=ItemCode From POR1 Where DocEntry=@list_of_cols_val_tab_del and LineNum = @lin1
          if (SELECT COUNT(T0.DocEntry) FROM POR1 T0 inner join OPOR T1 on T0.DocEntry = T1.DocEntry
          WHERE T0.ItemCode = @ItemCode and T1.CardCode = @Vend)> 1
          Begin
               Set @Out1 = 1
               Break;
          END
               Else
               Begin
               Set @lin1 = @lin1+1
               Continue
          END
    END
    Set @lin1 = @lin1 + 1
    if @out1 = 1
    begin
          Set @error = 1
          Set @error_message = 'Item Code in line ' + CONVERT(nvarchar(4), @lin1) + N'already Exists For This Vendor!'
    End
    END
    Regards,
    Bala

  • How to use stored procedure in crystal report for eclipse

    Hi;
    I am working on crystal report for eclipse 2.0 and  trying to use stored procedure in report .It is created from Oracle but it is not showing any dependencies
    CREATE OR REPLACE procedure ACT_DB.getCostTransferDetails
            p_In_Contract_ID         varchar2 DEFAULT  '*',
            p_In_Status_ID           varchar2 DEFAULT  '*',
            p_In_COST_TRAN_DATE      varchar2 DEFAULT  '*',
            p_In_DEPT_ID             varchar2 DEFAULT  '*',
            p_In_PROJECT_ID          varchar2 DEFAULT  '*',
            p_In_EMPLOYEE_ID         varchar2 DEFAULT  '*',
            p_Out_CostTransfer_Cusor OUT COST_TRANSFER_PACKAGE.COST_TRANSFER_TYPE
    AS
    BEGIN    
            OPEN p_Out_CostTransfer_Cusor FOR
            SELECT
                header.cost_tran_id,
                header.cost_tran_date,
                header.total_credit_amount,
                header.total_debit_amount,
                header.transfer_status,
                header.updated_by,
                header.added_by,
                header.trf_over_ninety_days,
                header.business_unit_id,
                header.equip_approval,
                header.batch_desc,
                details.opr_unit_id,
                status.status_id,
                details.fund_code_id,
                details.prgm_code_id,
                details.class_id,
                details.activity_id,
                details.product_id,
                details.status_id,
                details.transaction_amount,
                details.jrnl_date,
                details.adjust_prcnt,
                details.adjust_amnt,
                details.details_equip_approval,
                details.detail_desc,
                details.account_id,
                details.project_id,
                details.dept_id,
                details.contract_id,
                details.reason_code_id,
                details.jrnl_id,
                employee.f_name,
                employee.l_name,
                employee.employee_id,
                project.project_id,
                project.project_status,
                --header.transfer_status,
                contracts.contract_desc 
              FROM header, details, status, employee, department, project, contracts
             WHERE     (header.cost_tran_id = details.cost_tran_id)
                    AND (header.cost_tran_date = details.cost_tran_date)
                    AND (header.transfer_status = status.status_id)
                    AND (department.dept_id = details.dept_id)
                    AND (department.dept_id = employee.dept_id)
                    AND (project.project_id = details.project_id)
                    AND (contracts.contract_id = details.contract_id)
                    AND (details.Contract_ID = p_In_Contract_ID OR p_In_Contract_ID ='*' )
                    AND (header.TRANSFER_STATUS = p_In_Status_ID OR p_In_Status_ID ='*' )
                    AND (TO_CHAR(details.COST_TRAN_DATE, 'MM/DD/YYYY') = p_In_COST_TRAN_DATE OR p_In_COST_TRAN_DATE ='*' )
                    AND (details.DEPT_ID  = p_In_DEPT_ID  OR p_In_DEPT_ID  ='*' )
                    AND (details.PROJECT_ID  = p_In_PROJECT_ID  OR p_In_PROJECT_ID  ='*' )
                    AND (header.ADDED_BY  = p_In_EMPLOYEE_ID  OR '*'=p_In_EMPLOYEE_ID  )
    Can any another way to make procedure
    Thanx
    Regards ,
    Amol

    Hi Amol,
    Are you able to execute your stored procedure from oracle?.
    - If "Yes" then use  the Crystal Report XIR2 Designer to create the report.
    - Import this report in the Crystal Report For Eclipse Workbench.
    - The latest version for Crystal Report For Eclipse is SP1.
    Please let me know the results.
    Thanks,
    Neeraj

  • Crystal Reports can't add stored procedure using Oracle Provider for OLE DB

    Hello,
    I am trying to bind an oracle stored procedure to a crystal report through Visual Studio 2008.
    This oracle stored procedure returns a ref cursor.
    I am using an oracle 11g database (11.2.0.2.0) .
    When I use the Oracle Provider For OLE DB driver to bind the store procedure with the report, I get the following error message:
    Description : ORA -06550 Line 1 Column 7
    PLS 00306 wrong number of types or arguments to the "Strored Procedure Name"
    But When I use the Microsoft OLE DB provider for oracle driver, I can bind the stored procedure to the report successfully .
    I cannot use the Microsoft OLE DB provider for oracle driver because it does not support the CLOB data type which I plan on having the stored procedure return once I can get everything working.
    I have tried setting PLSQLRSET = 1 IN "HKEY_LOCAL_MACHINE\SOFTWARE\KEY_OraDb11g_home1\OLEDB", but that does not seem to work either
    Any assistance would be greatly Appreciated
    My Stored procedure is very simple as the moment (I just need to get it working then I'll add more stuff). Here's what it looks like:
    CREATE OR REPLACE PACKAGE PROMO.PKG_REPORT as
    TYPE OUT_Type IS REF CURSOR;
    procedure Report_ThisReport (
    p_ThisIdField IN number,
    IO_CURSOR IN OUT OUT_Type
    end PKG_REPORT;
    CREATE OR REPLACE PACKAGE BODY PROMO.PKG_REPORT as
    procedure REPORT_ThisReport (
    p_ThisIdField IN number,
    IO_CURSOR IN OUT OUT_Type
    IS
    BEGIN
    OPEN IO_CURSOR FOR
    SELECT ThisField
    FROM ThisTable
    WHERE ThisIdField = p_ThisIdField ;
    END REPORT_ThisReport;
    end PKG_REPORT;
    Edited by: 894988 on Nov 3, 2011 2:45 PM
    Edited by: 894988 on Nov 3, 2011 2:46 PM
    Edited by: 894988 on Nov 3, 2011 2:47 PM

    It seems that some questions posted here on the XE forum are really questions about other Oracle technologies.
    Concretely, for you there is an Oracle Provider for OLE DB Forum that is active and a terrific resource for you to use.
    Oracle Provider for OLE DB
    Cheers!

  • How to extract compiled stored procedure without line break for long statement

    After I compiled stored procedure which contains long statement, the statement would cut into 2 rows into dba_source.
    However, when I extract the codes from dba_source table, the source couldn't be compiled successfully because of
    the broken lines.
    For example, the following statement would be broken into 2 rows like this:
    (line 1) gv_Message := 'Interface Description: Interface with Training '|| 'and Development Intran
    (line 2) et (Evaluation Statistic Details)';

    That's very strange. What did you originally compile it with (sql*plus, toad, etc...)? I was able to compile a procedure with the maximum line length (2499 characters see error SP2-0027) and there is no split. Is the procedure in a VALID state with that line break? Honestly, this seems very odd, possibly even a bug here somewhere.
    Richard

  • Problem using stored procedure to populate table for report

    I have a report that in one instance the user wants the quantity data pulled from a smaller subset of data. My thought was to create a global temporary table and then use a stored procedure to populate this table then pass the table name in a lexical that contains the table name. So my query in the report stays the same except for the lexical table name. This all seems to work except for the procedure populating the table. I thought it might be the global temporary table so I created a real table. When I run the procedure from the command prompt the table gets populated. When I run the procedure in the before report trigger I get nothing. When I run the procedure from the command line and leave the data, then run the report I get updated data in the table, but nothing returned to the report. Any ideas, questions, solutions?
    Thanks
    Andy Hendrickson

    Hi Andy Hendrickson,
    Let me understand your problem correctly.
    1) When you run the procedure from command prompt the table gets populated. It is clear.
    2)When you run the procedure in before report trigger you get nothing. Let us analyze why but for now it is clear.
    3) What you mean by "I run the procedure from the command line and leave the data, then run the report I get updated data in the table, but nothing returned to the report."
    Can you please explain a bit more and also update code snippets of what you are using ?
    Thanks,
    Vinod
    Oracle Reports Team

  • Stored Procedure to block cost center or profit center to present in JE

    Hi ...
    I have a case where i need to block if either one of the cost center or the Profit Center is not present in the manual journal entry.
    Below is my Stored Procedure which i have written....My Problem is that this block allows me to update only if both the Cost Center and the Profit Center is Present and does not allow if any one is present.
    IF @object_type='30' AND (@transaction_type='A' or @transaction_type='U')
    BEGIN
      if(Select Count(*) from OJDT T0  INNER JOIN JDT1 T1 ON T0.TransId=T1.TransId
      INNER JOIN OACT T2 ON T2.AcctCode=T1.Account
      where  T2.ExportCode LIKE '1%' And (isnull(T1.ProfitCode,0)='0'  OR ISNULL(T1.OcrCode2,'')='')  and
       T0.TransId=@list_of_cols_val_tab_del)>0
      begin
      SET @error = 0201
         SET @error_message= 'R1'
    end
    end
    What could be the problem...?

    Hi Gopi
    Try This
    IF @transaction_type IN ('A','U') and @Object_type = 30
    BEGIN
    IF EXISTS (SELECT T0.TransId FROM dbo.JDT1 T0
    WHERE ((T0.ProfitCode ='' OR T0.ProfitCode IS NULL) and (T0.[OcrCode2]='' OR T0.[OcrCode2] IS NULL) and (T0.[OcrCode3]='' OR T0.[OcrCode3] IS NULL) and
    (T0.[OcrCode4]='' OR T0.[OcrCode4] IS NULL) and (T0.[OcrCode5]='' OR T0.[OcrCode5] IS NULL)) AND T0.TransId = @list_of_cols_val_tab_del)
    Begin
    SET @Error = 1111
    SET @error_message = 'At least one cost center is mandatory!'
    End
    End
    With Regards
    Balaji Sampath

  • Stored procedure or table adapter for insert etc. - preferred method

    We are using ver 4.112.1.2 of ODP.Net in Visual Studio 2010.
    I was what would be considered best practice regarding how to perform a simple insert into a table.
    I know of two ways:
    First, we could just call the insert through the table adapter like:
    if adp is a table adapter
    adp.Insert(reqID, DateTime.Now, reqByUserID, acctNum);or we could call a stored procedure in Oracle to do the insert.
    What are the particular advantages or disadvantages to both methods?
    I know the stored procedure could be helpful because it centralizes the method of inserting. It ensures everything else that may need to be along with the insert is done. I also know that calling the stored procedure would require more lines of Dot.Net code.

    These are the errors iam getting .
    But the Existing Stored Procedure which needs to be exposed , works fine on sqlplus.
    Errors: check compiler log
    8/12 PLS-00302: component 'DETAIL' must be declared
    8/3 PL/SQL: Statement ignored
    9/12 PLS-00302: component 'LIST_NAME' must be declared
    9/3 PL/SQL: Statement ignored
    10/12 PLS-00302: component 'BREAK_TYPE' must be declared
    10/3 PL/SQL: Statement ignored
    11/12 PLS-00302: component 'DESCRIPTION' must be declared
    11/3 PL/SQL: Statement ignored
    12/12 PLS-00302: component 'ADJUSTMENT_METHOD' must be declared
    12/3 PL/SQL: Statement ignored
    13/12 PLS-00302: component 'ADJUSTMENT_VALUE' must be declared
    13/3 PL/SQL: Statement ignored
    20/33 PLS-00302: component 'DETAIL' must be declared
    20/3 PL/SQL: Statement ignored
    21/36 PLS-00302: component 'LIST_NAME' must be declared
    21/3 PL/SQL: Statement ignored
    22/37 PLS-00302: component 'BREAK_TYPE' must be declared
    22/3 PL/SQL: Statement ignored
    23/38 PLS-00302: component 'DESCRIPTION' must be declared
    23/3 PL/SQL: Statement ignored
    Commit
    Edited by: anantwag on Dec 13, 2012 10:39 AM

  • Stored Procedure to create table for PdO Change Log

    Hi Experts,
    I have read in the forums that the only way to get a Change Log was to create a Stored Prodedure and create a new Table that is populated with the Change when ever a User update a Production Order.
    I started on this Stored Procedure and have hit a wall on a error. I'm fairly new to queries...
    Here is what I have so far:
    if((@transaction_type = 'U')and(@object_type = '202'))
    BEGIN
    set @PdO = case @object_type
              INSERT INTO ChangeLogPdO2 (DocEntry, Status, ItemCode, PlannedQty, DueDate)
              SELECT T0.DocEntry, T0.Status, T0.ItemCode, T0.PlannedQty, T0.DueDate
              FROM OWOR T0      
              WHERE T0.DocEntry = @list_of_cols_val_tab_del
        END
    if(@PdO = 'true')
    begin
          select @error = 1
          select @error_message = N'My Error message'
    end
    I plan to add more columns, but only started with these. Also how do I put a time stamp on this?
    Thanks,
    Marli
    Edited by: Marli Schutte on Feb 3, 2010 7:09 PM

    Gordon,
    I created a new UDT named CLPdO.
    Then I did as you suggested and I get the error message 'Incorrect syntax near the keyword 'INSERT''.
    Here is how the Sotred Procedure now look:
    [code}
    if((@transaction_type = 'U')and(@object_type = '202'))
    BEGIN
    set @PdO = case @object_type
              INSERT INTO dbo@CLPdO (DocEntry, Status, ItemCode, PlannedQty, DueDate)
              SELECT T0.DocEntry, T0.Status, T0.ItemCode, T0.PlannedQty, T0.DueDate
              FROM OWOR T0      
              WHERE T0.DocEntry = @list_of_cols_val_tab_del
        END
    if(@PdO = 'true')
    begin
          select @error = 1
          select @error_message = N'My Error message'
    end
    Any help will be appreciated.
    Marli

  • Oracle Forms' Stored Procedure Data Blocks

    i'm using the 6i demo procedure code to populate the data from the peocedure. it is retrieving data fine. but whn it will creates the following procedure. onece it shows me only insert procedure but after that i didnt find any procedure.
    Query-procedure
    Insert-procedure
    Update-procedure
    Delete-procedure
    Lock-procedure
    thanks in advance
    Shakeel

    yes i know insert, update delete and lock proceduer are written on the procedure packege but after block wizard these procedure automerically created on block level.

  • Stored Procedure to Block Changing of a particular UDF Field by a particular USER ID

    Hi,
    I have a case where a particular UDF Field in Sales Order  must not be changed by a particular USER ID.
    My SP is,
    IF @object_type='17' AND ( @transaction_type='U')
    BEGIN
      if(Select T0.XXX  from ORDR T0
      where T0.UserSign='1' and T0.DocEntry=@list_of_cols_val_tab_del)>0
      begin
      SET @error = 1
         SET @error_message= 'You Cannot Change this Field'
      GOTO EXITLINE
      end
    end
    It throws me with the Error : -
    [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting the nvarchar value 'ABC' to data type int. (CINF)
    The UDF Field is Alphanumeric in type.
    Can any one please suggest me what could be the error.
    Thanks

    Hi Gopi Krishnan,
    Please check below SP Transaction Notification.
    if @object_type = '17' and @transaction_type in ('U')
    begin
    If Exists (SELECT T0.[DocEntry] FROM ORDR T0 
    INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
    INNER JOIN OUSR T2 ON T0.[UserSign] = T2.[USERID]
    WHERE T0.[UserSign] = '1'  AND T0.DocEntry = @list_of_cols_val_tab_del)
        Begin
            SET @error = 1002
            SET @error_message = N'You are not Authorized to Update Sales Order'
        End
    End
    Hope this help
    Regards::::
    Atul Chakraborty

Maybe you are looking for

  • Transaction code to change group indicator & group number of a routine

    Transaction code to change group indicator & group number of a routine

  • Deploying app for client

    Hi i have been following this tutorial - http://www.netbeans.org/kb/articles/appclient-entappclient.html got it to work in netbean 5.5.1 IDE but when i try java -jar "C:\Documents and Settings\blahblah\Desktop\JBossTest\Client\ApplicationClientForTes

  • How can I slow down picture frequency on screen saver?

    I use an iPhoto smartfolder as slideshow for screensaver, but it shifts the picture every 2 seconds, which is far faster than I want it. About 30 seconds watch on each picture would be fine, Is there no way to change this setting on Mountain Lion?

  • IPhone 4 refuses to sync to iTunes

    I updated my iPhone 4 to the new iOS5 software today (Oct 12th, 2011) and all the new apps run perfectly. However I have two problems now; 1. A good chunk of my album artwork did not sync onto my iPhone. I'm not missing any music, so I might have to

  • How do I submit a site for consideration for the official list?

    There is supposed to be a button in Edit Settings, but it's not appearing for Rutgers. Alternatively, is there any way to get to a human being at Apple? I'm about to declare iTunesU a loss. I've tried several support avenues and they all say there is