Error in Looping with variable

Dear All,
Please help me. i want to loop of record. i have two scheme. First, i make without variable and not error. Second, i make with variable and error occurs. as below my syntax:
First:
declare
x varchar(50);
begin
--x:='select dummy from dual';
for c1 in (select dummy from dual) loop
dbms_output.put_line(c1.dummy);
end loop;
end;
result:
X
Second:
declare
x varchar(50);
begin
x:='select dummy from dual';
for c1 in (x) loop
dbms_output.put_line(c1.dummy);
end loop;
end;
result:
Encountered the symbol 'LOOP' when expecting one...

Billy  Verreynne  wrote:
Why? For what purpose?
A cursor fetch loop is not the ideal processing structure.
It is slow. It requires data to travel from the buffer cache of the database into PL/SQL variables (in the PGA). It requires context switching between the PL/SQL and SQL engines.
It does not scale. More rows means more data to travel that path from the SQL engine to the PL/SQL engine. More loop iterations in PL/SQL. If a single loop iteration (for processing a row) is 1ms, then a 100,000 rows will take a 100 seconds. 200,000 rows 200 seconds. Etc. This clearly does not scale with an increase in data volume.
Also keep in mind that DBMS_OUTPUT does not write to screen or display anything. It is incapable of accessing a client device as it executes inside a server process. So each call to DBMS_OUTPUT stores that line of text in very expensive server memory. When the database call is done, the client (e.g. TOAD or SQL*Plus) can read those lines from the database and the client can display it.
So if your loop is for a 1000 rows, it means writing a 1000 lines of text into very expensive server memory - and then expecting the client to read that afterwards and display it. Why? This is not a standard client-server method. It also does not scale. It can actually crash the server when this method is abused.
The standard method would be to create a SQL cursor using PL/SQL code, and then return a reference handle (pointer) to the client. This allows the client the ability to fetch data directly from the cursor - in an optimal way that does not consume expensive server memory.I have to say it: I sincerely appreciate you taking the time to write this whenever it needs to be written rather than just giving up and letting people stumble along with bad design - it must take a lot of mental stamina to keep doing it. One day it will sink into my head also :-)

