Lr_selections- get_selected_rows returns zero entries Follow-Up Question...

Hello SDN Community,
I was able to get a list of row numbers returned from GET_SELECTED_ROWS when I added a call to GET_METADATA.
However, GET_SELECTED_ROWS only works the first time.  When I return to the screen, the lines are still highlighted and if I click the button again, it goes thru the code but won't return the row numbers. 
If I back up to the previous screen and come forward to the ALV grid screen, the rows are still highlighted and when i click the button, no row numbers are returned.
I do not understand why the rows remain highlighted in the grid.  I tried the grid->refresh method, but that does not clear the highlighting.  I can't help but think that maybe if I could figure out how to get the highlighted lines to go away, that maybe GET_SELECTED_ROWS would start working again.
Or maybe I need to do something else for GET_SELECTED_ROWS to start working again?
Your thoughts and insights are appreciated!
Thank you,
Dean Atteberry.

Hi,
Not sure ...what you are missing...I tried this code..and it returns the correct set of rows...even if click the button to get the rows...multiple times...
please check this sample.
DATA: g_container TYPE scrfname VALUE 'CONTAINER1'.
DATA: g_custom_container TYPE REF TO cl_gui_custom_container.
TYPES: BEGIN OF type_output,
         matnr TYPE matnr,
       END OF type_output.
DATA:lt_output   TYPE STANDARD TABLE OF type_output,
     lwa_rows    TYPE int4,
     lwa_output  TYPE type_output,
     lt_rows     TYPE salv_t_row.
* Local declarations.
DATA: lr_table      TYPE REF TO cl_salv_table,
      lr_selections TYPE REF TO cl_salv_selections.
DATA: lr_columns    TYPE REF TO cl_salv_columns_table.
DATA: lr_grid       TYPE REF TO cl_gui_alv_grid.
START-OF-SELECTION.
* Prepare data.
  lwa_output-matnr = 'TEST1'.APPEND lwa_output TO lt_output.
  lwa_output-matnr = 'TEST2'.APPEND lwa_output TO lt_output.
  lwa_output-matnr = 'TEST3'.APPEND lwa_output TO lt_output.
  CALL SCREEN 100.
*       MODULE PBO OUTPUT                                             *
MODULE pbo OUTPUT.
  SET PF-STATUS 'TEST'.
  IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
      EXPORTING
        container_name = g_container.
* Call the factory method
    TRY.
        cl_salv_table=>factory(
          EXPORTING
            r_container = g_custom_container
            container_name = 'CONTAINER1'
          IMPORTING
            r_salv_table = lr_table
          CHANGING
            t_table      = lt_output ).
      CATCH cx_salv_msg.                                "#EC NO_HANDLER
    ENDTRY.
* Column selection
    lr_selections = lr_table->get_selections( ).
    lr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
    lr_columns = lr_table->get_columns( ).
    lr_columns->set_optimize( abap_true ).
* Display
    lr_table->display( ).
  ENDIF.
ENDMODULE.                    "pbo OUTPUT
*       MODULE PAI INPUT                                              *
MODULE pai INPUT.
  CASE sy-ucomm.
    WHEN 'EXIT' OR 'BACK'.
      PERFORM exit_program.
    WHEN 'GET_ROWS'.
      CALL METHOD lr_table->get_metadata.  " call this method....
* Get the selected rows.
      lt_rows = lr_selections->get_selected_rows( ).
* Display the selected rows.
      BREAK-POINT.          " break point.
      LOOP AT lt_rows INTO lwa_rows.
        READ TABLE lt_output INTO lwa_output INDEX lwa_rows.
        WRITE: / lwa_output-matnr.
      ENDLOOP.
  ENDCASE.
ENDMODULE.                    "pai INPUT
*       FORM EXIT_PROGRAM                                             *
FORM exit_program.
  LEAVE PROGRAM.
ENDFORM.                    "exit_program
Thanks
Naren

