Convert delimited list of numbers from function to use in SELECT IN () quer

Hey guys,
I have to create a view based on some conditions. I have to get only the rows with specific IDs. I do the calculations for the logic using a function which returns a delimited list of the IDs. When I use this string in the query, it gives me a "Invalid Number" error.
Here's the skeleton
Select table1.col, table2.col1, table2.col2, table2.col3
from table1, table2
where table2.col1 in (function(table1.col))
function() returns 12,34,564,7657 ....
The reason that I am using a function to get the IDs is that the logic involved is complicated to get the right IDs. Any help would be appreciated
Thanks,
-P

You can do this.
select emp.* from  emp,
table (sys.dbms_debug_vc2coll (7499,7788,7934))
where empno = column_value
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7788 SCOTT      ANALYST         7566 19-APR-87       3630                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300    

Similar Messages

  • GL Report listing all lines from the documents used

    Hi Experts
    The standard GL Report is printed from SAP only GL level transactions.
    I would like to produce a printed report by inputting a GL Code and a date range. Output should be all transactions that have been posted to that account during the specified time period.  The important requirement of this report is that  transactions should actually contain details from the source documents ie a figure from an AP invoice should go on to list the lines on that AP invoice that are relevant to this account. Same applies to AR Invoices, Inventory transactions, etc, etc. Any GL Account specified and details of all
    Is there a report in SAP that can achive this or is there a query that can be run to achieve above
    Thank you
    Regards
    Apsara

    Hi Apsara Senaratna,
    I believe that the General Ledger report in SAP can cater your need. (Go to Financials > Financials Reports > Accounting > General Ledger.)
    But you just have to uncheck BP, then mark (x) to what GL accounts you want to show details. Then you could also set parameters for Posting, Due, and Document Dates.
    Hope this helps!
    Thanks!

  • Use PL/SQL Table values as a comma delimited list in a in (...) clause

    Hi,
    One my procedure's parameters is a PL/SQL table of id's (NUMBER) that the GUI sends it, based on the user's selections.
    Now, I want to use the table's values in my select's where clause to return only the correct records.
    However,
    select ......
    from ....
    where id in (i_array_ids)
    doesn't work of course, and my attempts of transfering the ids to a comma delimited list of numbers (as opposed to a lenghty varchar2 string) that could work between the ( ) have all failed.
    Thanks

    And here's an example I gave with some more up-to-date syntax than in that old AskTom thread:
    Re: DYNAMIC WHERE CLAUSE in PROCEDURE

  • Can we change WSDL file created from Function Module wizard??

    Hi everybody!
    I have created a web service from function module using SAP wizard.
    Now the consumer side want me to change <wsp:UsingPolicy wsdl:required="true"/>
    Is this possible???
    If so how?????
    Thank u in advance!!

    Hi Muhammad!
    As soon as you open WSDL for selected binding in the URL are of you explorer change the ws_policy with "standard" . Then simply save the wsdl and send it to the other party.
    Hope this helps!

  • Retrieve HP IP phones serial numbers from Lync Server

    Hello everyone.
    I'm wondering if there's anyway to retrieve HP phone serial numbers from Lync Server using a script or any method there ? 
    If there's not, Is there any tool that would extract the serial numbers of the phone from HP Phones? I know until now there's two HP phones that's compatible with Lync.
    4110 and 4112.
    I would appreciate any comment. 
    thanks
    Mohammed JH

    I got it, 
    This batch file will do the job, I created a folder on Lync and made it available for me on the network so I can get a daily report of the HP connected phones along with serial numbers. 
    The folder name is C:\PublicFolder
    The below batch file will check for the word (HP) on the Lync imageupdates folder and will send all files which have HP inside them to the public folder. 
    I will run a schedule task on daily basis to do this. 
    Thanks.
    setlocal
    set SourcePath=C:\Lyncshare\1-WebServices-7\DeviceUpdateLogs\Server\Audit\imageUpdates
    set TargetPath=C:\PublicFolder
    set FileMask=*.*
    set Search=HP
    for %%a in ("%SourcePath%\%FileMask%") do (
    echo Processing %%~nxa ...
    findstr.exe /r "\<%Search%\>" "%%a" >NUL
    if not errorlevel 1 (
    copy "%%a" "%TargetPath%"
    echo Done.
    Mohammed JH

  • Move data from multiple Tables to a Single Table & Convert the list to ALV.

    Hi,
    My aim is to get the list of Materials with their descriptions, with MRP Controller, with Unrestriced Qty. & the Reorder Qty. So, I have to fetch the data from different tables. But finally I am not able to copy or move the fetched data from multiple tables into the single final table.
    Also tell me how to convert this list into ALV.
    Below is the program code.
    *& Report  Y_REORDER_REPORT
    REPORT  Y_REORDER_REPORT.
    tables : marc,makt, mard.
    DATA: Begin of i_final occurs 0,
            matnr type marc-matnr,
            maktx type makt-maktx,
            DISPO type marc-DISPO,
            MINBE type marc-MINBE,
            LABST type mard-LABST,
          end of i_final.
    DATA: Begin of i_marc occurs 0,
           matnr type marc-matnr,
           DISPO type marc-DISPO,
           MINBE type marc-MINBE,
          end of i_marc.
    DATA: Begin of i_makt occurs 0,
           matnr type makt-matnr,
           maktx type makt-maktx,
          end of i_makt.
    DATA: Begin of i_mard occurs 0,
           matnr type mard-matnr,
           LABST type mard-LABST,
           LGORT TYPE MARD-LGORT,
          end of i_mard.
    SELECT  matnr
            dispo
            minbe from marc
            into corresponding fields of table i_marc
            where dispo EQ 'STR'.
    SORT I_MARC by MATNR.
    WRITE: /10  'Material',
            75  'MRP',
            80  'Reorder Qty.'.
    LOOP at i_marc.
    Write: /10  i_marc-matnr,
            75  i_marc-dispo,
            80  i_marc-minbe.
    ENDLOOP.
    write: /.
    SELECT  matnr
            MAKTX from makt
            into corresponding fields of table i_makt
            for all entries in i_marc
            where matnr = i_marc-matnr.
    LOOP at i_makt.
    Write: /10 i_makt-matnr,
            30 i_makt-maktx.
    ENDLOOP.
    SELECT  matnr
            LGORT
            LABST from mard
            into corresponding fields of table i_mard
            for all entries in i_marc
            where matnr = i_marc-matnr.
    LOOP at i_mard.
    Write: /10 i_mard-matnr,
            30 I_MARD-LGORT,
            40 i_mard-labst.
    ENDLOOP.
    move  i_mard-matnr to i_final-matnr.
    move  i_marc-dispo to i_final-dispo.
    move  i_marc-minbe to i_final-minbe.
    move  i_makt-maktx to i_final-maktx.
    move  i_mard-labst to i_final-labst.
    WRITE: /10  'Material',
            30  'Material Desc.',
            75  'MRP',
            80  'Reorder Qty.',
            105 'Current Stock'.
    LOOP at i_final.
    Write: /10  i_final-matnr,
            30  i_final-maktx,
            75  i_final-dispo,
            80  i_final-minbe,
            105 i_final-labst.
    ENDLOOP.
    *LOOP at i_mard.
    *Write: /10  i_mard-matnr,
           30  i_makt-maktx,
           75  i_marc-dispo,
           80  i_marc-minbe,
           105 i_mard-labst.
    *ENDLOOP.
    Regards,
    Vishal

    Change like this,
    SELECT matnr
    lgort
    labst FROM mard
    INTO CORRESPONDING FIELDS OF TABLE i_mard
    FOR ALL ENTRIES IN i_marc
    WHERE matnr = i_marc-matnr.
    LOOP AT i_mard.
       WRITE: /10 i_mard-matnr,
       30 i_mard-lgort,
       40 i_mard-labst.
    ENDLOOP.
    LOOP AT i_marc.
       READ TABLE i_mard WITH KEY matnr =  i_marc-matnr.
       READ TABLE i_makt WITH KEY matnr =  i_marc-matnr.
       MOVE i_mard-matnr TO i_final-matnr.
       MOVE i_marc-dispo TO i_final-dispo.
       MOVE i_marc-minbe TO i_final-minbe.
       MOVE i_makt-maktx TO i_final-maktx.
       MOVE i_mard-labst TO i_final-labst.
       APPEND i_final.
    ENDLOOP.
    WRITE: /10 'Material',
    30 'Material Desc.',
    75 'MRP',
    80 'Reorder Qty.',
    105 'Current Stock'.

  • Convert list item attachment from docx to pdf using Word Automation Services

    I have been trying to convert List Item attachments from docx to pdf using word automation services, it works in a normal document library but when I use the list attachment it throws a null reference error.
    var settings = new ConversionJobSettings();
    settings.OutputFormat = Microsoft.Office.Word.Server.Conversions.SaveFormat.PDF;
    var conversion = new ConversionJob("Word Automation Services", settings);
    conversion.UserToken = SPContext.Current.Site.UserToken;
    var wordFile = SPContext.Current.Site.RootWeb.Url + "/" + wordForm.Url;
    var pdfFile = wordFile.Replace(".docx", ".pdf");
    conversion.AddFile(wordFile, pdfFile);
    conversion.Start();
    Using reflector I was able to see my problem lies in Microsoft.Office.Word.Server.FolderIterator.cs where it uses SPFile.Item which returns NULL
    internal void CheckSingleItem(SPFile inputFile, SPFile outputFile)
    Microsoft.Office.Word.Server.Log.TraceTag(0x67337931, Microsoft.Office.Word.Server.Log.Category.ObjectModel, Microsoft.Office.Word.Server.Log.Level.Verbose, "OM: FolderIterator start a single item: source='{0}'; dest='{1}'", new object[] { inputFile.Url, outputFile.Url });
    Stopwatch stopwatch = Microsoft.Office.Word.Server.Log.StartPerfStopwatch();
    try
    this.CheckInputFile(inputFile.Item);
    this.CheckOutputFile(outputFile.Url);
    Is there any way to get around this?

    Hi Qfroth,
    According to your description, my understanding is that when you use word automation service to convert Word to PDF for list item attachment, it throws the null reference error.
    I suggest you can create an event receiver and convert the word to memory stream like below:
    private byte[] ConvertWordToPDF(SPFile spFile, SPUserToken usrToken)
    byte[] result = null;
    try
    using (Stream read = spFile.OpenBinaryStream())
    using (MemoryStream write = new MemoryStream())
    // Initialise Word Automation Service
    SyncConverter sc = new SyncConverter(WORD_AUTOMATION_SERVICE);
    sc.UserToken = usrToken;
    sc.Settings.UpdateFields = true;
    sc.Settings.OutputFormat = SaveFormat.PDF;
    // Convert to PDF
    ConversionItemInfo info = sc.Convert(read, write);
    if (info.Succeeded)
    result = write.ToArray();
    catch (Exception ex)
    // Do your error management here.
    return result;
    Here is a detailed code demo for your reference:
    Word to PDF Conversion using Word Automation Service
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Can't make calls to numbers from contact list or c...

    I have a Nokia N95 8GB and have the same problem. I can key in a number and dial it, but am unable to dial from the contact list or from the call register. If I restart the phone, I am able to dial numbers from my phone book, but after some time, the same problem takes over. Any suggestions?

    Me too have same problem, guys please help !!

  • PL/SQL function returning a colon delimited list of headings

    Hello,
    Apex version 4.1.0.23. I am editing an existing classic report which has the column heading option set to 'PL/SQL function returning a colon delimited list of headings'. I have been looking for some time but I cannot find where this PL/SQL function is defined. Can any one point me to the right direction? I do not see anything in the documentation either.
    Thanks,
    Usman

    Hi Usman,
    I looked into this issue and found that there's some JavaScript code executed when opening the page with the PL/SQL headings option enabled, or when selecting that option after loading the page, and this JavaScript attempts to set a background color for the column heading fields. Since we only display attributes for up to 100 columns, this JavaScript fails once you have more than 100 columns.
    I would certainly agree with Tony that 60 or 100 columns are a bit much. But there should be some indication why something is not working, even if it's only a message stating that there's only a certain number of columns supported. So I'll log a bug to improve this in APEX 5.0.
    Thanks,
    Marc

  • Is it possible to convert a table of values into a comma-delimited-list?

    Hi,
    I'd like to turn the following dataset:
    Parent | Child
    Charles | William
    Charles | Harry
    Anne | Peter
    Anne | Zara
    Andrew | Beatrice
    Andrew | Eugenie
    into this:
    Parent | Children
    Charles | Diana,Camilla
    Anne | Peter,Zara
    Andrew | Beatrice,Eugenie
    In other words, I'd like to take a list of values pertaining to some key and produce them as a comma-delimited-list.
    I know its is possible in T-SQL although the method is a bit of a nasty hack. Is it possible in PL-SQL?
    Thaks in advance
    Jamie

    Hi,
    With model clause (10g)
    with t  as(
    select 'Charles' parent, 'William' child from dual union
    select 'Charles', 'Harry' from dual union
    select 'Anne', 'Peter' from dual union
    select 'Anne', 'Zara' from dual union
    select 'Andrew', 'Beatrice' from dual union
    select 'Andrew', 'Eugenie' from dual
    select parent,substr(res,2) res
    from t
    model
    return updated rows
    partition by ( parent)
    dimension by ( row_number()over(partition by parent order by child) rn)
    measures(child, cast( null as varchar2(4000)) as res)
    rules
    iterate(100000)
    until(presentv(res[iteration_number+2],1,0)=0)
    ( res[0]=res[0]||','||child[iteration_number+1]);
    PARENT  RES                                              
    Anne    Peter,Zara                                       
    Andrew  Beatrice,Eugenie                                 
    Charles Harry,William                                    
    3 rows selected.

  • How to find max value from a list of numbers stored in a varray?

    hi,
    Can any body help me to get the max value from a list of numbers stored in a varray?
    thanks in advance....
    regards
    LaxmiNarsimha

    Yes. Could you post what you have tried before we start helping you in this?

  • There is a URL with all my apple hardware. When I sell a iPhone, I must cancel it from the list - how does it function?

    There is a URL with all my apple hardware. When I sell a iPhone, I must cancel it from the list - how does it function?

    There is no requirement that you add or delete items, but it can be helpful. The URL is https://supportprofile.apple.com/ and to delete, you click the "Edit Products" button near the top right of that page.

  • I have all my devices connected to iCloud.  I would like a reduced contact list on my iPhone without removing any from my master list on my computer.  How do I delete contact numbers from my phone without disrupting the master list on my computer?

    I have all my devices connected to iCloud.  I would like a reduced contact list on my iPhone without removing any from my master list on my computer.  How do I delete contact numbers from my iphone without disrupting the master list on my computer?

    Are you trying to reduce the visual clutter on the phone, save space on the phone, or limit the security exposure if your phone is stolen?
    If you are only wanting to reduce the visual clutter and make scrolling through the list faster, you could set up a group on the computer containing only the contacts you want to see on my phone (called, for example, "Show on my Phone") and enable only that group inside Contacts on the phone. You might even have one or more existing groups that you could enable that way (maybe "Family" and "Personal").

  • How do I generate random numbers from a list of numbers without repeating any number

    I am trying to generate a list of random numbers without any repeating numbers.  For example say the list is from 1 to 15, how do I randomly generate a list of numbers using each number only once?

    pb,
    You can build a randomizer by making a 2-column table with 15 rows. In Column A, Fill with the numbers 1 to 15. In column B Fill with RAND(). Then sort on Column B. There will now be a randomized list of the numbers from 1 to 15 in Column A. You can copy this random list and use it in your application.
    Jerry

  • Convert abap list to DOC

    how do i convert abap list to DOC .
    Rendi

    hi,
    this program to convert abap list to PDF file.
    *& Report  ZWARUN_TEST4
    REPORT  ZWARUN_TEST4.
    tables:mara,bseg.
    data:begin of itab occurs 2,
         matnr like mara-matnr,
         ernam like mara-ernam,
        end of itab.
    data:begin of it_bseg occurs 2,
         bukrs like bseg-bukrs,
         belnr like bseg-belnr,
         gjahr like bseg-gjahr,
         shkzg like bseg-shkzg,
         dmbtr like bseg-dmbtr,
        blart like bkpf-blart,
         end of it_bseg.
    data: lv_numbytes type i,
          lv_spoolno type tsp01-rqident,
          c_layout like pri_params-paart value 'X_65_132',
          C_X type c value 'X',
          numbers type i,
          cancel.
    data:it_pdf like tline occurs 10 with header line.
    data:p_down like rlgrap-filename.
    *at selection-screen.
    selection-screen:begin of  block blk with frame.
    select-options:s_matnr for mara-matnr,
                   s_bukrs for bseg-bukrs.
    parameter: download as checkbox default 'X',
               p_file like rlgrap-filename default 'c:\warun.pdf'.
              p_down LIKE RLGRAP-FILENAME DEFAULT 'c:\warun2.txt'.
    selection-screen:end of block blk .
    selection-screen pushbutton 12(20) push user-command cl1.
    at selection-screen.
      perform validate.
    top-of-page.
      write:/10 sy-repid inverse color 3.
      write:/2 'Date:' , sy-datum,
             40 'Time:' , sy-uzeit.
      write:/2 sy-uline.
    end-of-page.
      write:/50 'Intelligroup Asia Pvt'.
      write:/20 sy-pagno.
    start-of-selection.
      select matnr
             ernam
             into table itab
             from mara
             where matnr in s_matnr.
      if sy-subrc = 0.
        sort itab by matnr.
      endif.
      perform besg_data.
    set pf-status 'PUSH'.
    at user-command.
    if sy-ucomm = 'DOWNLOAD'.
      if download = space.
        perform get_file.
      endif.
    end-of-selection.
      if download = 'X'.
        perform PDFfile.
      ENDIF.
    *&      Form  validate
    FORM validate .
      data: v_temp(40).
      select single
             matnr
             into v_temp
             from mara
             where matnr in s_matnr.
      if sy-subrc <> 0.
        message e000(zz) with 'no data found'.
      endif.
    ENDFORM.                    " validate
    at line-selection.
      set parameter ID 'MAT' FIELD ITAB-MATNR.
      CALL TRANSACTION 'MM03' .
      WRITE:/ 'Material data displayed' .
      write:/2 itab-matnr.
    *&      Form  PDFfile
    FORM PDFfile .
      data:lk_params type pri_params,
            lv_valid.
    All the parameters passed are constants, so exceptions
    doesn't get raised
      call function 'GET_PRINT_PARAMETERS'
        EXPORTING
          immediately    = ' '
          layout         = c_layout                             "'X_65_132'
          no_dialog      = c_x
        IMPORTING
          out_parameters = lk_params
          valid          = lv_valid.
      if lv_valid <> space .
        new-page print on parameters lk_params no dialog.
    *--To display the final report
        perform print_report.
        new-page print off.
    *---To convert the download to PDF
        perform conv_to_pdf_download.
        perform download.
      endif.
    endif.
    *--To display the final report
      perform print_report.
    ENDFORM.                    " PDFfile
    *&      Form  print_report
    FORM print_report .
      loop at itab.
        write:/2 sy-vline,
               4 itab-matnr  color 4 HOTSPOT,
               40 sy-vline ,
               41 itab-ernam color 5,
               55 sy-vline.
        HIDE: ITAB-MATNR.
      endloop.
    ENDFORM.                    " print_report
    *&      Form  conv_to_pdf_download
    FORM conv_to_pdf_download .
      wait up to 2 seconds.
      lv_spoolno = sy-spono.
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        exporting
          src_spoolid                    =  lv_spoolno
         no_dialog                      = ''
       DST_DEVICE                     =
       PDF_DESTINATION                =
       importing
         pdf_bytecount                  = lv_numbytes
       PDF_SPOOLID                    = pdfspoolid
       LIST_PAGECOUNT                 =
       BTC_JOBNAME                    = jobname
       BTC_JOBCOUNT                   = jobcount
       tables
         pdf                            = it_pdf.
    ENDFORM.                    " conv_to_pdf_download
    *&      Form  download
    FORM download .
      check download = 'X'.
      call function 'DOWNLOAD'
        EXPORTING
          bin_filesize = lv_numbytes
          filename     = p_file
          filetype     = 'BIN'
        IMPORTING
          act_filename = p_file
          filesize     = lv_numbytes
          cancel       = cancel
        TABLES
          data_tab     = it_pdf.
      if cancel = space.
        write: / lv_numbytes, p_file.
      endif.
    ENDFORM.                    " download
    *&      Form  get_file
    FORM get_file .
      Data: s_filename like rlgrap-filename,
            s_filepath like rlgrap-filename,
            tm_filepath like rlgrap-filename.
      CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
         DEF_FILENAME           = s_filename
         DEF_PATH               = s_filepath
            MASK                   = ' '
            MODE                   = ' '
            TITLE                  = ' '
       IMPORTING
         FILENAME               =  tm_filepath
      IF SY-SUBRC = 0.
        p_down = tm_filepath.
        perform download2.
      endif.
    ENDFORM.                    " get_file
    *&      Form  download2
    FORM download2 .
      DATA: LV_STRING TYPE STRING.
      LV_STRING = P_DOWN.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                        = LV_STRING
         FILETYPE                        = 'ASC'
      APPEND                          = ' '
         WRITE_FIELD_SEPARATOR           = 'X'
        TABLES
          DATA_TAB                        = itab
       EXCEPTIONS
         FILE_WRITE_ERROR                = 1
         NO_BATCH                        = 2
         GUI_REFUSE_FILETRANSFER         = 3
         INVALID_TYPE                    = 4
         NO_AUTHORITY                    = 5
         UNKNOWN_ERROR                   = 6
         HEADER_NOT_ALLOWED              = 7
         SEPARATOR_NOT_ALLOWED           = 8
         FILESIZE_NOT_ALLOWED            = 9
         HEADER_TOO_LONG                 = 10
         DP_ERROR_CREATE                 = 11
         DP_ERROR_SEND                   = 12
         DP_ERROR_WRITE                  = 13
         UNKNOWN_DP_ERROR                = 14
         ACCESS_DENIED                   = 15
         DP_OUT_OF_MEMORY                = 16
         DISK_FULL                       = 17
         DP_TIMEOUT                      = 18
         FILE_NOT_FOUND                  = 19
         DATAPROVIDER_EXCEPTION          = 20
         CONTROL_FLUSH_ERROR             = 21
         OTHERS                          = 22
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                                                    " download2
    *&      Form  besg_data
    FORM besg_data .
    if itab is initial.
    select bukrs
           belnr
           gjahr
           shkzg
           dmbtr
          into corresponding fields of table it_bseg
           from bseg
          where bukrs in s_bukrs.
    endif.
    ENDFORM.                    " besg_data
    regards
    warun

Maybe you are looking for

  • What kind of portable hard drive can I use with my macbook air 13''

    What is the type of portable hard disk that can be used with the macbook air

  • Need a Way to Create a Local Group Push via GPO on Windows Server 2003 DC

    There is a new requirement to create a new local group on all machines and add all local and built-in administrators. To save time, I would like a GPO to create the new group, along with configuring its members. Any helpful information I found is for

  • Update table based on collection

    Hello friends, I have two tables: 1- PHOTOS (img_id number (5,0),Product_id number (5,0), Content Blob ....) 2- PRODUCTS (Product_id number (5,0), product_type .... ) each product has 1 to 6 images. I need to watermark the uploaded images in the memo

  • Don't permit release maintenance orders after Period-End CO

    Hello. Is there a standard way in SAP to don't permit the creation or release of maintenance orders after a Period-End CO is established? We had a case the last month when an user created an order after a specific hour and it caused an incongruity in

  • Traveling and am getting No Service

    I am from the US traveling in Germany and the first day all was well with my phone but now I'm getting No Service -- I've tried changing the settings and turning it off and on -- it contines to read No Service.  Any helpful ideas?