Complex conjugate in MIMO

hi there,i m new to labview and working on mimo........now i have a problem in complex conjugate......as its output isnt working
ur suggestions will be appreciated
regards

What are you using as the inputs or inputs of the complex conjugate function?
Scott A
SSP Product Manager
National Instruments

Similar Messages

  • Basic transpose (not a complex conjugate transpose) of a complex 2-D array

    Hi, folks
    Just ran an old analysis that I had written in v6.1 where a 2-D complex array is simply transposed (not complex conjugate) for further analysis. Now, under 7.1, the code gives crap results. I've noticed that now LabView automatically performs a complex conjugate transpose on the array. Obviously, not what I want.
    So, I changed the type to a real transpose, and which ends up truncating all the imaginary terms. No dice again.
    Has anybody out there come up with a solution?
    Would appreciate any help and/or empathy.
    Frustrated,
    Hunter

    Your anger is well founded. When these high level languages change routine functionality between versions, it can have disastrous results. And because it's an interchangeable piece, it could be buried deep within your code and you are on an Easter egg hunt to find why your code is broken.
    Version changes with complex code scare me.
    Sheldon
    Technical geek, engineer, research scientist, biodegradable...

  • Help me start a rogram - Complex nembers

    I have an assignment that includes complex numbers, and I have no idea what a complex number is and where to start. Is there anyone that could help me get started?
    Program details:
    Given a complex number a+ib, we can define the following operations:
    * |a+ib| = square root of (a2+b2) is the absolute value operation.
    * s(a+ib)=sa+isb, where s is a real number, is scaling.
    * the complex conjugate of a+ib is a-ib.
    * (a+ib)+(c+id)=(a+c)+i(b+d) is addition.
    * (a+ib)*(c+id)=(ac-bd)+i(ad+cb) is multiplication. (Notice that scaling is just a special case, where b=0.)
    * do subtraction on your own.
    * (a+ib)/(c+id)=((ac+bd)+i(cb-ad))/(c2+d2) is division. You will have to be careful when dividing - the resulting denominator cannot be equal to 0!
    You are to write a program which contains two separate files.
    The first file will define a Complex class which should include exactly two data members, two constructors, the operations defined above, and a toString method. Important note, the scaling, conjugate, addition, multiplication, subtraction, and division operations all return another complex number. You also must include the appropriate set and get methods. Be sure you comment this class appropriately. Each function should have its own set of comments.
    The second file is an application to test your Complex class as follows: repeatedly read numbers of type double (a, b, c, d, and s), create and print the complex numbers a+ib and c+id, print each numbers absolute value, then create and print the following new complex numbers: s(a+ib), the complex conjugate of a+ib, and the sum, product, difference, and quotient of a+ib and c+id. Continue this loop until the user terminates the application.

    Yes, learn complex numbers. Java is the least of your problems.
    %

  • Passing data from Microphone to FFT (Fast Fourier Transform) Class

    I am quite new to Java and trying to find a way to use microphone and pass the data from microphone to a FFT Class and get the result back as one number (which will be the frequency). Because I am quite new, I am in need of some advice and description to solve this problem.
    I will be glad if anybody experienced on this issue can help me.
    Regards.

    You need to read a good bit about signal analysis before you tackle this.
    The FFT is an algorithm for the implementation of the Discret Fourier Transform (DFT). If you just perform an FFT of your data how are you then going to extract the frequency. For example, if you take the DFT of 1024 samples you will generate 1024 complex values with the to 512 pairs being complex conjugates of the bottom 512 pairs.
    If you just choose the frequency with the largest magnitude then you will suffer from 'windowing' effects. You will need first to apply a 'window 'to your data so as to minimize the effects of only being able to use a limited length of data.
    OK, so you have applied a window, performed the DFTand found the sample with the largest magnitude then how do you relate this frequency index to the real frequency?
    If you Google for Java FFT I know you will be able to find an FFT implementation but that is just the start. You need to understand the DFT and how to use it and what it's limitations are and how to relate the results to the real world. You almost certainly cannot get that information from a Java forum. Java forums are for dealing with specific Java problems.
    So! Go study some signal analysis before you start using the FFT on your microphone data.
    A few words of warning. If you download an FFT implementation, make sure you test it extensively before you use it on your real data. I have tested about 10 and there are some rubbish implementations out there.

  • Determining natural frequency

    Having never done vibration analysis, I'm wondering if anyone has experience in determining the natural frequency of a solid using an accelerometer. Aside from knowing that we can produce a voltage signal through the accelerometer, and that we in some way need to condition this through a fourier transform, I am completely stumped.
    Can anyone provide a simple explanation, and hopefully any more complex knowledge of how to go about solving this problem?
    Thanks,
    Justin
    Just as a post note, I'm really completely unfamiliar with vibrations
    analysis, and am hoping to learn enough through this process to really
    understand the problem and its solution...
    Any help is appreciated!
    Message Edited by g0dam0ng1n53ct5 on 12-17-2009 09:01 AM

    OK, I dug up the old code (I'm talking 1994 here).
    The TRANSFER function is a statement of the relationship between the independent measurement (Y) and the driving force (X).
    You hit point A with force X, and at point B, you see a movement Y.
    The transfer function is dependent on structure geometry, materials, mounting, supports, maybe termperature, etc. 
    That is frequency-dependent, so doing it in the frequency domain provides a lot of info at one time. 
    Here are comments from my 1994 code:
           F(x)     F*(x)           |F(x)|^2
    Sxx = ------ * -------     =   ----------   (no phase information)
            N         N               N^2
           F(y)     F*(x)
    Sxy = ------ * -------
            N         N
                          Cross power spectrum          Sxy
    Transfer function = ------------------------   =   -----
                             Power spectrum             Sxx
                 | Sxy | ^2
    Coherence = -------------
                 Sxx  *  Syy
    where:
      F(x) is the complex Fourier transform of the time domain signal x, and
      F*(x) is the complex conjugate of the Fourier transform of x, and
      N is the number of points in x.
    Note that SXX is the magnitude squared.  It is faster to compute the square of the magnitude than it is to compute the magnitude. Although the complex-to-polar VI would look simpler on the diagram, it would take longer since it computes the magnitude proper, (an extra square-root operation), and it computes the angle (extra arc-tangent operations).
    Since N^2 is a term in both Sxy and Sxx, and since we are dividing one by the other, we do not need to explicitly divide by N^2; it is cancelled automatically.
    Here is the code to process a single channel:
    I'm not sure of the comment "this is much faster..." anymore, as I've tested it recently and found it not the case.  But it was true in 1994. 
    And here is the code to handle the actual Xfer function:
    Note that I had an implicit rule that the first channel in the array was always the reference channel, i.e. the hammer (stimulus).  Any other channel(s) were response channels - you can get transfer functions between one stimulus point and any number of response points with one recording.
    The middle section there is averaging: you may or may not want to do that.  It's averaging from several hammer blows.
    What you get out is a complex spectrum (in the TRANSFER FUNCTION array).
    At each frequency, there's a complex number (R+jI) that describes how well the vibration travels from point A to point B. 
    If this function shows a clear peak at say, 583 Hz, then the structure in question is best at transferring vibration at that frequency.
    If the MAGNITUDE of that peak is close to 1.0, then it's very resonant.  If the magnitude is much lower, it's very damped.
    (If it's greater than 1.0... RUN!  It's about to come off it's mountings !)
    You also get a COHERENCE spectrum, I'm not as well versed on the uses of that. 
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • MIMO vs 10 MHz Reference

    I am attempting to recreate the scenario detailed in the this whitepaper from the Ettus site....
    http://www.ettus.com/content/files/kb/mimo_and_sync_with_usrp_updated.pdf
    ...which uses an external RF source, with a carrier at a small IF relative to the USRP.  The white paper shows that by using the MIMO cable...the measurements between two USRPs can be phase locked and synchronized.  I recreated this with two N210's with WBX's and the LV driver....EXCEPT...instead of the MIMO cable...I used only a common 10 MHz reference.
    Upon initiating and fetching packets...I note that within a fetch...the data appears phase and frequency locked, with some constant phase offset.  However, if running continuously...with each new fetch that is displayed...the relative phase between radios appears to change (yet is still constant over that fetch).
    My understanding is that the MIMO cable provides not only the 10 MHz reference...but also timing information such that "t0" is the same between radios.  Using only the 10 MHz reference...I understand that can't be assured that the data between radios was in fact taken at the same time.  I anticipated that this "synch offset" would change every time I configured the radio....but should at least be constant when observing multiple fetches over time after a single configuration event.
    This is not what I see.  It's as if the constant phase offset changes fetch to fetch.
    Any idea what's going on here?  What's different when I use the MIMO cable vs the 10 MHz reference only?
    Brandon
    However...I expected this to result in some kind of phase offset which would remain *constant* between fetches (nothing is changing between fetches). 

    Initially, no.  My understanding was that using the 10 MHz would have phase locked the two, but the samples wouldn't be synchronous because I wasn't latching in a time via the PPS.  This should have just resulted in some initial phase offset, which would have been fine for my application.  However...it appeared that instead of a constant phase offset between the two radios...I was seeing a slightly varying phase offset between fetches. 
    The code I initially used had two parallel processes to configure/initiate/fetch from two radios.  However...since then...we've combined the configure/initiate/fetch into a single process using the ";" separator and fetching data using the "complex array" polymorphic Fetch VI.  This approach does not appear to have phase 'jumps' between fetches...and results in a constant phase over time.  Not sure yet why the two approaches would have caused what I've seen....but the second approach seems to do the trick.
    Still...it would be good just to get a second opinion that by using only the 10 MHz reference and not the PPS that my measurements would still be phase locked...just with some constant phase offset because I'm not synchronous.

  • Using complex numbers in Fletcher Reeves optimization method

    Hello,
    I would like to minimize a function of 4 complex variables with the Fletcher Reeves optimization method (Conjugate Gradient VI).
    Is it possible to do it with this VI or with HiQ4.5 ?
    (for S-parameters specialists) The purpose is to de-embed using optimization method.
    Thanks,
    Dze

    I believe that the "Conjugate Gradient nD.vi" and the optimize function in HiQ only work with real vectors. Most of the solve functions in HiQ work with complex numbers, and you may be able to create your own algorithm for the purpose, but I don't think that there is already a function that will do quite what you want.

  • Complex in Formula Node

    I need to enter the following formula (j-imaginary 1) in Formula Node
    x1=1/kr - j/(kr*kr) - 1/(kr*kr*kr); 
    x2=1/(kr*kr) - j/(kr*kr*kr); 
    Further I need to receive y = x1*conjugate(x1) + x2*conjugate(x2). 
    I do not know, how it is necessary to designate complex x1 and x2 in Formula Node and how to program conjugate. Help me, please!
    Solved!
    Go to Solution.
    Attachments:
    Formula.vi ‏9 KB

    Formula node do not support complex numbers. But a Mathscript node do. But I am not sure you find Mathscript node in LV 7.1. But I think you are making things to complex. You do not need a formula node
    Edit: Upsk made an error in the calculation, but it is fixed now
    Message Edited by t06afre on 03-07-2009 12:03 PM
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)
    Attachments:
    sample.vi ‏22 KB

  • Mimo ofdm simulation

    hi,
    I just downloaded mimo-ofdm http://users.ece.utexas.edu/~jandrews/molabview.html
    Unfortunately, I am getting error that "an exception occurred within the external code called by call library function.." VI simulator.vi was stopped at node " " at a call to NI_AALBase.lvlib:Complex A x B.vi:4.
    Can anyone help me with this ?
    Any help is greatly appreciated.
    Thanks,
    Vijayant Bhatnagar

    I have seen this happen when the vi cannot find the library. If it is a dll, it should be either in the system32 directory or in the same directory as the VI.
    Also, this can happen if the call is of the wrong type. If you open the vi, and check the settings for how the call is made, you will see 2 possibilities. One the Functions tab you will see a selection called "Calling Convention" One is stdcall and the other is C. I suggest trying both ways if this is your code you are operating.
    The last possibility is that the function is not being called properly and there is a fault internal to the called code. Sometimes, during the error stack rewind, it will make it back to labview code, but not with information that labview can handle. It then gives a generic error message. If all else fails, look for another version of the api that you are using, or make absolutly sure that the parameters you send in are appropriate for the call... for instance you would not send in a 0 for the divisor if it was a divide function.
    Good luck,
    CyberTazer
    Software Systems Engineer

  • MIMO with 3 radios

    I am synchronizing 3 NI-2920 USRPs.  Two are connected via the MIMO cable (what I'll call the "MIMO pair").  An external PPS and 10MHz Ref is connected to one radio in this pair, as well as the third USRP so that all three are synchronized and phase locked.  The cable lengths of the PPS and 10MHz are the same to each radio.
    Measuring the same event over all three radios, I do observe coherency over my measurement, however I observe some strange behavior in terms of time synchronization.  I notice that the event appears at the same sample number between the MIMO pair...but it is delayed relative to the third radio.  Once I figure out what this 'delay' is (in terms of samples), it is constant over multiple observations of the event, so long as I don't turn off the radio.  So...I'm confident that things are phase locked and the A/D's are firing at the same time....though...I can't explain where this 'delay' comes from. 
    To be clear...I am confident that my event is reaching all three radios at the same time...so the "delay" seems to be related more to when the A/D's of the MIMO pair "turn on" relative to the third radio.  The delay is about 3.25ms +/-0.25ms.
    Is this expected behavior?  It seems like there might be some kind of delay as the MIMO pair tries to negotiate it's synchronization relative to the external PPS and 10MHz.  Don't recall ever reading anything about this.
    BC
    I

    Brandon -
    If you are using the property node to set ref and time base to external on the external ref and PPS, and then MIMO cable on the liked device then timed commands to start you should be fine. If you are addressing all 3 using the same function call then they should all be synchronized to sub-sample accuracy. You will need to set these parameters for each radio separately by calling the property node 3 times and specifying each radio: 0, 1, 2
    Ref synchronizes the frequency while PPS synchronizes time. There will be phase offset but the complex magnitude of each channel should have a rising edge at the same instant.

  • Complex structures in Sender File adapter

    Hi Experts
    I am working on XI 3.0 SP 22. How do we handle the complex structures in sender file adapter in file content conversion.
    Please help me out.
    Regards
    Hari

    Hi,
    FCC can support upto max 3 levels, find below link for more help
    http://help.sap.com/saphelp_nw70/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Content Conversion ( The Key Field Problem )

  • Problem in calling a WS with complex type

    Hi all...
    I have to invoke a WS that has as input type a complex type defined in the wsdl...
    <complexType name="LoginInfo">
    - <sequence>
      <element name="appCode" nillable="true" type="string" />
      <element name="login" nillable="true" type="string" />
      <element name="passwd" nillable="true" type="string" />
      </sequence>
      </complexType>the soapui request looks like this:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://com.susan/SusanWS/types">
       <soapenv:Header/>
       <soapenv:Body>
          <typ:LoginWebService>
             <LoginInfo_1>
                <appCode>WEB_SERVICES</appCode>
                <login>root</login>
                <passwd>root</passwd>
             </LoginInfo_1>
          </typ:LoginWebService>
       </soapenv:Body>
    </soapenv:Envelope>in my java code I'm trying to call it with:
    Service service = new Service();
                Call call = (Call)service.createCall();
                call.setTargetEndpointAddress( new URL( wsEndpoint ) );
    //            call.setOperationName( wsMethod );
                call.setOperationName( new QName("http://com.susan/SusanWS/types",wsMethod));
                call.addParameter( "LoginInfo_1", Constants.XSD_ANYTYPE, ParameterMode.IN );
    //            call.addParameter( "appCode", Constants.XSD_STRING, ParameterMode.IN );
    //            call.addParameter( "login", Constants.XSD_STRING, ParameterMode.IN );
    //            call.addParameter( "passwd", Constants.XSD_STRING, ParameterMode.IN );
                String[] params={appCode, login, passwd};
    //            call.setReturnType( Constants.XSD_INT );
    //            Object retval = call.invoke( new String[] {appCode, login, passwd} );
                Object retval = call.invoke( new Object[] { params } );doing so..it doesn't work...the first problem I can see...is that I don't assign a parameter name to the 3 strings I pass in the param array...
    anybody has a tip to give me on how to solve this problem?

    solved...
    I imported the wsdl into Intellij idea...which created all the needed classes, interfaces,...and used service locator and endpoint binding stubs...

  • Cannot assign value to a Variable of Complex Type beyond index 1

    Hello:
    I have a variable defined as a complex type as followed. I tried to assign a value to each of the two elements but it only allows me to assign to the 'element#1.
    This statement that tries to assign a value into element#2 will not work, if I assign with '[1]' for the first element it will work:
    <copy> <---- THIS WORKS
    <from expression="'John'"/>
    <to variable="My_Variable"
    part="My_Collection"
    query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item[1]/ns9:pname"/>
    </copy>
    <copy> <---- THIS DOES NOT WORK
    <from expression="'John'"/>
    <to variable="My_Variable"
    part="My_Collection"
    query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item[2]/ns9:pname"/>
    </copy>
    Is there something wrong with my definition below that allows only element#1 to be refererenced but not element#2???? Am I missing some kind of initialization that is needed to initialize both elements????
    Here are my message and Complex Type definitions:
    <variable name="My_Variable" messageType="ns8:args_out_msg"/>
    <message name="args_out_msg">
    <part name="My_Collection" element="db:My_Collection"/>
    </message>
    <element name="My_Collection">
    <complexType>
    <sequence>
    <element name="Collection" type="db:Collection_Type" db:index="2" db:type="Array" minOccurs="0" nillable="true"/>
    <element name="Ret" type="string" db:index="3" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    </sequence>
    </complexType>
    </element>
    <complexType name="Collection_Type">
    <sequence>
    <element name="Collection_Item" type="db:Collection_Type_Struct" db:type="Struct" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
    </sequence>
    </complexType>
    <complexType name="Collection_Type_Struct">
    <sequence>
    <element name="pname" db:type="VARCHAR2" minOccurs="0" nillable="true">
    <simpleType>
    <restriction base="string">
    <maxLength value="25"/>
    </restriction>
    </simpleType>
    </element>
    </sequence>
    </complexType>
    The error msg it gives me is as followed:
    [2010/09/04 00:47:59] Error in <assign> expression: <to> value is empty at line "254". The XPath expression : "" returns zero node, when applied to document shown below:less
    oracle.xml.parser.v2.XMLElement@1fa7874
    [2010/09/04 00:47:59] "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.less
    -<selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    -<part name="summary">
    <summary>
    XPath query string returns zero node.
    According to BPEL4WS spec 1.1 section 14.3, The assign activity &lt;to&gt; part query should not return zero node.
    Please check the BPEL source at line number "254" and verify the &lt;to&gt; part xpath query.
    </summary>
    </part>
    </selectionFailure>
    Thanks
    Newbie

    Hello:
    Base on the suggestion to use 'append' instead of 'copy', I tried to define a 'singleNode' which is of type 'Collection_Type_Struct' so I can append this individual 'struct' into my array (i.e. as the 2nd. element of my array "/ns9:My_Collection/ns9:Collection/ns9:Collection_Item"), but I am getting an error in defining this variable as:
    <variable name="singleNode" element="Collection_Type_Struct"/> <--- error
    Can someone tell me how should I define "singleNode" so I can put a value in it and then append this 'singleNode' into the array:
    <variable name="singleNode" element=" how to define this????"/>
    <assign>
    <copy>
    <frem expression="'Element2Value'"/>
    <to variable="singleNode"
    part="My_Collection"
    query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item/ns9:pname"/>
    </copy>
    </assign>
    <bpelx:assign>
    <bpelx:append>
    <from variable="singleNode" query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item"/>
    <to variable="My_Variable"
    "part="My_Collection"
    query="/ns9:My_Collection/ns9:Collection"/>
    </bpelx:append>
    </bpelx:assign>
    Again here is my definition in my .xsd file:
    <element name="My_Collection">
    <complexType>
    <sequence>
    <element name="Collection" type="db:Collection_Type" db:index="2" db:type="Array" minOccurs="0" nillable="true"/>
    <element name="Ret" type="string" db:index="3" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    </sequence>
    </complexType>
    </element>
    <complexType name="Collection_Type">
    <sequence>
    <element name="Collection_Item" type="db:Collection_Type_Struct" db:type="Struct" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
    </sequence>
    </complexType>
    <complexType name="Collection_Type_Struct">
    <sequence>
    <element name="pname" db:type="VARCHAR2" minOccurs="0" nillable="true">
    <simpleType>
    <restriction base="string">
    <maxLength value="25"/>
    </restriction>
    </simpleType>
    </element>
    </sequence>
    </complexType>
    Thanks for any help!!!!

  • Simplel complex report query

    hi guru's
    i had prepared two complex reports seperately having the same Selection-screen , internal tables and declerations...now i have to combine both the reports into one single report....based upon <b>one field (i.e, filed PROCESS_TYPE)</b> of Selection-criteria(i.e, S_PR_TYP ) i have to display 2 outputs..One for SHC and another for CONF.....But the Logic  and Header display for the 2 output's is different   ........please let me know where should i write the logic ....and how the logic should be build....
    the code is as follows :
    <u><b>The code which is common for both the reports:</b></u>
    $$********************************************************************
    $$    TABLES DECLERATION
    $$********************************************************************
    TABLES: crmd_orderadm_h,
            crmd_orderadm_i,
            bbp_pdigp.
    $$********************************************************************
    $$  TYPE-POOLS
    $$********************************************************************
    TYPE-POOLS: slis, list.
    $$********************************************************************
    $$    GLOBAL TYPES
    $$********************************************************************
    TYPES: BEGIN OF y_str1,
           CLIENT         TYPE CRMD_ORDERADM_H-CLIENT,
           guid           TYPE crmd_orderadm_h-guid,
           object_id      TYPE crmd_orderadm_h-object_id,
           object_type    TYPE crmd_orderadm_h-object_type,
           process_type   TYPE crmd_orderadm_h-process_type,
           created_at     TYPE crmd_orderadm_h-created_at,
           changed_at     TYPE crmd_orderadm_h-changed_at,
           archiving_flag TYPE crmd_orderadm_h-archiving_flag,
           deliv_date     TYPE bbp_pdigp-deliv_date,
           final_entry    TYPE bbp_pdigp-final_entry,
           del_ind        TYPE bbp_pdigp-del_ind,
           END OF y_str1.
    TYPES: BEGIN OF y_str2,
           guid1          TYPE crmd_orderadm_h-guid,
           object_id      TYPE crmd_orderadm_h-object_id,
           object_type    TYPE crmd_orderadm_h-object_type,
           process_type   TYPE crmd_orderadm_h-process_type,
           created_at     TYPE crmd_orderadm_h-created_at,
           changed_at     TYPE crmd_orderadm_h-changed_at,
           archiving_flag TYPE crmd_orderadm_h-archiving_flag,
           guid2          TYPE crmd_orderadm_i-guid,
           header         TYPE crmd_orderadm_i-header,
           guid3          TYPE bbp_pdigp-guid,
           deliv_date     TYPE bbp_pdigp-deliv_date,
           final_entry    TYPE bbp_pdigp-final_entry,
           del_ind        TYPE bbp_pdigp-del_ind,
           END OF y_str2.
    $$********************************************************************
    $$    GLOBAL CONSTANTS
    $$********************************************************************
    CONSTANTS: C_BLANK_F(1)           TYPE C VALUE 'X',
               C_DEL_IND_F(1)         TYPE C VALUE 'X',
               C_ARCHIVING_FLAG(1)    TYPE C VALUE 'X',
               C_FINAL_ENTRY_F(1)     TYPE C VALUE 'X',
               C_FINAL_ENTRY_SPACE(1) TYPE C VALUE ' ',
               C_CBA_SPACE(1)         TYPE C VALUE ' ',
               C_DEL_SPACE(1)         TYPE C VALUE ' '.
    $$********************************************************************
    $$    Global Elementary Variables
    $$********************************************************************
    DATA: w_ld_lines                 TYPE i,
          w_ld_linesc(10)            TYPE c,
          w_del_ind                  TYPE c,
          w_final_entry              TYPE c,
          w_COUNT_cba                TYPE I VALUE 0,
          w_count_f                  TYPE I VALUE 0,
          W_BLANK_F                  TYPE C,
          W_FINAL_ENTRY_F            TYPE C,
          W_DEL_COUNT                TYPE I VALUE 0,
          W_PER_CBA1                 TYPE P decimals 3,
          W_PER_CBA                  TYPE P decimals 2,
          W_PER_E_LINE               TYPE I,
          W_N                        TYPE I.
    $$********************************************************************
    $$    GLOBAL INTERNAL TABLES (custom structure)
    $$********************************************************************
    DATA:   t_str_sc1 TYPE STANDARD TABLE OF y_str1 INITIAL SIZE 1.
    DATA:   t_str_sc2 TYPE STANDARD TABLE OF y_str2 INITIAL SIZE 1.
    DATA:   t_header      TYPE   slis_t_listheader,
            w_header      TYPE   slis_listheader,
            e_line        LIKE   w_header-info.
    DATA:   v_index       LIKE SY-TABIX.
            v_index = '1'.
    $$********************************************************************
    $$    GLOBAL FIELD-SYMBOLS
    $$********************************************************************
    FIELD-SYMBOLS: <FS_STR1> TYPE Y_STR1,
                   <FS_STR2> TYPE Y_STR2.
    $$********************************************************************
    $$    PARAMETERS & SELECT-OPTIONS
    $$********************************************************************
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_scno   FOR crmd_orderadm_h-object_id,
                    s_pr_typ FOR crmd_orderadm_h-process_type NO INTERVALS NO DATABASE SELECTION NO-EXTENSION DEFAULT 'SHC',
                    s_change FOR crmd_orderadm_h-changed_at.
    SELECTION-SCREEN END OF BLOCK b1.
    $$********************************************************************
    $$    START-OF-SELECTION
    $$********************************************************************
    START-OF-SELECTION.
      REFRESH t_str_sc1.
      SELECT client
             guid
             object_id
             object_type
             process_type
             created_at
             changed_at
             archiving_flag
             FROM crmd_orderadm_h INTO TABLE t_str_sc1
             WHERE object_id IN s_scno AND  changed_at IN s_change AND process_type IN s_pr_typ.
      IF sy-subrc <> 0.
        MESSAGE I002.
      ENDIF.
      LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
        REFRESH t_str_sc2.
        SELECT a~guid
               a~object_id
               a~object_type
               a~process_type
               a~created_at
               a~changed_at
               a~archiving_flag
               b~guid
               b~header
               c~guid
               c~deliv_date
               c~final_entry
               c~del_ind
          INTO TABLE t_str_sc2
          FROM crmd_orderadm_h AS a INNER JOIN crmd_orderadm_i AS b
            ON aguid eq bheader INNER JOIN bbp_pdigp AS c
            ON bguid eq cguid
         WHERE a~guid eq <FS_STR1>-guid.
    <u><b>THE LOGIC FOR FIRST REPORT:</b></u>
    *"logic for displaying Delivery date at Header level
          SORT T_STR_SC2 BY DELIV_DATE.
          DESCRIBE TABLE T_STR_SC2 LINES W_N.
         READ TABLE T_STR_SC2 WITH KEY DELIV_DATE = T_STR_SC2-DELIV_DATE INTO <FS_STR2>-deliv_date.
          READ TABLE T_STR_SC2 INDEX v_index ASSIGNING <FS_STR2>.
          IF SY-SUBRC = 0.
            <FS_STR1>-deliv_date = <FS_STR2>-deliv_date.
            MODIFY  T_STR_SC1 FROM <FS_STR1> TRANSPORTING DELIV_DATE.
          ENDIF.
    *"Setting up the flags for the entire items in CRMD_ORDERADM_H as per the scenario
        LOOP AT T_STR_SC2 ASSIGNING <FS_STR2> WHERE HEADER EQ <FS_STR1>-GUID.
          IF <FS_STR2>-DEL_IND NE 'X'.
            IF <FS_STR2>-FINAL_ENTRY NE 'X'.
              W_BLANK_f = C_BLANK_F.
            ELSE.
              W_FINAL_ENTRY_F = C_FINAL_ENTRY_F.
            ENDIF.
          ENDIF.
        ENDLOOP.
    *"Logic started at item level
        LOOP AT T_STR_SC2 ASSIGNING <FS_STR2> WHERE HEADER EQ <FS_STR1>-GUID.
          IF W_BLANK_F NE 'X'.
            IF W_FINAL_ENTRY_F NE 'X'.
    *" Displaying the status for Del 'X' , Final_entry ' ', Archive_flag 'X'.
              <FS_STR1>-DEL_IND = C_DEL_IND_F.
             W_DEL_COUNT = W_DEL_COUNT + 1.
              <FS_STR1>-FINAL_ENTRY = C_FINAL_ENTRY_SPACE.
              <FS_STR1>-ARCHIVING_FLAG = C_ARCHIVING_FLAG.
             w_COUNT_cba = w_COUNT_cba + 1.
              MODIFY  T_STR_SC1 FROM <FS_STR1> TRANSPORTING DEL_IND FINAL_ENTRY ARCHIVING_FLAG.
            ELSE.
    *" Displaying the status for Del ' ' , Final_entry 'X', Archive_flag 'X'.
              <FS_STR1>-FINAL_ENTRY = C_FINAL_ENTRY_F.
             w_count_f  = w_count_f  + 1.
              <FS_STR1>-DEL_IND = C_DEL_SPACE.
              <FS_STR1>-ARCHIVING_FLAG = C_ARCHIVING_FLAG.
             w_COUNT_cba = w_COUNT_cba + 1.
              MODIFY  T_STR_SC1 FROM <FS_STR1> TRANSPORTING FINAL_ENTRY DEL_IND ARCHIVING_FLAG.
            ENDIF.
          ELSE.
    *" Displaying the status for Del ' ' , Final_entry ' ', Archive_flag ' '.
            <FS_STR1>-DEL_IND = C_DEL_SPACE.
            <FS_STR1>-FINAL_ENTRY = C_FINAL_ENTRY_SPACE.
            <FS_STR1>-ARCHIVING_FLAG = C_CBA_SPACE.
            MODIFY  T_STR_SC1 FROM <FS_STR1> TRANSPORTING DEL_IND FINAL_ENTRY ARCHIVING_FLAG .
          ENDIF.
        ENDLOOP.    "end of t_str_sc2
        if  <FS_STR1>-DEL_IND eq C_DEL_IND_F.
             W_DEL_COUNT = W_DEL_COUNT + 1.
        endif.
       if <FS_STR1>-FINAL_ENTRY eq C_FINAL_ENTRY_F.
                w_count_f  = w_count_f  + 1.
       endif.
      if  <FS_STR1>-ARCHIVING_FLAG eq C_ARCHIVING_FLAG.
               w_COUNT_cba = w_COUNT_cba + 1.
        endif.
        CLEAR: W_BLANK_F , W_FINAL_ENTRY_F.
    *"Logic ended at item level
      ENDLOOP.    "end of t_str_sc1
    *" when Transaction type is SHC
    IF <FS_STR1>-process_type EQ 'SHC'.
    DESCRIBE TABLE t_str_sc1 LINES w_ld_lines.
      w_ld_linesc = w_ld_lines.
      CONCATENATE ' TOTAL NO OF RECORDS SELECTED:' w_ld_linesc INTO e_line SEPARATED BY space.
    *" Percentage of Archived SC's
      W_PER_E_LINE = w_ld_lines.
      W_PER_CBA1 = W_COUNT_CBA / W_PER_E_LINE.
      W_PER_CBA = W_PER_CBA1 * 100.
    *" Displaying the total no of records fetched for DB
      FORMAT COLOR 7.
      WRITE:/9 e_line .
      WRITE:/10 'TOTAL NO OF FINAL ENTRIES SELECTED:',        w_count_f.
      WRITE:/10 'TOTAL NO OF DELETE ENTRIES SELECTED:',       W_DEL_COUNT.
      WRITE:/10 'TOTAL NO OF ENTRIES SELECTED FOR ARCHIVING:',w_COUNT_cba.
      SKIP.
      WRITE:/10 'PERCENTAGE OF CAN BE ARCHIVED:',W_PER_CBA,'%'.
      FORMAT COLOR 3.
      SKIP.
      WRITE:/30 '#### SC HAVING FINAL ENTRY INDICATOR FOR ALL ITEM IN SRM #####'.
      FORMAT COLOR OFF.
      WRITE:/30(63) SY-ULINE.
      ULINE.
    *" Displaying Headings for the Report
    NEW-LINE SCROLLING.
      WRITE:/3        'Transaction No',                          18  sy-vline,
             19       'Transaction Type',                        36  sy-vline,
             37       'Business Trans.Cat',                      56  sy-vline,
             57       'Created On',                              68  sy-vline,
             69(10)   'Changed On',                              84  sy-vline,
             85       'Delivery date',                           99  sy-vline,
            100       'Final Entry Ind',                        115  sy-vline,
            116       'Deletion Ind',                           129  sy-vline,
            130       'Can be Archived',                        146  sy-vline.
    SET LEFT SCROLL-BOUNDARY COLUMN 19.
      ULINE.
    $$********************************************************************
    $$    DISPLAY DATA AT HEADER LEVEL FOR SHC
    $$********************************************************************
    *" Sort the SC in Sequence
      SORT t_str_sc1 BY object_id.
      IF SY-SUBRC = 0.
    *" Displaying the Report at Header level
        LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
          IF NOT <FS_STR1>-archiving_flag IS INITIAL.
            FORMAT COLOR 7.
          ELSE.
            FORMAT COLOR 3.
          ENDIF.
      WRITE:/3        <FS_STR1>-object_id,                       18  sy-vline,
             19       <FS_STR1>-process_type,                    36  sy-vline,
             37       <FS_STR1>-object_type,                     56  sy-vline,
             57       <FS_STR1>-created_at,                      68  sy-vline,
             69(10)   <FS_STR1>-changed_at,                      84  sy-vline,
             85       <FS_STR1>-deliv_date,                      99  sy-vline,
            100       <FS_STR1>-final_entry,                    115  sy-vline,
            116       <FS_STR1>-del_ind,                        129  sy-vline,
            130       <FS_STR1>-archiving_flag,                 146  sy-vline.
        ENDLOOP.   "end of t_str_sc1 displaying at header level
      ENDIF.    "End of SY-SUBRC
    *ENDCASE.
    ENDIF.   "End of displaying Transaction type as SHC
    *" when Transaction type is CONF
    IF <FS_STR1>-process_type EQ 'CONF'.
      DESCRIBE TABLE t_str_sc1 LINES w_ld_lines.
      w_ld_linesc = w_ld_lines.
      CONCATENATE ' TOTAL NO OF RECORDS SELECTED:' w_ld_linesc INTO e_line SEPARATED BY space.
    *" Percentage of Archived SC's
      W_PER_E_LINE = w_ld_lines.
      W_PER_CBA1 = W_COUNT_CBA / W_PER_E_LINE.
      W_PER_CBA = W_PER_CBA1 * 100.
    *" Displaying Headings for the Report
    *" Displaying the total no of records fetched for DB
      FORMAT COLOR 7.
      WRITE:/9 e_line .
    WRITE:/10 'TOTAL NO OF FINAL ENTRIES SELECTED:',        w_count_f.
      WRITE:/10 'TOTAL NO OF DELETE ENTRIES SELECTED:',       W_DEL_COUNT.
      WRITE:/10 'TOTAL NO OF ENTRIES SELECTED FOR ARCHIVING:',w_COUNT_cba.
      SKIP.
      WRITE:/10 'PERCENTAGE OF CAN BE ARCHIVED:',W_PER_CBA,'%'.
      FORMAT COLOR 3.
      SKIP.
      WRITE:/30 '#### SC HAVING FINAL ENTRY INDICATOR FOR ALL ITEM IN SRM #####'.
      FORMAT COLOR OFF.
      WRITE:/30(63) SY-ULINE.
      ULINE.
    NEW-LINE SCROLLING.
      WRITE:/3        'Transaction No',                          18  sy-vline,
             19       'Transaction Type',                        36  sy-vline,
             37       'Business Trans.Cat',                      56  sy-vline,
             57       'Created On',                              68  sy-vline,
             69(10)   'Changed On',                              84  sy-vline,
             85       'Delivery date',                           99  sy-vline,
           100       'Final Entry Ind',                        115  sy-vline,
            100       'Deletion Ind',                           112  sy-vline,
            113       'Can be Archived',                        129  sy-vline.
    SET LEFT SCROLL-BOUNDARY COLUMN 19.
      ULINE.
    *$$********************************************************************
    *$$    DISPLAY DATA AT HEADER LEVEL
    *$$********************************************************************
    *" Sort the SC in Sequence
      SORT t_str_sc1 BY object_id.
      IF SY-SUBRC = 0.
    *" Displaying the Report at Header level
        LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
          IF NOT <FS_STR1>-archiving_flag IS INITIAL.
            FORMAT COLOR 7.
          ELSE.
            FORMAT COLOR 3.
          ENDIF.
      WRITE:/3        <FS_STR1>-object_id,                       18  sy-vline,
             19       <FS_STR1>-process_type,                    36  sy-vline,
             37       <FS_STR1>-object_type,                     56  sy-vline,
             57       <FS_STR1>-created_at,                      68  sy-vline,
             69(10)   <FS_STR1>-changed_at,                      84  sy-vline,
             85       <FS_STR1>-deliv_date,                      99  sy-vline,
           100       <FS_STR1>-final_entry,                    115  sy-vline,
            100       <FS_STR1>-del_ind,                        112  sy-vline,
            113       <FS_STR1>-archiving_flag,                 129  sy-vline.
        ENDLOOP.   "end of t_str_sc1 displaying
      ENDIF.  "End of SY-SUBRC
    ENDIF.  "End of displaying Transaction type as CONF
    <b><u>
    THE LOGIC FOR THE SECOND REPORT</u></b>
    LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
          REFRESH t_str_sc2.
          SELECT a~guid
                 a~object_id
                 a~object_type
                 a~process_type
                 a~created_at
                 a~changed_at
                 a~archiving_flag
                 b~guid
                 b~header
                 c~guid
                 c~deliv_date
                 c~final_entry
                 c~del_ind
            INTO TABLE t_str_sc2
            FROM crmd_orderadm_h AS a INNER JOIN crmd_orderadm_i AS b
              ON aguid eq bheader INNER JOIN bbp_pdigp AS c
              ON bguid eq cguid
           WHERE a~guid eq <FS_STR1>-guid.
           IF NOT t_str_sc2[] is INITIAL.
          LOOP AT T_STR_SC2 ASSIGNING <FS_STR2>.
           IF <FS_STR2>-DEL_IND NE C_DEL_SPACE.        " if x
              <FS_STR2>-DEL_IND = C_DEL_IND_F.
              <FS_STR2>-ARCHIVING_FLAG = C_ARCHIVING_FLAG.
              MODIFY T_STR_SC2 FROM <FS_STR2> .
            ELSE.         "if ' '
              EXIT.
            ENDIF.
          ENDLOOP.    "End loop of t_str_sc2
          MOVE <FS_STR2>-DEL_IND TO <FS_STR1>-DEL_IND.
          MOVE <FS_STR2>-ARCHIVING_FLAG TO <FS_STR1>-ARCHIVING_FLAG.
          MODIFY T_STR_SC1 FROM <FS_STR1>.
        ELSE.   " For sy-subrc
          <FS_STR1>-REMARKS = c_itnf.
          MODIFY T_STR_SC1 FROM <FS_STR1>.
        ENDIF.    " End of sy-subrc
      IF <FS_STR1>-DEL_IND eq C_DEL_IND_F.
             W_DEL_COUNT = W_DEL_COUNT + 1.
      ENDIF.
      IF  <FS_STR1>-ARCHIVING_FLAG eq C_ARCHIVING_FLAG.
            w_COUNT_cba = w_COUNT_cba + 1.
      ENDIF.
      ENDLOOP.  "End loop of t_str_sc1
    ********************************" when Transaction type is CONF
    *******************************IF <FS_STR1>-process_type EQ 'CONF'.
      DESCRIBE TABLE t_str_sc1 LINES w_ld_lines.
      w_ld_linesc = w_ld_lines.
      CONCATENATE ' TOTAL NO OF RECORDS SELECTED:' w_ld_linesc INTO e_line SEPARATED BY space.
    *" Percentage of Archived SC's
      W_PER_E_LINE = w_ld_lines.
      W_PER_CBA1 = W_COUNT_CBA / W_PER_E_LINE.
      W_PER_CBA = W_PER_CBA1 * 100.
    *" Displaying Headings for the Report
    *" Displaying the total no of records fetched for DB
      FORMAT COLOR 7.
      WRITE:/9 e_line .
    WRITE:/10 'TOTAL NO OF FINAL ENTRIES SELECTED:',        w_count_f.
      WRITE:/10 'TOTAL NO OF DELETE ENTRIES SELECTED:',       W_DEL_COUNT.
      WRITE:/10 'TOTAL NO OF ENTRIES SELECTED FOR ARCHIVING:',w_COUNT_cba.
      SKIP.
      WRITE:/10 'PERCENTAGE OF CAN BE ARCHIVED:',W_PER_CBA,'%'.
      FORMAT COLOR 3.
      SKIP.
      WRITE:/30 '#### SC HAVING FINAL ENTRY INDICATOR FOR ALL ITEM IN SRM #####'.
      FORMAT COLOR OFF.
      WRITE:/30(63) SY-ULINE.
      ULINE.
      NEW-LINE SCROLLING.
      WRITE:/3        'Transaction No',                          18  sy-vline,
             19       'Transaction Type',                        36  sy-vline,
             37       'Business Trans.Cat',                      56  sy-vline,
             57       'Created On',                              68  sy-vline,
             69(10)   'Changed On',                              84  sy-vline,
            100       'Deletion Ind',                           112  sy-vline,
            113       'Can be Archived',                        129  sy-vline,
            130       'Remarks',                                 150  sy-vline.
      SET LEFT SCROLL-BOUNDARY COLUMN 19.
      ULINE.
    *$$********************************************************************
    *$$    DISPLAY DATA AT HEADER LEVEL
    *$$********************************************************************
    *" Sort the SC in Sequence
      SORT t_str_sc1 BY object_id.
      IF SY-SUBRC = 0.
    *" Displaying the Report at Header level
        LOOP AT t_str_sc1 ASSIGNING <FS_STR1>.
          IF NOT <FS_STR1>-archiving_flag IS INITIAL.
            FORMAT COLOR 7.
          ELSE.
            FORMAT COLOR 3.
          ENDIF.
          WRITE:/3        <FS_STR1>-object_id,                       18  sy-vline,
                 19       <FS_STR1>-process_type,                    36  sy-vline,
                 37       <FS_STR1>-object_type,                     56  sy-vline,
                 57       <FS_STR1>-created_at,                      68  sy-vline,
                 69(10)   <FS_STR1>-changed_at,                      84  sy-vline,
                100       <FS_STR1>-del_ind,                        112  sy-vline,
                113       <FS_STR1>-archiving_flag,                 129  sy-vline,
                130       <FS_STR1>-REMARKS,                        150  sy-vline.
        ENDLOOP.   "end of t_str_sc1 displaying
      ENDIF.  "End of SY-SUBRC
    **********************ENDIF.  "End of displaying Transaction type as CONF

    Very difficult to give you a solution without having access to the actual data and tables and some basic relationship model to explain the entities of the tables.
    But one thing I found that makes dealing complex queries a lot easier - easier to code and to read and to maintain - is to use the WITH clause. This allows the type of modularisation of code that we're using in other languages.
    The basic syntax is:WITH <alias1> AS(
      SELECT ...
    <alias2> AS(
      SELECT ...
    <aliasn> AS(
      SELECT ...
    SELECT
    FROM alias1, .. aliasnThis allows you to create distinct query sets once - and then re-use these again in joins, selects, and even other sub-sets.
    The resulting SQL is a lot les stressful on the eye and makes the whole "processing logic" of getting to the results much easier to analyse, follow and understand.

  • Loading complex report data into a direct update DSO using APD

    Dear All,
    Recently, I had a requirement to download the report data into a direct update DSO using an APD. I was able to perform this easily when the report was simple i.e it has few rows and columns. But I faced problems If the report is a complex one. Summing up, I would like to know how to handle the scenarios in each of the following cases:
    1.   How should I decide the key fields and data fields of the direct update DSO ? Is it that the elements in ROWS will go to the
          key fields of DSO and the remaining to the data fields? Correct me.
    2.   What if the report contains the Restricted KFs and Calculated KFs? Do I have to create separate infoobjects in the BI
          system and then include these in the DSO data fields to accommodate the extracted data ?
    3.   How do I handle the Free Characteristics and Filters ?
    4.  Moreover, I observed that if the report contains selection screen variables, then I need to create variants in the report and
         use that variant in the APD. So, if I have 10 sets of users executing the same report with different selection conditions, then
         shall I need to create 10 different variants and pass those into 10 different APDs, all created for the same report ?
    I would appreciate if someone can answer my questions clearly.
    Regards,
    D. Srinivas Rao

    Hi ,
    PFB the answers.
    1. How should I decide the key fields and data fields of the direct update DSO ? Is it that the elements in ROWS will go to the
    key fields of DSO and the remaining to the data fields? Correct me.
    --- Yes , you can use the elements in the ROWS in the Key fields,  but in case you get two records with same value in the ROWS element the data load will fail. So you basically need to have one value that would be different for each record.
    2. What if the report contains the Restricted KFs and Calculated KFs? Do I have to create separate infoobjects in the BI
    system and then include these in the DSO data fields to accommodate the extracted data ?
    Yes you would need to create new Infoobjects for the CKF's and RKF's in the Report and include them in your DSO.
    3. How do I handle the Free Characteristics and Filters ?
    The default filters work in the same way as when you yourself execute the reoprt. But you cannot use the Free characterisitics in the APD. only the ROWS and cloumns element which are in default layout can be used.
    4. Moreover, I observed that if the report contains selection screen variables, then I need to create variants in the report and
    use that variant in the APD. So, if I have 10 sets of users executing the same report with different selection conditions, then
    shall I need to create 10 different variants and pass those into 10 different APDs, all created for the same report ?
    --- Yes you would need to create 10 different APD's. Its very simple to create, you can copy an APD. but it would be for sure a maintance issue. you would have to maintain 10 APD's.
    Please revert in case of any further queries.

Maybe you are looking for

  • How change plant, net price, OPu, and Material Number from ME32K

    Hi GURUs, May let me know how I should configure ME32K in order to allow users to change: - Material Number - Net Price - Order Purchasing Unit - Plant I have tried setting up field selections layout properly, even debug PBO, it is still greyed out f

  • Can't see my home network

    I have a late 2008 13" macbook with latest version of lion installed. Everything was great since the day I bought it but couple of days ago a weird thing happened. all of a sudden I couldnt see my home network on the wi-fi list. All of the devices in

  • Is this an iTunes or a Time Machine or a Lion issue?

    hello there. so... i have bunch of mp3s on an external drive (this is where i keep them, they take up too much space otherwise). usually, if i download an mp3 file onto my machine, i subsequently drag it into iTunes and it goes in happily while simul

  • Plz help, i might have lost a years worth of music!!

    So my laptop(sony), is kinda old so i restored it to factory condition. Before though, i moved my library over to an external drive. Im having a lot of trouble getting the music back on to the laptop. To transfer, i dragged the library file off the e

  • Too much childprocess on linux

    Hello! I use 9iAS 9.0.3 on Suse Linux. Using the command "ps aux" and get a lot of childprocesses for each running jvm. If i only start a standalone oc4j-container i have the same result. My question: How can i set the max number of childprocesses ru