Creating a flatfile for muli- date table

I am creating a flatfile for reporting purposes. The ASSESSMENT tables can have up to two assessment_date, assessment_type_code per transaction_ID
ie ASSESSMENT
Record 1
TRANSACTION_ID = 1234
ASSESSMENT_TYPE_CODE = 'ABC;
ASSESSMENT_DATE = 01/06/2006;
Record 2
TRANSACTION_ID = 1234
ASSESSMENT_TYPE_CODE = 'BBC;
ASSESSMENT_DATE = 17/06/2006;
How do I change this update statement to store both records in the flatfile.
UPDATE FLATFILE2003
SET
ASSESSMENT_TYPE_CODE_1 = (SELECT ASSESSMENT_TYPE_CODE FROM ASSESSMENT F WHERE FLATFILE2003.TRANSACTION_ID = F.TRANSACTION_ID AND ?),
ASSESSMENT_DATE_1 = (SELECT ASSESSMENT_DATE FROM ASSESSMENT F WHERE FLATFILE2003.TRANSACTION_ID = F.TRANSACTION_ID AND ?),
ASSESSMENT_TYPE_CODE_2 = (SELECT ASSESSMENT_TYPE_CODE FROM ASSESSMENT F WHERE FLATFILE2003.TRANSACTION_ID = F.TRANSACTION_ID AND ?),
ASSESSMENT_DATE_2 = (SELECT ASSESSMENT_DATE FROM ASSESSMENT F WHERE FLATFILE2003.TRANSACTION_ID = F.TRANSACTION_ID AND ?)
Thanks
Brendon

Do you mean something like this?
WITH rec1 AS (SELECT 1234  TRANSACTION_ID,
                     'ABC' ASSESSMENT_TYPE_CODE,
                     TO_DATE('01/06/2006', 'dd/mm/yyyy') ASSESSMENT_DATE
                FROM dual
               UNION
              SELECT 1235  TRANSACTION_ID,
                     'ABC' ASSESSMENT_TYPE_CODE,
                     TO_DATE('01/06/2006', 'dd/mm/yyyy') ASSESSMENT_DATE
                FROM dual),
     rec2 AS (SELECT 1234  TRANSACTION_ID,
                     'BBC' ASSESSMENT_TYPE_CODE,
                     TO_DATE('17/06/2006', 'dd/mm/yyyy') ASSESSMENT_DATE
                FROM dual
               UNION
              SELECT 1236  TRANSACTION_ID,
                     'BBC' ASSESSMENT_TYPE_CODE,
                     TO_DATE('17/06/2006', 'dd/mm/yyyy') ASSESSMENT_DATE
                FROM dual)
SELECT rec1.transaction_id       transaction_id,
       rec1.assessment_type_code assessment_type_code_1,
       rec1.assessment_date      assessment_date_1,
       rec2.assessment_type_code assessment_type_code_2,
       rec2.assessment_date      assessment_date_2
  FROM rec1, rec2
WHERE rec1.transaction_id = rec2.transaction_id
UNION ALL
SELECT rec1.transaction_id       transaction_id,
       rec1.assessment_type_code assessment_type_code_1,
       rec1.assessment_date      assessment_date_1,
       rec2.assessment_type_code assessment_type_code_2,
       rec2.assessment_date      assessment_date_2
  FROM rec1, rec2
WHERE rec1.transaction_id = rec2.transaction_id(+)
   AND rec2.transaction_id IS NULL
UNION ALL
SELECT rec2.transaction_id       transaction_id,
       rec1.assessment_type_code assessment_type_code_1,
       rec1.assessment_date      assessment_date_1,
       rec2.assessment_type_code assessment_type_code_2,
       rec2.assessment_date      assessment_date_2
  FROM rec1, rec2
WHERE rec1.transaction_id(+) = rec2.transaction_id
   AND rec1.transaction_id IS NULL
;C.

