How to use collection in my code

PROCEDURE irp_status_check_list(P_YEAR IN VARCHAR2,P_SEASON IN VARCHAR2)  AS
g_count NUMBER;
BEGIN
       FOR CUR_GID IN (SELECT GENERATION_ID
                       FROM VRESS_GEN_DDLB_VW
                       WHERE SEASON_YEAR=P_YEAR AND SEASON_CODE=P_SEASON)
           LOOP
               SELECT COUNT(1)
               INTO g_count
               FROM dual
               WHERE EXISTS
                     (SELECT p.generation_id
                      FROM pvress_plan_irp_list p,pvress_tran_irp_list t
                      WHERE  p.generation_id=t.generation_id
                      AND   p.generation_id = cur_gid.generation_id);
                 IF G_COUNT=0
                 THEN
                     dbms_output.put_line(CUR_GID.generation_id||' NOT ARRANGEMENT FIX  ');
                 ELSE
                      SELECT COUNT(1)
                      INTO g_count
                      FROM dual
                      WHERE  EXISTS
                              (SELECT p.generation_id
                               FROM pvress_plan_irp_list p,pvress_tran_irp_list t,
                                    pvress_vaboss_judgement j
                               WHERE  p.generation_id=t.generation_id
                               AND  t.generation_id=j.generation_id
                               AND   p.generation_id = cur_gid.generation_id);
                  IF G_COUNT=0
                  THEN
                      dbms_output.put_line(CUR_GID.generation_id ||'  NOT VABOSS FIX  ');
                  ELSE
                      SELECT COUNT(1)
                      INTO g_count
                      FROM dual
                      WHERE EXISTS
                             (SELECT p.generation_id
                              FROM pvress_plan_irp_list p,pvress_tran_irp_list t
                              WHERE  p.generation_id=t.generation_id
                              AND p.release_no=t.release_no
                              AND p.generation_id=cur_gid.generation_id);
                  IF G_COUNT=0
                  THEN
                      dbms_output.put_line( CUR_GID.generation_id ||'  NOT RELEASE NOTE  ');
                    END IF;
                 END IF;
             END IF;
         END LOOP;
     END irp_status_check_list;
END vress_irp_check_list_pkg;Edited by: newbie on Nov 4, 2011 12:34 AM

Once you have done the BULK COLLECT you can CLOSE the cursor right now.
After that if there is any data in the collection, then you can LOOP through it
Something like this :
PROCEDURE irp_status_check_list(
          P_YEAR   IN VARCHAR2,
          P_SEASON IN VARCHAR2)
AS
     g_count NUMBER;
     CURSOR cur_sme_tbl
     IS
          SELECT
               GENERATION_ID
          FROM
               VRESS_GEN_DDLB_VW
          WHERE
               SEASON_YEAR   =P_YEAR
          AND SEASON_CODE=P_SEASON;
TYPE t_sme_col
IS
     TABLE OF cur_sme_tbl%ROWTYPE INDEX BY BINARY_INTEGER;
     l_sme_col t_sme_col;
BEGIN
     OPEN cur_sme_tbl;
     FETCH cur_sme_tbl BULK COLLECT INTO l_sme_col;
     CLOSE cur_sme_tbl;
     IF l_sme_col.COUNT >0 THEN
          FOR i            IN 1..l_sme_col.COUNT
          LOOP
               SELECT
                    COUNT(1)
               INTO
                    g_count
               FROM
                    pvress_plan_irp_list p,
                    pvress_tran_irp_list t
               WHERE
                    p.generation_id   =t.generation_id
               AND p.release_no   =t.release_no
               AND p.generation_id=l_sme_col(i).generation_id;
               IF G_COUNT         =0 THEN
                    dbms_output.put_line(l_sme_col(i).generation_id||' NOT ARRANGEMENT FIX  ');
               ELSE
                    SELECT
                         COUNT(1)
                    INTO
                         g_count
                    FROM
                         pvress_plan_irp_list p,
                         pvress_tran_irp_list t,
                         pvress_vaboss_judgement j
                    WHERE
                         p.generation_id    =t.generation_id
                    AND t.generation_id =j.generation_id
                    AND p.generation_id = l_sme_col(i).generation_id);
                    IF G_COUNT          =0 THEN
                         dbms_output.put_line(l_sme_col(i).generation_id ||'  NOT VABOSS FIX  ');
                    ELSE
                         SELECT
                              COUNT(1)
                         INTO
                              g_count
                         FROM
                              pvress_plan_irp_list p,
                              pvress_tran_irp_list t
                         WHERE
                              p.generation_id   =t.generation_id
                         AND p.release_no   =t.release_no
                         AND p.generation_id=l_sme_col(i).generation_id);
                         IF G_COUNT         =0 THEN
                              dbms_output.put_line( l_sme_col(i).generation_id ||'  NOT RELEASE NOTE  ');
                         END IF;
                    END IF;
               END IF;
          END LOOP;
     END IF;
END;

