Help needed in formulating the logic!!

Hi experts,
I have a requirement something like this. In CFM module we have some deals created.
For each deal there will be deal start date and end date.
Based on the user given input date I need to capture intrest accumlated till that date. Thats ok. But the problem is in between there can be repayments done.
For example : say deal number is 2004010155
start date : 4/1/2008
end date : 3/31/2009
basic amount : 8,00,000.
say suppose  on 30.06.2008 a partial repayment of 1,00,000 done.
Now if user given date is 31.07.2008,then we need to calculate intrest amount with basic amount as 8,00,000 till 30.06.2008 and
starting from 01.07.2008 to 31.07.2008(user given date) I need to calculate intrest with amount 7,00,000.(After deducting one lakh as partial repayment done during this period).
For refernce table name is VTBFHAPO.
How can we achieve this?
Thanks & Regards
Himayat.

Hi,
Currently this how am trying to do. Partial repayment not taken into consideration yet. Its for calcualting intrest amt based on linear method or exponential method.
READ TABLE i_vtbfhazu.
          IF sy-subrc = 0.
            i_final-dblfz = i_vtbfhazu-dblfz.
            i_final-delfz = i_vtbfhazu-delfz.
          ENDIF.
          IF p_datum = i_final-delfz.
            i_final-int_per = ( p_datum - i_final-dblfz ) .
          ELSEIF  p_datum < i_final-delfz.
            i_final-int_per = ( p_datum - i_final-dblfz ) + 1.
          ELSEIF p_datum > i_final-delfz.
            i_final-int_per = ( i_final-delfz - i_final-dblfz ) + 1.
          ENDIF.
          READ TABLE ivtbfhapo1 WITH KEY rfha = i_vtbfhazu-rfha
                                      rfhazu = '1'
                                      rfhazb = '1' BINARY SEARCH.
          IF sy-subrc = 0.
            g_bzbetr = ivtbfhapo1-bzbetr.
            i_final-bzbetr = g_bzbetr.
          ENDIF.
          READ TABLE ivtbfhapo WITH KEY rfha = i_vtbfhazu-rfha
*                              szbmeth = '3'
                                rkond   = '1000' BINARY SEARCH.
          IF sy-subrc = 0.
            i_final-pkond = ivtbfhapo-pkond.
            CLEAR : g_int_amt, g_wtd_prn.
            READ TABLE ivtbfhapo2 WITH KEY rfha = i_vtbfhazu-rfha
                                           jexpozins = 'X' .
            IF sy-subrc = 0 .
              CASE ivtbfhapo2-ammrhyzv.
                WHEN '00'. g_var = 1.
                WHEN '06'. g_var = 2.
                WHEN '03'. g_var = 4.
                WHEN '01'. g_var = 12.
                WHEN '52'. g_var = 52.
                WHEN OTHERS. g_var = 1.
              ENDCASE.
              g_int_amt =  i_final-bzbetr * ( 1 +  i_final-pkond  /
                 ( g_var * 100 ) )  ** ( i_final-int_per * ( g_var  /
                    ivtbfhapo2-abastage ) ).
              g_int_amt = g_int_amt - i_final-bzbetr.
              i_final-int_amt = g_int_amt.
            ELSE.
              LOOP AT ivtbfhapo2 WHERE rfha = i_vtbfhazu-rfha
                                  AND abastage > '000000'.
                g_int_amt = i_final-bzbetr * ( i_final-pkond / 100 ) * (
                       i_final-int_per / ivtbfhapo2-abastage ).
                i_final-int_amt = g_int_amt.
              ENDLOOP.
            ENDIF.
            g_wtd_prn = i_final-bzbetr * i_final-int_per.
            i_final-wtd_prn = g_wtd_prn.
            APPEND i_final.
Thanks & Regards
Himayat