Similar Messages

  • Error file adapter with variable substitution in PI 7.31

    Hello,
    I'm trying to create a file with a dynamic name, based on the payload of the message.
    We're trying to create a filename with the bold content in the name %batchId%.xml. The subtitution we use is
    payload:batch,1,batch-info,1,id,1
    <ns1:batch xmlns:ns1="http://www.atosworldline.com/archivingPortal/receivers">
    - <ns1:batch-info id="test" isTest="true"> 
    <ns2:sender-identifier xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">String 2</ns2:sender-identifier>  
    <ns2:nb-elements xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">3</ns2:nb-elements>  
    <ns2:batch-integration-mode xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">String 4</ns2:batch-integration-mode>  
    <ns2:creation-datetime xmlns:ns2="http://www.atosworldline.com/archivingPortal/batchInfo">1999-05-31T13:20:00Z</ns2:creation-datetime>  
    </ns1:batch-info>
    - <ns1:receivers> 
    - <ns1:receiver> 
    <ns1:id>String 5</ns1:id>  
    <ns1:action>String 6</ns1:action>  
    <ns1:contact-details />  
    - <ns1:tokenSets> 
    - <ns1:tokenSet startDate="1999-05-31T13:20:00Z" endDate="1999-05-31T13:20:00Z"> 
    - <ns1:token> 
    <ns1:tokenvalue>String 7</ns1:tokenvalue>  
    </ns1:token>
    - <ns1:token> 
    <ns1:tokenvalue>String 9</ns1:tokenvalue>  
    </ns1:token>
    </ns1:tokenSet>
    - <ns1:tokenSet startDate="1999-05-31T13:20:00Z" endDate="1999-05-31T13:20:00Z"> 
    - <ns1:token> 
    <ns1:tokenvalue>String 11</ns1:tokenvalue>  
    </ns1:token>
    - <ns1:token> 
    <ns1:tokenvalue>String 13</ns1:tokenvalue>  
    </ns1:token>
    </ns1:tokenSet>
    </ns1:tokenSets>
    </ns1:receiver>
    </ns1:receivers>
    </ns1:batch>
    The following error is shown, when processing the message through the receiving fileadapter.
    MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: batchId
    kind regards,
    Pieter

    AFAIK - Variable substitution does not support attributes. It only support the elements. (- <ns1:batch-info id="test" isTest="true">)
    May be you can go with dynamic configuration instead of variable substitution.

  • Error: Object variable or with variable not set while accessing BPC Excel

    Hi,
    I am working on BPC NW 7.5. When I am trying to access BPC for Excel I am getting the below error.
    'object variable or with variable not set'
    When I click on BPC for Excel it ask for the credentials, after entering it we encounter this error.
    Any idea why is this happening?
    Regards,
    Priyanka Singh

    Hi Renne,
    Could you share me the solution to resolve the issue?
    I am getting an error "object variable or with block variable not set" while trying to submit data through an Input schedule.
    I am working on SAP BPC 7.0 NW and using MS Excel 2003.
    I can log in to BPC Admin and excel with my user id and password.
    Only when i am trying to click esubmit --> send and refresh schedules i am getting this error.
    I checked my security profile and i have the submit data task in my task profile.
    Following couple existing SDN postings i tried to check the ADD-INs of the excel on my system. However it looks like the steps listed in the existing SDN posts are for MS EXCEL 2007.
    Please suggest me how do i resolve this issue. Please note I am working on SAP BPC 7.0 NW and using MS Excel 2003.
    Regards,
    Jagat

  • Error: Object variable or with variable not set while accessing

    Hi Friends,
    I am facing 'object variable or with variable not set' Error while opening BPC Excel.
    I have done, In Excel 2007, go to Excel Option -> Add-Ins -> Manage: COM Add-ins and Go...
    You look "BPC COM" disable and need enable again.
    But I am getting same Error message again and again. Please help me...
    I did BPC uninstall & install but still error massage poping
    Thank you in Advance

    Hi Kumar,
    I doubt if you are following the below steps. Please confirm. Thanks
    1. Open your normal Excel.
    2. Check for Planning and Consolidation tab on the top ribbon.
    3. I assume this wouldn't be available for you.
    4. If this is not present, open the Excel Options
    5. Click on Add-Ins and check the Active Application Add-ins
    6. Is Planning and consolidation present in it?
    7. If not, select "Disabled Add-ins" in the drop down below besides "Manage".
    8. Click "GO"
    9. Select the Planning and Consolidation add-in from disabled add-ins and "Enable" it.
    10. Check once again if this add-in is prersent in "Active" add-ins .
    11. Now close and re-open excel
    12. The Tab should be present now (Planning and Consolidation)
    Regards,
    Sanjeev

  • MapViewer Html5 API. Error with Variable Pie Chart Style Model

    Hello,
    I have a serious problem related to Variable Pie Chart Style. MapViewer - Mapbuilder version: 11.1.1.7.3.
    [ALERT]  MAPVIEWER_9023:Cannot load style.
        Source: OM.style.StyleStore.parseXMLStyle
    OMS: oracle.mapviewer.share.stylex.VariablePieChartStyleModel cannot be cast to oracle.mapviewer.share.stylex.BucketStyleModel
    In Mapbuilder, I have a geometry theme with rendering style, an advanced variable pie with variable range, style. This is the XML of advanced style:
    <?xml version="1.0" ?>
    <AdvancedStyle>
        <VariablePieChartStyle startradius="5" increment="4">
               <PieSlice name="T004_2009" color="#0033FF"/>
               <PieSlice name="T004_2010" color="#FF0033"/>
               <PieSlice name="T004_2011" color="#33FF00"/>
            <Buckets>
                <RangedBucket seq="0" label="0 - 20%" low="0" high="100000"/>
                <RangedBucket seq="1" label="20 - 40%" low="100001" high="370000"/>
                <RangedBucket seq="2" label="40 - 60%" low="370001" high="1000000"/>
                <RangedBucket seq="3" label="60 - 80%" low="1000001" high="2500000"/>
                <RangedBucket seq="4" label="80 - 100%" low="2500001" high="2.0E7"/>
        </Buckets>
       </VariablePieChartStyle>
    </AdvancedStyle>
    and this is the XML of the theme:
    <?xml version="1.0" standalone="yes"?>
    <styling_rules key_column="ID" caching="NONE">
        <hidden_info>
            <field column="INSTITUTION1" name="Port Name"/>
            <field column="T004_2009_CHAR" name="2009"/>
            <field column="T004_2010_CHAR" name="2010"/>
            <field column="T004_2011_CHAR" name="2011"/>
            <field column="T004_2012_CHAR" name="2012"/>
            <field column="T004_2013_CHAR" name="2013"/>
            <field column="T004_2014_CHAR" name="2014"/>
      </hidden_info>
        <rule column="PASSENGERS_2009,PASSENGERS_2010,PASSENGERS_2011">
            <features style="V.T004_PASSENGERS_VPIE"> (NVL(PASSENGERS_2009, 0) !=0 AND NVL(PASSENGERS_2010,0) != 0 AND NVL(PASSENGERS_2011, 0) != 0) </features>
            <label column="INSTITUTION1" style="T.CITY_NAME_H"> 1 </label>
      </rule>
    </styling_rules>
    When I preview the theme in mapbuilder everything seems fine.
    The problem arises, when I try to add a layer with this theme and style in my map in my APEX (version:4.2.6) application.
    This is the javascript:
    layer = new OM.layer.VectorLayer("layer1",
                def:{
                    type:OM.layer.VectorLayer.TYPE_PREDEFINED,
                    dataSource:ds, theme:themename,
                    url: baseURL
            map.addLayer(layer) ;
    and this is the error I get:
    [ALERT]  MAPVIEWER_9023:Cannot load style.
        Source: OM.style.StyleStore.parseXMLStyle
    OMS: oracle.mapviewer.share.stylex.VariablePieChartStyleModel cannot be cast to oracle.mapviewer.share.stylex.BucketStyleModel
    I' d appreciate any help.
    Thanks in advance,
    Vasso

    Hi,
    You're setting XML data in a JSON model, that's why the binding is incorrect.
    Depending on what your MII transaction is returning, you need to either retrieve the JSON part in the XML, or use a XML Model.
    Regards,
    Tanguy

  • Internal error in IP - cannot see filters with variables

    Hello Gurus,
    Please help me with this issue.
    I'm having a problem with data in a productive environment. When I try to access any filter with a variable, in Modeler, I receive the following error message:
    Internal error: Failed to read variables for characteristic XXX
    The list of infoobjects in the filter where exists a variable is showed "Object not found" instead of the name of the variable. 
    When I open the same filter using Bex Query designer I can see all information, including variables.
    It seemed that this problem doesn't affect function planning, only filters.
    What can be the problem?
    Thanks in advance.
    Best regards,

    Sue,
    create just the same variable as a new one; and delete the old one via transaction RSZDELETE; but you have to deselect the old variable from your selection before deleting the old one.
    Kind regerads,
    Clemens

  • Error during precalculation Object variable or With block variable not set.

    Hi
    We are tyring to set up a precal server for broadcasting. The precal server is running on a windows 2003 server and the service is running under a local admin account.
    When we try to run a test workbook, we get the email with the workbook, but there is no data in it.
    The Precal server shows us the following log:
    Connection transfer server BIPRD service sapgw00 system number
    S:RSRPREC:000 BIPRD sapgw00  ALEX
    S:RSRPREC:000 BIPRD sapgw00  ALEX
    S:RSRPREC:000 BIPRD sapgw00  ALEX
    S:RSRPREC:000 BIPRD sapgw00  ALEX
    S:RSRPREC:000 BIPRD sapgw00  ALEX
    Precalculation request type: E, printer: , variant:
    Request dispatched to precalculation DLL
    S:RSRPREC:000 E   ALEX
    S:RSRPREC:000 E   ALEX
    Unresolved exception occurred on the precalculation server
    E
    Error during precalculation Object variable or With block variable not set.
    S:RSRPREC:000  Object[] args  String[] paramnames  Boolean[] CopyBack) ALEX
    S:RSRPREC:000  DataTable iServerProperties  DataTable iVarTable)  Boolean[] CopyBack) ALEX
    S:RSRPREC:000  DataTable iServerProperties  DataTable iVarTable)  Boolean[] CopyBack) ALEX
    S:RSRPREC:000  DataTable iServerProperties  DataTable iVarTable)  Boolean[] CopyBack) ALEX
    Application server requires status report
    Application server requires status report
    Has anyone seen this issue?
    Please let us know, if anyone has any ideas.
    Thanks

    Does the query in the workbook require variable input, and, if so, have you provided a variant in the precalculation setting?

  • Put loop of variables into single array with formatting (PHP)

    I have the following loop;
    <?php
    $i=1;
    while($i<=$num_rows)
    $tempquantity = "extra".$i."quantity";
    $tempcomments = "extra".$i."comments";
    $tempname = "extra".$i."name";
    $tempprice = "extra".$i."price";
    $$tempquantity = $_POST['extra' . $i . 'quantity'];
    $$tempcomments = $_POST['extra' . $i . 'comments'];
    $$tempname = $_POST['extra' . $i . 'name'];
    $$tempprice = $_POST['extra' . $i . 'price'];
    print "Extra name: " . $$tempname;
    print "<br />";
    print "Extra price: " . $$tempprice;
    print "<br />";
    print "Quantity required: " . $$tempquantity;
    print "<br />";
    print "Client comments: " . $$tempcomments;
    print "<br /><br />";
      $i++;
    ?>
    Which, since there are 3 rows, outputs the following;
    Extra name: dfvgfddf
    Extra price: 4
    Quantity required: 67
    Client comments: gtfh
    Extra name: wewew
    Extra price: 34
    Quantity required: 45
    Client comments: thtrt
    Extra name: ewewe
    Extra price: 43
    Quantity required: 12
    Client comments: gdfgg
    What I want to be able to do is show the output above in a PHP email body variable, which I think this means that the loop of varaibles needs to be in one single array variable since coding in an email body variable is not allowed. How do I put a loop of variables like this into a single variable, and how to I keep the <br /> tags and names in front of the varaibles ('Extra name:' etc), so it looks as it should in the PHP email body?
    Thanks in advance

    Hi Murray,
    This is the code that sends the email;
    $to = "$renteremail";
    $subject = "Request confirmation";
    $headers = "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: website";
    $body = "
    Your reference number is <strong>$rrnumber</strong>.
    <br />
    <br />
    Below is a summary of your request details;
    <br /><br /><strong>Accommodation name</strong>: $accomm_name
    <br /><strong>Accommodation type</strong>: $accomm_type
    <br /><strong>Board-type</strong>: $ptbt
    <br /><strong>Max. capacity</strong>: $ptc
    <br /><strong>Check-in date</strong>: $passdate
    <br /><strong>Number of nights</strong>: $passnights
    <br /><br /><strong>Renter's name</strong>: $rentername
    if (mail($to, $subject, $body, $headers)) {$messagesent = 'yes';}
    So the three loop items with their four respective variables should go at the end of the list of variables above after 'Renters name'.
    I also need to put the variables generated by the loop into a single database feild, so if possible all should go into one variable.
    Thanks

  • Error in transmission with BBPSC01

    I have typical problem where in
    When  ordered, SC created via BBPSC02 goes through without errors. But the cart that is created via BBPSC01 will have ' Error in Transmission, With an error 'SE142 please enter qunatity in line 3000111'. This error is coming from the backend in the RFC mode while debugging BBP_REQREQ_TRANSFER.
    This happens only when number items in the cart are more than four, if the items were less than or equal to 4, follow on document is created even in case of BBPSC01.
    We are implementing BADI for Follow-on-Document for service-category.
    May I know 1.what could be the difference between these two templates.2.And where they exactly these dump the values 3. How could I go from here 4.what fields I need to look while debugging.
    Input will be:
    BBPSC02:  User selects description item and the service button, enters the price, quantiy as 1 service unit and selects the a specific-service-Category
    BBPSC01: Selects the Same category as in BBPSC02 enters the same data .
    Thank you,
    Manyam

    Thank you.
    This is a long code please bear with me. And provide your suggestion.
    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.

  • Error codes for shared variables in Labview 8.5?

    I am trying to use Shared Variables in Labview 8.5 to enable real-time loops (similar to some of the examples in "Using the LabVIEW Shared Variable", published Aug 28, 2007).  I created it to hold the result of a 16-channel A/D converter (so a 16-element I16 array).  To avoid losing samples, I used buffering, with a buffer of 5.  To test this, I made a pair of VIs, one a producer that stuffs a 16-element I16 array into the shared variable "every so often" (controlled by a timed loop), and a consumer loop that reads the shared variable and does something with the data.
    If I think of the buffered shared variable as a Real Time FIFO (as the article suggests it is), I was curious how I would know (a) when the queue was empty, and (b) if the queue had overflowed.  Both are necessary if this is to be a practical means of exchanging data -- you want the producer and consumer to run more-or-less at the same rate, but only the producer is deterministic.  The consumer needs to be able to run "faster" if it falls behind (for example, because it is writing data to disk), but you don't want it to read data from the shared variable if there's nothing there.  [One can always read a shared variable, after all -- as the article states, it simply "holds" the last value written to it].
    Snooping around, I discovered that there are "error codes" associated with the shared variable.  In particular, a code of -2220 (FFFFF754) seems to signify an empty queue (or a shared variable that has not yet been written to), while a code of -1950678981 (8BBB003B) appears to be "buffer overflow".
    Is this documented anywhere?  Are there other "error codes" that would be helpful to know?  Is there some rationale to these seemingly-random numbers?  [It would help to develop code to utilize shared variables if there was a bit less "magic" and "mystery" involved].
    For what it is worth, with a buffer of size 40, I could generate 16 I16 values at 1 KHz (simulating sampling from a 16-channel A/D at 1 KHz) and pass it to a consumer node that (a) read from the shared variable until it was empty, then (b) "went to sleep" for 20 msec (simulating "doing something else non-deterministically"), and not miss any data (because I could then empty the Shared Variable RT-FIFO, which should have been half full, before it overflowed on me).  Not bad throughput -- I bet I could push it even higher.
    Bob Schor

    Hey Bob,
    The errors are documented in the LabVIEW help:
    Shared Variable Error Codes
    Real-Time Shared Variable Error Codes
    There are several error messages for buffer underflow/overflow depending on the settings of the network or RT FIFO buffers. In particular the -2220 and -2221 are useful for the producer/consumer use case. For example (as you probably know) the consumer can flush a variable using the error code (see the attached image).
    Gerardo
    Attachments:
    variable1.png ‏3 KB

  • Error message into a Variable.

    Dear users,
    I have a rather usual (unusual from the weekend beers for me though!!) query which I can't figure out a proper way to implement.
    My requirement is like this:
    I have a message class in which I want to define a text 'Employee number & not found'.
    I want to use this in the program, but not to raise this error. Instead, I want to move this error message with the Employee number into a Character(200) variable.
    So instead of using MESSAGE e0xx(messageclass) USING employee number, I would like to move the error text into a variable which looks like:
    lv_text = e0xx(messageclass) USING '1234'   which stores the text 'Employee number 1234 not found' in lv_text.
    How would I acheive it??
    Thanks, V!

    Try tis way
    message e999(00) with i_emp-empno into lv_text.
    press f1 in message will provide you more details

  • Getting error while creating the variable of Schema Element type

    Hi everybody,
    For creating a variable of schema element type I am doing the following steps...
    Select 'Variables' after right clicking on bpel process. IN this window, go to 'Create VAriable' then select 'Element' type. Now in Type Choose, I expanded the my imported schema files. And selected a element type, then click ok to create this variable... I am getting the message...
    IN ORDER TO SAVE IMPORTED WSDL/SCHEMA FILES, YOU MUST HAVE A PARTNER LINK LOCATED UNDER THE CURRENT PROJECT DIRECTORY.
    What is mean by that.
    I have imported the schema files in project. AFter that I have imported them into the WSDL also. Now why I am getting error while creating the variable. However I can create variable directly in .BPEL file then everything is fine. And it is working also. But what is mean with the above error? Why I am not able to create variable through GUI?
    Thanks.

    Hi,
    I have this same problem this morning, and I was going crazy, until I found this webpage on the internet:
    [http://technology.amis.nl/blog/1803/problem-importing-xml-schema-in-bpel-process|http://technology.amis.nl/blog/1803/problem-importing-xml-schema-in-bpel-process]
    The idea is that the jdeveloper is not very good working with directories with spaces on the directory name. If you move all your work to a directory without spaces, it will work smoothly. At least, it had worked for me.
    Regards,
    Nacho

  • How to catch error message inside a variable?

    Hi,
    I'm trying to catch the error message inside a variable using this this command below:-
    <%=odiRef.getPrevStepLog("MESSAGE")%>
    Could you please tell me what is the right approach to capture the error message inside a variable.
    Thanks
    Anindya

    Hi Bhabani,
    I have done this and select an oracle schema.But the variables only captures the (null).Please look into this.You must have one step prior to this refresh variable. Then only it can get the status as given below.
    Returns the one-letter code indicating the status with which the previous step terminated. The state R (Running) is never returned.
    D: Done (success)
    E: Error
    Q: Queued
    W: Waiting
    M: Warning
    If you want the complete error details then you will face issues in case of multi line message. For this best option would be jython variable.Could please provide me some idea how to use this jython variable.I will update you on this soon
    Thanks
    Anindya

  • Windows Vista Installation Failed. Error Restart Loop After Install.

    I made it as far as the end of Step 2: Partition for Windows Vista -> Format -> Install -> Restart
    Note: Partition size = 45 GB. Apple USB keyboard and mouse worked fine.
    The install process was stuck in a loop at this point. After restart the screen was black for about 5 minutes. Disc made noise off and on but no screen input. Then it finally restarted. Next screen had error info and a choice to continue. After that a "Install Windows" error msg appeared;
    +"The computer restarted unexpectedly or encountered an unexpected error. Windows installation cannot proceed. To install Windows, click "OK" to restart the computer and then restart the installation."+
    Clicking "OK" resulted in the same error msg. along with +"Press any key to boot from disc"+. No success attempting to start up from Windows partition. or disc. Restarted to Mac HD. There is a "Untitled" drive on the Desktop. It contains multiple folders (11 GB). I tried to restart from this drive w/o Windows disc and it returned to the previous error msg.
    Next I tried restarting w/ Option key, inserting Windows disc, clicking on arrow under disc icon and quickly pressing any key. This brought up +"Windows Boot Manager Window"+. The only choice was; +"Windows set up [EMS Enabled]. To specify an advanced option for this choice, press F8. Tools: Windows memory diagnostic.+" None of the key choices (Enter, Tab, Esc) responded. Disc would not eject.
    Booted to Mac HD. Ejected disc w/ mouse. Used Boot Camp to restore partition. After restart screen is black with; +"No bootable device -- insert boot disc and press any key".+ Then I power down/on with Option key. Only Mac HD is displayed. Log into Admin. Mac HD looks fine. Run Disk Utility to verify disk/volume. OK. Also ran TechTool Deluxe. Passed. Open System Preferences, check that Mac HD Startup Disk is highlighted. Restart. OK now.
    What is going on? I was quite confident this would install without any problem since I was using the latest OS X 10.5.6 and Windows Vista Business (early version). Could that be the cause? I had no problem installing it under VMware Fusion 2 (downloaded updates), worked flawlessly. If I can't get this to work then I have to go back to a PC for ACAD. HELP!!
    Can I get Apple Support for this issue (Phone only, or Genius Bar)? I have AppleCare.
    Message was edited by: Sakahara
    Message was edited by: Sakahara

    Your problem sounds somewhat like mine, although not exactly. In my case it seems as if my CD/DVD drive didn't like the hologram on my Windows XP install CD. I solved this by using Disk Utility to make a disk image of the Windows DVD and then burning the disk image onto a new DVD with an opaque "label". That solved that problem.
    A further problem occurred after that. When I got to the screen that told me to hit "Enter" to start the installation process my keyboard was unresponsive. I solved this by buying a cheap Windows keyboard. That solved that problem and I now have Windows XP running just fine.
    I think that you'll find that Apple tech support isn't very responsive to these sort of problems. I don't have Apple Care but was willing to pay my $49 for tech support. I ended up talking to a "Boot Camp specialist". He was polite but told me that it was "a windows problem" and that Apple didn't support Windows. I agree that Apple can't support windows but it seemed like my two problems were "Mac problems". Anyway, after tearing my hair out for 4 days I finally got it done. I have to admit that I'm not happy with apple tech support.

  • Problem with variable substitution.

    Hello,
    I asked this before but now I want to change the question focus.
    I have scenario from IDOC to XML file.
    The scenario is digital invoice for our company in Mexico and I end this scenario with java mapping that I import from SAP marketplace.
    Now I have request to add to the XML file name the content of the field "<ODN_NUMBER>" from the XML data.
    I try to use with variables substitution.
    My payload is:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ZINVOIC02>
    - <IDOC BEGIN="1">
    - <EDI_DC40 SEGMENT="1">
    <TABNAM>EDI_DC40</TABNAM>
    <MANDT>400</MANDT>
    <DOCNUM>0000000006599015</DOCNUM>
    <DOCREL>700</DOCREL>
    <STATUS>30</STATUS>
    <DIRECT>1</DIRECT>
    <OUTMOD>2</OUTMOD>
    <IDOCTYP>INVOIC02</IDOCTYP>
    <CIMTYP>ZINVOIC02</CIMTYP>
    <MESTYP>INVOIC</MESTYP>
    <STDMES>ZEDI</STDMES>
    <SNDPOR>SAPDEV</SNDPOR>
    <SNDPRT>LS</SNDPRT>
    <SNDPRN>DEV400ECC</SNDPRN>
    <RCVPOR>SAPDEV</RCVPOR>
    <RCVPRT>LS</RCVPRT>
    <RCVPFC>LS</RCVPFC>
    <RCVPRN>MX_INV</RCVPRN>
    <CREDAT>20100118</CREDAT>
    <CRETIM>075931</CRETIM>
    <SERIAL>20100118075931</SERIAL>
    </EDI_DC40>
    - <E1EDK01 SEGMENT="1">
    <CURCY>USD</CURCY>
    <HWAER>MXN</HWAER>
    <WKURS>10.55530</WKURS>
    <ZTERM>0090</ZTERM>
    <KUNDEUINR>ACH971209KRA</KUNDEUINR>
    <BSART>INVO</BSART>
    <BELNR>0100017295</BELNR>
    <BRGEW>0.045</BRGEW>
    <GEWEI>KGM</GEWEI>
    <FKART_RL>LR</FKART_RL>
    <RECIPNT_NO>0000012977</RECIPNT_NO>
    <FKTYP>L</FKTYP>
    - <Z1EDK01 SEGMENT="1">
    <XML_VERSION>2.0</XML_VERSION>
    <ODN_PREFIX>A</ODN_PREFIX>
    <ODN_NUMBER>1883</ODN_NUMBER>
    <DATE_TIME>2009-11-01T17:05:10</DATE_TIME>
    <DOC_SUB_TOTAL>4.22</DOC_SUB_TOTAL>
    <DOC_DISCOUNT>3.00</DOC_DISCOUNT>
    <DOC_TOTAL>1.40</DOC_TOTAL>
    </Z1EDK01>
    And the xml that I create is:
      <?xml version="1.0" encoding="utf-8" ?>
    - <Comprobante xmlns="http://www.sat.gob.mx/cfd/2" version="2.0" serie="A" folio="1883" fecha="2009-11-01T17:05:10" sello="NxZCWU8hMJMiEc2fSZafpS81Z9rUScbBotvJ8lcW76GGpmcD2lFyAV7DlNQKecYMnQJnwMVoHfGjzhpFJrjLuRcyqU3nOnH1mE1JMxY/MjLkal0Ybo2aRKCorQxx+F/Vy5ucvyeDDFAt2gx0PeHJhFS3tJ6ssc6nryz3iUr8c=" noAprobacion="49806" anoAprobacion="2009" formaDePago="Pago en una sola exhibiciףn" noCertificado="00001000000100891274" condicionesDePago="90 DAYS FROM BILL OF LADING" subTotal="4.22" descuento="3.00" motivoDescuento="Customer DiscountCustomer Discount" total="1.40" tipoDeComprobante="ingreso">
    - <Emisor rfc="NMS940324RY6" nombre="Netafim Mexico S.A. de C.">
      <DomicilioFiscal calle="Leibnitz" noExterior="20" noInterior="901" colonia="Anzures" localidad="Mexico city" municipio="Miguel Hidalgo" estado="Distrito Federal" pais="Mexico" codigoPostal="11590" />
      </Emisor>
    - <Receptor rfc="ACH971209KRA" nombre="AGRICOLA 5 HERMANOS SA DE CV">
      <Domicilio calle="JUAN DE LA BARRERA NO 1249 NORTE" localidad="COL. CHAPULTEPEC" municipio="CULIACAN" estado="Sinaloa" pais="Mexico" codigoPostal="80040" />
      </Receptor>
    -     <Conceptos>
    I try to use with this variable:
    payload:ZINVOIC02,1,IDOC,1,E1EDK01,1,Z1EDK01,1,ODN_NUMBER,1
    I received in RWB the error:
    Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: var_filename
    Thank you in advance for your help
    Elad

    But my target is looks very strange:
      <?xml version="1.0" encoding="utf-8" ?>
    - <Comprobante xmlns="http://www.sat.gob.mx/cfd/2" version="2.0" serie="A" folio="1883" fecha="2009-11-01T17:05:10" sello="NxZCWU8hMJMiEc2fSZafpS81Z9rUScbBotvJ8lcW76GGpmcD2lFyAV7DlNQKecYMnQJnwMVoHfGjzhpFJrjLuRcyqU3nOnH1mE1JMxY/MjLkal0Ybo2aRKCorQxx+F/Vy5ucvyeDDFAt2gx0PeHJhFS3tJ6ssc6nryz3iUr8c=" noAprobacion="49806" anoAprobacion="2009" formaDePago="Pago en una sola exhibiciףn" noCertificado="00001000000100891274" condicionesDePago="90 DAYS FROM BILL OF LADING" subTotal="4.22" descuento="3.00" motivoDescuento="Customer DiscountCustomer Discount" total="1.40" tipoDeComprobante="ingreso">
    - <Emisor rfc="NMS940324RY6" nombre="Netafim Mexico S.A. de C.">
      <DomicilioFiscal calle="Leibnitz" noExterior="20" noInterior="901" colonia="Anzures" localidad="Mexico city" municipio="Miguel Hidalgo" estado="Distrito Federal" pais="Mexico" codigoPostal="11590" />
      </Emisor>
    - <Receptor rfc="ACH971209KRA" nombre="AGRICOLA 5 HERMANOS SA DE CV">
      <Domicilio calle="JUAN DE LA BARRERA NO 1249 NORTE" localidad="COL. CHAPULTEPEC" municipio="CULIACAN" estado="Sinaloa" pais="Mexico" codigoPostal="80040" />
      </Receptor>
    I need to add folio field
    Elad

Maybe you are looking for

  • How to set destination filename at runtime

    Hello All , I want to set the destination filename at runtime , so that it will include the run date and time in the generated file name . It should be like this , in the distribution xml file : <destinations> <file id="MyFiles" name="v_report_file_n

  • Have Weblogic 10.3.5 error when starting weblogic server from CLI

    I have installed wls 10.3.5 and ADF 11.1.1.5 runtime on windows machine.when I start the weblogic server from command line using C:\Oracle\Middleware\user_projects\domains\adf_domain\bin\startWebLogic.cmd My em doesnt start and is in Failed state and

  • Budget checking document type wise

    Dear sapient I have mapped fund management as per the business scenario but i need some solution for the following point. Can budget checking mapped as per the PR docuemnt type . i checked in derivatio rule but docment type is available as per the fi

  • Catching all possible exceptions in gui thread

    Hi, I have such a problem: I am developing Swing app and sometimes it crashes by throwing an Exception which I don't catch. The effect is that this exception prints stack trace on System.err but user is not notified and wonders what is happening... I

  • Where can i download Logic Express 9 for free ???

    Where can i download logic express 8 or 9 for free