Similar Messages

  • How to Use the JAVA SCRIPT code in .htm page of the component

    Hi .
    In my requirement i have to use Java Script Function in .htm code ..how to use the java script code and functions in .htm???
    thank you
    B.Mani

    Check this document  [Arun's Blog|http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUI-TalkingwithJava+Script]
    Regards
    Kavindra

  • How to use collect statement for below

    data : begin of itab,
             n(3) type c,
          n1 type n,
          k(5) type c,
          end of itab.
    select n n1 from into itab table /zteest.
    *internal table has
    n      n1    k
    gar    100  uji
    hae    90   iou
    gar    90   uji
    hae    87   iou
    I want
    gar 190
    hae 177
    How to use collect statement as n1 is n ..?
    let me know..
    Thanks

    try this..
    DATA : BEGIN OF itab OCCURS 0,
    n(3) TYPE c,
    n1(3) TYPE p DECIMALS 2,
    k(5) TYPE c,
    END OF itab.
    itab-n = 'gar'.
    itab-n1 = 100.
    itab-k = 'uji'.
    COLLECT itab .CLEAR itab.
    itab-n = 'hae'.
    itab-n1 = 90.
    itab-k = 'iou'.
    COLLECT itab .CLEAR itab.
    itab-n = 'gar'.
    itab-n1 = 90.
    itab-k = 'uji'.
    COLLECT itab .CLEAR itab.
    itab-n = 'hae'.
    itab-n1 = 87.
    itab-k = 'iou'.
    COLLECT itab .CLEAR itab.

  • How to use collect statement

    hi everybody,
    how to use collect statement to get the total amount paid to different vendor payments 
    data : begin of wa occurs 0,
            bukrs type bsak-bukrs,
            lifnr type bsak-lifnr,
            land1 type lfa1-land1,
            name1 like lfa1-name1,
            dmbtr like bsak-dmbtr,
            count type i value 0,
            tot_vend  type i,
            vend type i.
    data :end of wa.
    data : itab like table of wa.
      select distinct bukrs lifnr waers from bsak into
    corresponding fields of wa
              where bukrs in s_bukrs
              and   lifnr in s_lifnr
              and   bschl in s_bschl.
    i want the total amount paid according to vendor i am  using this way but i am not getting
      loop at itab into wa.
    wa-dmbtr = bsak-dmbtr.
    collect wa-dmbtr into itab.
    modify itab from wa transporting dmbtr.
    i am unalbe to get it
    can anybody help me regarding this if possible with example.
    thanks in advance,
    regards,
    venu.

    Hi Venu,
    types: BEGIN OF ty,
            NAME(20),
            SALES TYPE I,
          END   OF ty.
    data : itab type standard table of ty,
    itab1 type standard table of ty,
    wa type ty,
    wa1 type ty.
    wa-NAME = 'Duck'.  wa-SALES = 10.
    append wa to itab.
    wa-NAME = 'Tiger'. wa-SALES = 20.
    append wa to itab.
    wa-NAME = 'Duck'.  wa-SALES = 30.
    append wa to itab.
    loop at itab into wa.
    wa1 = wa.
    collect wa1 into itab1.
    endloop.
    loop at itab1 into wa1.
    write : / wa1-name , wa1-sales.
    endloop.
    COLLECT is used to create unique or compressed datsets. The key fields are the default key fields of the internal table itab .
    If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not contain two entries with the same default key fields.
    <b>If, besides its default key fields, the internal table contains number fields (see also ABAP/4 number types ), the contents of these number fields are added together if the internal table already contains an entry with the same key fields.</b>
    If the default key of an internal table processed with COLLECT is blank, all the values are added up in the first table line.
    In the program you mentioned yesterday,I am not able to get the logic since many lines are commented.

  • How to use collective confirmation CO12

    can any body explain me how to use collective confirmation CO12 with screen dump.
    Plz help

    Hi Viswa,
    Prerequisites:
    You can predefine values to identify confirmations and to determine default values in Conf. parameters for collective confirmation/fast entry (Customizing for Shop Floor Control by choosing Operations ® Confirmation ® Confirmation Parameters Collective Entry/Fast Entry):
        Identifying the confirmation
    You can identify an individual confirmation either by the confirmation number or the order number/operation number.
        Suggest actual data
    You can define whether and when (after entry, during saving) quantities (see Determining a Default for Yield) or activities are suggested. The default setting is that no quantities are suggested and activities are determined during saving. Personnel data and dates are always suggested.
    Procedure:
        Choose Logistics ® Production ® Shop floor control ® Confirmation ® Enter ® For operation ® Collective entry.
        The screen for collective entry of confirmations appears.
        In this screen you can enter confirmations in a table (table control). You enter a new confirmation in each line. You can control the appearance of the table yourself.
    You can change the type of confirmation identification during input. To do so choose Other view.
    Enter all the data needed for the confirmations. Each line corresponds to a new confirmation. In this line you have all the fields that are available in single entry of a time ticket confirmation.
    On the top line of the screen you can enter default values (for example unit of measure, personnel number) that are copied to all confirmations. Enter the values and choose This graphic is explained in the accompanying text. You can save these default values for a specific user, so that they are preset the next time the user logs on. You can also delete these defaults.
    With this function, you can let the system suggest actual data (quantities, activities, dates, personnel data). To do so, select the confirmations, choose This graphic is explained in the accompanying text Propose actual data, set the indicator for the relevant actual data and choose This graphic is explained in the accompanying text. This data overwrites data that you may have already entered.
        Save your confirmations.
    Note
    To reach the Actual data screen for the selected confirmations choose This graphic is explained in the accompanying text. Here you have the complete functionality of time ticket confirmation. From this screen you can go to the detail screens and to the goods movement overview. If several confirmation have been selected, you can switch between the individual confirmations.
    Note
    You can switch to the goods movement overview from the collective entry screen (choose This graphic is explained in the accompanying text Goods movements). In this screen the goods movements for the selected confirmations are displayed.
    You can check and, if necessary, change the goods movements. When you go back to the collective entry screen, the GM indicator is set for the selected confirmations (goods movements for confirmations already determined). As soon as you save a confirmation, the goods movements are also posted.
    For more information choose the GOODS MOVEMENT OVER VIEW.
    Regards,
    Madhu.G
    Edited by: madhu333mac on Jan 11, 2012 11:34 PM

  • How to use collect statement properly

    In PBID table , i will get 4 rows for a material . I will get the corresponding values of bdzei from the same table . Now i will pass this bdzei into pbhi table. then i will get some 200 rows of data. I have to sum up the field plnmg , by grouping the laeda field of pbhi. In short, i need to know the sum of pbhi-plnmg for a particular pbhi-laeda . I know a way to do it. But i want to know how to use the COLLECT statement for this purpose. My output should contain oly 1 line for 1 material ..
    PBID table                      
    Matnr   BDZEI
    p4471   457
            1002
            2309
            2493
    PBHI table
    BDZEI     LAEDA         PLNMG
    1002     06.08.2004     0.000          
    1002     06.08.2004     83.000
    457      07.08.2004     12.000          
    457     07.08.2004     24.000
    Reqd O/p
    MATNR   LAEDA        PLNMG
    p4471  06.08.2004    83
    p4471  07.08.2004    36
    Hope u understood my situation .please help me out ...
    Thanking you in advance ..
    Shankar

    REPORT zppr_zpipr NO STANDARD PAGE HEADING LINE-SIZE 150 LINE-COUNT 63.
    TABLES: pbid,
            pbhi,
            makt,
            mseg,
            mkpf.
    DATA: BEGIN OF it_pbid OCCURS 0,
          matnr LIKE pbid-matnr,        " Material
          status TYPE c LENGTH 4,       " For distinguishing materials from pbid and pbim .. will contain space for PBID and 'PBIM' for PBIM
          bdzei LIKE pbid-bdzei,
          laeda LIKE pbhi-laeda,
    end of it_pbid.
    DATA: BEGIN OF it_pbim OCCURS 0,
          matnr LIKE pbid-matnr,        " Material
          status TYPE c LENGTH 4,       " For distinguishing materials from pbid and pbim .. will contain space for PBID and 'PBIM' for PBIM
          bdzei LIKE pbim-bdzei,
          laeda LIKE pbhi-laeda,
    end of it_pbim.
    DATA: BEGIN OF it_pbid_pbim OCCURS 0,
          matnr LIKE pbid-matnr,        " Material
          laeda LIKE pbhi-laeda,        " Reduction Date
          dbmng LIKE pbhi-dbmng,        " Planned quantity in the data base
          plnmg LIKE pbhi-plnmg,        " Planned quantity
          status TYPE c LENGTH 4,       " For distinguishing materials from pbid and pbim .. will contain space for PBID and 'PBIM' for PBIM
          mblnr LIKE mseg-mblnr,        " Material Doc Number
          pbfnr LIKE pbid-pbdnr,        " Plan Number
          maktx LIKE makt-maktx,         " Matl Desc
          aenam LIKE pbhi-aenam,        " User Changed
          erfmg LIKE mseg-erfmg,        " Qty Invoiced
          budat LIKE mkpf-budat,        " Invoice date
          bdzei LIKE pbid-bdzei,        " Independent requirements pointer
          werks LIKE pbid-werks,        " plant
          pirrednqty TYPE i,            " PIR Reduction Quantity        = pbih-plnmg - pbih-dbmng
          diff TYPE i,                  " Difference
          slno TYPE i,                  " Sl No
    END OF it_pbid_pbim.
    DATA: BEGIN OF it_allrows OCCURS 0.
            INCLUDE STRUCTURE it_pbid_pbim.
    DATA: END OF it_allrows.
    *DATA: BEGIN OF it_final OCCURS 0.
           INCLUDE STRUCTURE it_pbid_pbim.
    *DATA: END OF it_final.
    DATA: BEGIN OF line,
          matnr LIKE pbid-matnr,        " Material
          laeda LIKE pbhi-laeda,        " Reduction Date
          plnmg LIKE pbhi-plnmg,        " Planned quantity
          maktx LIKE makt-maktx,        " Matl Desc
          dbmng LIKE pbhi-dbmng,        " Planned quantity in the data base
          mblnr LIKE mseg-mblnr,        " Material Doc Number
          pbfnr LIKE pbid-pbdnr,        " Plan Number
          aenam LIKE pbhi-aenam,        " User Changed
          erfmg LIKE mseg-erfmg,        " Qty Invoiced
          budat LIKE mkpf-budat,        " Invoice date
          bdzei LIKE pbid-bdzei,        " Independent requirements pointer
          werks LIKE pbid-werks,        " plant
          pirrednqty TYPE i,            " PIR Reduction Quantity        = pbih-plnmg - pbih-dbmng
          diff TYPE i,                  " Difference
          slno TYPE i,                  " Sl No
          status TYPE c LENGTH 4,       " For distinguishing materials from pbid and pbim .. will contain space for PBID and 'PBIM' for PBIM
    END OF line.
    DATA Itfinal1 LIKE STANDARD TABLE
                OF LINE
              WITH DEFAULT KEY.
    DATA ITfinal LIKE ITfinal1.
    DATA: BEGIN OF it_dates OCCURS 0,
          date TYPE sy-datum,
    END OF it_dates.
    DATA: l_slno TYPE i.
    DATA: l_zebra TYPE c.
    SELECT-OPTIONS:
          s_werks FOR pbid-werks obligatory.
    SELECT-OPTIONS:
          s_matnr FOR pbid-matnr.
    SELECT-OPTIONS:
          s_pbdnr FOR pbid-pbdnr.
    SELECT-OPTIONS:
          s_laeda FOR pbhi-laeda obligatory.
    parameter:
          c_print type checkbox.
    SELECT matnr bdzei FROM pbid INTO (it_pbid-matnr, it_pbid-bdzei) WHERE werks IN s_werks AND matnr IN s_matnr AND pbdnr IN s_pbdnr.
      it_pbid-status = 'PBID'.
      APPEND it_pbid.
    move-corresponding it_pbid to it_pbid_pbim.
    Append it_pbid_pbim.
    ENDSELECT.
    SELECT matnr bdzei FROM pbim INTO  (it_pbim-matnr,it_pbim-bdzei) WHERE werks IN s_werks AND matnr IN s_matnr AND pbdnr IN s_pbdnr.
      APPEND it_pbim.
    Append it_pbid_pbim.
    ENDSELECT.
    *break-point.
    START-OF-SELECTION.
      LOOP AT s_laeda.
        it_dates-date = s_laeda-low.
        APPEND it_dates.
      ENDLOOP.
      DATA: l_startdate LIKE sy-datum.
      IF s_laeda-high EQ space.
      ELSE.
        l_startdate = s_laeda-low + 1.
        DO.
          IF l_startdate <= s_laeda-high.
            it_dates-date = l_startdate.
            APPEND it_dates.
          ELSE.
            it_dates-date = sy-datum.
            EXIT.
          ENDIF.
          l_startdate = l_startdate + 1.
        ENDDO.
      ENDIF.
    *break-point.
      LOOP AT it_pbim.
        LOOP AT it_dates.
          it_pbim-laeda = it_dates-date.
          it_pbim-status = 'PBIM'.
          MODIFY it_pbim TRANSPORTING laeda status.
          MOVE-CORRESPONDING it_pbim TO it_pbid_pbim.
          APPEND it_pbid_pbim.
        ENDLOOP.
      ENDLOOP.
    break-point.
      l_zebra = 'X'.
      DATA: l_toterfmg LIKE mseg-erfmg.
      DATA: l_erfmg LIKE mseg-erfmg.
      data: l_totpir type i.
    **************************************PBID*************************************
      LOOP AT it_pbid.
        move-corresponding it_pbid to it_pbid_pbim.
           append it_pbid_pbim.
        SELECT SINGLE maktx FROM makt INTO (it_pbid_pbim-maktx) WHERE matnr = it_pbid-matnr.
        MODIFY table it_pbid_pbim TRANSPORTING maktx.
        SELECT aenam laeda FROM pbhi INTO (it_pbid_pbim-aenam,it_pbid_pbim-laeda) WHERE bdzei = it_pbid-bdzei AND aenam = 'Abbau-'.
           MODIFY TABLE it_pbid_pbim TRANSPORTING aenam laeda. " debug here
        select single sum( dbmng )  sum( plnmg ) FROM pbhi INTO (it_pbid_pbim-dbmng,it_pbid_pbim-plnmg) WHERE bdzei = it_pbid-bdzei AND aenam = 'Abbau-' and laeda = it_pbid_pbim-laeda..
           MODIFY TABLE it_pbid_pbim TRANSPORTING dbmng plnmg. " debug here
       endselect.
        it_pbid_pbim-pirrednqty = it_pbid_pbim-dbmng - it_pbid_pbim-plnmg.
           MODIFY table it_pbid_pbim TRANSPORTING pirrednqty.
        IF ( it_pbid_pbim-laeda IN s_laeda AND it_pbid_pbim-aenam EQ 'Abbau-' ).
          MOVE-CORRESPONDING it_pbid_pbim TO it_allrows.
          append it_allrows.
        ELSEIF NOT it_pbid_pbim-laeda IN s_laeda.
              delete it_pbid_pbim index sy-tabix.           " debug here
        ENDIF.
        ENDSELECT.
      ENDLOOP.
    **************************************PBIM*************************************
      LOOP AT it_pbim.
        move-corresponding it_pbim to it_pbid_pbim.
           append it_pbid_pbim.
        SELECT SINGLE maktx FROM makt INTO (it_pbid_pbim-maktx) WHERE matnr = it_pbim-matnr.
           MODIFY table it_pbid_pbim TRANSPORTING maktx.
        SELECT aenam laeda FROM pbhi INTO (it_pbid_pbim-aenam,it_pbid_pbim-laeda) WHERE bdzei = it_pbim-bdzei AND aenam = 'Abbau-'.
           MODIFY TABLE it_pbid_pbim TRANSPORTING aenam laeda. " debug here
        select single sum( dbmng )  sum( plnmg ) FROM pbhi INTO (it_pbid_pbim-dbmng,it_pbid_pbim-plnmg) WHERE bdzei = it_pbim-bdzei AND aenam = 'Abbau-' and laeda = it_pbid_pbim-laeda..
           MODIFY TABLE it_pbid_pbim TRANSPORTING dbmng plnmg. " debug here
        it_pbid_pbim-pirrednqty = it_pbid_pbim-dbmng - it_pbid_pbim-plnmg.
           MODIFY table it_pbid_pbim TRANSPORTING pirrednqty.
        IF ( it_pbid_pbim-laeda IN s_laeda AND it_pbid_pbim-aenam EQ 'Abbau-' ).
          MOVE-CORRESPONDING it_pbid_pbim TO it_allrows.
          append it_allrows.
        ELSEIF NOT it_pbid_pbim-laeda IN s_laeda.
              delete it_pbid_pbim index sy-tabix.           " debug here
        ENDIF.
        ENDSELECT.
      ENDLOOP.
    sort it_allrows by matnr laeda status.
    **********************************ALL ROWS************************
    loop at it_allrows.
      line-matnr = it_allrows-matnr.
      line-laeda = it_allrows-laeda.
      line-plnmg = it_allrows-plnmg.
      line-dbmng = it_allrows-dbmng.
    line-mblnr = it_allrows-mblnr.
    line-pbfnr = it_allrows-pbfnr.
      line-maktx = it_allrows-maktx.
    line-aenam = it_allrows-aenam.
    line-erfmg = it_allrows-erfmg.
    line-budat = it_allrows-budat.
      line-bdzei = it_allrows-bdzei.
    line-werks = it_allrows-werks.
      line-pirrednqty = it_allrows-pirrednqty.
      line-diff = it_allrows-diff.
      line-slno = it_allrows-slno.
      line-status = it_allrows-status.
      collect line into itfinal1.
    endloop.
    loop at itfinal1 into line.
      collect line into itfinal.
        write: / line-matnr, line-plnmg, line-dbmng,line-laeda,line-status..
    endloop.
    skip 4.
    loop at itfinal into line.
      write: / line-matnr, line-plnmg, line-dbmng,line-laeda,line-status..
    endloop.
    break-point.

  • How to use Form tracking (T.code-J1IUN)

    Hi all,
    How to use the form tracking.and How to use the J1IUN. Can anybody help give a details idea how to track the C form wether the customer is giving the form againt the billing document .
    Thanks in advance.
    Regards,
    Abhijit.

    hi
    As per indian C form business process J1IUN will not meet the requirements.
    we have to develop Z programme for this, logic is
    1. Transaction one is  all CST 4 % or 3 %  invoices we have to store in Z table. (daily by creating Z tcode)
    2. second  transaction is maintain the C from numbers for respective invoice numbers ( by crating Z code)
    3.develop 2 reports, one is invoices with C from numbers another one is invoices with out c form numbers.
    so by sitting with u r abaper u can give above solution

  • How to use collections

    Hi
    i'm still quite the novice on APEX so bare with me.
    my problem is as follows:
    I have to develop a page for mass registration of sales, in APEX, and the client would like a tabular form with 20 empty rows in which the client can insert sales data.
    i'm developing on apex version 3.0.0.00.20 on a 10g Enterprise Edition Release 10.1.0.5.0 database.
    i've tried using collections for the job, but my problem is that i can't get the code to save any changes to the collection??
    i've created a on load before header process
    that creates a collection named SALGSBUFREG using apex_collection.create_collection_from_query where no rows are returned.
    the table i query is the table that the sales data eventually is inserted into.
    /** on-load before header process start */
    declare
    c_coll_name constant varchar2(100) := 'SALGSBUFREG';
    c_number_of_rows constant number := 20;
    begin
    if apex_collection.collection_exists(p_collection_name=>c_coll_name) then
    apex_collection.delete_collection(p_collection_name=>c_coll_name);
    end if;
    apex_collection.create_collection_from_query(
    p_collection_name=>c_coll_name,
    p_query=>'SELECT varenummer,
    antal,
    aip_omsaetning,
    apotekskode ,
    salgsdato,
    salgsperiode,
    dlibruger_id,
    salgsbatch_id,
    sygehuskode,
    afvist,
    indsat,
    updateret,
    registreringsdato
    FROM salgsbuffere
    WHERE 1 = 2');
    /** create c_number_of_rows empty rows*/
    for i in 1 .. c_number_of_rows
    loop
    apex_collection.add_member (p_collection_name => c_coll_name,
    p_c001 => ' ',
    p_c002 => ' ',
    p_c003 => ' ',
    p_c004 => ' ',
    p_c005 => null,
    p_c006 => ' ',
    p_c007 => ' ',
    p_c008 => ' ',
    p_c009 => ' ',
    p_c010 => ' ',
    p_c011 => ' ',
    p_c012 => ' ',
    p_c013 => null
    end loop;
    end;
    /** on-load before header process stop */
    i've created a report region called salgs_buf based on the following query:
    select c001, c002, c003, c004, c005, c006, c007, c008,c009,c010,c011, c012,c013
    from apex_collections
    where collection_name = 'SALGSBUFREG'
    i've made the report attributes c001 - c005 editable.
    finally i've made a on submit - after computations and validations process with the following content:
    declare
    c pls_integer := 0;
    c_coll_name constant varchar2(100) := 'SALGSREGBUF';
    begin
    for c1 in (
    select seq_id from apex_collections
    where collection_name = c_coll_name
    order by seq_id) loop
    c := c+1;
    apex_collection.update_member_attribute (p_collection_name=> c_coll_name,
    p_seq=> c1.seq_id,p_attr_number =>4,p_attr_value=>wwv_flow.g_f01(c));
    apex_collection.update_member_attribute (p_collection_name=> c_coll_name,
    p_seq=> c1.seq_id,p_attr_number =>5,p_attr_value=>wwv_flow.g_f02(c));
    apex_collection.update_member_attribute (p_collection_name=> c_coll_name,
    p_seq=> c1.seq_id,p_attr_number =>6,p_attr_value=>wwv_flow.g_f03(c));
    apex_collection.update_member_attribute (p_collection_name=> c_coll_name,
    p_seq=> c1.seq_id,p_attr_number =>7,p_attr_value=>wwv_flow.g_f04(c));
    end loop;
    end;
    For some reason the collection dosen't get updated????
    any idears why, or am I using the wrong apporach.

    first off thanks for your help.
    I seem to have cracked the nut so to speak, i'm just posting my solution
    I've changed the process so that exisisting collections aren't deleted.
    /** before header process start**/
    DECLARE
    c_coll_name CONSTANT VARCHAR2 (100) := 'SALGSBUFREG';
    c_number_of_rows CONSTANT NUMBER := 20;
    v_row_count_diff NUMBER;
    v_row_count NUMBER;
    BEGIN
    IF NOT apex_collection.collection_exists (c_coll_name)
    THEN
    apex_collection.create_collection_from_query
    (p_collection_name => c_coll_name,
    p_query => 'SELECT varenummer,
    antal,
    aip_omsaetning,
    apotekskode,
    salgsdato,
    salgsperiode,
    dlibruger_id,
    salgsbatch_id,
    sygehuskode,
    afvist,
    indsat,
    updateret,
    registreringsdato
    FROM salgsbuffere
    WHERE 1 = 2'
    -- create c_number_of_rows empty rows
    FOR i IN 1 .. c_number_of_rows
    LOOP
    apex_collection.add_member (p_collection_name => c_coll_name,
    p_c001 => ' ',
    /** vare nr*/
    p_c002 => ' ',
    /** antal */
    p_c003 => ' ',
    /** aip_omsaetning*/
    p_c004 => ' ',
    /** apotekskode */
    p_c005 => NULL,
    /** salgsdato*/
    p_c006 => ' ',
    /** salgsperiode */
    p_c007 => ' ',
    /** dlibruger_id*/
    p_c008 => ' ',
    /** salgsbatch_id*/
    p_c009 => ' ',
    /** sygehuskode*/
    p_c010 => ' ',
    /** afvist*/
    p_c011 => ' ',
    /** indsat*/
    p_c012 => ' ',
    /** updateret*/
    p_c013 => NULL
    /** registrerings dato*/
    END LOOP;
    -- the empty collection is set to unchanged
    apex_collection.reset_collection_changed (c_coll_name);
    END IF;
    END;
    /** before header process stop**/
    i've made a on submit and before computation process that populates the collection with the values that i input in the updatable rport region on my page, and it works just fine:
    /** on submit and before computation start**/
    /* Formatted on 2008/06/11 09:37 (Formatter Plus v4.8.8) */
    DECLARE
    c_coll_name CONSTANT VARCHAR2 (100) := 'SALGSBUFREG';
    c_row_count CONSTANT NUMBER := 20;
    v_member_count NUMBER;
    BEGIN
    IF apex_collection.collection_exists (c_coll_name)
    THEN
    FOR i IN 1 .. apex_collection.collection_member_count (c_coll_name)
    LOOP
    apex_collection.update_member_attribute
    (p_collection_name => c_coll_name,
    p_seq => i,
    p_attr_number => 1,
    p_attr_value => apex_application.g_f01
    (i)
    apex_collection.update_member_attribute
    (p_collection_name => c_coll_name,
    p_seq => i,
    p_attr_number => 2,
    p_attr_value => apex_application.g_f02
    (i)
    apex_collection.update_member_attribute
    (p_collection_name => c_coll_name,
    p_seq => i,
    p_attr_number => 3,
    p_attr_value => apex_application.g_f03
    (i)
    apex_collection.update_member_attribute
    (p_collection_name => c_coll_name,
    p_seq => i,
    p_attr_number => 4,
    p_attr_value => apex_application.g_f04
    (i)
    apex_collection.update_member_attribute
    (p_collection_name => c_coll_name,
    p_seq => i,
    p_attr_number => 5,
    p_attr_value => apex_application.g_f05
    (i)
    END LOOP;
    END IF;
    END;
    /** on submit and before computation start**/

  • How to use collect?

    hi all ,
    i want to add net value of all the line items which are in the same group
    am using collect but am unable to do that.
    plz suggest me what to do?
    DATA: BEGIN OF del_grp_data occurs 0,
            vbeln like vbap-vbeln,  " Sales document
            grkor like vbap-grkor,  " Delivery group
            netwr like vbap-netwr, "net value
            posnr like vbap-posnr,  " Sales document item
             End OF del_grp_data.
    SELECT vbeln grkor pstyv netwr
        posnr
       FROM   vbap
        INTO corresponding fields of  TABLE del_grp_data
        FOR ALL ENTRIES IN orders_vbeln
        WHERE vbeln eq orders_vbeln-vbeln.
    loop at del_grp_data.
    collect ord_grp_data .
    endloop.
    Regards,
    Amit.

    Basic form
    COLLECT [wa INTO] itab.
    Addition:
    ... SORTED BY f
    Cannot Use Short Forms in Line Operations.
    Effect
    COLLECT allows you to create unique or summarized datasets. The system first tries to find a table entry corresponding to the table key. (See also Defining Keys for Internal Tables). The key values are taken either from the header line of the internal table itab, or from the explicitly-specified work area wa. The line type of itab must be flat - that is, it cannot itself contain any internal tables. All the components that do not belong to the key must be numeric types ( ABAP Numeric Types).
    If the system finds an entry, the numeric fields that are not part of the table key (see ABAPNumeric Types) are added to the sum total of the existing entries. If it does not find an entry, the system creates a new entry instead.
    The way in which the system finds the entries depends on the type of the internal table:
    STANDARD TABLE:
    The system creates a temporary hash administration for the table to find the entries. This means that the runtime required to find them does not depend on the number of table entries. The administration is temporary, since it is invalidated by operations like DELETE, INSERT, MODIFY, SORT, ...). A subsequent COLLECT is then no longer independent of the table size, because the system has to use a linear search to find entries. For this reason, you should only use COLLECT to fill standard tables. U
    SORTED TABLE:
    The system uses a binary search to find the entries. There is a logarithmic relationship between the number of table entries and the search time.
    HASHED TABLE:
    The system uses the internal hash administration of the table to find records. Since (unlike standard tables), this remains intact even after table modification operations, the search time is always dependent on the number of table entries.
    For standard tables and SORTED TABLEs, the system field SY-TABIX contains the number of the existing or newly-added table entry after the APPEND. With HASHED TABLEs, SY-TABIX is set to 0.
    Notes
    COLLECT allows you to create a unique or summarized dataset, and you should only use it when this is necessary. If neither of these characteristics are required, or where the nature of the table in the application means that it is impossible for duplicate entries to occur, you should use INSERT [wa INTO] TABLE itab instead of COLLECT. If you do need the table to be unique or summarized, COLLECT is the most efficient way to achieve it.
    If you use COLLECT with a work area, the work area must be compatible with the line type of the internal table.
    If you edit a standard table using COLLECT, you should only use the COLLECT or MODIFY ... TRANSPORTING f1 f2 ... statements (where none of f1, f2, ... may be in the key) enthalten sein). Only then can you be sure that:
    -The internal table actually is unique or summarized
    -COLLECT runs efficiently. The check whether the dataset
    already contains an entry with the same key has a constant
    search time (hash procedure).
    If you use any other table modification statements, the check for entries in the dataset with the same key can only run using a linear search (and will accordingly take longer). You can use the function module ABL_TABLE_HASH_STATE to test whether the COLLECT has a constant or linear search time for a given standard table.
    Example
    Summarized sales figures by company:
    TYPES: BEGIN OF COMPANY,
            NAME(20) TYPE C,
            SALES    TYPE I,
          END OF COMPANY.
    DATA: COMP    TYPE COMPANY,
          COMPTAB TYPE HASHED TABLE OF COMPANY
                                    WITH UNIQUE KEY NAME.
    COMP-NAME = 'Duck'.  COMP-SALES = 10. COLLECT COMP INTO COMPTAB.
    COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB.
    COMP-NAME = 'Duck'.  COMP-SALES = 30. COLLECT COMP INTO COMPTAB.
    Table COMPTAB now has the following contents:
               NAME    | SALES
              Duck    |   40
              Tiger   |   20
    Addition
    ... SORTED BY f
    Effect
    COLLECT ... SORTED BY f is obsolete, and should no longer be used. It only applies to standard tables, and has the same function as APPEND ... SORTED BY f, which you should use instead. (See also Obsolete Language Elements).
    Note
    Performance:
    Avoid unnecessary assignments to the header line when using internal tables with a header line. Whenever possible, use statements that have an explicit work area.
    For example, " APPEND wa TO itab." is approximately twice as fast as " itab = wa. APPEND itab.". The same applies to COLLECT and INSERT.
    The runtime of a COLLECT increases with the width of the table key and the number of numeric fields whose contents are summated.
    Note
    Non-Catchable Exceptions:
    COLLECT_OVERFLOW: Overflow in an integer field during addition
    COLLECT_OVERFLOW_TYPE_P: Overflow in a type P field during addition.
    TABLE_COLLECT_CHAR_IN_FUNCTION: COLLECT on a non-numeric field.
    Related
    APPEND, WRITE ... TO, MODIFY, INSERT
    Additional help
    Inserting SummarizedTable Lines

  • How to use wscompile to generate code using a WSDL file?

    I am working with JAX-RPC of Java Web Service ver: 1.1. I am intrested in making the WSDL file first and generating Java code from the WSDL file. On the following link:
    http://java.sun.com/webservices/docs/1.1/tutorial/doc/JAXRPC6.html#wp80094
    it says that wscompile can generate code using a WSDL file..:
    <quote>
    Table 11-3 wscompile Options
    -import : read a WSDL file, generate the service's RMI interface and a template of the class that implements the interface
    </quote>
    and the wscompile software says this:
    <quote>
    C:\>wscompile
    -import : generate interfaces and value types only
    </quote>
    can anyone tell me how to generated Java code from a WSDL file. As in, make the WSDL file (e.g. using XMLSpy) and then use that WSDL generate Java code.
    Thanks

    I'm trying to generate code using wscompile under the struction in JAXRPC_Tutorial.pdf.
    I issued the following command:
    wscompile.sh -keep -gen:client -f:wsi -verbose config.xml
    But I met with the following warning and I cann't find the produced java code, who know why? Thanks in advance!
    warning: ignoring SOAP port "EmployeeDBPort": unrecognized transport
    warning: Service "EmployeeDatabase" does not contain any usable ports
    the config.xml file is:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration
    xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    <wsdl name="EmployeeDBService"
    location="EmployeeDB.wsdl"
    packageName="com.sun.xml.rpc.xml.EmployeeDB">
    </wsdl>
    </configuration>

  • How to use *166# operator service codes on N900?

    Please let someone help me to find a solution for getting the balance and other service commands on N900.

    you can look here, for the answer:
    /t5/Maemo-Devices/Problem-when-dialing-166-to-chec​k-account-balance/m-p/619163/highlight/true#M4500
    I got it to work, i just can use it with the dialing out type codes, as this doesn't have access to those (understandable with test software though, looking forward to an official fix from pr.1.2)

  • How to use IncludeIn in Script code

    Hallo, i don't know how to add a label (dinamically created) to a particular State. I do it with MXML with the includeIn property but there is not such a property through as3 code.
    Please help
    Max

    help.

  • How to use TreeByKeyTableColumn  (with sample code)

    Hi Guys,
                  Can anyone tell me How to bind data with TreeByKeyTableColumn ? (with sample code). Is it possible to add checkbox with TreeByKeyTableColumn? Kindly aware me further in this regards....
    Thanks,
    Ravin

    Hi
    Answering to following question
    How to bind data with TreeByKeyTableColumn
    Create the Context
    Click on the Context tab of the view. Create a node name it as "AIR_LINES". Set the Cardinality as 0...N. Make it a Singleton Node. Give a method name in supply function column by name "GENERATE_TREE".
    Then we will create attributes required for the tree column. We require 5 attributes
       1. Attribute which contains the current level of the node. Create an attribute called "NODE_LEVEL" of type STRING.
       2. Attribute which contains the parent level of the node. Create an attribute called "PARENT_LEVEL" of type STRING.
       3. Attribute which contains the contents of the node. Create an attribute called "NODE_CONTENT" of type STRING.
       4. Attribute which contains X or Space depending upon the node is expanded or not. Create an attribute called "EXPANDED" of type WDY_BOOLEAN.
       5. Attribute which contains X or Space depending upon the type of the node, whether the node is a branch or a leaf. Create an attribute called "IS_LEAF" of type WDY_BOOLEAN.
    Click on the layout tab of the view. Add UI element of type Table, give the name as 'Tree Table'. Bind the DATASOURCE property of the table to the AIR_LINES node of the view context.
    Give heading to the table as "Booking Details".
    Right click on table node crated and chose Insert Master Column.
    Name it as "TREE_NODE" and chose TreeByKeyTableColumn from the dropdown
    Bind the 4 properties with context attributes we have already created.
    Expanded -> Expanded.
    Is_leaf     -> Is_leaf.
    Parent_key -> Parent_level
    Row_key   -> Node_level
    Give heading to the tree node in the text field.
    Insert a cell editor in the tree column and chose the type as Text view.
    Bind the text property of the text view to the NODE_CONTENT attribute of the context.
    Similarly create a table column to display the second column i.e. Node type.
    Right click -> Insert table column -> Give the heading in the text property of the header (Node Type).
    Right click -> Insert Cell Editor -> Bind the text property to NODE_TYPE attribute of the context.
    Click on the Methods tab of the view. You will find the method of type supply function which we created during the creation of node. Double click and write the following code.
    METHOD generate_tree .
    Ideally this code must go to a method of a class which will return four internal tables
    start of Model code
    TYPES : BEGIN OF ty_scarr,        " Air line Table
             carrid TYPE s_carr_id,
            END OF ty_scarr.
    TYPES : BEGIN OF ty_spfli,        " Flight Connection Table
             carrid TYPE s_carr_id,
             connid TYPE s_conn_id,
            END OF ty_spfli.
    TYPES : BEGIN OF ty_sflight,      " Flight Table
             carrid TYPE s_carr_id,
             connid TYPE s_conn_id,
             fldate TYPE s_date,
            END OF ty_sflight.
    TYPES : BEGIN OF ty_sbook,        " Flight Booking Table
             carrid TYPE s_carr_id,
             connid TYPE s_conn_id,
             fldate TYPE s_date,
             bookid TYPE s_book_id,
            END OF ty_sbook.
    DATA : lt_scarr TYPE TABLE OF ty_scarr.
    DATA : lt_spfli TYPE TABLE OF ty_spfli.
    DATA : lt_sflight TYPE TABLE OF ty_sflight.
    DATA : lt_sbook TYPE TABLE OF ty_sbook.
    DATA : ls_scarr TYPE  ty_scarr.
    DATA : ls_spfli TYPE  ty_spfli.
    DATA : ls_sflight TYPE ty_sflight.
    DATA : ls_sbook TYPE  ty_sbook.
    SELECT carrid
      FROM scarr
      INTO TABLE lt_scarr
      UP TO 2 ROWS.
    IF lt_scarr[] IS NOT INITIAL.
      SELECT carrid connid
        FROM spfli
        INTO TABLE lt_spfli
        FOR ALL ENTRIES IN lt_scarr
        WHERE carrid EQ lt_scarr-carrid.
        IF lt_spfli[] IS NOT INITIAL.
          SELECT carrid connid fldate
            FROM sflight
            INTO TABLE lt_sflight
            FOR ALL ENTRIES IN lt_spfli
            WHERE carrid EQ lt_spfli-carrid
            AND connid EQ lt_spfli-connid.
    For an additional level of branching
           IF lt_spfli[] IS NOT INITIAL.
               SELECT carrid connid fldate bookid
                 FROM sbook
                 INTO TABLE lt_sbook
                 FOR ALL ENTRIES IN lt_sflight
                 WHERE carrid EQ lt_sflight-carrid
                 AND connid EQ lt_sflight-connid
                 AND fldate EQ lt_sflight-fldate.
           ENDIF.
        ENDIF.
    ENDIF.
    End of Model code
    Start of code for generation the tree
    data declaration
      DATA lt_table TYPE wd_this->elements_air_lines.
      DATA ls_table LIKE LINE OF lt_table.
      DATA lvl1_index TYPE string.
      DATA lvl2_index TYPE string.
      DATA lvl3_index TYPE string.
      DATA lvl4_index TYPE string.
    Level 1
    LOOP AT lt_scarr INTO ls_scarr.
      lvl1_index = sy-tabix.
      condense lvl1_index.
      create a row
        ls_table-node_level       = lvl1_index.     " 1 st level
        ls_table-parent_level     = ''.             " No parent
        ls_table-node_content     = ls_scarr-carrid.
        ls_table-node_type        = 'Air Line'.
        ls_table-is_leaf          = abap_false.
        INSERT ls_table INTO TABLE lt_table.
        clear ls_table.
    Level 2
    LOOP AT lt_spfli INTO ls_spfli.
      lvl2_index = sy-tabix.
      condense lvl2_index.
      create a row
        concatenate lvl1_index `.` lvl2_index into ls_table-node_level.
        ls_table-parent_level     = lvl1_index.     " Parent 1 st level
        ls_table-node_content     = ls_spfli-connid.
        ls_table-node_type        = 'Flight Connection'.
        ls_table-is_leaf          = abap_false.
        INSERT ls_table INTO TABLE lt_table.
        clear ls_table.
    Level 3
    LOOP AT lt_sflight INTO ls_sflight.
      lvl3_index = sy-tabix.
      condense lvl3_index.
      create a row
        concatenate lvl1_index `.` lvl2_index `.` lvl3_index into ls_table-node_level.
        concatenate lvl1_index `.` lvl2_index into ls_table-parent_level.
        ls_table-node_content     = ls_sflight-fldate.
        ls_table-node_type        = 'Flight'.
        ls_table-is_leaf          = abap_true.
        INSERT ls_table INTO TABLE lt_table.
        clear ls_table.
    If you want an additional level it can be programmed like this
    Level 4
    *LOOP AT lt_sbook INTO ls_sbook.
    lvl4_index = sy-tabix.
    condense lvl4_index.
      create a row
       concatenate lvl1_index `.` lvl2_index `.` lvl3_index `.` lvl4_index into ls_table-node_level.
       concatenate lvl1_index `.` lvl2_index `.` lvl3_index into ls_table-parent_level.
       ls_table-node_content     = ls_sbook-bookid.
       ls_table-node_type        = 'Booking'.
       ls_table-is_leaf          = abap_true.      " as its the final level in our hier archy
       INSERT ls_table INTO TABLE lt_table.
    ENDLOOP.
    ENDLOOP.
    ENDLOOP.
    ENDLOOP.
    bind all the elements
      node->bind_table(
        new_items            =  lt_table
        set_initial_elements = abap_true ).
    ENDMETHOD.

  • How to use MallocDebug with C++ code

    Hi,
    I would like to learn to use MallocDebug with a C++ executable.
    Say I have created a simple C++ project using Xcode. (as follows)
    #include <iostream>
    int main (int argc, char * const argv[])
    double a = 1.0;
    double b = 2.0;
    double c = a+b;
    std::cout << "c="<< c <<\n;
    return 0;
    1. In Xcode I go to Debug->Launch Using Performance Tool->MallocDebug.
    2. In MallocDebug window I click launch.
    But I get a message saying "Unable to read malloc information from ..."
    I am wondering what else I should do to get MallocDebug work. Thanks
    oicing

    Your simple C++ project may be too simple.
    Try adding a declaration like <pre>
    double *d = (double *) malloc( 12 * sizeof (double) );</pre>; it's just a guess, but it's entirely possible your test program doesn't allocate anything from the heap, and thus doesn't use malloc, and thus doesn't generate anything for MallocDebug to read...

  • How to use SUBMIT for transaction program?

    Hello,
    Please help me with following requirement.
    I need to pass selection screen values from ZReport to transaction F.01 and collect displayed data output in internal table in ZReport and use internal table for further processing.
    Please let me know,
    1) How to use SUBMIT with transaction code or modulepool program (<b>remember I don't want to submit report program</b>)?
    2) How to collect F.01 output data and bring back to Zreport ?
    Thanks in advance.

    Hi ab,
    1.  How to collect F.01 output data and bring back to Zreport
    The data (of output) can be collected,
    for display purpose.
    We cannot get the full data, which makes sense.
    2. The data shall be collected, in a printable format only,
       ie. with vertical lines, horizontal lines (if any) etc.
    regards,
    amit m.

Maybe you are looking for

  • TDS (WHT) Reports, Tables, T-codes

    My Dear Friends, Please help me in the below requirement My Client need a report which consists the below fields. If there is no standard SAP report, please help me with tables, programs. TDS Report Vendor Name Vendor Number Vendor PAN Number Posting

  • Table for purachse order tax( Invoice tab)

    Hi, Can anybody tell me table name for purchase order taxes which are matainined in invoice tab.   Thanks and Regards     Anil

  • Obiee solaris installation for 10.1.3.4.1

    hi.. we are going to install obiee 10.1.3.4.1 in a solaris environment... i just want to know before running the ./setup.sh , any specific scripts or solaris specific package should be run or not...

  • Is there a simpler solution/directory/file structure for banner ads?

    I also have to wonder what a pain this has to be for a large website with many rotating banner ads - having all of these same files copied over and over in separate subdirectories. Flash had 2 files - a html file and swf file stored in the same direc

  • Speed Estimates

    As per my other thread, the engineer is coming Thursday to activate me. I ask, do the speed estimates on the BT site for Infinity tend to be low? i.e. do BT er on the side of caution so as not to give people unrealistic expectations? If i put my no.