Similar Messages

  • Help needed to optimize the query

    Help needed to optimize the query:
    The requirement is to select the record with max eff_date from HIST_TBL and that max eff_date should be > = '01-Jan-2007'.
    This is having high cost and taking around 15mins to execute.
    Can anyone help to fine-tune this??
       SELECT c.H_SEC,
                    c.S_PAID,
                    c.H_PAID,
                    table_c.EFF_DATE
       FROM    MTCH_TBL c
                    LEFT OUTER JOIN
                       (SELECT b.SEC_ALIAS,
                               b.EFF_DATE,
                               b.INSTANCE
                          FROM HIST_TBL b
                         WHERE b.EFF_DATE =
                                  (SELECT MAX (b2.EFF_DATE)
                                     FROM HIST_TBL b2
                                    WHERE b.SEC_ALIAS = b2.SEC_ALIAS
                                          AND b.INSTANCE =
                                                 b2.INSTANCE
                                          AND b2.EFF_DATE >= '01-Jan-2007')
                               OR b.EFF_DATE IS NULL) table_c
                    ON  table_c.SEC_ALIAS=c.H_SEC
                       AND table_c.INSTANCE = 100;

    To start with, I would avoid scanning HIST_TBL twice.
    Try this
    select c.h_sec
         , c.s_paid
         , c.h_paid
         , table_c.eff_date
      from mtch_tbl c
      left
      join (
              select sec_alias
                   , eff_date
                   , instance
                from (
                        select sec_alias
                             , eff_date
                             , instance
                             , max(eff_date) over(partition by sec_alias, instance) max_eff_date
                          from hist_tbl b
                         where eff_date >= to_date('01-jan-2007', 'dd-mon-yyyy')
                            or eff_date is null
               where eff_date = max_eff_date
                  or eff_date is null
           ) table_c
        on table_c.sec_alias = c.h_sec
       and table_c.instance  = 100;

  • I need to add the logic for posting key,

    I need to add the logic for posting key, if posting key = 50 then amount is credit (add negative sign in amount field).
    I creadted this scenario in mapping, We wanted to make sure that the negative sign was placed in the amount field if the posting key was = 50.  So it seems we are good.  We will just need to test.
    How i can test this case?
    Please do needful.
    Thanks in advance.

    Hi,
    You need to use an IfElse node function in your mapping in which the input should be the posting key from the source structure.
    You need to check in the IfElse statement whether the posting key=50, if it is true, then use concat node function to concat the negative sign("-") along with the original value to be passed to the amount field on the target side. Else, if the condition is false(i.e posting key!=50), then simply pass the value to the amount field as it is without adding the negative sign.
    After the mapping is done, go to the test tab and then insert the values in the source fields and then execute from the lower left button showing start transformation.  You need to test with the value of posting key=50 once and with the value not equal to 50 once.In the first case, the output amount field should have the negative sign, which should not be present in the second case.
    You will find your target structure in the righter half of your screen. That's it mate
    Thanks
    Biswajit

  • Please help me to build the logic

    Hi All,
    Please help me to implement the following logic.
    The conditional statements should not only be executed in sequence, but also if any of them are true they should not be overridden by any subsequent conditional statements being true.
    When actual effort Accepted or Rejected for AST proposals and calculate a flag for “enhance to AST guideline” = Y/N as follows for each employee and display at the employee level
    1)If AST eligibility = N AND proposed AST % >0, then “N”
    2)Else If AST eligibility = N AND proposed AST % = 0 then “n/a”
    3)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST = 0 then “Y”
    4)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST >0 then “N”
    5)Else If AST eligibility = Y AND Act Rank = 2 AND proposed AST = 0 then “Y”
    6)Else If AST eligibility = Y AND AST % is greater than or equal to the AST guideline minimum AND less than or equal to the AST guideline maximum, then “Y”
    7)Else If AST eligibility = Y AND AST % is less than the minimum guideline OR greater than the maximum guideline, then “N”
    I tried the following code but I am not getting the expected result .
    Could you Please help me to build the logic.
    Your earliest response is very helpful to me.
    if (upper(P_stat)='ACCEPTED' or upper(P_stat) like 'REJECTED%') then
    else if NVL(P_elgi,'N') <> 'Y' AND P_prop > '0' then
    P_flag := 'N';
    else if(NVL(P_elgi,'N') <> 'Y' AND P_prop = '0') then
    P_flag := 'N/A';
    else if ((NVL(P_elgi,'N')='Y') AND P_rank = '3' AND P_prop = '0') then
    P_flag := 'Y';
    else if((NVL(P_elgi,'N')='Y') AND P_rank = '3' AND P_prop > '0') then
    P_flag := 'N';
    else if((NVL(P_elgi,'N')='Y') AND P_rank = '2' AND P_prop = '0') then
    P_flag := 'Y';
    Else if (P_prop >=ast_min_guide AND P_prop <= ast_max_guide ) then
    P_flag := 'Y';
    else
    ((P_prop < ast_min_guide) OR (P_prop > ast_max_guide)) then
    P_flag := 'N';
    end if;
    end if;

    Thanks for ur quick responce .
    When actual effort Accepted or Rejected for AST proposals and calculate a flag for “enhance to AST guideline” = Y/N
    Once the above condition is satisfied we have to check for remaing conditions
    if (upper(P_stat)='ACCEPTED' or upper(P_stat) like 'REJECTED%') then
    once it is satisfies then we have to go for remaing conditions.
    how can we do it in CASE statement.
    1)If AST eligibility = N AND proposed AST % >0, then “N”
    2)Else If AST eligibility = N AND proposed AST % = 0 then “n/a”
    3)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST = 0 then “Y”
    4)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST >0 then “N”
    5)Else If AST eligibility = Y AND Act Rank = 2 AND proposed AST = 0 then “Y”
    6)Else If AST eligibility = Y AND AST % is greater than or equal to the AST guideline minimum AND less than or equal to the AST guideline maximum, then “Y”
    7)Else If AST eligibility = Y AND AST % is less than the minimum guideline OR greater than the maximum guideline, then “N”
    I tried the following code but I am not getting the expected result .

  • Help needed in getting the previous Quarter Data

    Hello folks,
    I have this procedure where i have to modify the current procedure in the following manner:
    I need to get rid of the variables p_start and p_end so that i cannot see them in the crystal report and include the Frequency in the procedure to get the Data based on the Dates.
    and Main requirement is" If the Frequency is Quarterly " it should get the previous quarter Data, if "Frequency is monthly" it should return the previous month data.Can anyone please let me know where shud i make changes. Am including the procedure for refernce. Any help is appreciated
    Thanks a millioin,
    CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h(report_record in out cr_return_types.gen_cursor,
    p_start       string,
    p_end         string)
    IS
    v_startdate date;
    v_enddate date;
    BEGIN
    v_startdate := to_date(p_start, 'YYYY/MM');
    v_enddate := last_day(to_date(p_end, 'YYYY/MM'));
    open report_record for
    select --distinct r.recovery_id
    r.event_id,
    r.event_case_id,
    c.client_id,
    c.client_code,
    c.client_name,
    b.branch_group_code,
    b.branch_group_description,
    g.employer_group_code,
    g.employer_group_name,
    e.client_policy_identifier,
    e.date_of_incident,
    e.event_type_code,
    sum(nvl(r.amount, 0)) as amt_received,
    nvl(sum(case
    when r.amount >= 0 then
    rd.fees
    else
    rd.fees * (-1)
    end),
    0) as fees,
    ec.close_date, *001* commented
    (case
    when ec.close_date <= to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
    'MMDDRRRR HH24MISS') then
    ec.close_date
    else
    null
    end) as close_date, --*001*  added
    get_case_value(ec.event_id, ec.event_case_id, v_enddate) as case_value,
    nvl(etl.fee_percent_flag, 'N') workmans_comp,
    max(to_char(r.recovery_date, 'FMMonthYYYY')) Year_Month,
    max(to_char(r.recovery_date, 'YYYYMM')) Y_M,
    max(to_date(to_char(r.recovery_date, 'MMYYYY'), 'MM/YYYY')) date_MY
    from recovery r,
    recovery_detail rd,
    event e,
    client c,
    branch_group b,
    employer_group g,
    event_case ec,
    event_type_lookup etl
    where r.event_id = e.event_id
    and r.event_case_id = ec.event_case_id
    and ec.event_id = e.event_id
    and rd.recovery_id(+) = r.recovery_id
    and r.recovery_date between v_startdate and
    to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
    'MMDDRRRR HH24MISS')
    and e.client_id = c.client_id
    and g.client_id = c.client_id
    and b.client_id = c.client_id
    and g.employer_group_id(+) = e.employer_group_id
    and b.branch_group_id(+) = g.branch_group_id
    and e.event_type_code = etl.event_type_code -- SST 130852 04/14/09
    group by r.event_id,
    r.event_case_id,
    c.client_id,
    c.client_code,
    c.client_name,
    b.branch_group_code,
    b.branch_group_description,
    g.employer_group_code,
    g.employer_group_name,
    e.client_policy_identifier,
    e.date_of_incident,
    e.event_type_code,
    ec.close_date,
    get_case_value(ec.event_id, ec.event_case_id, v_enddate),
    nvl(etl.fee_percent_flag, 'N')
    having sum(nvl(r.amount, 0)) <> 0
    order by c.client_code,
    b.branch_group_code,
    g.employer_group_code,
    r.event_case_id;
    Edited by: user11961230 on Oct 20, 2009 9:02 AM

    user11961230 wrote:
    1. I want to get rid of the p_start and p_end. So how do i declare the v_startdate and v_enddate in the following part?
    v_startdate := to_date(p_start, 'YYYY/MM');
    v_enddate := last_day(to_date(p_end, 'YYYY/MM'));I'm not sure what you mean by "declare".
    In PL/SQL, "declare" means state (at the beginning of a block) that there will be a certain variable with a certain name (such as v_startdate) and datatype (such as DATE). You're already declaring the variables v_startdate and v_enddate correctly, right before the BEGIN statement.
    Declaring a variable is not the same as initializing it, that is, giving it a value for the first time. Your next question seems to be about initializing..
    2. where exactly shud i include the logic that u have mentioned. sorry a dumb questionIn place of the two assignment statments that reference p_start and p_end.
    3. This time am gonna use frequency instead of report_type so that i will get rid of the p_start and p_end from the procedure.Do you mean you want to pass an argument (called frequency) that tells if you want a quarterly or a mionthly report, just like the variable report_type in my example?
    If so, replace report_type in my example with frequency.
    I think you want something like this:
    CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h
    (      report_record         in out     cr_return_types.gen_cursor
    ,      frequency         IN           VARCHAR2
    IS
         -- Declare local variables:
         v_startdate     date;
         v_enddate      date;
    BEGIN
         -- Initialize v_startdate and v_enddate, depending on frequency
         IF  frequency = 'QUARTERLY'
         THEN
              v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -3)
                                           , 'Q'
              v_enddate := TRUNC (SYSDATE, 'Q');
         ELSIF  frequency = 'MONTHLY'
         THEN
              v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -1)
                             , 'MM'
              v_enddate := TRUNC (SYSDATE, 'MM');
         END IF;
         --   Subtract one second from v_enddate
              v_enddate := v_enddate - ( 1
                                            / (24 * 60 * 60)
         open report_record for
         select --distinct r.recovery_id
                r.event_id,
         and     r.recovery_date  BETWEEN  v_startdate     
                         AND       v_enddate
         ...When you post formatted text on this site (and code should always be formatted), type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    Edited by: Frank Kulash on Oct 20, 2009 2:37 PM
    Changed query to use BETWEEN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help needed in debugging the BADI: BBP_CREATE_REQ_BACk

    Hi,
    I  need help in debugging a BADI which causing an error ' SE142 please enter quantity in line 3000111'.
    This happens only when number items in the cart are more than four and only for Service category items for which we have this BADI, if the items were less than or equal to 4, follow on document is created.
    Please let me know what could be the error.
    Thank you,
    Manyam
    METHOD if_ex_bbp_create_req_back~fill_req_interface.
    Method Parameters:
    *LOGICAL_SYSTEM     TYPE BBP_BACKEND_DEST-LOG_SYS OPTIONAL
    *REQ_ITEMS            TYPE BBP_REQ_ITEM_SPOOL
    *REQ_ITEM_ACCOUNT     TYPE BBP_REQ_ACCT_SPOOL
    *REQ_ITEM_TEXT     TYPE BBP_REQ_TEXT_SPOOL
    *REQ_LIMITS            TYPE BBP_REQ_LIMITS_SPOOL
    *REQ_CONTRACT_LIMITS     TYPE BBP_REQ_LIMITS_CONTR_SPOOL
    *REQ_SERVICES            TYPE BBP_REQ_SERV_SPOOL
    *REQ_SERV_ACCOUNT     TYPE BBP_REQ_SERV_ACC_SPOOL
    *REQ_SERV_TEXT     TYPE BBP_REQ_SERV_TEXT_SPOOL
    *REQ_ADDRDELIVERY     TYPE BBP_REQ_ADDRDELIVERY_SPOOL
    This is the logic to create a Service Requisition based on a service
    material group selected in the Shopping Cart.  This logic is based on
    SAP's standard function SPOOL_RQ_READ_BAPI_EXPORTS from which this
    BADI is called.
    INSERT FUNCTION SPOOL_RQ_READ_BAPI_EXPORTS TO REPROCESS DATA FOR
    SERVICE SPECIAL REQUESTS.  -- IOK 07/13/01
    *function spool_rq_read_bapi_exports.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(REQNO) LIKE  REQHEAD-REQNO
    *"     VALUE(REQUIS_NUMBER) LIKE  BAPIEBANC-PREQ_NO
    *"  EXPORTING
    *"     VALUE(SKIP_ITEMS_WITH_ERROR) LIKE  BAPIMMPARA-SELECTION
    *"     VALUE(LOGICAL_SYSTEM) LIKE  BBP_BACKEND_DEST-LOG_SYS
    *"  TABLES
    *"      REQUISITION_ITEMS STRUCTURE  BAPIEBANC
    *"      REQUISITION_ACCOUNT_ASSIGNMENT STRUCTURE  BAPIEBKN
    *"      REQUISITION_ITEM_TEXT STRUCTURE  BAPIEBANTX
    *"      REQUISITION_LIMITS STRUCTURE  BAPIESUHC
    *"      REQUISITION_CONTRACT_LIMITS STRUCTURE  BAPIESUCC
    *"      REQUISITION_SERVICES STRUCTURE  BAPIESLLC
    *"      REQUISITION_SRV_ACCASS_VALUES STRUCTURE  BAPIESKLC
    *"      RETURN STRUCTURE  BAPIRETURN
    *"      REQUISITION_SERVICES_TEXT STRUCTURE  BAPIESLLTX
    *"      REQUISITION_ADDRDELIVERY STRUCTURE  BBPS_RQADDRDELIVERY_46
    *"      CONTROL_RECORD STRUCTURE  BBP_CONTROL_RECORD
    *"  EXCEPTIONS
    *"      INTERNAL_ERROR
    ---- Data Declaration -  from LBBP_BS_RQTOP -
    - Header                         -
      DATA: reqheader TYPE reqhead.
    - Header services                -
      DATA: reqheaders TYPE reqheads.
    - References -
      TYPES: reqreferences_type TYPE reqref.
      DATA:  reqreferences      TYPE STANDARD TABLE OF reqreferences_type
                                     INITIAL SIZE 10.
      DATA:  l_reqreferences    TYPE reqreferences_type,
             x_reqreferences    TYPE reqreferences_type.
    - Administrative lines requirement request -
      TYPES: reqlines_type TYPE reqline.
      DATA:  reqlines      TYPE STANDARD TABLE OF reqlines_type
                                INITIAL SIZE 10.
      DATA:  l_reqlines    TYPE reqlines_type.
    - MRO-Lines requirement request -
      TYPES: reqlinemas_type TYPE reqlinema_eci.
      DATA:  reqlinemas      TYPE STANDARD TABLE OF reqlinemas_type
                                  INITIAL SIZE 10.
      DATA:  l_reqlinemas    TYPE reqlinemas_type.
    - SRV-Lines requirement request -
      TYPES: reqlinesrs_type TYPE bbps_reqlinesr_eci.
      DATA:  reqlinesrs      TYPE STANDARD TABLE OF reqlinesrs_type
                                  INITIAL SIZE 10.
      DATA:  l_reqlinesrs    TYPE reqlinesrs_type.
    - Texts requirement request -
      TYPES: reqtexts_type TYPE reqtext.
      DATA:  reqtexts      TYPE STANDARD TABLE OF reqtexts_type
                                INITIAL SIZE 10.
      DATA:  l_reqtexts    TYPE reqtexts_type.
    *- Delivery address
      TYPES: reqaddress_type TYPE reqaddress.
      DATA:  reqaddress      TYPE STANDARD TABLE OF reqaddress_type
                                  INITIAL SIZE 10.
      DATA:  l_reqaddress    TYPE reqaddress_type.
    - Account assignment requirement request -
      TYPES: reqaccts_type TYPE reqacct_470.
      DATA:  reqaccts      TYPE STANDARD TABLE OF reqaccts_type
                                INITIAL SIZE 10.
      DATA:  l_reqaccts    TYPE reqaccts_type.
    - tablekey with the shortlife-line -
      DATA: BEGIN OF shortkey,
               client   TYPE ec_client, "REQLINE-CLIENT,
               reqno    TYPE ec_reqno,  "REQLINE-REQNO,
               reqsline TYPE reqsline,  "REQLINE-REQSLINE,
               reqlline TYPE reqlline,  "REQLINE-REQLLINE,
            END OF shortkey.
    - tablekey with the longlife-line -
      DATA: BEGIN OF longkey,
               client   TYPE ec_client, "REQLINE-CLIENT,
               reqno    TYPE ec_reqno,  "REQLINE-REQNO,
               reqlline TYPE reqlline,  "REQLINE-REQLLINE,
            END OF longkey.
      DATA: BEGIN OF bankey,
                preq_no    TYPE banfn, "BAPIEBAN-PREQ_NO,
                preq_item  TYPE bnfpo, "BAPIPOGN-PREQ_ITEM,
            END OF bankey.
    any other working fields
      DATA: h_preq_item     TYPE bnfpo,       "BAPIEBANC-PREQ_ITEM,
            h_srv_item      TYPE bnfpo,       "BAPIEBANC-PREQ_ITEM,
            h_logsys        TYPE log_system.  "reqref-logical_system.
      DATA: h_serial_no     TYPE dzebkn.      "BAPIEBKN-SERIAL_NO.
      DATA: h_packno_item   TYPE packno,      "BAPIESLL-PCKG_NO,
            h_packno_srv    TYPE packno,      "BAPIESLL-PCKG_NO,
            h_introw        TYPE srv_line_no, "BAPIESLL-LINE_NO,
            h_serial_no_srv TYPE dzekkn,      "BAPIESKN-SERIAL_NO,
            h_srv_outl_created,
            next TYPE i,
            h_index         LIKE sy-tabix,
            h_wempf         TYPE wempf.       "bapiekkn-gr_rcpt.
    ------ End of std data declaration -
      DATA:   l_req_items               TYPE bapiebanc,
              l_req_item_account        TYPE bapiebkn,
              l_req_item_text               TYPE bapiebantx,
              l_req_limits               TYPE bapiesuhc,
              l_req_contract_limits      TYPE bapiesucc,
              l_req_services               TYPE bapiesllc,
              l_req_serv_account        TYPE bapiesklc,
              l_req_serv_text               TYPE bapieslltx,
              l_req_addrdelivery        TYPE bbps_rqaddrdelivery_46.
      DATA:
           old_req_items           TYPE STANDARD TABLE OF bapiebanc,
           old_req_item_account    TYPE STANDARD TABLE OF bapiebkn,
           old_req_item_text       TYPE STANDARD TABLE OF bapiebantx,
           old_req_limits          TYPE STANDARD TABLE OF bapiesuhc,
           old_req_contract_limits TYPE STANDARD TABLE OF bapiesucc,
           old_req_services        TYPE STANDARD TABLE OF bapiesllc,
           old_req_serv_account    TYPE STANDARD TABLE OF bapiesklc,
           old_req_serv_text       TYPE STANDARD TABLE OF bapieslltx,
           old_req_addrdelivery    TYPE STANDARD TABLE OF
                                              bbps_rqaddrdelivery_46.
      DATA: l_mat_group TYPE comm_category-category_id.
      DATA: f_change_required TYPE c,
            f_limit_change    TYPE c,
            f_mat_sr_change   TYPE c,
            f_first_change    TYPE c VALUE 'X'.
    Data declaration for Shopping Cart number and PO number
      DATA: reqno          TYPE ec_reqno,
            requis_number  TYPE banfn.
      DATA: l_current_item TYPE bnfpo,
            line_item(5)   TYPE n.
    ---- Begin Processing ----
      DATA: l_requis_number TYPE banfn.   "jms 022802
    DEBUG TOOL ****** Goto SM50
    *data: i type i value 1.
    *while i <> 0.
    i = i + 1.
    *endwhile.
    END DEBUG TOOL *******
    Get Req Number and Shopping Cart Number
    read table req_items into l_req_items index 1.
    requis_number = l_req_items-preq_no.
    select single reqno
         into  (reqno)
         from  reqref
         where refnumber = requis_number.
    read detailed data from the requirement request
    call function 'BBP_REQREQ_GETDETAIL'
          EXPORTING
               reqno               = reqno
          IMPORTING
               req_header          = reqheader
               req_header_srv      = reqheaders
          TABLES
               req_reference       = reqreferences
               req_line            = reqlines
               req_line_mat        = reqlinemas
               req_line_srv        = reqlinesrs
               req_text            = reqtexts
               req_acct            = reqaccts
               req_address         = reqaddress
          EXCEPTIONS
               not_found           = 1
               foreign_lock        = 2
               no_enqueue_possible = 3
               others              = 4.
    if sy-subrc <> 0.
       raise internal_error.
       exit.
    endif.
    Begin JMS
    PO_NUM = PO_HEADER-PO_NUMBER.
    CMH Data declaration
      TYPES: et_header TYPE bbp_pds_sc_header_d.
      DATA:  t_et_header TYPE STANDARD TABLE OF et_header INITIAL SIZE 0,
             x_et_header TYPE et_header.
      TYPES: et_item TYPE bbp_pds_sc_item_d.
      DATA:  t_et_item TYPE STANDARD TABLE OF et_item INITIAL SIZE 0,
             x_et_item TYPE et_item.
      TYPES: sc_header TYPE bbp_pds_sc_header_d.
      DATA:  x_sc_header TYPE sc_header.
      TYPES: sc_is_pd TYPE xfeld.
      DATA:  l_sc_is_pd TYPE sc_is_pd.
      TYPES: sc_item TYPE bbp_pds_sc_item_d.
      DATA:  t_sc_item TYPE STANDARD TABLE OF sc_item INITIAL SIZE 0,
             x_sc_item TYPE sc_item.
      TYPES: sc_account TYPE bbp_pds_acc.
      DATA:  t_sc_account TYPE STANDARD TABLE OF sc_account INITIAL SIZE 0,
             x_sc_account TYPE sc_account.
      TYPES: sc_partner TYPE bbp_pds_partner.
      DATA:  t_sc_partner TYPE STANDARD TABLE OF sc_partner INITIAL SIZE 0,
             x_sc_partner TYPE sc_partner.
      TYPES: sc_confirm TYPE bbp_pds_con.
      DATA:  t_sc_confirm TYPE STANDARD TABLE OF sc_confirm INITIAL SIZE 0,
             x_sc_confirm TYPE sc_confirm.
      TYPES: sc_longtext TYPE bbp_pds_longtext.
      DATA:  t_sc_longtext TYPE
               STANDARD TABLE OF sc_longtext INITIAL SIZE 0,
             x_sc_longtext TYPE sc_longtext.
      TYPES: sc_limit TYPE bbp_pds_limit.
      DATA:  t_sc_limit TYPE STANDARD TABLE OF sc_limit INITIAL SIZE 0,
             x_sc_limit TYPE sc_limit.
      TYPES: sc_orgdata TYPE bbp_pds_org.
      DATA:  t_sc_orgdata TYPE
               STANDARD TABLE OF sc_orgdata INITIAL SIZE 0,
             x_sc_orgdata TYPE sc_orgdata.
      TYPES: sc_tax TYPE bbp_pds_tax.
      DATA:  t_sc_tax TYPE STANDARD TABLE OF sc_tax INITIAL SIZE 0,
             x_sc_tax TYPE sc_tax.
      TYPES: sc_pridoc TYPE bbp_pds_prc.
      DATA:  t_sc_pridoc TYPE STANDARD TABLE OF sc_pridoc INITIAL SIZE 0,
             x_sc_pridoc TYPE sc_pridoc.
      TYPES: sc_messages TYPE bbp_pds_messages.
      DATA:  t_sc_messages TYPE
               STANDARD TABLE OF sc_messages INITIAL SIZE 0,
             x_sc_messages TYPE sc_messages.
      TYPES: sc_actval TYPE bbp_pds_actval.
      DATA:  t_sc_actval TYPE STANDARD TABLE OF sc_actval INITIAL SIZE 0,
             x_sc_actval TYPE sc_actval.
      TYPES: sc_acc_actval TYPE bbp_pds_actval.
      DATA:  t_sc_acc_actval TYPE STANDARD TABLE OF sc_acc_actval
                                                          INITIAL SIZE 0,
             x_sc_acc_actval TYPE sc_acc_actval.
      TYPES: sc_header_rel TYPE bbp_pds_hrel.
      DATA:  t_sc_header_rel TYPE STANDARD TABLE OF sc_header_rel
                                                          INITIAL SIZE 0,
             x_sc_header_rel TYPE sc_header_rel.
      TYPES: sc_itmlim_rel TYPE bbp_pds_ilrel.
      DATA:  t_sc_itmlim_rel TYPE STANDARD TABLE OF sc_itmlim_rel
                                                          INITIAL SIZE 0,
             x_sc_itmlim_rel TYPE sc_itmlim_rel.
      TYPES: it_cuf_item_type TYPE bbps_cuf_item.
      DATA:  t_it_cuf_item TYPE STANDARD TABLE OF it_cuf_item_type
                                                          INITIAL SIZE 0,
             x_it_cuf_item TYPE it_cuf_item_type.
    - Contract limits                -
      TYPES: reqconlimits_type TYPE reqheads.
      DATA:  reqconlimits      TYPE STANDARD TABLE OF reqconlimits_type
                                INITIAL SIZE 10.
      DATA:  l_reqconlimits    TYPE reqconlimits_type.
      DATA:   lv_abort      TYPE xfeld,
              lv_is_pd      TYPE xfeld,
              lv_deliv_date LIKE sy-datum,
              lv_tabix      LIKE sy-tabix,
              lv_line       TYPE introw,
              lv_msarg      TYPE char200,
              lv_sc_guid    TYPE bbp_pdview_iap-header,
              lv_req_guid   TYPE bbp_pdview_iap-header.
      DATA: x_requis_number TYPE bapiebanc.
      IF NOT req_items[] IS INITIAL.
        CLEAR l_requis_number.
        READ TABLE req_items INTO x_requis_number INDEX 1.
        l_requis_number = x_requis_number-preq_no.
        requis_number = x_requis_number-preq_no.
      ENDIF.
    Get PO Guid from Backend Table.
      SELECT SINGLE guid
             INTO   lv_req_guid
             FROM   bbp_pdbei
             WHERE  be_object_id   =  l_requis_number
             AND    be_object_type = 'BUS2105'.
    Get Shopping Cart Guid from PO Guid
      SELECT SINGLE header
             INTO   lv_sc_guid
             FROM   bbp_pdview_iap
             WHERE  guid = lv_req_guid.
    Get detail from shopping cart
      CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
        EXPORTING
          i_guid                  = lv_sc_guid
          i_with_itemdata         = 'X'
        IMPORTING
          e_header                = x_sc_header
          ev_is_pd                = l_sc_is_pd
        TABLES
          e_item                  = t_sc_item
          e_account               = t_sc_account
          e_partner               = t_sc_partner
          e_confirm               = t_sc_confirm
          e_longtext              = t_sc_longtext
          e_limit                 = t_sc_limit
          e_orgdata               = t_sc_orgdata
          e_tax                   = t_sc_tax
          e_pridoc                = t_sc_pridoc
          e_messages              = t_sc_messages
          e_actval                = t_sc_actval
          e_acc_actval            = t_sc_acc_actval
          e_header_rel            = t_sc_header_rel
          e_itmlim_rel            = t_sc_itmlim_rel.
      lv_is_pd = l_sc_is_pd.
    message handling
      IF NOT t_sc_messages[] IS INITIAL.
        CALL FUNCTION 'BBP_BS_ADD_MESSAGES'
          IMPORTING
            ev_abort    = lv_abort
          TABLES
            it_messages = t_sc_messages.
      ENDIF.
    if error occured set alert/ exception.
      IF NOT lv_abort IS INITIAL.
        CALL FUNCTION 'BBP_ALERT_SB_LOCAL'
          EXPORTING
            msgid              = 'BBP_PD'
            msgno              = 280
            msgarg1            = lv_msarg
          EXCEPTIONS
            invalid_parameters = 1
            OTHERS             = 2.
       RAISE internal_error.
      ENDIF.
    map shopping cart in new structure into old structure to be able
    to continue with the old coding
      REFRESH t_sc_messages.
      CALL FUNCTION 'BBP_SC_MAP_PD_TO_REQ'
        EXPORTING
          is_new_header    = x_sc_header
        IMPORTING
          es_reqhead       = reqheader
          es_req_heads     = reqheaders
         es_cuf_header    = is_cuf_header
        TABLES
          et_req_reference = reqreferences
          et_req_line      = reqlines
          et_req_line_mat  = reqlinemas
          et_req_line_srv  = reqlinesrs
          et_req_text      = reqtexts
          et_req_acct      = reqaccts
          et_req_address   = reqaddress
          et_req_conlimit  = reqconlimits
          it_new_items     = t_sc_item
          it_account       = t_sc_account
          it_partner       = t_sc_partner
          it_longtext      = t_sc_longtext
          it_limit         = t_sc_limit
          it_orgdata       = t_sc_orgdata
          it_tax           = t_sc_tax
          it_actval        = t_sc_actval
          it_itmlim_rel    = t_sc_itmlim_rel
          et_messages      = t_sc_messages.
         et_cuf_item      = it_cuf_item
         et_cuf_acc       = it_cuf_acc.
      IF NOT t_sc_messages[] IS INITIAL.
    message handling
        CALL FUNCTION 'BBP_BS_ADD_MESSAGES'
          IMPORTING
            ev_abort    = lv_abort
          TABLES
            it_messages = t_sc_messages.
      ENDIF.
    if error occured set alert/ exception.
      IF NOT lv_abort IS INITIAL.
        CALL FUNCTION 'BBP_ALERT_SB_LOCAL'
          EXPORTING
            msgid              = 'BBP_PU'
            msgno              = 326
            msgarg1            = lv_msarg
          EXCEPTIONS
            invalid_parameters = 1
            OTHERS             = 2.
       RAISE internal_error.
      ENDIF.
    End insert 03/26/2003
    ReqReferences doesn't list the PO item number.  We'll need that to
    associate the WBS to a Service Sub Item later.  Let's put it in.
      SORT reqreferences BY client refnumber reqlline.
      LOOP AT reqreferences INTO x_reqreferences.
        IF x_reqreferences-refline IS INITIAL.
          IF l_requis_number = x_reqreferences-refnumber. "jms 022802
            ADD 1 TO line_item.
          ELSE.
            l_requis_number = x_reqreferences-refnumber.  "jms 022802
            line_item = 1.
          ENDIF.
        Accumulate the line item
          x_reqreferences-refline = line_item.
          MODIFY reqreferences FROM x_reqreferences INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
      SORT reqlines      BY client reqno reqlline.
      SORT reqreferences BY client reqno reqlline counter.
      SORT reqlinemas    BY client reqno reqsline reqlline.
      SORT reqlinesrs    BY client reqno reqsline reqlline.
      SORT reqaccts      BY client reqno reqlline serial_no. " note 359605
      CLEAR: h_preq_item.
      CLEAR: h_srv_item, h_srv_outl_created,
             h_packno_item, h_packno_srv, h_introw.
    First, the Shopping Cart number should be extracted from REQREF table
    based on the Req number.
    take all items with the specific reference number
      LOOP AT reqreferences
         INTO l_reqreferences                                  "iok 091701
        WHERE refnumber EQ requis_number.
       if logical_system is initial.
         logical_system = l_reqreferences-logical_system.
       endif.
        MOVE-CORRESPONDING l_reqreferences TO longkey.
      read table reqlines with key longkey binary search.
        READ TABLE reqlines INTO l_reqlines                    "iok 091701
            WITH KEY client = longkey-client
                      reqno = longkey-reqno
                   reqlline = longkey-reqlline
                   BINARY SEARCH.
        CHECK sy-subrc EQ 0.
        h_preq_item = l_reqlines-reqsline+5(5).
      clear h_preq_item.
      Change line_type based on Material Group
      add code here later.
        CLEAR: f_change_required,
               f_mat_sr_change,
               f_limit_change.
        SELECT SINGLE category_id
          INTO l_mat_group
          FROM comm_category
         WHERE category_guid = l_reqlines-category.
      Check if Services Special Request
        IF l_reqlines-catalogid IS INITIAL AND
           l_reqlines-product   IS INITIAL AND
           l_mat_group(1)        = 'S'     AND
           l_reqlines-line_type  = '1'.     "Service Special Request
        Set flags for future processing
          l_reqlines-line_type = '3'.
          f_change_required    = 'X'.
          f_limit_change       = 'X'.
      Check if Material Special Request
        ELSEIF l_reqlines-catalogid IS INITIAL AND
               l_reqlines-product   IS INITIAL AND
               l_mat_group(1)       <> 'S'     AND
               l_reqlines-line_type = '1'. "Material Special Request
        Set flags for future processing
          f_change_required = 'X'.
          f_mat_sr_change = 'X'.
        ENDIF.
        CHECK f_change_required = 'X'.
      For Material Special Requests only need to select and store UNSPSC
      code   -- iok 092401
        IF f_mat_sr_change = 'X'.
        Get UNSPSC code (first hit) based on Material Group and store
        in text id B05.   iok 092101
          READ TABLE req_items INTO l_req_items
              WITH KEY preq_item = h_preq_item
                       mat_grp   = l_mat_group.
          READ TABLE req_item_text INTO l_req_item_text
              WITH KEY preq_no   = requis_number
                       preq_item = l_req_items-preq_item
                       text_id = 'B05'.
          IF sy-subrc <> 0.
            CLEAR l_req_item_text.
          Find a UNSPSC Code from a Material Group .. even it's arbitrary
            SELECT unspsc_code UP TO 1 ROWS
                 FROM zxl8_category_id
                 INTO l_req_item_text-text_line
                WHERE category_id = l_mat_group.
            ENDSELECT.
          If nothing found then fill in a dummy UNSPSC.  The first
          letter of the Material will designate whether it's a Material
          or Service.
            IF sy-subrc NE 0.
            Move the Material Group value into a holding variable
              CONCATENATE l_mat_group(1) 'XXXXXXXX'
                     INTO l_req_item_text-text_line.
            ENDIF.
            l_req_item_text-preq_no   = requis_number.
            l_req_item_text-preq_item = l_req_items-preq_item.
            l_req_item_text-text_id   = 'B05'.
            INSERT l_req_item_text INTO TABLE req_item_text.
          ENDIF.
          CONTINUE.  "to next item.
        ENDIF.
        IF f_first_change = 'X' AND f_limit_change = 'X'.
        Save old P.Req. data and clear tables
          old_req_items[]           = req_items[].
          old_req_item_account[]    = req_item_account[].
          old_req_item_text[]       = req_item_text[].
          old_req_limits[]          = req_limits[].
          old_req_contract_limits[] = req_contract_limits[].
          old_req_services[]        = req_services[].
          old_req_serv_account[]    = req_serv_account[].
          old_req_serv_text[]       = req_serv_text[].
          old_req_addrdelivery[]    = req_addrdelivery[].
          REFRESH:  req_items,
                    req_item_account,
                  req_item_text,
                    req_limits,
                    req_contract_limits,
                    req_services,
                    req_serv_account,
                    req_serv_text.
                  req_addrdelivery.
          CLEAR f_first_change.
        ENDIF.
      Limit
        IF l_reqlines-line_type EQ '3'.
          and not reqheaders-limit is initial.
          DATA: l_reqreferences_temp   TYPE reqreferences_type.
        +JMS 2/26/2002
          CLEAR l_reqreferences_temp.
          READ TABLE reqreferences INTO l_reqreferences_temp
            WITH KEY client   = longkey-client
                     reqno    = longkey-reqno
                     reqlline = longkey-reqlline
                     BINARY SEARCH.
          IF sy-subrc = 0.
            h_preq_item = l_reqreferences_temp-refline.
          ENDIF.
          CLEAR l_req_items.
          READ TABLE old_req_items INTO l_req_items
              WITH KEY preq_item = h_preq_item.
          MOVE-CORRESPONDING l_req_items TO reqheaders.
          reqheaders-begdate   = l_req_items-deliv_date.
          reqheaders-limit     = l_req_items-c_amt_bapi.
          reqheaders-exp_value = l_req_items-c_amt_bapi.
          reqheaders-gr_ind    = 'X'.
          reqheaders-reqno     = l_req_items-preq_no.           "jms 022602
          CLEAR l_req_items.
    INSERT FORM **** CREATE_SERVICE_ITEM
          h_packno_item = h_packno_item + 1.
          h_packno_srv  = h_packno_srv  + 10000.
          h_introw      = h_introw + 1.
          CLEAR l_req_items.                                 " Note 364396
          MOVE-CORRESPONDING reqheaders TO l_req_items.
          l_req_items-preq_no = reqheaders-reqno.               "jms 022602
         l_REQ_ITEMS-PREQ_NO = REQUIS_NUMBER.                 "jms 022602
    l_REQ_ITEMS-PREQ_ITEM = H_PREQ_ITEM + 1.    "iok 091801
          l_req_items-preq_item = h_preq_item.                  "iok 091801
          l_current_item = h_preq_item.                         "iok 092101
          h_srv_item  = l_req_items-preq_item.
          h_preq_item = h_preq_item + 1.
          IF NOT reqheaders-limit IS INITIAL OR
             NOT reqheaders-exp_value IS INITIAL.
            IF reqheaders-gr_ind IS INITIAL.
              l_req_items-item_cat = '1'.
            ELSE.
              l_req_items-item_cat = '9'.
            ENDIF.
            l_req_items-deliv_date = reqheaders-begdate.
          ELSE.
            l_req_items-item_cat = '9'.
          ENDIF.
          IF l_req_items-del_datcat IS INITIAL.
            l_req_items-del_datcat = '1'.
          ENDIF.
          l_req_items-quantity = 1.
          l_req_items-pckg_no  = h_packno_item.
          IF l_req_items-preq_name EQ space.
            l_req_items-preq_name = sy-uname.
          ENDIF.
          APPEND l_req_items TO req_items.
    END OF FORM INSERTION ********
          l_req_limits-pckg_no    = h_packno_item.
          l_req_limits-limit      = reqheaders-limit.
          l_req_limits-exp_value  = reqheaders-exp_value.
          l_req_limits-no_limit   =  reqheaders-no_limit.
          l_req_limits-no_frlimit = 'X'.
          APPEND l_req_limits TO req_limits.
    *.... Account assignment
        clear requisition_srv_accass_values.
          CLEAR l_req_serv_account.
          l_req_serv_account-pckg_no = h_packno_item.
          MOVE-CORRESPONDING l_reqlines TO longkey.
        read table reqaccts with key longkey binary search. "iok 091801
          READ TABLE reqaccts INTO l_reqaccts                   "iok 091801
            WITH KEY client   = longkey-client
                     reqno    = longkey-reqno
                     reqlline = longkey-reqlline
                     BINARY SEARCH.
          IF sy-subrc = 0.
            LOOP AT reqaccts
                INTO l_reqaccts
                WHERE reqno    = l_reqreferences-reqno
                AND   reqlline = l_reqreferences-reqlline.
    INSERT FULL FORM *********** FILL_REQ_ACCT_SRV
              DATA: acctcomp1 TYPE bapiebkn,
                    acctcomp2 TYPE bapiebkn,
                    high_serial TYPE dzekkn.  "LIKE BAPIEKKN-SERIAL_NO.
              CLEAR l_req_serv_account-serial_no.
              CLEAR acctcomp1.
              MOVE-CORRESPONDING l_reqaccts TO acctcomp1.
              CLEAR: acctcomp1-preq_no,
                     acctcomp1-preq_item,
                     acctcomp1-serial_no,
                     acctcomp1-created_on,
                     acctcomp1-created_by,
                     acctcomp1-preq_qty,
                     acctcomp1-distr_perc,
                     acctcomp1-change_id,
                     acctcomp1-currency.
              LOOP AT req_item_account INTO l_req_item_account.
                CLEAR acctcomp2.
      MOVE-CORRESPONDING l_req_item_account TO ACCTCOMP2.  "is blank
                CLEAR: acctcomp2-preq_no,
                       acctcomp2-preq_item,
                       acctcomp2-serial_no,
                       acctcomp2-created_on,
                       acctcomp2-created_by,
                       acctcomp2-preq_qty,
                       acctcomp2-distr_perc,
                       acctcomp2-change_id,
                       acctcomp2-currency.
               IF acctcomp1 EQ acctcomp2  AND h_srv_outl_created IS INITIAL.
                l_req_serv_account-serial_no = l_req_item_account-serial_no.
                  EXIT.
                ENDIF.
                high_serial = l_req_item_account-serial_no.
              ENDLOOP.
              h_srv_outl_created = ' '.
              IF l_req_serv_account-serial_no IS INITIAL.
                MOVE-CORRESPONDING l_reqaccts TO l_req_item_account.
               l_REQ_item_ACCOUNT-PREQ_NO   = REQUIS_NUMBER.   "jms 022702
                l_req_item_account-preq_no = l_req_items-preq_no."jms 022702
                l_req_item_account-preq_item = h_srv_item.
    REQUISITION_ACCOUNT_ASSIGNMENT-WBS_ELEM_E = REQACCT-BBP_PROJECT.
                l_req_item_account-serial_no = high_serial + 1.
                l_req_serv_account-serial_no = l_req_item_account-serial_no.
                APPEND l_req_item_account TO req_item_account.
              ENDIF.
    END OF FORM INSERTION ***********
              h_serial_no = h_serial_no + 1.
              l_req_serv_account-serno_line = h_serial_no.
              l_req_serv_account-percentage = l_reqaccts-distr_perc.
              APPEND l_req_serv_account TO req_serv_account.
            ENDLOOP.
    INSERT FULL FORM **************** CONVERT_ACCOUNT_***_CAT
    data: account_tab LIKE bbp_pds_acc OCCURS 0 WITH HEADER LINE.
            DATA: account_tab TYPE STANDARD TABLE OF bbp_pds_acc.
            DATA: l_account_tab TYPE bbp_pds_acc.
            DATA: h_knttp TYPE knttp.
          move the accounting data to that item into the interface table
                LOOP AT reqaccts
               INTO l_reqaccts
              WHERE reqno    EQ l_reqreferences-reqno
                AND reqlline EQ l_reqreferences-reqlline.
              MOVE-CORRESPONDING l_reqaccts TO l_account_tab.
              APPEND l_account_tab TO account_tab.
            ENDLOOP.
          call the convert API
            CALL FUNCTION 'BBP_ACCCAT_MAP_EXP'
                 EXPORTING
                      i_logical_system = logical_system
                 IMPORTING
                      e_r3_acc_cat     = h_knttp
                 TABLES
                      i_pd_account     = account_tab.
            IF h_knttp IS INITIAL.
              h_knttp = 'X'.
            ENDIF.
          +JMS 2/14/2002 Issue #1590
            CLEAR   account_tab.
            REFRESH account_tab.
          account assignment category - set in the correct item
            LOOP AT req_items
               INTO l_req_items
              WHERE preq_item EQ l_req_item_account-preq_item.
              l_req_items-acctasscat = h_knttp.
              MODIFY req_items FROM l_req_items INDEX sy-tabix.
            ENDLOOP.
    END OF FORM INSERTION ************
          ELSE.
    INSERT FULL FORM ************* Form  CONVERT_ACCOUNT_***_CAT_U
            LOOP AT req_items
               INTO l_req_items
              WHERE preq_item EQ l_current_item.
              l_req_items-acctasscat = 'U'.
              MODIFY req_items FROM l_req_items INDEX sy-tabix.
            ENDLOOP.
    END OF FORM INSERTION ************
          ENDIF.
        Get UNSPSC code (first hit) based on Material Group and store
        in text id B05.   iok 092101
          READ TABLE req_items INTO l_req_items
              WITH KEY preq_item = l_current_item
                       mat_grp   = l_mat_group.
          READ TABLE req_item_text INTO l_req_item_text
              WITH KEY preq_no   = requis_number
                       preq_item = l_req_items-preq_item
                       text_id   = 'B05'.
          IF sy-subrc <> 0.
            CLEAR l_req_item_text.
          Get UNSPSC Code from Material Group .. even if arbitrary
            SELECT unspsc_code UP TO 1 ROWS
              FROM zxl8_category_id
              INTO l_req_item_text-text_line
             WHERE category_id = l_mat_group.
            ENDSELECT.
          If nothing found then fill in a dummy UNSPSC.  The first
          letter of the Material will designate whether it's a Material
          or Service.
            IF sy-subrc NE 0.
            Move the Material Group value into a holding variable
              CONCATENATE l_mat_group(1) 'XXXXXXX'
                     INTO l_req_item_text-text_line.
            ENDIF.
            l_req_item_text-preq_no   = requis_number.
            l_req_item_text-preq_item = l_req_items-preq_item.
            l_req_item_text-text_id   = 'B05'.
            INSERT l_req_item_text INTO TABLE req_item_text.
          ENDIF.
        Don't send Internal Note to Backend
         delete req_item_text where text_id = 'B02'.
    Service -- NOT NEEDED -- IOK 07/13/01
       elseif not reqlines-reqsline is initial
             and reqlines-line_type eq '2'.
         move-corresponding reqlines to shortkey.
         read table reqlinesrs with key shortkey binary search.
         if sy-subrc = 0.
           h_serv = reqlinesrs.
           append h_serv.
         endif.
    material item -- NOT NEEDED -- IOK 07/13/01
        ENDIF.
      ENDLOOP.
    Services -- NOT NEED -- IOK 07/13/01
      IF f_limit_change = 'X'.
      Check multiple account assignment
        LOOP AT req_items INTO l_req_items.
          h_index = sy-tabix.
          CLEAR next.
          LOOP AT req_item_account
             INTO l_req_item_account
            WHERE preq_item EQ l_req_items-preq_item.
            next = next + 1.
          ENDLOOP.
          IF next > 1.
            l_req_items-distrib    = '2'. "prozentuale Verteilung
            l_req_items-part_inv   = '1'.
            l_req_items-gr_non_val = 'X'.
           MODIFY req_items FROM l_req_items INDEX h_index.     "217191
         modify requisition_items.                                "217191
          ENDIF.
        ENDLOOP.
      ENDIF.
    Remap delivery address for backend processing
      LOOP AT req_addrdelivery INTO l_req_addrdelivery.
        MOVE:  l_req_addrdelivery-name_2   TO l_req_addrdelivery-name,
               l_req_addrdelivery-c_o_name TO l_req_addrdelivery-name_2.
        CLEAR: l_req_addrdelivery-c_o_name.
        MODIFY req_addrdelivery FROM l_req_addrdelivery INDEX sy-tabix.
      ENDLOOP.
    CHM 07/16/2003 Changed created by to always be actual creator even
                   for on behalf of situations
        LOOP AT req_items
           INTO l_req_items.
          l_req_items-created_by = x_sc_header-created_by.
          MODIFY req_items FROM l_req_items INDEX sy-tabix.
        ENDLOOP.
    CMH - end change
    MA 12/10/04 - Pass MP2 number from Manu Prod# to Req Item Text
    LOOP AT req_items INTO l_req_items.
        READ TABLE t_sc_item into x_sc_item
             WITH KEY number_int  = l_req_items-preq_item.
        l_req_item_text-preq_no   = requis_number.
        l_req_item_text-preq_item = l_req_items-preq_item.
        l_req_item_text-text_id   = 'B06'.
        l_req_item_text-text_line = x_sc_item-manu_prod.
        INSERT l_req_item_text INTO TABLE req_item_text.
    ENDLOOP.
    ENDMETHOD.

    Any help guys?
    Thanks
    Manyam

  • My 2011 MacBook Pro does not start and stop after the apple appear, they said that the problem is a video problem and need to change the logic board. Cost almost same to buy a new one. Somebody have the same problem?

    I have a MacBook Pro early 2011. Does not start. After the apple show, a blank screen appear. The service said that the problem is with the video plaquue in the logic board. Need to change. Cost lmmost the same than a new MacBook Pro. Somebody has the same problem? What we can do?

    I hate to break this to you, but life isn't fair. If your job is that critically in need of a computer, then you should have a spare to use for just this kind of situation or have your employer provide you with a computer to use.
    Computers break down, just like cars. If your car breaks down do you curse the car maker or get it fixed? Surely, you paid more for your car than the computer.
    This is reality. Best get used to it because it won't get any better.

  • Help needed in overriding the finalize() method!

    Hi
    I need some help in overwriting the finalize() method.
    I have a program, but at certain points, i would like to "kill" a particular object.
    I figured that the only way to do that is to make that object's class override the finalize method, and call it when i need to kill the object.
    Once that is done, i would call the garbage collector gc() to hopefully dispose of it.
    Please assist me?
    Thanks
    Regards

    To, as you put it, kill an object, just null it. This
    will be an indication for the garbage collector to
    collect the object. In the finalizer, you marely null
    all fields in the class. Like this:
    public class DummyClass
    String string = "This is a string";
    Object object = new Boolean(true);
    public void finalize() throws Throwable
    super.finalize();
    string = null;
    object = null;
    public static void main(String[] args)
    //Create a new object, i.e allocate an
    te an instance.
    DummyClass cls = new DummyClass();
    //Null the reference
    cls = null;
    This is a pointless exercise. If an object is being finalized, then all the references it contains are about to cease being relevant anyway, so there's no purpose to be served in setting them to null.
    All that clearing a reference to an object does is to clear the reference. Whether the object is subsequently finalized depends on whether the object has become unreachable.
    Directly calling finalize is permitted, but doesn't usually serve any purpose. In particular, it does not cause the object to be released. Further, calling the finalize method does not consitute finalization of the object. Finalization occurs when the method is called as a consequence of a garbage collector action.
    If a variable contains a reference to an object (say a table), and you want a new table instead, then create a new table object, and assign its reference to the variable. Assuming that the variable was the only place that the old table's reference was stored, the old table will, sooner or later, get finalized and collected.
    Sylvia.

  • Help needed in understanding the concept of hierarchical queries

    I really need help in this matter. I have a flafile containing about 4000 rows. It is from my supplier, it's structure is as follows:
    create table Flatfile
    (Pgroup varchar2(30),
    Pclass varchar2(30),
    Manufacturer varchar2(30),
    Article varchar2(30),
    Price Number(6,2));
    Insert into Flatfile Values
    ('Application Software','Database Software','Oracle','Oracle 10G',115);
    Insert into Flatfile Values
    ('Application Software','Database Software','Microsoft','MS SQL Server 2000',200);
    Insert into Flatfile Values
    ('Application Software','Spreadsheet Software','Microsoft','Excel',100);
    Insert into Flatfile Values
    ('Monitor','15"','Acer','Acer 15"" TFT superscreen',199);
    Insert into Flatfile Values
    ('Monitor','15"','Sony','Sony R1500 flat',225);
    Insert into Flatfile Values
    ('Monitor','17"','Philips','Philips Flatscreen',250);
    Insert into Flatfile Values
    ('Monitor','19"','Viewsonic','Viewsonic PLasma Monitor',275);
    Insert into Flatfile Values
    ('Processor','AMD','AMD','FX-55',600);
    Insert into Flatfile Values
    ('Processor','Intel','Intel','P4 3 GHZ',399);
    My goal is to make a hierarchical query with the start with and connect by clauses. From what I have read is that I need to normalize the data of the flatfile.
    How do I achieve a table which I can query so that the query will represent the hierarchy that exists. Namely
    Pgroup
    ++Pclasse
    Application Software
    ++Database Software
    ++Spreadsheet Software
    So a 2-level hierarchy. I'd like to understand this simple concept first. I built on the knowledge that I gain. So the questions are:
    1.What do I need to do to make the table so that I can use a hierarchical query on it?
    2. How should the query syntax be?
    3. Is it also possible to get the data in the hierarchical query sorted asec?
    I would only like to use the simple structures of the start with and connect by clauses first. I've read there are some new additions to 10G. The problem with the examples used by the tutorials is that the tables are already made so that they are suitable for hierarchical queries. I hope to understand it by this example. And take it a step further.
    Sincerely,
    Pete

    Primarily hierarchy query serves to process tree-like structures which RDBMS simulates using through parent-child relation, often in a single table (see famoust
    EMP table where employee can have the manager who is an employee at the same time).
    In your case it could look like:
    SQL> select pgroup, pclass from flatfile;
    PGROUP                         PCLASS
    Application Software           Database Software
    Application Software           Database Software
    Application Software           Spreadsheet Software
    Monitor                        15"
    Monitor                        15"
    Monitor                        17"
    Monitor                        19"
    Processor                      AMD
    Processor                      Intel
                                   Application Software
                                   Monitor
                                   Processor
    12 rows selected.
    SQL> select decode(level,1,pclass,'  ' || pclass), Manufacturer from flatfile
      2  start with pgroup is null
      3  connect by prior pclass = pgroup
      4  /
    DECODE(LEVEL,1,PCLASS,''||PCLASS MANUFACTURER
    Application Software
      Database Software              Oracle
      Database Software              Microsoft
      Spreadsheet Software           Microsoft
    Monitor
      15"                            Acer
      15"                            Sony
      17"                            Philips
      19"                            Viewsonic
    Processor
      AMD                            AMD
      Intel                          Intel
    12 rows selected.The hierarchy syntax is described completely in the documentation including
    LEVEL and PRIOR keywords.
    As for the ordering question you can use siblings ordering:
    SQL> select decode(level,1,pclass,'  ' || pclass), Manufacturer from flatfile
      2  start with pgroup is null
      3  connect by prior pclass = pgroup
      4  order siblings by 1 desc
      5  /
    DECODE(LEVEL,1,PCLASS,''||PCLASS MANUFACTURER
    Processor
      Intel                          Intel
      AMD                            AMD
    Monitor
      19"                            Viewsonic
      17"                            Philips
      15"                            Acer
      15"                            Sony
    Application Software
      Spreadsheet Software           Microsoft
      Database Software              Oracle
      Database Software              Microsoft
    12 rows selected.Rgds.

  • Help needed in using the appropriate Trigger

    I have a master detail form.DEPT block is the master block and Employee is Detail block.I need to display the message when user is
    trying to enter the ENAME field in the Employee block(detail) when the DEPTNO in the DEPT block(master) is not equal to 10.
    Messgae should be displayed when user trying to type the value but not when the user navigates into the ENAME text field.
    What is the appropriate trigger that is useful here?
    Thanks.
    GSR

    If the DEPT block is table based in the block's POST-QUERY trigger you can simply set
      if :DEPT.DEPTNO !=10 then
        set_item_proerty('DEPT.ENAME', insert_allowed, property_false);
        set_item_proerty('DEPT.ENAME', update_allowed, property_false);
      else
        set_item_proerty('DEPT.ENAME', insert_allowed, property_true);
        set_item_proerty('DEPT.ENAME', update_allowed, property_true);
      end if;if the block is a non-database one then you can put that code in EMPNAME's WHEN-VALIDATE-ITEM trigger
    Luca
    Don't forget to mark the answer as helpful/correct if it is. please.

  • Help needed in using the DocCheck utility

    Hi
    Can somebody help me to use the DocCheck utility.I need to check that all the java files have the required javadoc tags and they are correct.
    I have downloaded the zip file and I have been giving the following commands
    c:\javadoc -doclet com.sun.tools.doclets.doccheck.DocCheck -docletpath c:\svk\jdk1.2.2\bin\doccheck1.2b1\lib\doccheck.jar -sourcepath<full path with the file name>
    But I get the following error message : No package or class specified.
    I also tried giving the following command:
    D:\SegaSource\sega\src\com\sega\account>javadoc -doclet com.sun.tools.doclets.do
    ccheck.DocCheck -docletpath d:\jdk1.3\doccheck1.2b1\lib\doccheck.jar User.java
    But I get the following message:
    Loading source file User.java...
    Constructing Javadoc information...
    javadoc: warning - Import not found: com.sega.account.address.Address - ignoring
    javadoc: warning - Import not found: com.sega.account.icon.Icon - ignoring!
    javadoc: warning - Import not found: com.sega.common.DateUtil - ignoring!
    javadoc: warning - Import not found: atg.nucleus.GenericService - ignoring!
    javadoc: warning - Cannot find class com.sega.account.icon.Icon
    javadoc: warning - Cannot find class com.sega.account.address.Address
    javadoc: warning - Cannot find class com.sega.account.MasterManager
    7 warnings
    please help
    Thanks
    SVK

    I have never ran the DocCheck from the command prompt, so I really don't know how to do it, but I do run it succesfully using ant (build tool from apache - jakarta, if you use tomcat you already have it installed).
    So.. if you do use ant.. this will help:
    <target name="doccheck" depends="prepare">
         <javadoc
              packagenames="${packages}"
                    destdir="${doccheck.home}"
              doclet="com.sun.tools.doclets.doccheck.DocCheck"
              docletpath="${doccheck.path}" >
              <classpath refid="project.classpath"/>
              <sourcepath refid="project.classpath"/>
         </javadoc>
    </target>If you don't use it.. I guess I was of no help, sorry.
    Ylan

  • I have a siebel application in english and i do have built the framework in oats,now if the application changes to arabic , do i need to change the logical name of the object?

    Hi
    Iam currently working on OATS automation for siebel application.
    I am having the marketing site in siebel in english language currently and i have developed framework for the same.
    Now, customer is changing the marketing site from english to arabic, now my question is will the logical name of the objects change?
    do i need to again build the Object repository for arabic as well or will the logical name remains the same?

    Hi,
    If you developed framework based on objects id, then that will work.
    If you used text of objects to identify them( say example click on a link with text 'SignUp') then script will fail - fail to find object with text mentioned in script
    Regards,
    Deepu M

  • Help need in writing a logic/proc

    SELECT   TRACK_NUM, MIN(sub_account) AS START_KEY, MAX(sub_account) AS END_KEY
      FROM (
                  SELECT to_number(sub_account) as sub_account,
                  RANK() OVER (PARTITION BY sub_account
                  ORDER BY ROWNUM) AS ROW_INSTANCE,
                  NTILE(  20  ) OVER (ORDER BY sub_account) AS TRACK_NUM
                  FROM  STG_SUB_MASTER_MONTH_HISTORY)
                  WHERE ROW_INSTANCE = 1
                  GROUP BY TRACK_NUM ;The above sql gives result set like
    TRACK_NUM     START_KEY     END_KEY
    1     200000028     2095931954
    2     2095932501     5067004214
    3     5067004346     1.1092E+10
    4     1.1092E+10     2.1028E+10
    5     2.1028E+10     2.3078E+10
    6     2.3078E+10     2.9010E+10
    7     2.9010E+10     3.1089E+10
    8     3.1089E+10     3.3051E+10
    9     3.3051E+10     3.4081E+10
    10     3.4081E+10     3.7014E+10
    11     3.7014E+10     3.7067E+10
    12     3.7067E+10     4.1006E+10
    13     4.1006E+10     4.5040E+10
    14     4.5040E+10     4.9047E+10
    15     4.9047E+10     5.2030E+10
    16     5.2030E+10     6.4578E+10
    17     6.4578E+10     7.1001E+10
    18     7.1001E+10     7.1035E+10
    19     7.1035E+10     7.2048E+10
    20     7.2048E+10     7.9553E+10Now i have to pass these start key and end key to my below code
    Insert into /*+ Parallel (A,8) append */ Sub_phone_Rateplan_fss A
    SELECT /* Index(Sub, IDX_Sub_hist)*/
                    sub.MARKET_CODE        ,
                            sub.SUB_CTYPE ,
                            phn.PH_BASIC_SRV        ,
                            sub.MONTH_ID  ,
                             sub.SUB_ACCOUNT        ,
                            sub.SUB_LAST_NAME     ,
                           sub.SUB_FIRST_NAME   ,
                            SUB.WS_ENTRY_DATE AS SUB_WS_ENTRY_DATE   ,
                            sub.WS_DISC_DATE       ,
                            sub.SUB_DISC_REASON ,
                            sub.SUB_BILL_CYCLE    ,
                            sub.SUB_MUN_CODE     ,
                            sub.SUB_30DAY_BAL     ,
                            sub.SUB_60DAY_BAL     ,
                            sub.SUB_90DAY_BAL     ,
                            sub.SUB_OVR90_BAL     ,
                            sub.SUB_WRTOFF_AMT ,
                            sub.SUB_BALANCE_DUE ,
                            sub.SUB_CURRENT_BAL ,
                            sub.SUB_STATUS,
                            phn.PH_MOBIL_ID         ,
                            phn.WS_ESN_UN           ,
                            phn.WS_START_DATE    ,
                            phn.WS_STOP_DATE      ,
                            PHN.WS_ENTRY_DATE AS PHN_WS_ENTRY_DATE   ,
                            phn.PH_STATUS            ,
                            phn.PH_FEAT_CODES     ,
                            phn.PH_MODEL  ,
                            phn.CRICKET_LOCATION_ID_KEY           ,
                            phn.FEATURE_SET_ID 
                         -- NTILE(10) OVER(PARTITION BY SUB.SUB_ACCOUNT ORDER BY SUB.SUB_ACCOUNT) AS NT
                        FROM STG_SUB_MASTER_MONTH_HISTORY SUB, STG_PHN_MASTER_MONTH_HISTORY PHN
                        WHERE
                        --SUB.MONTH_ID = PHN.MONTH_ID
                         SUB.SUB_ACCOUNT = PHN.PH_ACCOUNT 
                         And to_number(SUB.Sub_Account)  BETWEEN   @startkey and  @endkey;
                                          Commit;can anyone help me getting the logic or the procedure since i have to use the result set provided above by the first query.
    Message was edited by:
    Vakeel

    Hi, Vakeel,
    The usual way of using the results of one query in another is to join the two queries. Sometimes it's easier to do a corellated sub-query instead. I can't tell which is the best way for you, or exactly how to do it, because I don't understand exactly what results you want.
    Please post a few rows of sample data and the results you want to get from that data. Simplify as much as possible. For example, post a query that uses NTILE (4) instead if NTILE (20). (If you know how to solve one, you can solve the other.)
    Another example: only select a couple of columns in the second query.

  • Help me to build the logic

    Hi experts,
    i want to build the logic as follows.
    the give fields in the ITAB are.
    F1    F2 F3
    123  546
    222  788
    222  277
    222  666
    345  431
    345  888
    777  888
    F1 AND F2 are the given fields i want to out put f3 as follow.
    F1    F2  F3
    123  546  10
    222  788  10
    222  277  20 
    222  666  30
    345  431  10
    345  888  20
    345  888  20
    if f1 abd f2 repeats the f3 will be same number.
    if f1 repeats and f2 is diff then sequence will be incremented every time by 10.
    when f1 starts with diff number then f3 starts with number 10 as above shown.
    Please build me the logic by using Internal table.
    Please help me

    Hi Ramesh,
    Please see the following test program..
    <b>REPORT ZSRITEST44 .
    DATA: BEGIN OF gt_data OCCURS 0,
            f1 TYPE i,
            f2 TYPE i,
            f3 TYPE i,
          END OF gt_data,
          BEGIN OF gt_datac OCCURS 0,
            f1(10),
            f2(10),
            f3 TYPE i,
          END OF gt_datac,
          gv_counter TYPE i.
    gt_data-f1 = 123.
    gt_data-f2 = 546.
    APPEND gt_data.
    gt_data-f1 = 222.
    gt_data-f2 = 546.
    APPEND gt_data.
    gt_data-f1 = 222.
    gt_data-f2 = 277.
    APPEND gt_data.
    gt_data-f1 = 222.
    gt_data-f2 = 666.
    APPEND gt_data.
    gt_data-f1 = 345.
    gt_data-f2 = 431.
    APPEND gt_data.
    gt_data-f1 = 345.
    gt_data-f2 = 888.
    APPEND gt_data.
    gt_data-f1 = 345.
    gt_data-f2 = 888.
    APPEND gt_data.
    gt_data-f1 = 777.
    gt_data-f2 = 888.
    APPEND gt_data.
    SORT gt_data BY f1 f2.
    LOOP AT gt_data.
      AT NEW f2.
        ADD 10 TO gv_counter.
      ENDAT.
      AT NEW f1.
        CLEAR gv_counter.
      ENDAT.
      IF gt_datac-f1 EQ gt_data-f1
      AND gt_datac-f2 EQ gt_data-f2.
        IF gv_counter GT 0.
          gv_counter = -1 * gv_counter.
        ENDIF.
      ENDIF.
      gt_datac-f1 = gt_data-f1.
      gt_datac-f2 = gt_data-f2.
      gt_datac-f3 = gv_counter + 10.
      COLLECT gt_datac.
      IF gv_counter LT 0.
        CLEAR gv_counter.
      ENDIF.
    ENDLOOP.
    LOOP AT gt_datac.
      gt_data-f3 = gt_datac-f3.
      MODIFY gt_data TRANSPORTING f3
      WHERE f1 = gt_datac-f1 AND f2 = gt_datac-f2.
    ENDLOOP.
    LOOP AT gt_data.
      WRITE: / gt_data-f1, sy-vline, gt_data-f2, sy-vline, gt_data-f3.
    ENDLOOP.</b>
    Hope this helps..
    Sri

  • Powe Mac G5 early 2004 gives error (no memory installed) Do I need to replace the Logic Board. Machine powers up,2beeps and power lights blinks 2 times and stops there, No video or any thing?

    I just recently aquired a Power Mac G5 early 2004.
    When I power the system up. I get 2 beeps
    and the small front panel light blinks 2 times continuously.
    The error codes show that it means a memory problem or
    no memory present. Memory is installed.
    In this case do I need to replace the mother board.
    The system goes no futher, no video or any thing.

    Well, it's possible that someone pulled the original RAM from the computer before they sold it, and repalced it with incompatible RAM. That, believe it of not, would be the best of all world in this case, as a working G5 logic board and its installation could cost as much as a refurbed Intel mac.
    I would contact the seller if you did not personally see the computer working before you bought it.
    As the computer had to be moved about--possibly shipped--to change hands, first check that all internal cards and RAM Modules are fully seated. They can work loose in some models.

Maybe you are looking for

  • Managing wwv_flow_files table

    Lets say I have a file upload feature on one of my pages. When the page is submitted, the file is uploaded to the wwv_flow_files table. I have a after submit process to parse the file, load it into a collection and process the data. When the process

  • Ipad locked, PC formatted, help on saving data from ipad...

    I need help....i typed my passcode wrongly 4-5 times and my ipad got locked, my pc crashed so had to format hard disk. Now i dont have itunes back up and fear of loosing all my data and purchased music...please help

  • Insert XHTML elements inside XML schema

    Hi, My oracle version is 10.2.0.2.0. Following this suggest : http://forums.oracle.com/forums/thread.jspa?messageID=835251&#835251 I tried to create a schema in this way: <?xml version="1.0"?> <xs:schema      xmlns:xs="http://www.w3.org/2001/XMLSchem

  • Which Security version is Safari using for a secure connection

    Now that SSL 3.0 can be compromised, how can I determine which security version Safari is using: TLS 1.2, TLS 1.1 or TLS 1.0.  Is there a way to force Safari to use at least TLS 1.0?

  • Raw converted to unix files

    I batch renamed a folder of raw files in photoshop cs and it converted them all to unix files, any hope of reading them or converting them to jpg or tiff? help!