Fill a table with multiple records

REPORT  REPORT1.
DATA: wa_itab1  LIKE TABLE1.
DATA: wa_itab2  LIKE TABLE2.
DATA: itab1 TYPE STANDARD TABLE OF TABLE1,
      itab2 TYPE STANDARD TABLE OF TABLE2.
DATA: v_dat TYPE d VALUE '20080101'.
SELECT * FROM TABLE1 INTO TABLE itab1.
LOOP AT itab1 INTO wa_itab1.
  wa_itab2-FIELD1 = wa_itab1-FIELD1.
  wa_itab2-FIELD2 = wa_itab1-FIELD2.
  wa_itab2-FIELD3 = wa_itab1-FIELD3.
  wa_itab2-FIELD4 = v_dat. "pass the initialized date
  APPEND wa_itab2 TO itab2.
  v_dat = v_dat + 1. " increment the date
  IF v_dat GT '20080105'.
    EXIT.
  ENDIF.
ENDLOOP.
MODIFY TABLE2 FROM TABLE itab2.
I have the program above which is not doing exactly what I need.  Lets say TABLE1 has 3 records
FIELD1 FIELD2     FIELD3
PLANT1 STOR_LOC1  20
PLANT2 STOR_LOC2  30
PLANT3 STOR_LOC3  40
The loop is for 5 days so in TABLE2 I want to see the following
FIELD1 FIELD2     FIELD3  FIELD4
PLANT1 STOR_LOC1  20     20080101
PLANT2 STOR_LOC2  30     20080101
PLANT3 STOR_LOC3  40     20080101
PLANT1 STOR_LOC1  20     20080102
PLANT2 STOR_LOC2  30     20080102
PLANT3 STOR_LOC3  40     20080102
PLANT1 STOR_LOC1  20     20080103
PLANT2 STOR_LOC2  30     20080103
PLANT3 STOR_LOC3  40     20080103
PLANT1 STOR_LOC1  20     20080104
PLANT2 STOR_LOC2  30     20080104
PLANT3 STOR_LOC3  40     20080104
PLANT1 STOR_LOC1  20     20080105
PLANT2 STOR_LOC2  30     20080105
PLANT3 STOR_LOC3  40     20080105
At the moment the program gives me
FIELD1 FIELD2     FIELD3  FIELD4
PLANT1 STOR_LOC1  20     20080101
PLANT2 STOR_LOC2  30     20080101
PLANT3 STOR_LOC3  40     20080101
Do I need a WHERE clause and if so how do I add assuming that the equal fields are FIELD1 and FIELD2? Thanks

I have added a DO condition to the program and tried a couple of attempts.  The latest is below.  With this attempt I get 80,000+ records the majority of which do not have the fields filled.  Thanks
REPORT REPORT1.
DATA: wa_itab1 LIKE TABLE1.
DATA: wa_itab2 LIKE TABLE2.
DATA: itab1 TYPE STANDARD TABLE OF TABLE1,
itab2 TYPE STANDARD TABLE OF TABLE2.
DATA: v_dat TYPE d VALUE '20080101'.
SELECT * FROM TABLE1 INTO TABLE itab1.
DO v_dat+1 TIMES.
LOOP AT itab1 INTO wa_itab1.
wa_itab2-FIELD1 = wa_itab1-FIELD1.
wa_itab2-FIELD2 = wa_itab1-FIELD2.
wa_itab2-FIELD3 = wa_itab1-FIELD3.
wa_itab2-FIELD4 = v_dat. "pass the initialized date
APPEND wa_itab2 TO itab2.
v_dat = v_dat + 1. " increment the date
IF v_dat GT '20080105'.
EXIT.
ENDIF.
ENDLOOP.
ENDDO.
MODIFY TABLE2 FROM TABLE itab2.