Similar Messages

  • Bug Report: ResultSet.isLast() returns false when queries return zero rows

    When calling the method isLast() on a resultset that contains zero (0) rows, false is returned. If a resultset contains no rows, isLast() should return true because returning false would indicate that there are more rows to be retrieved.
    Try the following Java source:
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    public class Test2 {
    public static void main (String [] args) throws Exception {
    Connection conn = null;
    String jdbcURL = "jdbc:oracle:thin:@" +
    "(DESCRIPTION=(ADDRESS=(HOST=<host computer>)"+
    "(PROTOCOL=tcp)(PORT=<DB port number>))"+
    "(CONNECT_DATA=(SID=<Oracle DB instance>)))";
    String userId = "userid";
    String password = "password";
    try{
    // Load the Oracle JDBC Driver and register it.
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // *** The following statement creates a database connection object
    // using the DriverManager.getConnection method. The first parameter is
    // the database URL which is constructed based on the connection parameters
    // specified in ConnectionParams.java.
    // The URL syntax is as follows:
    // "jdbc:oracle:<driver>:@<db connection string>"
    // <driver>, can be 'thin' or 'oci8'
    // <db connect string>, is a Net8 name-value, denoting the TNSNAMES entry
    conn = DriverManager.getConnection(jdbcURL, userId, password);
    } catch(SQLException ex){ //Trap SQL errors
    // catch error
    //conn = new OracleDriver().defaultConnection(); // Connect to Oracle 8i (8.1.7), use Oracle thin client.
    PreparedStatement ps = conn.prepareStatement("select 'a' from dual where ? = ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // Use any query that will return zero rows.
    ps.setInt(1, 1); // Set the params so that the query returns 0 rows.
    ps.setInt(2, 2);
    ResultSet rs = ps.executeQuery();
    System.out.println("1. Last here? " + rs.isLast());
    while (rs.next()) {
    // do whatever
    System.out.println("2. Last here? " + rs.isLast());
    ps.close();
    rs.close();
    EXPECTED RESULT -
    1. Last here? true
    2. Last here? true
    ACTUAL RESULT -
    1. Last here? false
    2. Last here? false
    This happens to me on Oracle 9.2.0.1.0.

    387561,
    For your information, I discovered this problem from
    running a query that did access an actual DB table.
    Try it and let me know.I did say I was only guessing, and yes, I did try it (after I posted my reply, and before I read yours). And I did check the query plan for the queries I tried -- to verify that they were actually doing some database "gets".
    In any case, the usual way that I determine whether a "ResultSet" is empty is when the very first invocation of method "next()" returns 'false'. Is that not sufficient for you?
    Good Luck,
    Avi.

  • Popularity Trends report always returns zero

    Hello,
    I have a SharePoint installed on “Windows server 2008 -R2”.
    I have a SQL Data base installed on the same machine.
    I create a new web application with port “2020”. Then I create w new site collection “Publishing”.
    I activate the feature “Reporting” in the site collection level.
    I Open central admin “Monitoring >> Configure usage and health data collection”. I checked “Enable usage data collection” Check box. And I Checked All “Events to Log” check boxes.
    I have configures the following services applications :
           -Business Connectivity Service
           -Excel Services Application
          -Search Service Application
         -Security Token Service Application
         -Application Discovery and Load Balancer Service Application
         -WSS_UsageApplication.
    I run the crawl search. And it is completed successfully.
    The search service account is member of “WSS_WPG” group.
    I have checked the following values from SharePoint PowerShell:
             AppEventTypeId          : 00000000-0000-0000-0000-000000000000
             EventTypeId                 : 1
             EventName                   : Views
             LifeTimeManagedPropertyName : ViewsLifeTime
             RecentManagedPropertyName   : ViewsRecent
            ApplicationName             :
            RecommendationWeight        : 1
           RelevanceWeight             : 1
          RecentPopularityTimeframe   : 14
          AggregationType             : Count, UniqueUsers
         Rollups                     : SiteSubscriptionId, SiteId, ScopeId
        TailTrimming                : 2
       Options                     : AllowAnonymousWrite
        IsReadOnly                  : False
    I open the “default.aspx” page on the portal (I have opened it more than 10 times in different browser window).
    Next day I open “popularity Trends” report, I found that it returns zero.
    I open the “Analytics Report” data base. Then I open “AnalyticsItemData” table. There are already items in the table.
        So I need to know why the “popularity Trends” excel sheet report returns zeros all the time.
    ASk

    Hi,
    According to your description, the popularity Trends report always returns no records.
    Please check the status of the 3 timer jobs: Microsoft SharePoint Foundation Usage Data Import, Microsoft SharePoint Foundation Usage Data Processing and Web Analytics
    Trigger Workflows to see if they are configured to run at regular intervals.
    Also you can take a look at the two links about the similar issue for more information:
    http://www.myriadtech.com.au/blog/Ben/Lists/Posts/Post.aspx?ID=7
    http://sharepoint.stackexchange.com/questions/66476/whats-popular-webpart-is-empty
    Feel free to reply if there any progress.
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • Shadowing API Issues on 2012R2 (SM_REMOTECONTROL GetSystemMetrics and WTSStopRemoteControlSession) Always Returns Zero

    According to the MSDN article on the GetSystemsMetric API, SM_REMOTECONTROL returns zero if the user is not currently being shadowed but will return non-zero if the user is currently being shadowed.  It lists no restirction on OS support from what I
    can see.
    WTSStopRemoteControlSession also lists no restrictions on OS support in MSDN.
    I have a simple VB.NET application that calls these APIs.  It basically reads:
    <DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> Public Shared Function GetSystemMetrics(ByVal nIndex as Integer) As Integer
    End Function
    Private Const SM_REMOTECONTROL as Integer = &H2001
    <DllImport("wtsapi32.dll", SetLastError:=True)> Public Shared Function WTSStopRemoteControlSession(ByVal iLoginId as Int32) as Int32
    End Function
    Private Declare Function ProcessIdToSessionId Lib "Kernel32.dll" Alias "ProcessIdToSessionId" (ByVal processID as Int32, ByRef sessionID as Int32) as Boolean
    retVal = GetSystemMetrics(SM_REMOTECONTROL)
    On 2008R2, retVal = 1 when the user is being shadowed, retVal = 0 when the user is not being shadowed.
    On 2012R2, retval = 0 no matter if the user is being shadowed or not shadowed.
    Dim sessionIDCurrent as Int32
    ProcessIdToSessionId(Process.GetCurrentProcess, sessionIDCurrent)
    WTSStopRemoteControlSession(sessionIDCurrent)
    On 2008R2, the shadow session will be stopped and WTSStopRemoteControlSession returns non-zero (indicating success)
    On 2012R2, the sahdow session will NOT be stopped and WTSStopRemoteControlSession returns zero (indicating failure).  LastDLLError returns zero as well.
    Has anyone else run into this?  Is this a known issue?

    Known issue,similar to this question: http://stackoverflow.com/questions/14725781/getsystemmetrics-returns-different-results-for-net-4-5-net-4-0
    http://connect.microsoft.com/VisualStudio/feedback/details/763767/the-systemparameters-windowresizeborderthickness-seems-to-return-incorrect-value
    https://connect.microsoft.com/VisualStudio/feedback/details/753224/regression-getsystemmetrics-delivers-different-values
    Best Regards,
    Please remember to mark the replies as answers if they help

  • OVD plugin returning "Virtual" entry when entry not yet available in OID

    Hi,
    We've been working on a solution in which a new user has to get immediate access to a website and we, because the provisioning is taking some time, we have implemented a plugin for OVD which basically looks in the OID and if the user exists in OID it will return that entry and otherwise will create an virtual entry (it is not stored in OID) and return this entry to the requestor.
    Now this al looks like it is working fine but the requester, OAM in this case, reacts different on a "virtual" entry then a non virtual entry. When it is a "virtual" entry not al headers are filled by OAM. So my question is if there is someone out there who has done something simliar and/or knows why this is happening, because we tried everything and still face this problem. Any help would be appreciated!
    Br,
    Sarris

    Hi Flanjman,
    Additional this article may give you more tips.
    https://connect.microsoft.com/SQLServer/feedback/details/674454/name-resolution-not-yet-available
    I’m glad to be of help to you!
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Return zero

    Can i have simple select query to get the expected out. if negative balance return zero otherwise return as it is. Please provide a select query to get expected output
    Actual output
    Balance
    -20
    40
    50
    -60
    Expected output(if balance negative return 0)
    Balance
    0
    40
    50
    0

    Hi,
    Try this:
    SELECT     GREATEST (balance, 0)     AS balance
    FROM     table_x
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.

  • Resolving "IOException: Underlying input stream returned zero bytes" errors

    Hi guys,
    I'm currently working on a simple application that reads GPS receiver data from a serial port using the RXTX library. However, everytime I try to read the resulting InputStream (which I convert to a BufferedReader) using readLine(), after 2 or 3 lines of reading normally, I always get the following exception:
    GPSNotifier::run(): I/O error encountered while reading from COM4
    java.io.IOException: Underlying input stream returned zero bytes
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:268)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
    at java.io.InputStreamReader.read(InputStreamReader.java:167)
    at java.io.BufferedReader.fill(BufferedReader.java:136)
    at java.io.BufferedReader.readLine(BufferedReader.java:299)
    at java.io.BufferedReader.readLine(BufferedReader.java:362)
    at discomm.gps.GPSNotifier.run(GPSNotifier.java:260)
    at java.lang.Thread.run(Thread.java:619)
    I'm not sure how to fix this problem, since it occurs everytime I run the application. The code for opening the stream is as follows:
    // Open up the port: no problems here ...
    CommPortIdentifier comm = CommPortIdentifier.getPortIdentifier(port_name);
    CommPort port = comm.open(APP_NAME, OPEN_TIMEOUT);
    SerialPort serial_port = (SerialPort) port;
    serial_port.setSerialPortParams(PORT_BAUDRATE, PORT_DATABITS, PORT_STOPBITS, PORT_PARITY);
    BufferedReader in = BufferedReader(new InputStreamReader(serial_port.getInputStream()));
    String line = null;
    // Problem is here ...
    while ((line = in.readLine()) != null) {
    }The IOException always occurs when readLine() is called. Any ideas on how to fix this problem?
    Thanks in advance,
    Simon Liu

    I don't use readLine() but read()
    A bit of code:
              BufferedReader inStream = new BufferedReader(new InputStreamReader(inputStream));
              byte ch = 0;
              char myChar;
              int charVal;          
              try{               
                   while((ch = (byte)inStream.read()) != -1){
                        if((ch == 13) || (ch == 10)){ //In ASCII code: 13 = Carriage return, 10 = line feed. When the GPS receiver sends those characters, the while loop must be broken to avoid an IOException                         
                             break;
                        }else{
                             myChar = (char)ch;
                        charVal = myChar;
                        //System.out.print("byte=" + ch +" myChar=" + myChar + " charVal=" + charVal + "\n");
                        System.out.print(myChar);
                   }

  • XPath query string returns zero node error

    I have created car loan bpel application. One is Citi Loan and another is Star Loan.
    I have created just like similar to sample loan demo.
    I have entered the SSN, email, carModel, carYear, loanAmount and creditRating value and submitted. It will initiated the following tasks successfully.
    StarLoan Instance
    CitiLoan Instance
    TaskManager Instance
    CreditRating Instance
    Root appln. instance
    I have created one user approval page for Approve/Reject (jsp). Through this page, I have approved the CitiLoan offer. I have faced the following errors.
    <output>
    <part name="payload" >
    <loanOffer>7.4</loanOffer>
    </part>
    </output>
    <loanOffer>7.4</loanOffer>
    <selectionFailure>
    <part name="summary" >
    <summary>XPath query string returns zero node. According to BPEL4WS spec 1.1 section 14.3, The assign activity <to> part query should not return zero node. Please check the BPEL source at line number "90" and verify the <to> part xpath query. </summary>
    </part>
    </selectionFailure>
    Please help me.
    Thanks in advance.
    Regards,
    Sara

    Let us know if you have customized SOA composite for user creation approval?
    -Vamsi.

  • Follow up question about image not looking good in canvas-Shane?

    I guess this is a follow up question for Shane....
    You wrote this in response to someone a year ago which helped me out.
    Shane's Stock Answer #49 - Why is the quality different between what I see in the Viewer and what I see in the Canvas?
    Well... the viewer is just that-- a viewer. It will display anything that fcp will recognize as usable video or graphics. The canvas is a viewer too, but at the pixel dimension specified by the settings of your project and sequence.
    For example, if your graphic or footage is much higher resolution than your 720x480 DV sequence, FCP is interpolating down your file to fit the settings of the sequence. Usually this makes it look not so hot. DV is a 5:1 compression working with a 4:1:1 color depth. Your pristine picture images and graphics are being crushed.
    Same with picture files. HIgh res pics now adopt the sequence settings and will render to those specs, and most likely they are not as high quality.
    So, based on your answer, I made an HDV sequence, dropped my DVCPro50-NTSC footage and my tiffs into the sequence and now the stills look great. Is this an okay workaround or do you have another suggestion? I'm worried about this HD sequence taking too long to make a compressed QT from in the end.
    Thanks!

    Photo JPEG is a good option.  But this all depends on what your final output will be.  If you are going to make a DVD, then that is SD, so using an HD sequence setting makes no sense.  Photo JPEG is good, but not realtime in FCP.  DV50 or ProRes NTSC are good options.
    Unless you are making an HD master...in which case ProRes 422 for HD is good

  • View follow up questions in Q&A pod in a threaded or some other related view

    Currently when a question is answered it will be linked to the question. We sometimes have participants requiring further information about the same question, but Adobe Connect does not seem to allow participants to click the response and add follow up questions. As a presenter you can click on answered questions and add more but participants always have to submit new unlinked questions. Is there a way for participants to ask follow up questions in Q&A pod so that they are threaded to their original question?

    Currently when a question is answered it will be linked to the question. We sometimes have participants requiring further information about the same question, but Adobe Connect does not seem to allow participants to click the response and add follow up questions. As a presenter you can click on answered questions and add more but participants always have to submit new unlinked questions. Is there a way for participants to ask follow up questions in Q&A pod so that they are threaded to their original question?

  • IMovie and external hard drive: follow up question

    This is a follow up question from the iMovie 6 forum. Hopefully, this question will help the poster on that forum as well. I, too, am working on multiple iMovie 5.0.2 projects at the same time and am running out of hard disk space. I would like to transfer remaining miniDV tape to an external hard drive and, when finished, transfer these clips from the external hard drive to the current iMovie project in my Powerbook, one project at a time. Is this possible ? Will I transfer files from the external hard drive to the Powerbook hard drive and then to iMovie, or directly from the external hard drive to iMovie ? Do I have to format the external drive to Mac OS Extended as advised in iMovie 6 forum in order to transfer miniDV tape to the external hard drive ? When pressing the erase tab to format the external hard drive, will this erase files already on the hard drive before formatting ? Can I transfer projects I am not working on from iMovie to the external hard drive and then transfer them back to the Powerbook when it is time to work on them ? Sorry about all the questions but I need to think very simple-minded when it comes to computer related issues. Thanks for your help.

    I was able to use and store iMovie in the external hard drive using my Powerbook as a monitor, so I presume it is formatted correctly
    Sorry, but you cannot assume the drive is formatted correctly. iMovie doesn't tell you the drive format is incompatible with iMovie. (it should, but it doesn't.) Some iMovie project features can be saved and some cannot.
    It's easy to check the disk format. In the Finder, click on the drive icon and choose File > Get Info from the Finder menubar. The window that opens shows the disk Format. You want it to say "Mac OS Extended". "(Journaled)" is optional.
    With some drives, sometimes even that can be wrong. To be sure, use Disk Utility to check the format. When you click on the drive in the list along the left side of the Disk Utility window, the format is displayed at the bottom of the window.
    Always, always, always check the disk format before using a drive with iMovie.
    Karl

  • Follow up question...

    I just purchased a Airport Extreme from the Apple Store yesterday. I purchased it to extend/share my iPhone 5 hotspot. I have figured out how to have AEBS join my hotspot, but it does not seem to have access on the Ethernet ports in the back?? This is my needed feature, unfortunately I live in an area that only offers DSL and only 2.5mbps.. .  Using my phone I'm able to receive 10-20mbps on LTE/4G, and fortunately for me I have unlimited data on my hotspot. So I'm set for the wireless devices in my home, but struggling getting wired devices working....
    Any help will be greatly appreciated!
    Thanks,
    Tim
    Info
    iPhone 5 iOS 7.0.4
    Windows 8
    Linux Ubuntu 12.10
    Airport Extreme Base Station, iOS 7.0.4
    This solved my question by Bob Timmons  on Nov 28, 2013 3:33 PM
    No, only the AirPort Express. There are 2 Ethernet ports on the Express. If you need more, you can add an Ethernet switch.
    The Express has a special feature called ProxySTA that allows it to join a network and the Ethernet ports will be enabled when it does this.
    Might be fun to ask one of the sales guys what exactly ProxySTA is and what it does before you explain it to them. Even the "genius" may not know.
    See the answer in context
    Follow Up Question----
    I asked the apple salesperson about proxySTA, first I got a blank stare then, some nonsense to attempt they knew what it was.
    So I picked up the Express, set it up to join my hotspot and it works really well!!! The only problem is the hotspot only allows five connections. The express eats one, that only leaves four! Is there another way to set up the express so it can handle the dhcp so my hotspot only sees the one connection to the express??
    Thanks,
    Tim

    Now please perform a hard reset on the second Express by holding in the reset button for 10 seconds, then release. Allow a full minute for the Express to restart to a slow, blinking amber light.
    Make sure that the Ethernet connection from the first "joining" Express goes to the WAN "O" port on the second Express creating a wireless network.
    Don't worry about the Double NAT message for now, just make sure that you can now log on to the Internet through the second Express wireless network.
    You may need to power off both Express devices and restart the "joining" Express first, then start up the "creating" Express.
    Once you verify that everything is working, you can go back in using AirPort Utillty and click to ignore the Double NAT so that a green light will be displayed on the second Express.

  • Follow-up question on ZXM08U16 table E_TDRSEG  (function group XM08)

    Rich's suggestion worked (on how to retype the E_TDRSEG table received from MIRO by include ZXM08U16 in the function group XM08.
    Before asking my new follow-up question, let me recap the original SAP typing of this table and the way I've retyped it (following Rich's instructions):
    The original SAP typing is:
    E_TDRSEG TYPE  MMCR_TDRSEG
    TYPES: mmcr_tdrseg TYPE mmcr_drseg OCCURS 0,
    TYPES: BEGIN OF mmcr_drseg_co.
            INCLUDE STRUCTURE cobl_mrm_d.
    TYPES: cr LIKE drseg_cr    OCCURS 0,
           unpl_refwr TYPE refwr,
           END OF mmcr_drseg_co.
    TYPES: BEGIN OF mmcr_drseg.
            INCLUDE STRUCTURE drseg.
    TYPES: cr LIKE drseg_cr OCCURS 0,
           co TYPE mmcr_drseg_co OCCURS 0,
           sm LIKE drseg_sm OCCURS 0,
           charact TYPE rbcharact_instance OCCURS 3,
                                           "instances of characteristics
           uebgmat  TYPE matnr,
           uebrblgp TYPE rblgp,
           selkz_db TYPE selkz,
           rblgp_old TYPE rblgp,           "rblgp before aggregation
           END OF mmcr_drseg.
    I retyped this as follows:
    TYPES:
      ty_cobl_mrm_d        TYPE cobl_mrm_d,
      ty_drseg_cr          TYPE STANDARD TABLE OF drseg_cr with DEFAULT KEY,
      ty_drseg_sm          TYPE STANDARD TABLE OF drseg_sm with DEFAULT KEY,
      ty_charact           TYPE STANDARD TABLE OF rbcharact_instance with DEFAULT KEY,
      BEGIN OF ty_mmcr_drseg_co.
        INCLUDE            TYPE ty_cobl_mrm_d.
        TYPES:
          cr               TYPE ty_drseg_cr ,
          unpl_refwr       TYPE refwr,
      END OF   ty_mmcr_drseg_co,
      ty_co                TYPE STANDARD TABLE OF ty_mmcr_drseg_co
                           WITH DEFAULT KEY,
      BEGIN OF ty_mmcr_drseg.
        INCLUDE            TYPE drseg.
        TYPES:
          cr               TYPE ty_drseg_cr,
          co               TYPE ty_co,
          sm               TYPE ty_drseg_sm,
          charact          TYPE ty_charact,        "instances of characteristics
          uebgmat          TYPE matnr,
          uebrblgp         TYPE rblgp,
          selkz_db         TYPE selkz,
          rblgp_old        TYPE rblgp,             "rblgp before aggregation
      END OF   ty_mmcr_drseg.
      DATA:
        x_mmcr_drseg       TYPE mmcr_drseg,
        x_mmcr_drseg_oo    TYPE ty_mmcr_drseg,
        it_mmcr_drseg      TYPE STANDARD TABLE OF ty_mmcr_drseg,
        x_drseg_cr         TYPE drseg_cr,
        x_drseg_sm         TYPE drseg_sm,
        x_drseg_co         TYPE ty_mmcr_drseg_co.
    But here's my question.  To load the new table from the SAP table, I've had to use the code below.  Is there any way to simplify this code?  (I don't think there is because the drseg structure is included in the old and the new, so you can't simply say new-drseg = old-drseg.  But maybe there's another way to do it and I'm not seeing it.  Also, note that I had to loop on each of  the inner three tables because it wouldn't compile when I tried statements of the form "new-table[] = old-table[].)
      LOOP AT e_tdrseg INTO x_mmcr_drseg.
        x_mmcr_drseg_oo-anln1     = x_mmcr_drseg-anln1.
        x_mmcr_drseg_oo-anln2     = x_mmcr_drseg-anln2.
        x_mmcr_drseg_oo-aplzl     = x_mmcr_drseg-aplzl.
        x_mmcr_drseg_oo-arewr     = x_mmcr_drseg-arewr.
        x_mmcr_drseg_oo-areww     = x_mmcr_drseg-areww.
        x_mmcr_drseg_oo-aufnr     = x_mmcr_drseg-aufnr.
        x_mmcr_drseg_oo-aufpl     = x_mmcr_drseg-aufpl.
        x_mmcr_drseg_oo-basme     = x_mmcr_drseg-aufpl.
        x_mmcr_drseg_oo-bedat     = x_mmcr_drseg-bedat.
        x_mmcr_drseg_oo-begru     = x_mmcr_drseg-begru.
        x_mmcr_drseg_oo-bewae     = x_mmcr_drseg-bewae.
        x_mmcr_drseg_oo-ekgrp     = x_mmcr_drseg-ekgrp.
        x_mmcr_drseg_oo-bpmng     = x_mmcr_drseg-bpmng.
        x_mmcr_drseg_oo-bprme     = x_mmcr_drseg-bprme.
        x_mmcr_drseg_oo-bpumn     = x_mmcr_drseg-bprme.
        x_mmcr_drseg_oo-bpumz     = x_mmcr_drseg-bpumz.
        x_mmcr_drseg_oo-bpwem     = x_mmcr_drseg-bpwem.
        x_mmcr_drseg_oo-bprem     = x_mmcr_drseg-bprem.
        x_mmcr_drseg_oo-bsmng     = x_mmcr_drseg-bsmng.
        x_mmcr_drseg_oo-budat     = x_mmcr_drseg-budat.
        x_mmcr_drseg_oo-bukrs     = x_mmcr_drseg-bukrs.
        x_mmcr_drseg_oo-bwtar     = x_mmcr_drseg-bwtar.
        LOOP at x_mmcr_drseg-cr INTO x_drseg_cr.
          APPEND x_drseg_cr TO x_mmcr_drseg_oo-cr.
        ENDLOOP..
        LOOP at x_mmcr_drseg-co INTO x_drseg_co.
          APPEND x_drseg_co TO x_mmcr_drseg_oo-co.
        ENDLOOP..
        LOOP at x_mmcr_drseg-sm INTO x_drseg_sm.
          APPEND x_drseg_sm TO x_mmcr_drseg_oo-sm.
        ENDLOOP..
        x_mmcr_drseg_oo-charact   = x_mmcr_drseg-charact.
        x_mmcr_drseg_oo-uebgmat   = x_mmcr_drseg-uebgmat.
        x_mmcr_drseg_oo-uebrblgp  = x_mmcr_drseg-uebrblgp.
        x_mmcr_drseg_oo-selkz_db  = x_mmcr_drseg-selkz_db.
        x_mmcr_drseg_oo-rblgp_old = x_mmcr_drseg-rblgp_old.
      ENDLOOP.

    Hi
    I don't think, I'm agree with you, u can only replace some statament:
    LOOP AT E_TDRSEG INTO X_MMCR_DRSEG.
      X_MMCR_DRSEG_OO-ANLN1     = X_MMCR_DRSEG-ANLN1.
      X_MMCR_DRSEG_OO-ANLN2     = X_MMCR_DRSEG-ANLN2.
      X_MMCR_DRSEG_OO-APLZL     = X_MMCR_DRSEG-APLZL.
      X_MMCR_DRSEG_OO-AREWR     = X_MMCR_DRSEG-AREWR.
      X_MMCR_DRSEG_OO-AREWW     = X_MMCR_DRSEG-AREWW.
      X_MMCR_DRSEG_OO-AUFNR     = X_MMCR_DRSEG-AUFNR.
      X_MMCR_DRSEG_OO-AUFPL     = X_MMCR_DRSEG-AUFPL.
      X_MMCR_DRSEG_OO-BASME     = X_MMCR_DRSEG-AUFPL.
      X_MMCR_DRSEG_OO-BEDAT     = X_MMCR_DRSEG-BEDAT.
      X_MMCR_DRSEG_OO-BEGRU     = X_MMCR_DRSEG-BEGRU.
      X_MMCR_DRSEG_OO-BEWAE     = X_MMCR_DRSEG-BEWAE.
      X_MMCR_DRSEG_OO-EKGRP     = X_MMCR_DRSEG-EKGRP.
      X_MMCR_DRSEG_OO-BPMNG     = X_MMCR_DRSEG-BPMNG.
      X_MMCR_DRSEG_OO-BPRME     = X_MMCR_DRSEG-BPRME.
      X_MMCR_DRSEG_OO-BPUMN     = X_MMCR_DRSEG-BPRME.
      X_MMCR_DRSEG_OO-BPUMZ     = X_MMCR_DRSEG-BPUMZ.
      X_MMCR_DRSEG_OO-BPWEM     = X_MMCR_DRSEG-BPWEM.
      X_MMCR_DRSEG_OO-BPREM     = X_MMCR_DRSEG-BPREM.
      X_MMCR_DRSEG_OO-BSMNG     = X_MMCR_DRSEG-BSMNG.
      X_MMCR_DRSEG_OO-BUDAT     = X_MMCR_DRSEG-BUDAT.
      X_MMCR_DRSEG_OO-BUKRS     = X_MMCR_DRSEG-BUKRS.
      X_MMCR_DRSEG_OO-BWTAR     = X_MMCR_DRSEG-BWTAR.
      X_MMCR_DRSEG_OO-CR[]      = X_MMCR_DRSEG-CR[].
      X_MMCR_DRSEG_OO-CO[]      = X_MMCR_DRSEG-CO[].
      X_MMCR_DRSEG_OO-SM[]      = X_MMCR_DRSEG-SM[].
      X_MMCR_DRSEG_OO-CHARACT   = X_MMCR_DRSEG-CHARACT.
      X_MMCR_DRSEG_OO-UEBGMAT   = X_MMCR_DRSEG-UEBGMAT.
      X_MMCR_DRSEG_OO-UEBRBLGP  = X_MMCR_DRSEG-UEBRBLGP.
      X_MMCR_DRSEG_OO-SELKZ_DB  = X_MMCR_DRSEG-SELKZ_DB.
      X_MMCR_DRSEG_OO-RBLGP_OLD = X_MMCR_DRSEG-RBLGP_OLD.
    ENDLOOP.
    If you want to use APPEND statament u need to refresh the target table at very loop:
    LOOP AT E_TDRSEG INTO X_MMCR_DRSEG.
      X_MMCR_DRSEG_OO-ANLN1     = X_MMCR_DRSEG-ANLN1.
      X_MMCR_DRSEG_OO-ANLN2     = X_MMCR_DRSEG-ANLN2.
      X_MMCR_DRSEG_OO-APLZL     = X_MMCR_DRSEG-APLZL.
      X_MMCR_DRSEG_OO-AREWR     = X_MMCR_DRSEG-AREWR.
      X_MMCR_DRSEG_OO-AREWW     = X_MMCR_DRSEG-AREWW.
      X_MMCR_DRSEG_OO-AUFNR     = X_MMCR_DRSEG-AUFNR.
      X_MMCR_DRSEG_OO-AUFPL     = X_MMCR_DRSEG-AUFPL.
      X_MMCR_DRSEG_OO-BASME     = X_MMCR_DRSEG-AUFPL.
      X_MMCR_DRSEG_OO-BEDAT     = X_MMCR_DRSEG-BEDAT.
      X_MMCR_DRSEG_OO-BEGRU     = X_MMCR_DRSEG-BEGRU.
      X_MMCR_DRSEG_OO-BEWAE     = X_MMCR_DRSEG-BEWAE.
      X_MMCR_DRSEG_OO-EKGRP     = X_MMCR_DRSEG-EKGRP.
      X_MMCR_DRSEG_OO-BPMNG     = X_MMCR_DRSEG-BPMNG.
      X_MMCR_DRSEG_OO-BPRME     = X_MMCR_DRSEG-BPRME.
      X_MMCR_DRSEG_OO-BPUMN     = X_MMCR_DRSEG-BPRME.
      X_MMCR_DRSEG_OO-BPUMZ     = X_MMCR_DRSEG-BPUMZ.
      X_MMCR_DRSEG_OO-BPWEM     = X_MMCR_DRSEG-BPWEM.
      X_MMCR_DRSEG_OO-BPREM     = X_MMCR_DRSEG-BPREM.
      X_MMCR_DRSEG_OO-BSMNG     = X_MMCR_DRSEG-BSMNG.
      X_MMCR_DRSEG_OO-BUDAT     = X_MMCR_DRSEG-BUDAT.
      X_MMCR_DRSEG_OO-BUKRS     = X_MMCR_DRSEG-BUKRS.
      X_MMCR_DRSEG_OO-BWTAR     = X_MMCR_DRSEG-BWTAR.
      REFRESH: X_MMCR_DRSEG_OO-CR,
               X_MMCR_DRSEG_OO-CO,
               X_MMCR_DRSEG_OO-SM.
      APPEND LINES OF: X_MMCR_DRSEG-CR TO X_MMCR_DRSEG_OO-CR,
                       X_MMCR_DRSEG-CO TO X_MMCR_DRSEG_OO-CO
                       X_MMCR_DRSEG-SM TO X_MMCR_DRSEG_OO-SM.
      X_MMCR_DRSEG_OO-CHARACT   = X_MMCR_DRSEG-CHARACT.
      X_MMCR_DRSEG_OO-UEBGMAT   = X_MMCR_DRSEG-UEBGMAT.
      X_MMCR_DRSEG_OO-UEBRBLGP  = X_MMCR_DRSEG-UEBRBLGP.
      X_MMCR_DRSEG_OO-SELKZ_DB  = X_MMCR_DRSEG-SELKZ_DB.
      X_MMCR_DRSEG_OO-RBLGP_OLD = X_MMCR_DRSEG-RBLGP_OLD.
    ENDLOOP.
    Max

  • Global Temp Table, always return  zero records

    I call the procedure which uses glbal temp Table, after executing the Proc which populates the Global temp table, i then run select query retrieve the result, but it alway return zero record. I am using transaction in order to avoid deletion of records in global temp table.
    whereas if i do the same thing in SQL navigator, it works
    Cn.ConnectionString = Constr
    Cn.Open()
    If FGC Is Nothing Then
    Multiple = True
    'Search by desc
    'packaging.pkg_msds.processavfg(null, ActiveInActive, BrandCode, Desc, Itemtype)
    SQL = "BEGIN packaging.pkg_msds.processavfg(null,'" & _
    ActiveInActive & "','" & _
    BrandCode & "','" & _
    Desc & "','" & _
    Itemtype & "'); end;"
    'Here it will return multiple FGC
    'need to combine them
    Else
    'search by FGC
    SQL = "BEGIN packaging.pkg_msds.processavfg('" & FGC & "','" & _
    ActiveInActive & "','" & _
    BrandCode & "',null,null); end;"
    'will alway return one FGC
    End If
    ' SQL = " DECLARE BEGIN rguo.pkg_msds.processAvedaFG('" & FGC & "'); end;"
    Stepp = 1
    Cmd.Connection = Cn
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Dim Trans As System.Data.OracleClient.OracleTransaction
    Trans = Cn.BeginTransaction()
    Cmd.Transaction = Trans
    Dim Cnt As Integer
    Cnt = Cmd.ExecuteNonQuery
    'SQL = "SELECT rguo.pkg_msds.getPDSFGMass FROM dual"
    SQL = "select * from packaging.aveda_mass_XML"
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Adp.SelectCommand = Cmd
    Stepp = 2
    Adp.Fill(Ds)
    If Ds.Tables(0).Rows.Count = 0 Then
    blError = True
    BlComposeXml = True
    Throw New Exception("No Record found for FGC(Finished Good Code=)" & FGC)
    End If
    'First Row, First Column contains Data as XML
    Stepp = 0
    Trans.Commit()

    Hi,
    This forum is for Oracle's Data Provider and you're using Microsoft's, but I was curious so I went ahead and tried it. It works fine for me. Here's the complete code I used, could you point out what are you doing differently?
    Cheers,
    Greg
    create global temporary table abc_tab(col1 varchar2(10));
    create or replace procedure ins_abc_tab(v1 varchar2) as
    begin
    insert into abc_tab values(v1);
    end;
    using System;
    using System.Data;
    using System.Data.OracleClient;
    class Program
        static void Main(string[] args)
            OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger");
            con.Open();
            OracleTransaction txn = con.BeginTransaction();
            OracleCommand cmd = new OracleCommand("begin ins_abc_tab('foo');end;", con);
            cmd.Transaction = txn;
            cmd.ExecuteNonQuery();
            cmd.CommandText = "select * from abc_tab";
            OracleDataAdapter da = new OracleDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            Console.WriteLine("rows found: {0}", ds.Tables[0].Rows.Count);
            // commit, cleanup, etc ommitted for clarity
    }

  • Query returns zero records in coldfusion context, but works fine in Navicat

    I've got a query that's returning zero records when I load a page.  If I copy and paste that same query (from the debug output) into navicat, I get rows returned (as I expect).  Has anyone seen this?  It happens locally (CF9) AND remotely on our staging server (CF10).  Even weirder, it's a query that was previously working fine - I simply added an if statement to the where clause, and all of a sudden... 
    Here's the query:
            <CFQUERY name="LOCAL.getEncounterServices" datasource="#REQUEST.dsn#"> 
            SELECT
                a.EncounterProductID,
                a.DateTime AS ServiceDate,
                aa.CartItemID,
                aaa.CartID,
                aaaaa.CartStatus,
                b.ProductID,
                b.ProductName,
                b.CPTCode,
                b.Price,
                c.EncounterID,
                c.DateTimeClosed AS EncounterClosedDate,
                d.FirstName,
                d.LastName
            FROM
                EncounterProducts a
                    LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
                    LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
                    LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
                    LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
                Product b,
                Encounters c,
                Contacts d,
                EncounterStatuses e
            WHERE
                1 = 1
                AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
                AND a.Active = 1
                AND a.ProductID = b.ProductID
                AND a.EncounterID = c.EncounterID
                AND c.PatientID = d.ContactID
                AND c.EncounterStatusID = e.EncounterStatusID
                AND e.EncounterStatus = 'Closed'
              <CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
                     AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
             <CFELSE>
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
               </CFIF>
                AND c.LocationID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.locationID#">
                AND c.CustomerID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.customerID#">
            </CFQUERY>
    All of this worked just fine before I added the lines:
             <CFIF IsDefined("ARGUMENTS.encounter") AND IsObject(ARGUMENTS.encounter)>
                     AND c.EncounterID = <CFQUERYPARAM cfsqltype="cf_sql_integer" value="#ARGUMENTS.encounter.getID()#">
             <CFELSE>
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
              </CFIF>
    Previously, it had just been:
                    AND c.DateTimeClosed >= <CFQUERYPARAM cfsqltype="cf_sql_date" value="#ARGUMENTS.startDate#">
                    AND c.DateTimeClosed < <CFQUERYPARAM cfsqltype="cf_sql_date" value="#DateFormat(DateAdd('d', 1, ARGUMENTS.endDate), 'yyyy-mm-dd')# 00:00:00">
    With no IF/ELSE statement.
    Anyone seen anything like this before?  Any ideas? 
    Thanks.

    Right, I'll start disabusing myself of the DateFormat!
    I'm sorry, I should've posted the actual query too.  It's inserting the first part - "AND c.EncounterID = ....."
    Here's the full query:
    LOCAL.getEncounterServices (Datasource=xmddevdb, Time=9ms, Records=0) in /Applications/ColdFusion9/wwwroot/XMD_NEW/xmd_dev/cfc/ShoppingGateway.cfc @ 16:56:28.028
    SELECT
                a.EncounterProductID,
                a.DateTime AS ServiceDate,
                aa.CartItemID,
                aaa.CartID,
                aaaaa.CartStatus,
                b.ProductID,
                b.ProductName,
                b.CPTCode,
                b.Price,
                c.EncounterID,
                c.DateTimeClosed AS EncounterClosedDate,
                d.FirstName,
                d.LastName
            FROM
                EncounterProducts a
                    LEFT JOIN CartItemProduct aa ON (a.EncounterProductID = aa.EncounterProductID AND aa.Active = 1)
                    LEFT JOIN CartItem aaa ON (aa.CartItemID = aaa.CartItemID)
                    LEFT JOIN Cart aaaa ON (aaa.CartID = aaaa.CartID)
                    LEFT JOIN CartStatus aaaaa ON (aaaa.CartStatusID = aaaaa.CartStatusID),
                Product b,
                Encounters c,
                Contacts d,
                EncounterStatuses e
            WHERE
                1 = 1
                AND (aa.CartItemID IS NULL OR aaaaa.CartStatus = 'Deleted')
                AND a.Active = 1
                AND a.ProductID = b.ProductID
                AND a.EncounterID = c.EncounterID
                AND c.PatientID = d.ContactID
                AND c.EncounterStatusID = e.EncounterStatusID
                AND e.EncounterStatus = 'Closed'
                     AND c.EncounterID = ?
                AND c.LocationID = ?
                AND c.CustomerID = ?
    Query Parameter Value(s) -
    Parameter #1(cf_sql_integer) = 28
    Parameter #2(cf_sql_integer) = 16
    Parameter #3(cf_sql_integer) = 6
    Thansk again for the help!

Maybe you are looking for