OCI calls using select *

Hi,
I have been able to write OCI programs that select a know select-list following the examples in cdemo81.c and cdemo6.cc, but I've been unable to get an OCI program working that does a select * and then get the data out of the select. More to the point I need to be able to handle sql statements that I know nothing about prior to execution.
If you could give me a piece of sample code or point me to some that would be great. Please bear in mind that I'm writing a C++ program. If anyone knows how to get the libriaries for the older oparse, oexec stuff to compile in a C++ program that would be just a helpful. I'll be more than happy with either.
Any help would be appreciated.
Thanks in advance!
Bob Brown
null

I would investigate using Oracle's Transparent Data Encryption and giving up on re-inventing the wheel. Your wheel will be square and clunky as opposed to Oracle's wheel, but Oracle's wheel is an extra cost option of course. Larry's boat need to be paid somehow.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • Fetching whole table using OCI calls

    I am new to OCI programming .I am writing an appliaction in C# to fetch data from ORACLE using OCI calls,Using that application i can able to fecth single row,
    but i need to load/ fetch the entire table data from the database using the single fetch?
    I have created a scrollable resultset by using the below give statement
    and i can able to fetch single coloumn.
    short paramSizee = 20;
    IntPtr TestNo = GetPointer((int)paramSizee);
    rc = OCI.OCIDefineByPos(hStatement, out HDefine, hError, 1, TestNo, paramSizee, OCI.DATATYPE.VARCHAR2, OCI.NullHandleRef, OCI.NullHandleRef, OCI.NullHandleRef, OCI.MODE.OCI_DEFAULT);
    if (rc != 0)
    Console.WriteLine(CheckError(hError));
    throw new Exception("OCI Define Failed...");
    rc = OCI.OCIStmtExecute(hServiceContext, hStatement, hError, iters, 0, OCI.NullHandleRef, OCI.NullHandleRef, OCI.MODE.OCI_STMT_SCROLLABLE_READONLY);
    rc = OCI.OCIStmtFetch(hStatement, hError,50, OCI.FETCH.OCI_FETCH_NEXT, OCI.MODE.OCI_DEFAULT);
    if (rc != 0)
    Console.WriteLine(CheckError(hError));
    throw new Exception("OCI Fetch Failed...");
    Using above calls i can able to fetch arround 100 rows per fetch but my customer table has 16000 rows .
    So it will be great if someone suggest proper way to fetch entire table data in single fetch.
    Thanks,
    Raj

    For fetching large number of rows in single Db roundtrip use the following
    To get the bulk Data use the following.MAX_PREFETCH_ROWS is the integer value you want fetch in BULK
    (void) OCIAttrSet((dvoid *)DBctx->stmthp, (ub4) OCI_HTYPE_STMT,
    (dvoid *)&MAX_PREFETCH_ROWS,(ub4)sizeof(MAX_PREFETCH_ROWS),
    (ub4) OCI_ATTR_PREFETCH_ROWS, DBctx->errhp);

  • Problem with OCI call  and  how to install and use 'DEBUG_EXTPROC' on Linux

    Hi,
    Can any one let me know how I can install and use this debug_extproc package. I have installed oracle XE server on Linux machine(32-bit).
    When I use : DEBUG_EXTPROC.STARTUP_EXTPROC_AGENT' ... i get an error saying that : it is not declared.
    I tried looking in all the directories but did not find the dbgextp.sql(which is required in order to install that package).And tried searching on google but could not get any relevant information.
    Also I am newbie to OCI call interface and also to C programming too: I have coded a external procedure or custom user aggregate in C. But since I was using C++ : 'set' STL. I have compiled my program using g++ instead of gcc and I have correspondingly modified the make file in public/demo directory.
    So, is it fine to do it that way: using OCI (instead of OCCI(C++)) but again compiling the pgm as a regular C++ using g++ instead of gcc.(But rest of the pgm including printf statements : everything is in C).
    Also I have created the library from my : custagg.so library:
    SQL> create or replace library custagg is '$ORACLE_HOME/lib/custagg.so'
    But my aggregate function implemented as external C function using OCI is either not recognised or else : if recognized then there is some error because of which i am getting the following errors : ORA-06522
    SQL> select MinDistance(TT) from egg1;
    select MinDistance(TT) from egg1
    ERROR at line 1:
    ORA-06520: PL/SQL: Error loading external library
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    cannot dynamically load executable
    Please kindly answers my queries and trying to resolve this for almost 4 days now and could not find any clue on how to get this done.
    Thanks,
    -NN

    #/bin/make
    # Make file for OCI,OCCI and ODBC demos
    # Usage :
    # For compiling & linking the cdemo81.c file
    # make -f demo_xe.mk buildoci CDEMOEXE=cdemo81 CDEMOOBJS=cdemo81.o
    .SUFFIXES: .o .c .cpp
    ICINCHOME=$(ORACLE_HOME)/rdbms/public/
    ICLIBHOME=$(ORACLE_HOME)/lib
    ICLIBPATH=-L$(ICLIBHOME)
    THREADLIBS=-lthread
    CCLIB=$(ICLIBPATH) -lclntsh $(THREADLIBS)
    OCCILIB=$(ICLIBPATH) -locci -lclntsh $(THREADLIBS)
    CCINCLUDES = -I$(ICINCHOME)
    CCFLAGS=$(CCINCLUDES) -D_REENTRANT -g -xs
    LDFLAGS=
    SO_EXT=.so
    EXTLDFLAGS=$(LDFLAGS) -shared
    REMOVE=rm -rf
    MKLINK=ln
    MAKE=make
    MAKEFILE=demo_xe.mk
    CDEMOEXE=custagg.so
    CDEMOOBJS=custagg.o
    OCCIDEMO=occidml
    OCCIOBJDEMO=occiobj
    OTT=$(ORACLE_HOME)/bin/ott
    OCCIOTTUSR=hr
    OCCIOTTPWD=hr
    ODBCDEMOEXE=odbcdemo
    ODBCDEMOOBJS=odbcdemo.o
    AQDEMOEXE=ociaqdemo00
    AQDEMOOBJS=ociaqdemo00.o
    EXTDEMO=extdemo2.so
    CC=/usr/bin/g++
    echo "LIBCLNT value is :" $(LIBCLNT)
    echo "CC value is :" $(CC)
    .c.o:
    g++ -c -I$(ICINCHOME) $(CCFLAGS) $<
    all: clean buildoci
    echo "LIBCLNT value is :" $(LIBCLNT)
    buildoci: $(LIBCLNT) $(CDEMOOBJS)
    g++ -o $(CDEMOEXE) $(LDFLAGS) $(CDEMOOBJS) $(CCLIB)
    echo "CC value is :" $(CC)
    echo "LIBCLNT value is :" $(LIBCLNT)
    clean:
    $(REMOVE) $(CDEMOOBJS) $(CDEMOEXE)
    # This port-specific file is currently empty on Solaris. Product
    # lines may use this file to override compiler definitions and
    # flags used in occi.mk.
    # Linux compiler definitions
    CC=/usr/bin/gcc
    cc=/usr/bin/gcc
    CCFLAGS=$(CCINCLUDES) -DLINUX -D_GNU_SOURCE -D_REENTRANT -g
    LDFLAGS=-g
    # This macro CCINCLUDES has to be redefined on Linux because of
    # the existence of the 'new' directory in t_work. The name new
    # clashes with a system header file.
    CCINCLUDES = -idirafter .
    THREADLIBS=-lpthread
    ifdef BUILD_CCC296
    CC=/usr/bin/g++296
    endif
    And I am executing the make file using the command :
    make -f demo12.mk buildoci CDEMOEXE=custagg.so CDEMOOBJS=custagg.o
    I am not getting any error while running this make file.
    Can you please tell me whether PLSQL/Oracle is able to locate the file or not. Incase, if it is locating the file but due to some error in the custagg.so it is throwing that error. If this is the case, is there any way that i can debug the C program .....how can i install the debug_extproc package.. I am really new to C & OCI ... if the custagg.so is being located then there might be some problem with the way I am dynamically allocating memory to some variables.
    Please kindly reply to this Post/response.
    Please let me know if you also want to see my program code.
    Thanks & Regards,
    -NN

  • F4 help on a field on selection-screen called using call selectionn-screen

    Hi,
    I am calling a selection-screen at runtime using call selection-screen 123.
    Now in this selection screen I am taking a parameter thead-tdid as a parameter.
    Could anyone tell me how to get the f4 help for this parameter.
    Please lemme know..
    Thanks in advance..

    Hi arup,
    1. sample code (just copy paste)
    2.
    REPORT ABC.
    DATA : BEGIN OF ITAB OCCURS 0,
    UNAME LIKE USR01-BNAME,
    END OF ITAB.
    data : RETURN_TAB LIKE DDSHRETVAL occurs 0 .
    data : RETURN_wa LIKE DDSHRETVAL .
    PARAMETERS : A(12) TYPE C.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR A.
    ITAB-UNAME = 'U01'. APPEND ITAB.
    ITAB-UNAME = 'U02'. APPEND ITAB.
    ITAB-UNAME = 'U03'. APPEND ITAB.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    DDIC_STRUCTURE = ' '
    retfield = 'ITAB-UNAME'
    PVALKEY = ' '
    DYNPPROG = SY-REPID
    DYNPNR = SY-DYNNR
    DYNPROFIELD = 'A'
    STEPL = 0
    WINDOW_TITLE =
    VALUE = ' '
    VALUE_ORG = 'S'
    MULTIPLE_CHOICE = ' '
    DISPLAY = ' '
    CALLBACK_PROGRAM = ' '
    CALLBACK_FORM = ' '
    MARK_TAB =
    IMPORTING
    USER_RESET =
    tables
    value_tab = ITAB
    FIELD_TAB = FTAB
    RETURN_TAB = return_tab
    DYNPFLD_MAPPING =
    EXCEPTIONS
    PARAMETER_ERROR = 1
    NO_VALUES_FOUND = 2
    OTHERS = 3
    break-point.
    regards,
    amit m.

  • OCI calls failing for Oracle 11g 11.1.0.7 (64 bit)

    Hi,
    I have a 32bit app which we build and compile in a 32 bit OS, we then deploy this in a 64 bit Windows 2008 R1 machine which has a 11g 64 bit DB;
    when the code make the OCI calls the app terminates.On debugging we found out that its failing to make OCI calls on the connect() method of a .cpp file.
    This connect code is a custom wrapper class created for OCI which only accepts a complete SQL statement mainly used for looking after rollback segments, etc.
    The code runs perfectly fine when we internally call the ORACMD of sqlplus and directly execute the sql from a script.
    It only fails when our code tries to connect to the DB and make OCI calls.
    I have also installed a 32 bit Oracle 11g Client 11.1.0.7 since I am using a 32 bit app.
    Is there any compatibility issues between these 2 versions or the dll's?
    Why is it failing while making OCI calls and is there any resolution?
    My machine and setup details:
    OS: Windows 2008 R1
    DB : Oracle 11g R1 11.1.0.7 (64 bit)
    Client: Oracle 11g R1 11.1.0.7 (32 bit)
    Our App: 32 bit
    ORACLE_HOME = // this is pointing to the 64 bit DB
    I tried pointing the oracle_home to the client still no go.
    Any suggestions on this will be appreciated.
    Regards
    Roy

    user13376823 wrote:
    how do i find that my database is using big file tablespace management or not ?
    SQL> select TABLESPACE_NAME,BIGFILE from dba_tablespaces;
    TABLESPACE_NAME                BIG
    SYSTEM                         NO
    UNDOTBS1                       NO
    SYSAUX                         NO
    USERS                          NO
    UNDOTBS2                       NO
    TEMP1                          NO
    TEMP3                          NO
    TEMP2                          NO
    8 rows selected.For tablespaces with smallfile datafile maximun datafile size is 32GB, where as bigfile datafile size is 8 exabytes.

  • Invalid datatype in OCI call ?

    Hello,
    Why i got
    ORA-01024: invalid datatype in OCI call
    when i'm trying to select a clob column from a table? that column contains 'hello world'. i don't know what causes this error..
    Thanks

    ORA-01024:     invalid datatype in OCI call
    Cause:     An OCI program call specified an invalid datatype. In OCI calls, Oracle datatypes are specified as numbers between 1 and 7.
    Action:     Check the datatype description and enter the correct number for the datatype. Please use search, before posting.

  • ORA-01830: date format picture ends before converting entire input string at OCI call OCIStmtFetch

    Hi all,
    We are trying to create a BIP Data Model based on an Answer, but after selecting report, it hangs when I try to Apply to create a query based on Oracle BI. When I try to open the query in aswers, going to results tab I'm getting this error (OBIEE 11.1.1.6.2):
    ORA-01830: date format picture ends before converting entire input string at OCI call OCIStmtFetch
    I suppose that BIP data model is not able to create it because of this error. But this answer is working fine inside dashboards, etc. It only does not work when editing it. Query is doing something like this: "USING "- Collection Attributes"."Due Date" >= TIMESTAMPADD(SQL_TSI_DAY, -30, CAST ('01/04/2009' AS DATE))"
    Any ideas?

    Solved watching date format in generated SQL and changing default date format in presentation variables default values inside criteria according to SQL format.

  • Core dump on OCI call

    We are getting the following core dump on an OCI call ....
    fde12fe0 kpucHTDelete (f872ac, f68380, 0, 31, 203d203a, f7c684) + 9c
    fddae464 kpursetstmttext (f872ac, f871c8, 8, fdd9fa84, d49c40,
    fe449a64) + 9c
    fddae61c kpurclientparse (f872ac, f7cc7c, f682e8, 9a, 400000, d49a14) +
    28
    fddae928 kpureq (f77338, f7cc7c, f682e8, 9a, 1, 0) + 150
    fde69efc OCIStmtPrepare (f872ac, f7cc7c, f682e8, 9a, 1, 0) + 7c
    004642b4 arb_internal_process_query (f68138, f68154, 0, 0, ffbfae28,
    1037de2) + 594
    00453178 arb_next_row (f68138, 10d6c58, 1037d88, ffbfaea4, 29, 2e) + 18
    0028d64c ???????? (f61828, 1067d00, ffbfafa8, 0, 0, 80808080)
    0028db68 list_abp_product_types (f61828, 1067d00, ffbfafa8, 1037c10,
    1067d00, 1067d00) + 20
    002e78a0 insert_abp_serv_inst_product (f61828, 103ee18, 1, ffbfb46c,
    fecd29e8, fd9f0240) + 278
    0014feb8 GTEAB_InsertMRC (ffbfbd54, ffbfc2d0, ffbfbda7, ffbfc2d0,
    ffbfbd98, ffbfc2d0) + 33b8
    000d193c run_pieces (e2f820, e33528, e35aa0, ffbfc3d4, e3f8c0, 0) + 1dc
    000d11b0 handle_request (e2f820, 5, e33528, e34e48, 0, 0) + 278
    000ce1a8 process_request (e2f820, 5, e33528, e34e48, fed73700,
    fd9f2a00) + c8
    000cdfd0 main (3, ffbfc9ac, ffbfc9bc, 79a000, fd9f0180, fd9f01c0) +
    568
    000cce08 _start   (0, 0, 0, 0, 0, 0) + 108
    It always seems to happen on the kpucHTDelete call. I have searched the net for kpucHTDelete but found nothing.
    Can someone
    1. describe what kpucHTDelete is supposed to accomplish and why it might fail.
    2. Is there a way to trace / log OCI ?
    3. Any other suggestions to help with this problem.
    Thanks in advance.
    Gary

    Well, it seems to me a bug.
    You can enable tracing using NET 8 Assistant, and from there go to the tracing tab.
    Select the SUPPORT trace level from the following pull down menu located in the Client Information section:
    OFF: Tracing disabled.
    USER: Trace information applicable for users.
    ADMIN: Trace information applicable for database administrators.
    SUPPORT: Trace information applicable for customer support staff.
    Enter a valid directory name in the Trace Directory field in the Client Information section. This directory specification is where trace files are written on either the client or server.
    Enter a valid filename in the Trace File field in the Client Information section. This filename specifies the name of the trace file on the client or server.
    Click on the "unique File Trace Name" checkbox if you want a unique identifier appended to each new trace file created.
    Save your configuration.
    You can check the SQLNET.ORA file found in the net80/admin directory path to verify that tracing is enabled. There is an entry called TRACE_LEVEL_CLIENT=SUPPORT located in that file and entries that indicate the log file location and name that you specified in the Oracle Net8 Assistant.
    regards

  • Sql command not properly ended at oci call oci stmtexecute

    Hi ,
    Iam new to OBI Apps, i have my DB,OBIEE 11g,Informatica, DAC instance installed in linux 64 bit and OBI Apps, Informatica, Dac clients in windows7 32 bit
    When i run DAC full load all the tasks show Success.
    In RPD when i select database in physical layer it is not showing any rows, when i try right click and select update row count
    [nqsError: 17001] Oracle Error Code: 933, message: ORA-00933: SQL Command not properly ended at OCI call OCIStmtExecute.[nqsError: 17010] SQL Statament Perparation failed.
    and als in answers iam facing same problem
    In Answers iam using EBS pre defined dashboards
    Unable to see the data in dashboards it is throwing error
    [nqsError: 17001] Oracle Error Code: 933, message: ORA-00933: SQL Command not properly ended at OCI call OCIStmtExecute.[nqsError: 17010] SQL Statament Perparation failed.
    I dont know where i had done mistake.
    can any one help in this regard \
    plzzzzzzzzzz

    Hi,
    Thanq for ur reply
    In EBS connection pool i have given at connection script-> execute on contact
    "call /* valueof(NQ_SESSION.ACF) */ APP_SESSION.validate_icx_session('valueof(NQ_SESSION.ICX_SESSION_COOKIE)')"
    can u let me know is it correct.
    And one more doubt
    in client machine i have 2 RPDs in repository
    1. OracleBIAnalyticApps.rpd and
    2. EnterpriseBusinessAnalytics.rpd
    i had uploaded OracleBIAnalytics.rpd in EM and below that i haven the path for catlog/EnterpriseBusinessAnalytics.rpd
    is it correct i have to upload EnterpriseBusinessAnalytics.rpd only

  • TNS:internal network communication error at OCI call OCIServerAttach

    hi,
    am using OBIEE 11g, i have made a new repository in obiee and when i done my analysis phase i checked the result and i recived an error :
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 17001] Oracle Error code: 12157, message: ORA-12157: TNS:internal network communication error at OCI call OCIServerAttach. [nQSError: 17014] Could not connect to Oracle database. (HY000)
    i made the changes in TNS but nothing happened, any suggestion ??
    thanx..

    Hi Guys,
    I got the same error message. I can see the data in the physical layer. Once i import my repository via weblogic, i can see the subject areas and all its related filed in Analysis section.
    However i cannot view any data for any columns. Error;
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 17001] Oracle Error code: 12154, message: ORA-12154: TNS:could not resolve the connect identifier specified at OCI call OCIServerAttach. [nQSError: 17014] Could not connect to Oracle database. (HY000)
      SQL Issued: SELECT 0 s_0, "Invoices"."Customer Name"."ACCOUNT_NAME" s_1 FROM "Invoices" FETCH FIRST 65001 ROWS ONLY

  • BI Analytics - ORA-12637: Packet receive failed at OCI call OCIServerAttach

    Hi All,
    I'm running through 1 of the tutorials at the moment, and when I try to view results in an Analytics dashboard, I get the following error message: -
    View Display Error
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 17001] Oracle Error code: 12637, message: ORA-12637: Packet receive failed at OCI call OCIServerAttach. [nQSError: 17014] Could not connect to Oracle database. (HY000)
    SQL Issued: SELECT s_0, s_1, s_2, s_3 FROM ( SELECT 0 s_0, "Sample Sales"."Products"."Type" s_1, "Sample Sales"."Time"."Per Name Year" s_2, "Sample Sales"."Base Facts"."Revenue" s_3 FROM "Sample Sales" ) djm
    The database is running and I can connect to it through SQLPLUS, I can tnsping the DB, can anyone help me debug this?
    Thanks,
    Mike

    1. If you are using SampleSales I assume these are xml files. If so, check your initb to verify the correct path for the folders.
    2. If you are using database, check if you have place the tns in the Oracle_BI1/Network location

  • OCI CALLS : Oracle 8.1.5 to Oracle 8.1.6

    Hi
    I am working on messaging product which was compiled and linked with Oracle 8.1.5. It was working on HPUX 11.0 machine. That product is a CORBA product which uses ORCALE to store message database. This product uses OCI calls to access ORACLE.
    But I am having a new task of running that product on oracle 8.1.6 version. When I ran old bineries(compiled and built with oracle 8.1.5 libs) with oracle 8.1.6 product, I am getting following runtime errors. DBINIT is a executable.
    $PROMPT>DBINIT -v
    /usr/lib/dld.sl: Unresolved symbol: LhtStrCreate (code) from /opt/oracle/8.1.6/lib/libwtc8.sl
    /usr/lib/dld.sl: Unresolved symbol: LhtStrInsert (code) from /opt/oracle/8.1.6/lib/libwtc8.sl
    /usr/lib/dld.sl: Unresolved symbol: nauzaoss (code) from AmOraDbInit
    /usr/lib/dld.sl: Unresolved symbol: nauzaoss (code) from /opt/TPBroker/AM/lib/libAmdOra.sl
    Whether I need to compile and build whole product with oracle 8.1.6.
    In my product I am using OCI calls, so whether I need to change those calls.
    $PROMPT>chatr DBINT
    shared executable
    shared library dynamic path search:
    SHLIB_PATH enabled first
    embedded path disabled second Not Defined
    shared library list:
    dynamic /usr/lib/libpthread.1
    dynamic /vobs/TPBroker/hpux/TPBroker/lib/libots_r.sl
    dynamic /vobs/TPBroker/hpux/TPBroker/lib/libdcpmsg.sl
    dynamic /vobs/bldenv/hp11/Visigenic/vbroker/lib/liborb_r.sl
    dynamic /vobs/bldenv/hp11/Oracle/lib/libclntsh.sl.8.0
    dynamic /usr/lib/libstd.2
    dynamic /usr/lib/libstream.2
    dynamic /usr/lib/libCsup.2
    dynamic /usr/lib/libm.2
    dynamic /usr/lib/libcl.2
    dynamic /usr/lib/libc.2
    static /usr/lib/libdld.2
    shared library binding:
    immediate
    global hash table disabled
    plabel caching disabled
    global hash array size:1103
    global hash array nbuckets:3
    shared vtable support disabled
    static branch prediction disabled
    executable from stack: D (default)
    kernel assisted branch prediction enabled
    lazy swap allocation disabled
    I haven't got any documents for this thing.
    If anybody gone thru this problem, please help me for solving this problems.
    Thank you
    -Pravin

    applets can only use jdbc thin drivers.

  • Using Select Statement in the decoe function in Oralce Form10 g

    Hello All:
    Is it possible to call another Select Statement inside the Decode Function in Oracle Form? I tested the SQL on PL/SQL Plus, it ran without giving any errors. However, I got the following errors when I tried to compile the procedure in the Oracle Form right after the where condiction at the first select statement....
    Error 103 at line number....
    Encountered the symbol "," when expecting one of the following
    ) intersect minus order union .....
    Select a.col1
    a.col2,
    decode((select min(test_date) pa_closr_date from table_name c where a.col1 = c.col1), null, a.col3,(select min(test_date) pa_closr_date from table_name c where a.col1 = c.col1)) test_date,
    a.col4,
    from table_name a;
    thanks ahead for any help.
    KMD

    You don't need the Select within the decode. In SQL Plus, I tried your SQL using this:
    Select
        a.col1,
        a.col2,
        decode( (select min(test_date) pa_closr_date
                   from table_name c where a.col1 = c.col1), null, a.col3,
                (select min(test_date) pa_closr_date
                   from table_name c where a.col1 = c.col1)
              ) test_date
      from table_name a;And this gives the same result:
    Select
        a.col1,
        a.col2,
        decode(c.pa_closr_date, null, a.col3, c.pa_closr_date ) test_date
      from table_name a,
           ( select col1, min(test_date) pa_closr_date
             from table_name
             group by col1 ) c
      where c.col1(+) = a.col1;

  • How to use select-options in the function module of import parameter ?

    Hi ...
       I have created a BAPI and tested in SWO1 tcode , by giving the single value for an company code ( BUKRS ) , it executed properly .
    Same thing is working after implementing in a program .
    so now it is working for fetching a single company code details .
    My requirement is : I want to use select-options in program as well as in function module IN IMPORT PARAMETER.
    Program :
    REPORT  ZTEST.
    TABLES : T001 , ZBAPI_STR .
    TYPES : BEGIN OF TY_ITEM  .
              INCLUDE STRUCTURE ZBAPI_STR .
    TYPES : END OF TY_ITEM .
    DATA :WA_ITEM TYPE TY_ITEM ,
          ITEM LIKE STANDARD TABLE OF WA_ITEM INITIAL SIZE 0 .
    PARAMETER : BUKRS TYPE ZBAPI_STR-BUKRS.
    call function 'ZBAPI_FMT001'
      exporting
        bukrs         =  BUKRS
    IMPORTING
      RETURN        =
      tables
        itemtab       = ITEM
    IF ITEM IS NOT INITIAL .
      LOOP AT ITEM INTO WA_ITEM .
        WRITE : / WA_ITEM-BUKRS , WA_ITEM-BUTXT , WA_ITEM-ORT01 , WA_ITEM-LAND1 .
      ENDLOOP.
    ENDIF.
    FUNCTION MODULE :
    FUNCTION ZBAPI_FMT001.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(BUKRS) TYPE  EFG_TAB_RANGES
    *"  EXPORTING
    *"     VALUE(RETURN) TYPE  BAPIRET2
    *"  TABLES
    *"      ITEMTAB STRUCTURE  ZBAPI_STR
    SELECT BUKRS BUTXT ORT01 LAND1 FROM T001 INTO TABLE ITEMTAB WHERE BUKRS = BUKRS .
    ENDFUNCTION.
    Regards
    Deepa.

    I have given a similiar example which i did
    Declare a
    Table type:Z_TT_PONUM             
    Short text  :  Select options  PO Number
    in SE11 tcode with row type eg: Z_ST_PONUM
    create a structure (this will be the row type)
    Structure          Z_ST_PONUM            
    Short text         Select Options Field PO number
    Compenent  Compent type
    SIGN       BAPISIGN      Inclusion/exclusion criterion SIGN for range tables
    OPTION       BAPIOPTION      Selection operator OPTION for range tables
    LOW       EBELN                      Purchasing Document Number
    HIGH       EBELN                      Purchasing Document Number
    In the function module import
    give as
    I_PO_NUM     TYPE     Z_TT_PONUM     opt  pass value Select options  PO Number
    Hope this is exactly what you want to know.
    So you create a structure simliar to mine but the low an high whould be your component
    then a table type  and then include that in the BAPI.
    Then pass your select-option value to this BAPI when you call this BAPI in the program

  • "Always Use Selected Format" check box in line items report

    Hi Experts,
    I have an issue in ECC 6.0.
    From the transaction code FBL1N (Vendor Line Items) I am trying to export the report to spreadsheet by selecting the option  List> Export>Spreadsheet  then I have selected "Always Use Selected Format" check box.  But if I execute the same report again I am not getting this option "Always Use Selected Format". Please let me how can we retrieve that option. Is there any possibility to get that option again either functionally or technically. I would like to know all the possible ways to get this option again.
    Please do the needful.

    Hello,
    In one my thread Mr. Frank has replied as follows. I believe he has solved this.
    Hope this may be really helpful.
    The problem with the spreadsheet download is at one point, users have selected their default file type.
    That said, SAPGUI is working as it should. (gui710)
    Question though is how do we reset the values so they get the ?Select Spreadsheet Format? popup again.
    The following steps should be performed :
    - Call transaction SE38, enter program SALV_BS_ADMIN_MAINTAIN, and press F8.
    - Follow the parameters below :
    - Select ?DELETE? on the Actions Group
    - Select ?DETAILED SELECTION? on the General Data :
    - On Client - your number
    - User : <user name>
    -Hit EXECUTE.
    -Press ENTER on the POPUP
    - If there is an entry in the report that will need to be deleted. Also, make sure that the entry you will delete (for the user) has a value of GUI_ALV_XML_VER on field ?Parameter? .
    - Select the line and hit the DELETE icon .
    - Press ?Y? to continue delete. Press ENTER on the popup.
    - Then EXIT all the way out of the program.
    NOTE : When you run program SALV_BS_ADMIN_MAINTAIN, make sure they are out of any program that they are using for download.
    Re: "Always Use Selected Format" check box in line items report
    Regards,
    Ravi
    Edited by: Ravi Sankar Venna on May 15, 2009 2:31 PM

Maybe you are looking for