Similar Messages

  • Select max date from a table with multiple records

    I need help writing an SQL to select max date from a table with multiple records.
    Here's the scenario. There are multiple SA_IDs repeated with various EFFDT (dates). I want to retrieve the most recent effective date so that the SA_ID is unique. Looks simple, but I can't figure this out. Please help.
    SA_ID CHAR_TYPE_CD EFFDT CHAR_VAL
    0000651005 BASE 15-AUG-07 YES
    0000651005 BASE 13-NOV-09 NO
    0010973671 BASE 20-MAR-08 YES
    0010973671 BASE 18-JUN-10 NO

    Hi,
    Welcome to the forum!
    Whenever you have a question, post a little sample data in a form that people can use to re-create the problem and test their ideas.
    For example:
    CREATE TABLE     table_x
    (     sa_id          NUMBER (10)
    ,     char_type     VARCHAR2 (10)
    ,     effdt          DATE
    ,     char_val     VARCHAR2 (10)
    INSERT INTO table_x (sa_id,  char_type, effdt,                          char_val)
         VALUES     (0000651005, 'BASE',    TO_DATE ('15-AUG-2007', 'DD-MON-YYYY'), 'YES');
    INSERT INTO table_x (sa_id,  char_type, effdt,                          char_val)
         VALUES     (0000651005, 'BASE',    TO_DATE ('13-NOV-2009', 'DD-MON-YYYY'), 'NO');
    INSERT INTO table_x (sa_id,  char_type, effdt,                          char_val)
         VALUES     (0010973671, 'BASE',    TO_DATE ('20-MAR-2008', 'DD-MON-YYYY'), 'YES');
    INSERT INTO table_x (sa_id,  char_type, effdt,                          char_val)
         VALUES     (0010973671, 'BASE',    TO_DATE ('18-JUN-2010', 'DD-MON-YYYY'), 'NO');
    COMMIT;Also, post the results that you want from that data. I'm not certain, but I think you want these results:
    `    SA_ID LAST_EFFD
        651005 13-NOV-09
      10973671 18-JUN-10That is, the latest effdt for each distinct sa_id.
    Here's how to get those results:
    SELECT    sa_id
    ,         MAX (effdt)    AS last_effdt
    FROM      table_x
    GROUP BY  sa_id
    ;

  • Reg - Reading internal table with multiple record in a single field

    Dear Guru's,
                        i want to read a internal table with field having mutilple entries like
    read table READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
    But it says comma without preceding colon (after READ?).
    please guide me.....
    thanks & Regards,
    Balaji.S

    ya this is inside the loop.
    plz check....
    loop at lt_t2 into lt_t2_wa.
    READ TABLE LT_T2 INTO LT_T2_WA WITH KEY HKONT IN ( '0001152430', '0001152930', '0001152410' ).
    endloop.
    thanks & Regards,
    Balaji.S

  • Populating a temp table with multiple records.

    I want to populate a temp table with a a set of recs. This table will be used for
    crossing/joining with my other tables to pull out data.
    ie:
    Main table (loc)contains these fields -> county,permit,utme,utmn
    Temp table ( tmpid) contains these fields -> countytemp, permittemp
    So I will be doing a statement like this once my temp table is populated.
    Select l.county,l.permit,l.utme,l.utmn from loc l,tmpid t where l.county=t.countytemp and l.permit=t.permittemp;
    So this temp table will basically be a list of ids that can range from a few recs to several hundred.
    I want to know is there is way I can poplulate/repopulate it easily using sqlPlus/other by reading in a Ascii file
    from client PCs. (besides SQL loader).

    HI
    let me explain my requirement first,
    i need to populate my block with the results from the following sql
    SELECT * from contactdet where
    (Month=12 and TrType='MTM' and FinYr='04-05' and Userid='SA009' and Clcode='SB001')
    UNION
    SELECT * from contactdetSUM where (Clcode='SB001' AND CSCODE='AB001')
    Pease note. the where clauses i have put are different in each table and my requirement is
    the constants values i have put in where clause should be variable (ie. i should be able to put variables like :clcode or so)
    I tried us using Query data source type as 'FROM clause query' but it does not allow me to put variables in where clause.
    Is there any way out i can do this ? Please help me
    Regards
    Uday

  • Joining Three Tables with multiple record

    Dear All
    we need some help. We have Three Tables in sqlserver2012
    Master Table
    OrderID       PackageID      CustomerName
    1                          1               Abc
    2                          2                Bcd
    3                          1                xyz
    Child1 Table
    OrderID          ControlName
    1                   Row1COlumn1             (It Means Pant in Red Color is selected by user(relation with Child2 Table))
    1                   Row3Column1             (It Means Gown in Blue Color is selected by user(relation with Child2 Table))
    1                   Row4Column3             (It Means T Shirt in White Color is selected by user(relation with Child2 Table))
    2                    Row1Column2            (It Means Tie in Green Color is selected by user(relation with Child2 Table))
    2                   Row3Column1            (It Means Bow in Red Color is selected by user(relation with Child2 Table))
    Child2 Table
    PackageID      Product      Color1     Color2    Color3
    1                       Pant        Red          Green     Blue    
    1                       Shirt        Blue      Pink    Purple
    1                       Gown         Blue      Black    Yellow
    1                       T Shirt     Red          Green     White
    2                       Tie         Red          Green     White
    2                       Socks       Red          Green     White
    2                       Bow         Red          Green     White
    We want to have result like
    OrderID    PackageID      CustomerName   Pant    Gown  T Shirt     Tie         Bow  
    1                     1                 ABC               Red     Blue    White      x    
          x
                                                                   Blue
    2                      2                 Bcd                 x         x          x
           Green      Red
    I have tried 
    ;with mycte as (
    select  ms.OrderID,ms.PackageID
    ,ms.CustomerName
    , Replace(stuff([ControlName], charindex('Column',ControlName),len(ControlName),''),'Row','')  rowNum 
    ,Replace(stuff([ControlName], 1, charindex('Column',ControlName)-1 ,''),'Column','') columnNum 
    From  child1 c inner join MasterTable ms on c.Orderid=ms.orderid)
    ,mycte1 as (
    select *, row_number() Over(Partition By PackageID Order By Child2ID) rn from child2
    ,mycte2 as (
    Select m.OrderID,m.PackageID, m.CustomerName, m.ColumnNum,  m1.Product 
    --,m1.Color1 , m1.Color2, m1.Color3 
    , Case WHEN ColumnNum= 1 Then Color1 
     WHEN ColumnNum= 1 Then Color1 
      WHEN ColumnNum= 2 Then Color2 
       WHEN ColumnNum= 3 Then Color3 End Colors  
    from mycte m 
    join mycte1 m1 on m.rowNum=m1.rn and m.PackageID=m1.PackageID)
    Select OrderID,PackageID,CustomerName, ISNULL(Max(Case WHen Product='Pant' Then Colors END),'X') as 'Pant'
    , ISNULL(Max(Case WHen Product='Gown' Then Colors END),'X') as 'Gown'
    , ISNULL(Max(Case WHen Product='T Shirt' Then Colors END),'X') as 'T Shirt'
    , ISNULL(Max(Case WHen Product='Tie' Then Colors END),'X') as 'Tie'
    , ISNULL(Max(Case WHen Product='Bow' Then Colors END),'X') as 'Bow'
    FROM mycte2
     Group by OrderID,PackageID, CustomerName
    it works if we have a product in one color only. like if we have pant in red and blue then its showing just first record
    Thanks and Best Regards Umair

    Are you really storing textual values like "Row3Column1" or "Row4Column3"???
    Your model is a mess. Redesign it.. btw, these kind of models are quite complex.
    USE tempdb;
    GO
    CREATE TABLE dbo.Colors
    ColorID INT NOT NULL ,
    ColorName NVARCHAR(255) NOT NULL ,
    CONSTRAINT PK_Colors PRIMARY KEY ( ColorID )
    CREATE TABLE dbo.Products
    ProductID INT NOT NULL ,
    ProductName NVARCHAR(255) NOT NULL ,
    CONSTRAINT PK_Products PRIMARY KEY ( ProductID ) ,
    CONSTRAINT UQ_Products_ProductName UNIQUE ( ProductName )
    CREATE TABLE dbo.Packages
    PackageID INT NOT NULL ,
    CONSTRAINT PK_Packages PRIMARY KEY ( PackageID )
    CREATE TABLE dbo.PackageDetails
    ColorID INT NOT NULL ,
    PackageID INT NOT NULL ,
    ProductID INT NOT NULL ,
    CONSTRAINT PK_PackageDetails PRIMARY KEY ( ColorID, PackageID, ProductID ) ,
    CONSTRAINT FK_PackageDetails_ColorID FOREIGN KEY ( ColorID ) REFERENCES dbo.Colors ( ColorID ) ,
    CONSTRAINT FK_PackageDetails_PackageID FOREIGN KEY ( PackageID ) REFERENCES dbo.Packages ( PackageID ) ,
    CONSTRAINT FK_PackageDetails_ProductID FOREIGN KEY ( ProductID ) REFERENCES dbo.Products ( ProductID )
    CREATE TABLE dbo.Orders
    OrderID INT NOT NULL ,
    CustomerID INT NOT NULL ,
    PackageID INT NOT NULL ,
    CONSTRAINT PK_Orders PRIMARY KEY ( OrderID ) ,
    CONSTRAINT UQ_Orders_CustomerID UNIQUE ( OrderID, PackageID ) ,
    CONSTRAINT FK_Orders_PackageID FOREIGN KEY ( PackageID ) REFERENCES dbo.Packages ( PackageID )
    CREATE TABLE dbo.OrderDetails
    ColorID INT NOT NULL ,
    OrderID INT NOT NULL ,
    PackageID INT NOT NULL ,
    ProductID INT NOT NULL ,
    CONSTRAINT FK_OrderDetails_Orders FOREIGN KEY ( OrderID, PackageID ) REFERENCES dbo.Orders ( OrderID, PackageID ) ,
    CONSTRAINT FK_OrderDetails_PackageDetails FOREIGN KEY ( ColorID, PackageID, ProductID ) REFERENCES dbo.PackageDetails ( ColorID, PackageID, ProductID )
    GO
    INSERT INTO dbo.Colors
    ( ColorID, ColorName )
    VALUES ( 1, 'Red' ),
    ( 2, 'Green' ),
    ( 3, 'Blue' ),
    ( 4, 'Pink' ),
    ( 5, 'Purple' ),
    ( 6, 'Black' ),
    ( 7, 'Yellow' ),
    ( 8, 'White' );
    INSERT INTO dbo.Products
    ( ProductID, ProductName )
    VALUES ( 1, 'Pant' ) ,
    ( 2, 'Shirt' ) ,
    ( 3, 'Gown' ) ,
    ( 4, 'T Shirt' ) ,
    ( 5, 'Tie' ) ,
    ( 6, 'Socks' ) ,
    ( 7, 'Bow' );
    INSERT INTO dbo.Packages
    ( PackageID )
    VALUES ( 1 ),
    ( 2 );
    INSERT INTO dbo.PackageDetails
    ( PackageID, ProductID, ColorID )
    VALUES ( 1, 1, 1 ),
    ( 1, 2, 3 ),
    ( 1, 3, 3 ),
    ( 1, 4, 1 ),
    ( 2, 5, 1 ),
    ( 2, 6, 1 ),
    ( 2, 7, 1 ),
    ( 1, 1, 2 ),
    ( 1, 2, 4 ),
    ( 1, 3, 6 ),
    ( 1, 4, 2 ),
    ( 2, 5, 2 ),
    ( 2, 6, 2 ),
    ( 2, 7, 2 ),
    ( 1, 1, 3 ),
    ( 1, 2, 5 ),
    ( 1, 3, 7 ),
    ( 1, 4, 8 ),
    ( 2, 5, 8 ),
    ( 2, 6, 8 ),
    ( 2, 7, 8 );
    INSERT INTO dbo.Orders
    ( OrderID, PackageID, CustomerID )
    VALUES ( 1, 1, 1 ),
    ( 2, 2, 2 ),
    ( 3, 1, 3 );
    INSERT INTO dbo.OrderDetails
    ( ColorID, OrderID, PackageID, ProductID )
    VALUES ( 1, 1, 1, 1 ),
    ( 3, 1, 1, 3 ),
    ( 8, 1, 1, 4 ),
    ( 2, 2, 2, 5 ),
    ( 1, 2, 2, 7 );
    GO
    SELECT *
    FROM dbo.Orders O
    INNER JOIN dbo.OrderDetails OD ON OD.OrderID = O.OrderID
    INNER JOIN dbo.Products P ON P.ProductID = OD.ProductID
    INNER JOIN dbo.Colors C ON C.ColorID = OD.ColorID;
    GO
    DROP TABLE dbo.OrderDetails;
    DROP TABLE dbo.Orders;
    DROP TABLE dbo.PackageDetails;
    DROP TABLE dbo.Packages;
    DROP TABLE dbo.Products;
    DROP TABLE dbo.Colors;
    GO

  • Issue in retrieving all the records from ADF Table with multiple row

    Hi,
    As per my requirement, I need to fill the table with multi selected LOV values and when user clicks on commit, I need to save them to database.
    I am using ADF 11g, Multi select table. Using the below ADD method, I am able to add the records but if user clicks on cancel, I need to remove those from view and clear the table as well.
    But the Issue I am facing is, in my cancel method, always I am getting half of the records. Lets assume table contains 100 records but in my cancel method, I am getting only 50 records.
    Please let me know what is the issue in my source code.
    ADD Method:
    public void insertRecInCMProcessParamVal(String commType, String processType, Number seqNumber){       
    try{
    Row row = this.getCmProcessParamValueView1().createRow();
    row.setAttribute("ParamValue7", commType);
    row.setAttribute("ProcessType", processType);
    row.setAttribute("CreationDate", new Date());
    row.setAttribute("CreatedBy", uid);
    row.setAttribute("ParamValueSeqNum", seqNumber);
    row.setAttribute("ProcessedFlag", "N");
    this.getCmProcessParamValueView1().insertRow(row);
    }catch(Exception e){           
    e.printStackTrace();
    Table Code:
    <af:table value="#{bindings.CmProcessParamValueView11.collectionModel}"
    var="row"
    rows="#{bindings.CmProcessParamValueView11.rangeSize}"
    emptyText="#{bindings.CmProcessParamValueView11.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.CmProcessParamValueView11.rangeSize}"
    rowBandingInterval="1"
    selectedRowKeys="#{bindings.CmProcessParamValueView11.collectionModel.selectedRow}"
    selectionListener="#{bindings.CmProcessParamValueView11.collectionModel.makeCurrent}"
    rowSelection="multiple"
    binding="#{backingBeanScope.backing_app_RunCalcPage.t1}"
    id="t1" width="100%" inlineStyle="height:100px;" >
    <af:column sortProperty="ParamValue6"
    sortable="true"
    headerText="#{bindings.CmProcessParamValueView11.hints.ParamValue6.label}"
    id="c1" visible="false">
    <af:inputText value="#{row.bindings.ParamValue6.inputValue}"
    label="#{bindings.CmProcessParamValueView11.hints.ParamValue6.label}"
    required="#{bindings.CmProcessParamValueView11.hints.ParamValue6.mandatory}"
    columns="#{bindings.CmProcessParamValueView11.hints.ParamValue6.displayWidth}"
    maximumLength="#{bindings.CmProcessParamValueView11.hints.ParamValue6.precision}"
    shortDesc="#{bindings.CmProcessParamValueView11.hints.ParamValue6.tooltip}"
    id="it3">
    <f:validator binding="#{row.bindings.ParamValue6.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="ParamValue7"
    sortable="true"
    headerText="Comm Type"
    id="c2">
    <af:inputText value="#{row.bindings.ParamValue7.inputValue}"
    label="#{bindings.CmProcessParamValueView11.hints.ParamValue7.label}"
    required="#{bindings.CmProcessParamValueView11.hints.ParamValue7.mandatory}"
    columns="#{bindings.CmProcessParamValueView11.hints.ParamValue7.displayWidth}"
    maximumLength="#{bindings.CmProcessParamValueView11.hints.ParamValue7.precision}"
    shortDesc="#{bindings.CmProcessParamValueView11.hints.ParamValue7.tooltip}"
    id="it4">
    <f:validator binding="#{row.bindings.ParamValue7.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="ParamValue8"
    sortable="true"
    headerText="#{bindings.CmProcessParamValueView11.hints.ParamValue8.label}"
    id="c3" visible="false">
    <af:inputText value="#{row.bindings.ParamValue8.inputValue}"
    label="#{bindings.CmProcessParamValueView11.hints.ParamValue8.label}"
    required="#{bindings.CmProcessParamValueView11.hints.ParamValue8.mandatory}"
    columns="#{bindings.CmProcessParamValueView11.hints.ParamValue8.displayWidth}"
    maximumLength="#{bindings.CmProcessParamValueView11.hints.ParamValue8.precision}"
    shortDesc="#{bindings.CmProcessParamValueView11.hints.ParamValue8.tooltip}"
    id="it2">
    <f:validator binding="#{row.bindings.ParamValue8.validator}"/>
    </af:inputText>
    </af:column>
    </af:table>
    Backing Bean Code:
    DCBindingContainer dcBindings=(DCBindingContainer)getBindings();
    DCIteratorBinding dcIterator=dcBindings.findIteratorBinding("CmProcessParamValueView1Iterator");
    RowSetIterator rs = dcIterator.getRowSetIterator();
    System.out.println("In Cancel Row Count is : "+ rs.getRowCount());
    if (rs.getRowCount() > 0) {
    Row row = rs.first();
    row.refresh(Row.REFRESH_UNDO_CHANGES);
    row.remove();
    while (rs.hasNext()) {
    int count = rs.getRowCount();
    System.out.println("Count is : "+ count);
    Row row = rs.next();
    System.out.println("Row === "+ row);
    if(row != null){                   
    row.refresh(Row.REFRESH_UNDO_CHANGES);
    row.remove();
    Thanks.

    Issue resolved.
    remove selectionListener and selectedRowKeys....
    code to get all the selectedRows.
    RowSetIterator rs = dcIterator.getRowSetIterator();
    RowKeySet rks = this.t1.getSelectedRowKeys();
    Iterator rksIter = rks.iterator();
    while (rksIter.hasNext()) {
    List l = (List) rksIter.next();
    Key key = (Key)l.get(0);
    Row row = rs.getRow(key);
    Thanks.

  • I want to create a mail merge for address labels into a table, but when I fill a table with merge fields, it ends up creating multiple entries for the same address, rather than one table full of each address.

    ...but when I fill a table with merge fields, it ends up creating multiple entries for the same address, rather than one table full of each address. Please help.
    Thanks!

    That is a quirk of Pagesthat  it applies only one record per page.
    There is a way around this:
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=245&highlight=labels &mforum=iworktipsntrick
    Peter

  • Problem with Multiple record creation using BAPI BAPI_PRICES_CONDITION

    Hi,
    I am working on IS Media Sales And Distribution wherein i am using BAPI BAPI_PRICES_CONDITION for condition record creation in TCODE JC9B. I am able to create one record using this BAPI for one sales promotion but having problem while creation of multiple records for the same sales promotion wherein my internal table have multiple records. It gives me error that data in BAPICONDIT is missing.
    I am aatching followig code for reference
    BAPI have field of varkey which i am filling as combination of sales org. + distn channel + sales promotion + delivery type
    In this varkey  delivery type is changing for sales promotion Can be said that one sales promotion can have multiple delivery type .
    Am i giving the correct varkey for each itration of internal table ?
    I am attaching code for reference.
    Here loop it_cond contain one promotion and multiple delivery type.
    sales org   distn ch  promotion     delivery
    0100             01        zsalesprom   03
    0100             01        zsalesprom   z3
      LOOP AT it_cond INTO wa_cond.
    Get next condition number
          CALL FUNCTION 'NUMBER_GET_NEXT'
            EXPORTING
              nr_range_nr                   = '01'
              object                        = 'KONH'
      QUANTITY                      = '1'
      SUBOBJECT                     = ' '
      TOYEAR                        = '0000'
      IGNORE_BUFFER                 = ' '
           IMPORTING
              number                        = number
      QUANTITY                      =
      RETURNCODE                    =
    EXCEPTIONS
      INTERVAL_NOT_FOUND            = 1
      NUMBER_RANGE_NOT_INTERN       = 2
      OBJECT_NOT_FOUND              = 3
      QUANTITY_IS_0                 = 4
      QUANTITY_IS_NOT_1             = 5
      INTERVAL_OVERFLOW             = 6
      BUFFER_OVERFLOW               = 7
      OTHERS                        = 8
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    Here i am concacating varkey for each new delivery
    CLEAR : l_min,l_length,l_var.
    CONCATENATE wa_cond-vkorg wa_cond-vtweg wa_cond-wrbakt INTO l_var.
    l_length = STRLEN( l_var ).
    IF l_var+14(2) IS INITIAL.
    WRITE wa_cond-lifart TO L_VAR+14.
    l_length = STRLEN( l_var ).
    ENDIF.
    W_LINE = W_LINE + 1.
    *First table in BAPI
            wa_bapicondct-operation = '009'.
            wa_bapicondct-cond_usage = 'A'.
            wa_bapicondct-table_no = '506'.
            wa_bapicondct-applicatio = 'J0'.
            wa_bapicondct-cond_type = 'RATE'.
            wa_bapicondct-varkey = l_var.
            wa_bapicondct-valid_to = wa_cond-datbi.
            wa_bapicondct-valid_from = wa_cond-datab.
            wa_bapicondct-cond_no = number. "
            APPEND wa_bapicondct TO it_bapicondct.
    *Second table in BAPI
            wa_bapicondhd-operation = '009'.
            wa_bapicondhd-cond_no = number.
            wa_bapicondhd-cond_usage = 'A'.
            wa_bapicondhd-table_no = '506'.
           wa_bapicondhd-created_by = sy-uname.
           wa_bapicondhd-creat_date = sy-datum.
            wa_bapicondhd-applicatio = 'J0'.
            wa_bapicondhd-cond_type = 'RATE'.
            wa_bapicondhd-varkey = l_var.
            wa_bapicondhd-valid_from = wa_cond-datab.
            wa_bapicondhd-valid_to = wa_cond-datbi.
            APPEND wa_bapicondhd TO it_bapicondhd.
    *Third table in BAPI
            wa_bapicondit-operation = '009'.
            wa_bapicondit-cond_no = number.
            wa_bapicondit-cond_count = wa_cond-cond_count.
            wa_bapicondit-applicatio = 'J0'.
            wa_bapicondit-cond_type = 'RATE'.
            wa_bapicondit-calctypcon = 'C'.
           wa_bapicondit-scaletype  = 'A'.
            wa_bapicondit-cond_value = wa_cond-kbetr.
            wa_bapicondit-condcurr = wa_cond-konwa.
            wa_bapicondit-promotion = wa_cond-wrbakt.
            APPEND wa_bapicondit TO it_bapicondit.
    *Fourth table in BAPI
            wa_bapicondqs-operation = '009'.
            wa_bapicondqs-cond_no = number.
            wa_bapicondqs-cond_count = wa_cond-cond_count.
            wa_bapicondqs-currency = wa_cond-kbetr.
            wa_bapicondqs-condcurr = wa_cond-konwa.
           wa_bapicondqs-cond_unit = 'EA'.
            wa_bapicondqs-LINE_NO = W_LINE."'0001'.
            APPEND wa_bapicondqs TO it_bapicondqs.
    *Fifth table in BAPI
            wa_bapicondvs-operation = '009'.
            wa_bapicondvs-cond_no = number.
            wa_bapicondvs-cond_count = wa_cond-cond_count.
            wa_bapicondvs-currenckey = wa_cond-konwa.
            wa_bapicondvs-currenciso = wa_cond-konwa.
           wa_bapicondvs-currency = wa_cond-kbetr.
           wa_bapicondvs-condcurr = wa_cond-konwa.
           wa_bapicondvs-curren_iso = wa_cond-konwa.
           wa_bapicondvs-LINE_NO = W_LINE."'0001'.
            APPEND wa_bapicondvs TO it_bapicondvs.
            CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
    EXPORTING
      PI_INITIALMODE       = ' '
      PI_BLOCKNUMBER       =
              TABLES
                ti_bapicondct        = it_bapicondct
                ti_bapicondhd        = it_bapicondhd
                ti_bapicondit        = it_bapicondit
                ti_bapicondqs        = it_bapicondqs
                ti_bapicondvs        = it_bapicondvs
                to_bapiret2          = it_bapiret2
                to_bapiknumhs        = it_bapiknumhs
                to_mem_initial       = it_cnd_mem_initial
             EXCEPTIONS
               update_error         = 1
               OTHERS               = 2
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
             EXPORTING
               wait          = 'X'
    IMPORTING
      RETURN        =
            CLEAR : wa_bapicondct,wa_bapicondhd,wa_bapicondvs,wa_bapicondqs.
            CLEAR : wa_bapicondit.
          ENDLOOP.
        ENDIF.
      ENDIF.
    Kindly Suggest.
    Thanks
    Parag

    Solved By myself
    There is problem while passing data to internal table for item level

  • How to fill internal table with no data in debugging mode

    Hi all,
             I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
    Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
    Thanks,
    Balaji

    Hi,
    In the debugging do the following..
    Click the Table button..
    Double click on the internal table name..
    Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
    Use the APPEND button to insert records to the internal table..
    Thanks,
    Naren

  • How to isolate error with a record/segment in IDOC with multiple records

    I have an IDOC with multiple records/segments (typically 1000 records/segments). Sometime XI can not process the IDOC because of some control characters in data.
    1. How can I pre-processed the IDOC to remove those control characters?
    Can I use XPATH expression/Java class to do it? How can I configure the XPATH expression/Java class in XI to pre-process the file?
    2. Until I have answer to 1st question. I would like to find out the error is exactly for which record? What configuration can I do in XI to isolate the error is with which record/segment in IDOC?
    Thanks in advance.

    Split the IDoc.
    with in the UDF, after the validations if every thing fine, pass as successful records to success_MT and pass it to target system using Branching in BPM.
    if errors found in the record, then store the error records in Hash table with in UDF, get the IDoc number, frame as a string and raise alert.
    U have to do this in the context of IDoc.
    If U wanna get the IDoc Number, Segment Name and field name for every failure, U can pass the expected error field name as constant to UDF, frame the sentence in the UDF like -> <b>IDoc 1234321 segment – SEG001 – field – FLD03 has a special character ‘*’</b>.
    If U wanna pass this string to source/target, U can do in error messages branch in BPM.
    U must use BPM for splitting the IDoc, since it is multi-mapping.
    reg.,
    Yallabandi.

  • Fill internal table with mutliple entries for nested structure

    Dear ABAP Experts,
    I have a question related to fill internal tables with nested structures.
    I have a structure like this:
    BEGIN OF proto,
              sicht TYPE ysicht,
              version TYPE FAGLFLEXA-RVERS,
              BEGIN OF kons,
    kon TYPE YKONSEINHEIT,
              END OF kons,
              jahr TYPE CHAR04,
    END OF proto.
    Now I need to fill this structure with values (over an internal table), but how can I achieve that I save multiple datas für element "kon" für one single entry of structure "proto"?
    An example could be:
    sicht = '01'
    version = '100'
    kon = 1001 (first entry)
    kon = 1002 (second entry)
    usw... (n entry)
    jahr = '2008'
    Thanks in advance for every helpful answer.
    Regards
    Thomas

    BEGIN OF proto,
               sicht TYPE ysicht,
               version TYPE FAGLFLEXA-RVERS,
               kons TYPE STANDARD TABLE OF YKONSEINHEIT WITH NON-UNIQUE KEY TABLE_LINE,
               jahr TYPE CHAR04,
    END OF proto.
    DATA: ls_proto TYPE proto,
          lt_proto TYPE STANDARD TABLE OF proto,
          ls_kon
    ls_proto-sicht = '01'.
    ls_proto-version = '100'
    INSERT '1001' INTO TABLE ls_proto-kons.
    INSERT '1002' INTO TABLE ls_proto-kons.
    ls_proto-jahr = '2008'.
    INSERT ls_proto INTO TABLE lt_proto
    If you're going to use a more complicated inner table with several components, then you need to define a type for those components. 
    matt

  • Can we bind a single external table with multiple files in OWB 11g?

    Hi,
    I wanted to ask if it is possible to bind an external table with multiple source files at same or different locations? Or an external table has to be bound to a single source file and a single location.
    Thanks in advance,
    Ann.
    Edited by: Ann on Oct 8, 2010 9:38 AM

    Hi Ann,
    Can you please help me out by telling me the steps to accomplish this. Right click on the external table in project tree, from the menu choose Configure,
    then in opened Configuration Properties dialog window right clock on Data Files node and choose from menu Create -
    you will get new record for file - specify Data File Name property
    Also link from OWB user guide
    http://download.oracle.com/docs/cd/B28359_01/owb.111/b31278/ref_def_flatfiles.htm#i1126304
    Regards,
    Oleg

  • Flat File with multiple record types (OWB 10.2.0.2)

    Hi!
    I`m using OWB 10.2.0.2 and I`m trying to load a flat file with multiple record types, using SQL LOADER.
    In the flat file editor in the Record tab, I`ve set the type values and the corresponding record names like this:
    Type Value Record Name
    ======== ===========
    T TRAILER
    0 DETAILS
    1 DETAILS
    2 DETAILS
    When using this flat file in a mapping to load the data in a staging table, the generated code looks like this:
    INTO TABLE TRAILER
    TRUNCATE
    REENABLE DISABLED_CONSTRAINTS
    WHEN (1:1) = 'T'
    INTO TABLE DETAILS
    APPEND
    REENABLE DISABLED_CONSTRAINTS
    WHEN (1:1) = '0,1,2'
    The above clause (WHEN (1:1) = '0,1,2') is wrong as I expect one "INTO TABLE..." clause for each record type.
    Could this be a bug or am I doing something wrong?
    Thanks a lot for your help,
    Yorgos

    We`re using two target tables, one for the trailer record and the other for the details records.
    We are facing this problem from the moment we upgraded from OWB 10.1 to OWB 10.2.0.2, so we think it must be something with the way the sql loader code is generated in the new version.
    As our data sources are mainly flat files coming from mainframes, this is a huge problem for us. We even asked an expert in DW from Oracle to help us on this, but still haven`t found a solution.
    Is there any workaround for this or should we forget sql loader and go with an external tables + custom PL/SQL code solution?
    Your help is greatly appreciated Jean-Pierre.
    Regards,
    Yorgos

  • Editable table with multiple rows

    Hi All!
    We're trying to develop some application in VC 7.0. That application should read data from some R/3 tables (via standard and custom functional modules), then display data to user and allow him/her to modify it (or add some data into table rows), and then save it back to R/3.
    What is the best way to do that?
    There's no problem with displaying data.
    But when I try to add something to table (on portal interface), I'm able to use only first row of the table... Even if I fill all fields of that row, I'm not able to add data to second row, etc.
    Second question. Is it possible to display in one table contents of output of several BAPIs? For example we have three bapis, one displaying user, second displays that user's subordinates, and the third one - that user's manager. And we want one resulting table...
    And last. What is the best way to submit data from table view in VC (portal) to R/3 table? I understand that we should write some functional module, that puts data to R/3. I'm asking about what should be done in VC itself. Some button, or action...
    Any help will be appreciated and rewarded :o)
    Regards,
    DK

    Here are some former postings:
    Editable table with multiple rows
    and
    Editable table with multiple rows
    Are you on the right SP-level?
    Can you also split up your posting: one question, one posting? This way you get faster answers, as people might just browse the headers.

  • How can I convert string to the record store with multiple records in it?

    Hi Everyone,
    How can I convert the string to the record store, with multiple records? I mean I have a string like as below:
    "SecA: [Y,Y,Y,N][good,good,bad,bad] SecB: [Y,Y,N][good,good,cant say] SecC: [Y,N][true,false]"
    now I want to create a record store with three records in it for each i.e. SecA, SecB, SecC. So that I can retrieve them easily using enumerateRecord.
    Please guide me and give me some links or suggestions to achieve the above thing.
    Best Regards

    Hi,
    I'd not use multiple records for this case. Managing more records needs more and redundant effort.
    Just use single record. Create ByteArrayOutputStream->DataOutputStream and put multiple strings via writeUTF() (plus any other data like number of records at the beginning...), then save the byte array to the record...
    It's easier, it's faster (runtime), it's better manageable...
    Rada