Similar Messages

  • How to create DB partitioning in active data tables for ods?

    hi all,
    Can anyone let me know how to create DB partitioning in active data tables for ods. if any docs pls share with me at my email id : [email protected]
    regds
    haritha

    Haritha,
    The following steps will briefly explain you to improve the performance in terms of DB partitioning as well as loading. Please find the same,
    transaction RSCUSTA2,
    oss note 120253 565725 670208
    and remove 'bex reporting' setting in ods if that ods not used for reporting.
    hope this helps.
    565725
    Symptom
    This note contains recommendations for improving the load performance of ODS objects in Business Information Warehouse Release 3.0B and 3.1 Content.
    Other terms
    Business Information Warehouse, ODS object, BW, RSCUSTA2, RSADMINA
    Solution
    To obtain a good load performance for ODS objects, we recommend that you note the following:
    1. Activating data in the ODS object
    In the Implementation Guide in the BW Customizing, you can implement different settings under Business Information Warehouse -> General BW settings -> Settings for the ODS object that will improve performance when you activate data in the ODS object.
    1. Creating SIDs
    The creation of SIDs is time-consuming and may be avoided in the following cases:
    a) You should not set the indicator for BEx Reporting if you are only using the ODS object as a data store.Otherwise, SIDs are created for all new characteristic values by setting this indicator.
    b) If you are using line items (for example, document number, time stamp and so on) as characteristics in the ODS object, you should mark these as 'Attribute only' in the characteristics maintenance.
    SIDs are created at the same time if parallel activation is activated (see above).They are then created using the same number of parallel processes as those set for the activation. However:if you specify a server group or a special server in the Customizing, these specifications only apply to activation and not the creation of SIDs.The creation of SIDs runs on the application server on which the batch job is also running.
    1. DB partitioning on the table for active data (technical name:
    The process of deleting data from the ODS object may be accelerated by partitioning on the database level.Select the characteristic after which you want deletion to occur as a partitioning criterion.For more details on partitioning database tables, see the database documentation (DBMS CD).Partitioning is supported with the following databases:Oracle, DB2/390, Informix.
    1. Indexing
    Selection criteria should be used for queries on ODS objects.The existing primary index is used if the key fields are specified.As a result, the characteristic that is accessed more frequently should be left justified.If the key fields are only partially specified in the selection criteria (recognizable in the SQL trace), the query runtime may be optimized by creating additional indexes.You can create these secondary indexes in the ODS object maintenance.
    1. Loading unique data records
    If you only load unique data records (that is, data records with a one-time key combination) into the ODS object, the load performance will improve if you set the 'Unique data record' indicator in the ODS object maintenance.
    Hope this helps..
    ****Assign Points****
    Thanks,
    Gattu

  • How to create transaction code for a Z-table

    How to create transaction code for a Z-table?
    Se93 --> then which radio button to be selected? and what is the program nam e to  be given

    Hi Sam,
    <b>Procedure to create a TCODE for ZTABLE:</b>
    Create a table maintainance/View for the Z* Table.
    Once you create the view goto SE93>Select Parameter transaction and give the short desc.>
    Give the transaction as SM30(Skip the first screen-optional)>Check all check boxes under GUI support>In the default values(grid)section first row give the VIEWNAME as you created initially and the second row UPDATE as X.
    <u><i>Se93 --> then which radio button to be selected</i></u>
    Select the parameter transaction as a radio button.
    <u><i>what is the program nam e to be given</i></u>
    no need to give any program name. Instead you have to give the transaction code name as SM30.
    Pls mark the helpful answers.
    Thanks
    Eswar

  • How to create a workflow for personnel data?

    Dear All,
                  I want to create a workflow for entering personnel data and submitting it to the immediate senior.I had created a workflow for leave approval.Can anyone tell me steps for creating the workflow for personnel data.
                               Pratighya Jain
    Message was edited by: Pratighya jain
            Pratighya Jain

    Check this documentaion on SAP Business Workflow, which is built in HR:
    http://help.sap.com/saphelp_46c/helpdata/en/a1/172437130e0d09e10000009b38f839/frameset.htm
    Things that can be done are eg:
    Application forms and everything for handling them
    Absence approvals, travel requests, expenses
    Time
    Pls don't forget to reward points and close the question if you find the answers useful.

  • How to create process chains for Master Data?

    I need information on " how we can create process Chains for Master Data"

    Hi Sachin,
      http://help.sap.com/saphelp_bw33/helpdata/en/ad/6b023b6069d22ee10000000a11402f/frameset.htm
    and also Modelling aspects in process chains (ppt)
    https://websmp109.sap-ag.de/~sapidb/011000358700002337702003
    Hope this helps.
    Srini

  • Want to create RFC FM for Getting data in CRM from R/3

    Hi,
    I have made the RFC connection in CRM system , now I want to make RFC FM for getting data from R/3 'MARD' table into CRM, If any one help me how to do this.
    From CRM system I will pass Plant & material no to FM and I need Storage location & Storage Bin from R/3 MARD table in CRM.
    Thanks
    Bobby

    Dear Bobby,
    You would create a FM in SE37 select 'Remote Enabled Module' radio-button in attributes tab of Function Builder.
    Select matnr werks LGORT LGPBE
               from MARD
               into ET_MARD
               where matnr = i_matnr
               and  werks = i_werks.
    Note:
    matnr is material number
    werks is plant
    LGORT is storage location
    LGPBE is storage bin
    Hope this will help.
    Regards,
    Naveen.

  • How to create object class for a z table

    Hi All,
    I have a z table and I want to register the changes of fields should be logged to CDHDR and CDPOS table.
    Is this possible?
    If yes how can I creat an object class for a z table. I have already checked the change document option in z data element.
    Please help.
    Regards,
    Jeetu
    Moderator message: standard functionality, please search for available information/documentation before asking.
    locked by: Thomas Zloch on Oct 6, 2010 6:16 PM

    Tcode SCDO. You'll need to create a change document for you Z table and then use the FM created to record the changed data.

  • How to create dynamic strcture for a interrnal table

    first i created one internal table . with five fields . suppose i want add two more fields in internal table.
    what is the code for the this . if any one konow

    REPORT  ZTEST05.
    PARAMETERS dbtab TYPE tabname DEFAULT 'SPFLI'.
    TYPE-POOLS rsds.
    DATA tadir_wa  TYPE tadir.
    DATA selid     TYPE  rsdynsel-selid.
    DATA field_tab TYPE TABLE OF rsdsfields.
    DATA table_tab TYPE TABLE OF rsdstabs.
    DATA table     LIKE LINE OF table_tab.
    DATA cond_tab  TYPE  rsds_twhere.
    DATA cond      LIKE LINE OF cond_tab.
    DATA dref      TYPE REF TO data.
    DATA alv       TYPE REF TO cl_salv_table.
    FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
    SELECT SINGLE *
           FROM tadir
           INTO tadir_wa
           WHERE pgmid = 'R3TR' AND
                 object = 'TABL' AND
                 obj_name = dbtab.
    IF sy-subrc <> 0.
      MESSAGE 'Database not found' TYPE 'I' DISPLAY LIKE 'E'.
      LEAVE PROGRAM.
    ENDIF.
    table-prim_tab = dbtab.
    APPEND table TO table_tab.
    CALL FUNCTION 'FREE_SELECTIONS_INIT'
      EXPORTING
        kind         = 'T'
      IMPORTING
        selection_id = selid
      TABLES
        tables_tab   = table_tab
      EXCEPTIONS
        OTHERS       = 4.
    IF sy-subrc <> 0.
      MESSAGE 'Error in initialization' TYPE 'I' DISPLAY LIKE 'E'.
      LEAVE PROGRAM.
    ENDIF.
    CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
      EXPORTING
        selection_id  = selid
        title         = 'Free Selection'
        as_window     = ' '
      IMPORTING
        where_clauses = cond_tab
      TABLES
        fields_tab    = field_tab
      EXCEPTIONS
        OTHERS        = 4.
    IF sy-subrc <> 0.
      MESSAGE 'No free selection created' TYPE 'I'.
      LEAVE PROGRAM.
    ENDIF.
    READ TABLE cond_tab WITH KEY tablename = dbtab INTO cond.
    IF sy-subrc <> 0.
      MESSAGE 'Error in condition' TYPE 'I' DISPLAY LIKE 'E'.
      LEAVE PROGRAM.
    ENDIF.
    CREATE DATA dref TYPE TABLE OF (dbtab).
    ASSIGN dref->* TO <table>.
    TRY.
        SELECT *
               FROM (dbtab)
               INTO TABLE <table>
               WHERE (cond-where_tab).
      CATCH cx_sy_dynamic_osql_error.
        MESSAGE 'Error in dynamic Open SQL' TYPE 'I' DISPLAY LIKE 'E'.
        LEAVE PROGRAM.
    ENDTRY.
    TRY.
        cl_salv_table=>factory(
          IMPORTING r_salv_table = alv
          CHANGING  t_table      = <table> ).
        alv->display( ).
      CATCH cx_salv_msg.
        MESSAGE 'Error in ALV display' TYPE 'I' DISPLAY LIKE 'E'.
    ENDTRY.

  • Generic delta for master data table MEAN

    Hello all,
    How should the settings for my generic data source look?
    It's masterdata attributes and I'd like it to be delta compatible. The basis for the data source is table MEAN in R/3.
    Could someone please specify the settings that should be applied in SBIW (Should for example a numeric pointer be used or is the date better for handling of the delta queue? How should the security ranges be set etc.?)?
    Thanks,
    Fredrik
    Message was edited by: Fredrik Carlsson

    Hello,
    TCDOB is a table where you need to maintain entries for Generic Detla.
    Please goto SE16 : enter table name TCDOB
    In the selection Screen Enter Object as EQUI and check the Number Of Entries..
    I guess you need to maintain the number of fields on which the change is dependent for Detla ()
    I treid creating the same Datasource Using Ale Detla
    It worked and saved without errors :
    i have the following entries in TCDOB table
    OBJECT          TABNAME
    EQUI            EQKT
    EQUI            EQUI
    EQUI            EQUZ
    EQUI            FLEET
    EQUI            ILOA
    Please tell me your count and entries..
    so that we can discuss this Further
    Also if you find if there are no entries then you can Go to SCDO tcode and maintain entries with respect to change object.
    waiting for your feedback
    Regards
    Nitin Bhatia
    Edited by: Nitin Bhatia on Mar 18, 2010 6:44 AM

  • How to create editable tablecells for a single table row dynamically?

    Hi
    How to make the cell of a tablerow editable based on flag in backing list object bound to row? I can't decide the editable property while creating table columns. So i can't use setCellFactory() during creation. However setCellFactory() makes all cells in table column editable.How to make non-editable table row cell editable and vice-versa based on flag?

    hi
    good
    if you want to create two different view for a same table than you cant give the same name for the same view,otherwise it would allow you to create the view.Try out with different view name as well as the function group name,i hope this ll work.
    thanks
    mrutyun^

  • How to Create Authorization Group for SAP Standard Tables

    All,
    I have 10 standard tables which are required to maintain by the user in Production environment.
    Is there any way to create a custom auth group for the standard table?
    Is it possible to assign same table in two different auth groups?
    Please advice
    Thanks,
    Kotesh

    Multiple tables can be linked to an auth group, but one table can be linked to only one auth group.
    You cannot link one table to more than one auth group.
    It is always advised to try to find an existing auth group having tables of same functinality and criticality, before creating a new auth group.
    In case you don't have any such auth group, I feel you can create a Z auth group using se16->tbrg.
    You can also create auth group using tcode se54.

  • Can we create secondary index for a cluster table

    hi
    can we create secondary index for a cluster table

    Jyothsna,
    There seems to be some kind of misunderstanding here. You <i>cannot</i> create a secondary index on a cluster table. A cluster table does not exist as a separate physical table in the database; it is part of a "physical cluster". In the case of BSEG for instance, the physical cluster is RFBLG. The only fields of the cluster table that also exist as fields of the physical cluster are the leading fields of the primary key. Taking again BSEG as the example, the primary key includes the fields MANDT, BUKRS, BELNR, GJAHR, BUZEI. If you look at the structure of the RFBLG table, you will see that it has primary key fields MANDT, BUKRS, BELNR, GJAHR, PAGENO. The first four fields are those that all cluster tables inside BSEG have in common. The fifth field, PAGENO, is a "technical" field giving the sequence number of the current record in the series of cluster records sharing the same primary key.
    All the "functional" fields of the cluster table (for BSEG this is field BUZEI and everything beyond that) exist only inside a raw binary object. The database does not know about these fields, it only sees the raw object (the field VARDATA of the physical cluster). Since the field does not exist in the database, it is impossible to create a secondary index on it. If you try to create a secondary index on a cluster table in transaction SE11, you will therefore rightly get the error "Index maintenance only possible for transparent tables".
    Theoretically you could get around this by converting the cluster table to a transparent table. You can do this in the SAP dictionary. However, in practice this is almost never a good solution. The table becomes much larger (clusters are compressed) and you lose the advantage that related records are stored close to each other (the main reason for having cluster tables in the first place). Apart from the performance and disk space hit, converting a big cluster table like BSEG to transparent would take extremely long.
    In cases where "indexing" of fields of a cluster table is worthwhile, SAP has constructed "indexing tables" around the cluster. For example, around BSEG there are transparent tables like BSIS, BSAS, etc. Other clusters normally do not have this, but that simply means there is no reason for having it. I have worked with the SAP dictionary for over 12 years and I have never met a single case where it was necessary to convert a cluster to transparent.
    If you try to select on specific values of a non-transparent field in a cluster without also specifying selections for the primary key, then the database will have to do a serial read of the whole physical cluster (and the ABAP DB interface will have to decompress every single record to extract the fields). The performance of that is monstrous -- maybe that was the reason of your question. However, the solution then is (in the case of BSEG) to query via one of the index tables (where you are free to create secondary indexes since those tables are transparent).
    Hope this clarifies things,
    Mark

  • Creating a cube for 2lis_11_vasth data source

    hi everyone,
    i am quite confused on how to create a cube for an r/3 data source for ex: 2lis_11_vasth. do i have to create my own cube by defining the individual info objects for each field or can i do it in business content? please let me know the procedure on how to do it in business content.
    thank you very much

    Hi Vidyarthi
    2LIS_11_VASTH updates Info Cubes 0SD_C13 (Service Level: Orders) and an ODS object , 0SD_O03 .
    You can install the required Objects from Business Content and check with your client requirements and decide if you require any Customization .
    Hope this helps.
    Cheers
    Raja

  • I want to upload om data through lsmw. how can i create transport request for lsmw data.

    can anyone help me?

    Hi Anand,
    There are 2 ways for transporting LSMW data from a system to another.
    1) Export/import this method gives you the opportunity to select the subprojects or objects you want to transfer. Hence you don't transfer the object a colleague might have created and that should stay in development system. LSMW -> Extras -> Export project  
    2)Transport request with this method, you can transport a LSMW project in full (you cannot select the objects you want). With this method, the project will be transported as any other SAP object in a transport order. 
    LSMW -> Extras -> Create change request 
    For more information, refer below link Steps to copy LSMW from one client to another
    Thanks
    KH

  • Creating tool bar - for Out put table

    Hi Experts,
    i  created - system action type - Hyperlink - In tool bar buttons tab. for my Output table.
    Regards
    Sidhu
    Edited by: sidhu ch on Feb 18, 2008 10:05 AM
    Edited by: sidhu ch on Feb 18, 2008 10:06 AM

    Hi,
    I am not creating any Systemaction  (No body can creat it ).
    I useing the Hyperlink System action .
    I am adding a Push button with a system action hyperlink and Draging the filed where we will enter the URL in Runtime into Hyperlink address .
    If you enter the address in Inputfield and After pressing the Submit button .
    It will navigate to your URL browser.
    Regards,
    Govindu

Maybe you are looking for

  • How to access remote web service?

    I try the demo in get start document(chapter 18).but I can not get any data. Do I have to change settings?Do I have to use FDS? Thanks Mark

  • Sync fails in iTunes 9.0 & 9.01: "too many files open" and error -6999

    I've been trying to synch my iPod (Touch, g1) for the last couple weeks but have been getting errors ever since going to iTunes 9.0. First it blew my library and now says "Previous iTunes Libraries" at the top. Can live with that (after going through

  • Auto Login (Console, No Manager) [SOLVED]

    I'm a noob to archlinux and the forums here, but hopefully I can become part of it! I'm looking for a way to autologin to the console on boot, as I'll be running this computer as an SSH server for secure connections from anywhere in the world, and if

  • Portlet could not be contacted

    Hello! Has anybody experinced this problem: we have the following: Server A, Windows 2000,2GB RAM, 9ias(9.0.2.0.0) [ infrastrcture, Portal, J2ee container, webcashe  ] Server B, Database Oracle 9i when accessing a portal page through Webcashe over SS

  • When I e-mail a docx document to my ipad?

    When I e-mail a docx document to my ipad, it does not give me the choice to open it in pages.I do have pages on my ipad?