Maybe you are looking for

  • OBIEE 11g Unable to browse multiple value hierarchy for analysis.

    Hi All, We are using OBIEE 11g Value Hierarchy feature to display GL Segment Hierarchies. -     We have set the hierarchies to be Ragged and Skipped Levels in the RPD Business Model. -     We have dragged the hierarchies from Business Model to Presen

  • Help wid Seeburger Adapter

    Hey guys i urgently need help in Seeburger adapter,actually i have a scenario where in i m getting EDI directly from VAN or from seeburger adapter over XI,and i have to post this information to R/3 server,can anyone provide me with some links about h

  • Connecting an iPhone 4 to Intel My WiFi Technology

    I have a new Dell computer that has Intel's 'My WiFi Technology' installed. This is supposed to allow  wireless devices to connect  to the internet via the laptop. To add a device - such as my iPhone  - the program has three options: (1) WiFi Protect

  • Does installing mavricks delete the photos in iPhoto please reply fast thanks.

    im in the middle of installing mavricks after you restart your computer but I want to know if It delets your photos from iPhoto please help. And if it does how do I cancel the mavricks installation

  • Automator not working properly after updating to OS 10.10.2

    I just updated to 10.10.2 and Automator in Safari is not working properly. I set up 10 URLs to open but only the first 4 open. The rest give a message "You can't open Safari because it is not responding". Any help would be appreciated. Thank you Usin