Purpose of the declaring the below type u0096 pools ?

Hi All,
What is the Purpose of the declaring the below type – pools in the program. Why we need type-pools in the program.
TYPE-POOLS: SLIS,
GSETC.
Akshitha.

type pool  slis
Type-pools is a place where u can store the type declarations globally which can be used in your ABAP program. Type-pools SLIS Stores all the ALV related Type definitions.
example
For example when you create an ALV program, all types you need to use are defined in types pool SLIS.
The objects that you don't want to create in SE11 but want a single place where you can declare them together will be done in TYPE POOLs. The best example is SLIS where you have declared all the TYPES that are required to execute a ALV REPORT using the REUSE functions.
In this way you define your types only once and then you can use them everytime you need:
TYPE-POOLS SLIS.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
The type SLIS_T_FIELDCAT_ALV is defined in type pools SLIS.
type pool gsetc
.GSETC type pool stores codes for differenct group classes
   i.e. gsetc_costcenter_setclass = '0101'
example
*& Report  ZCCGROUP_HIER                                               *
REPORT ZCCGROUP_HIER.
GSETC type pool stores codes for differenct group classes
   i.e. gsetc_costcenter_setclass = '0101'.
TYPE-POOLS: gsetc. "
TYPES: gseth_node_line    LIKE grpobjects,
       gseth_node_tab     TYPE gseth_node_line OCCURS 0.
TYPES: gseth_val_line     LIKE grpvalues,
       gseth_val_tab      TYPE gseth_val_line OCCURS 0.
TYPES: GSETH_MD_LINE      LIKE GRPMDLINE,
       GSETH_MD_TAB       TYPE GSETH_MD_LINE OCCURS 0.
DATA: it_nodes            TYPE  gseth_node_tab,
      it_values           TYPE  gseth_val_tab,
      it_mdtab            type gseth_md_tab,
      wa_mdtab            type GSETH_MD_LINE.
DATA: ld_setid            TYPE sethier-setid,
      ld_info             LIKE grphinfo,
      ld_overwrite        LIKE sy-datar.
PARAMETERS: p_ksgru  LIKE rksb1-ksgru,
            p_burks       TYPE bseg-BUKRS.
CONCATENATE gsetc_costcenter_setclass p_burks p_ksgru INTO ld_setid.
CALL FUNCTION 'K_HIERARCHY_TABLES_READ'
  EXPORTING
    e_class                           = gsetc_costcenter_setclass
                                                 "from gsetc type-pool
    e_setid                           = ld_setid
    e_kokrs                           = p_burks "company code
    E_MANDT                           = sy-mandt
    E_MASTER_DATA                     = 'XXX'
displays popup to confirm if a large amount of data is to be retrieved
    E_STRUCTURE                       = 'X  X0200'  "displays popup to confirm
    E_REPLACE_CLASS                   =
    E_REPLACE_UNIT                    =
    E_REPLACE_TABLE                   = ' '
    E_REPLACE_FIELD                   = ' '
    E_SUFFIX                          =
    E_OLD_LINE_LEVEL                  = 0
  IMPORTING
    I_DOUBLE_CHECK                    =
    I_MASTER_DATA                     =
  TABLES
    t_nodes                           = it_nodes
    t_values                          = it_values
    T_MASTER_DATA                     = it_mdtab
    T_FORMULA                         =
    T_FIELD_INFO                      =
    T_NODE_LIST_OVERWRITE             =
  CHANGING
    c_info                            = ld_info
    c_overwrite                       = ld_overwrite
EXCEPTIONS
   no_controlling_area               = 1
   no_chart_of_account               = 2
   different_controlling_areas       = 3
   different_chart_of_accounts       = 4
   set_not_found                     = 5
   illegal_field_replacement         = 6
   illegal_table_replacement         = 7
   fm_raise                          = 8
   convert_error                     = 9
   no_overwrite_standard_hier        = 10
   no_bukrs_for_kokrs                = 11
   OTHERS                            = 12.
BREAK-POINT.
An alternative function module can be found below which
is slightly easier to code but there is no direct link between
the hier and the val tables, it is just based on there
index possition.
*types : begin of T_SETHIER.
  include STRUCTURE  SETHIER_CO.
*types: end of t_sethier.
*data: it_SETHIER type standard table of t_SETHIER.
*types : begin of T_SETVAL.
  include STRUCTURE  SETVAL_CO.
*types: end of t_SETVAL.
*data: it_SETVAL type standard table of t_SETVAL.
*CALL FUNCTION 'K_GROUP_REMOTE_READ'
EXPORTING
   setclass         = gsetc_costcenter_setclass "from gsetc type-pool
   CO_AREA          = 'UNIV'
  CHRT_ACCTS       =
   groupname        =  p_ksgru
  LANGUAGE         =
IMPORTING
  RETURN           =
tables
   et_sethier       = it_SETHIER
   ET_SETVAL        = it_SETVAL.
Do reward if  helpful

Similar Messages

  • What r the different types item categ r thre ? what is the purposes of its?

    what r the different types item categ r thre ? what is the purposes of its?

    hi Deva,
    Go to T.code VOV4..>ITEM CATAGORY ASSIGNMENT
    sales doc. type+item catagory group Item usagehigher level of item catagory= Item catagory
    For Item catagory details
    Go to T.code VOV7
    Types of Item Catagory:
    AFN inquiry
    AGN quoation
    TAN standred order
    TAN rush order
    BVN cash sale
    Tann Free Goods
    Tas Third Party Order
    REN Return order
    G2N credit Memo Request
    L2n Dedit Memo Request
    TAQ bill of material (structure Above Material)
    TAP bill of matrial  (structure Below Material)
    PVN Item proposal
    NLC Interco stock trans item
    KLN contract
    Purpose of Item Catagory:
    Item catagory determines how the item will act during order processing.It Affects Schedule line catagory also.
    Item Catagory+MRP Type...>Schedule line catagory
    Reward points pls
    MCM

  • I need to set up an expense form so that our consultant can "filter" by customer type, program type, and finally the purpose of the trip. For instance: the customer types are churches, schools, organizations. The program type would be fund raising, gift p

    I need to set up an expense form so that our consultant can "filter" by customer type, program type, and finally the purpose of the trip. For instance: the customer types are churches, schools, organizations. The program type would be dependent on the customer type selection from the first list. Some examples would be: fund raising, gift planning, surveys, and others. The purpose of the trip would be dependent on the program type selected from the second list. Some examples of trip purposes would be: presentation, design, prospecting. Further, the purpose of trip selection from the third drop-down box would then have to determine the values of other fields by expense type: such as commission, airfare, hotel. etc. I've tried pop-up menu but can't figure out how to "select" from the final popup list and have it populate a field for the purpose of the trip. I've tried to look at the JavaScript examples for dependent drop-down boxes, but can't find any that quite fit what I'm trying to accomplish. I am very new to all of this. No training in writing Javascripts - just trying to wing it. The form has to be very simple for our consultants to use, but also give our office the detail we need to process through the correct account numbers. I would appreciate any detailed step-by-step instructions - kind of a javascript for dummies type of info. HELP!

    An AcroForm is the name given to the type of PDF form that you create in Acrobat. An XFA form is the type of form that you create in LiveCycle Designer. Although they are both PDF files, they are very different structurally and have significant;y different scripting models. So pay attention to the information on AcroForms and ignore anything about XFA. Be sure to get the sample PDF forms so you can look at how it works and where the scripts are placed.
    What you want to do will require scripting, and if you don't have the experience and are unable to use the information in the tutorials to create what you want, you might consider getting someone who has experience do this for you. I'll often suggest code if I can do so quickly, but what you want requires more than a few minutes.

  • What is the purpose of using rush order  doc type?

    what is the purpose of using rush order  doc type?

    hi,
    In a rush order transaction, the customer picks up the goods or you deliver the goods on the same day as the order is placed. In the standard system, when you save this sales document type, a delivery is automatically created and billing is related to the delivery.
    In the standard system, sales document type SO is saved for rush orders with immediate delivery type LF. Once the goods have been removed from storage, the goods are picked, and goods issue is posted.
    Once the billing documents are created (for example, in collective processing), invoice papers are printed and sent to the customer.
    CHAN

  • What is the purpose of using cash sales doc type?

    what is the purpose of using cash sales doc type?

    You can go through the link
    http://help.sap.com/saphelp_46c/helpdata/en/70/a7853478616434e10000009b38f83b/frameset.htm
    Update from help.sap.com
    Cash sales is an order type for when the customer orders, picks up and pays for the goods immediately. The delivery is processed as soon as the order has been entered. A cash invoice can be printed immediately from the order and billing is related to the order. Receivables do not occur for the customer as they do for rush or standard orders, because the invoice amount is posted directly to a cash account.
    Process Flow
    In the standard system, sales document type BV is saved for cash sales with immediate delivery type BV.
    When the sales employee creates a cash sale, the system automatically proposes the current date as the date for delivery and billing. Once the order has been posted, a delivery with type BV is created immediately in the background and the system prints a document that is used as an invoice for the customer.
    The invoice papers are controlled with output type RD03, contained in the output determination procedure for order type BV.
    If the customer has already received the goods, this delivery should not be relevant for picking. If the customer is to pick the goods up from a warehouse, the delivery should be relevant for picking. If the goods are to be sent, this can be processed by maintaining the delivery in the usual way.
    The system automatically creates a resource-related billing index which updates the billing due list. Billing document BV is created as the system processes the billing due list, but an invoice is not printed.
    Once the customer has received the goods and is satisfied with them, the transaction is considered to be complete. We recommend that you post goods issue in the background using a program designed specifically for this purpose. You can then bill the transaction.
    The cash sale can only be billed if the order quantity is the same as the goods issue quantity. If this is not the case, you need to adjust the cash sale document so that the delivered quantity and the quantity to be billed match.
    You use an order-related collective billing process to bill the cash sale, but an invoice is not printed. The sales order number is used as the reference for the accounting document, created in Financial Accounting.
    Dealing with Problems and Complaints
    If the transaction does not run smoothly, manual intervention is necessary. For example, if the required quantity of goods is not found in the warehouse, you need to adjust the delivery quantity. Equally, if the customer is not prepared to pay the agreed price, because, for example, the goods are scratched, you can change the price in the cash sale document.
    In extreme cases, you can delete the entire transaction, starting with the delivery.
    If the delivery is damaged before it is picked up but after it is paid for and there is no replacement stock, you can initiate a subsequent delivery.
    If you make changes to the cash sale, you can issue a new cash sale invoice using the repeat printout function.
    Creating a Cash Sale
    In the initial screen, choose Logistics ® Sales and distribution ® Sales.
    Choose Order ® Create.
    Enter the order type for cash sales (BV in the standard system) and, if necessary, the organizational data.
    The values for sales organization, distribution channel and the division are usually proposed from user-defined parameters. Entries for the sales office and the sales group are optional.
    Choose Enter.
    Enter the following data:
    – Customer number of the sold-to party
    – Material numbers
    – Order quantities for the materials
    Choose Enter.
    If the system carries out an availability check and finds that there is insufficient stock for an order item to be delivered on the requested date, it displays a screen on which you can choose between several delivery proposals. Normally, in a cash sale, you only sell the quantity you can deliver on the spot.
    Save your document.
    The system automatically processes the delivery in the background and prints out a cash sale invoice. The amount of the sale is processed later in an order-related billing transaction. The amount is posted to financial accounting, using the order number as reference. Because this is a cash sale, no invoice is produced during the billing run.

  • Purpose of entering the Condition type in Pricing procedure determination

    Dear All,
    We are maintaining a condition type in Pricing procedure determination.
    But I am not sure about the purpose of it. Because, even without maintaining a condition type, it is working.
    Could you please let me know the reason for maintaining a condition type over there.
    Regards,
    Mullairaja

    Hi.
    The condition type which you specify in the pricing procedure will be displayed in the overview screen - item level.  please try changing and check it out in sales order.
    Regards,
    CLN

  • What r the diff types of schedule line categoriesr there ? purposes of its?

    what r the diff types of schedule line categoriesr there ? purposes of its?

    Deva, you are asking A LOT of basic SD questions which you can find answers to in standard SAP documentation available on line.
    Please read that stuff first, and keep your questions here to more specific configuration / transaction details
    Thanks in advance

  • Please explain the use of all the below movt types

    Hi friends,
    Can you Please explain the use of all the below movt types and how it is triggered.
    901     GR Area for Production
    902     GR Area External Rcpts
    904     Returns
    910     GI Area General
    911     GI Area for Cost Center
    912     GI Area Customer Order
    913     GI Area - Fixed Assets
    914     GI Area Production Orders
    915     Fixed Bin Picking Area
    916     Shipping Area Deliveries
    917     Quality Assurance
    920     Stock Transfers (Plant)
    921     Stock Transfers (StLoc)
    922     Posting Change Area
    980     R/3 --> R/2 cumulative
    998     Init.entry of stock bal.
    999     Differences
    Regards,
    Balu R.V

    Hi,
    The below mentioned objects are interim storage types, not movement types.
    Interim storage types are used as a sort of bridge between IM and WM.
    MZ

  • Purpose of all the below Function Modules?

    Hi All,
    What is the Purpose of all the below Function Modules?
    CALL FUNCTION 'K_REPO_PCA_AUTHORITY_CHECK'
    CALL FUNCTION 'K_PCA_RESP_AUTHORITY_CHECK'
    CALL FUNCTION 'G_CURRENCY_FROM_CT_GET'
    CALL FUNCTION 'GET_CURRENT_YEAR'
    CALL FUNCTION 'BDC_OPEN_GROUP'
    CALL FUNCTION 'BDC_INSERT'
    CALL FUNCTION 'MESSAGE_TEXT_BUILD'
    Akshitha.

    Hi,,
    G_Buffer_ReSET-->Deleting Buffer in Set Manager
    G_SET_ENCRYPT_SETID-->Conversion of Combination of Characteristics in a Set ID
    G_SET_GET_INFO-->Checks whether Set exists and Provides Information about Set
    Reward IF useful

  • While running my app I get the below error  - have different Class objects for the type javax/servlet/http/HttpServletRequest used in the signature

    I am running ATG[10.1.2] app on Jboss [EAP 5.1.0 GA] I am able to open dyn/admin however when I start my app I get the below error
    java.lang.LinkageError: loader constraint violation: when resolving method "atg.servlet.ServletUtil.setSessionConfNumCacheRequest(Ljavax/servlet/http/HttpServletRequest;)Ljavax/servlet/http/HttpServletRequest;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, atg/filter/dspjsp/PageFilter, and the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) for resolved class, atg/servlet/ServletUtil, have different Class objects for the type javax/servlet/http/HttpServletRequest used in the signature
      at atg.filter.dspjsp.PageFilter.doFilter(PageFilter.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at atg.servlet.ForwardFilter.doFilter(ForwardFilter.java:263)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at atg.servlet.ErrorFilter.doFilter(ErrorFilter.java:279)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:446)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310)
      at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:416)
      at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
      at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:286)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:680)
    11:22:47,413 ERROR [[localhost]] Exception Processing ErrorPage[errorCode=500, location=/global/errorPage500.jsp]

    The supported JBoss version for 10.1.2 is JBoss EAP 5.1.2 but I don't think that your issue is caused because of this. Your issue is more of an environmental thing as you are probably getting two different versions getting loaded of class javax.servlet.http.HttpServletRequest and so correspondingly two different Class objects as the error shows. One reason for this could be if you include any server-specific libraries (in present case the Servlet API JAR which contains the class javax.servlet.http.HttpServletRequest) of a different version in the /WEB-INF/lib of your web application. Try removing it from there if so and see if that helps.

  • How can I replace the cursor in the below query?

    I have this below query which calls a stored procedure that takes only 1 item's attributes at a time. But because of performance problems we are
    required to remove the cursor. How can I replace the below cursor logic with set operations or CTE? Please advice.
    DECLARE db_cursor_ava CURSOR
    FOR
    SELECT t.[agent-id],
    t.[start-date],
    t.[end-date],
    t.[monitor-days],
    t.[monitor-start],
    t.[monitor-end],
    t.[timezone-offset]
    FROM @tmpAgentPeriodTimeRange t
    OPEN db_cursor_ava
    FETCH NEXT FROM db_cursor_ava INTO @agentID_ava,
    @stDateTime_ava,
    @endDateTime_ava,
    @monDays_ava,
    @monSt_ava,
    @monEnd_ava,
    @offset_ava
    WHILE @@FETCH_STATUS = 0
    BEGIN
    DELETE
    FROM @tmpMonitorPeriod
    DELETE
    FROM @tmpFinalResult
    SET @runID = 1
    IF(@endDateTime_ava>DATEADD(MI,@offset_ava, GETUTCDATE()))
    BEGIN
    SET @endDateTime_ava=DATEADD(MI,@offset_ava, GETUTCDATE())
    END
    INSERT INTO @tmpMonitorPeriod
    EXEC core.usp_GetMonitoringPeriod
    @startDate = @stDateTime_ava,
    @endDate = @endDateTime_ava,
    @monitoringDays = @monDays_ava,
    @monitoringStart = @monSt_ava,
    @monitoringEnd = @monEnd_ava
    SELECT @maxID = MAX(tm.id)
    FROM @tmpMonitorPeriod tm
    FETCH NEXT FROM db_cursor_ava INTO @agentID_ava,
    @stDateTime_ava,
    @endDateTime_ava,
    @monDays_ava,
    @monSt_ava,
    @monEnd_ava,
    @offset_ava
    END
    CLOSE db_cursor_ava
    DEALLOCATE db_cursor_ava
    mayooran99

    You've been down this path before  - and the response is exactly the same.
    how to replace cursor logic
    And I'll suggest that you post the entire code - since you repeatedly delete 2 table variables but only populate one. The setting of @maxID also seems to have no purpose. And perhaps the issue here isn't the cursor but the general approach.  Who knows
    - but it appears you may have prematurely assumed that the cursor is the problem.

  • Error in the below sql.

    Hi
    I am getting the below error in the below sql
    Hi
    I am getting the error in the below sql
    DECLARE
       pgm_id                  NUMBER := &1;
       schd_dt                 DATE := TO_DATE('&2','MM/DD/YYYY');
       l_schd_dt               DATE := NULL;
       l_pgm_id                NUMBER :=0;
       l_src_id                NUMBER;
       l_bulkCollectSize       NUMBER;
       l_trace_level           NUMBER := 0;
       l_CommitAllowance       INFT1.PRM_VALUE%TYPE;
       v_insrcdcnt             NUMBER := 0;
       g_ErrorString           VARCHAR2(500) := NULL;
       g_log_error             VARCHAR2(300) := NULL;
       g_recs_upd              NUMBER :=0;
       g_recs_ins              NUMBER :=0;
       g_aud_upd_ts            DATE := NULL;
       l_data_nbr              NUMBER := 0;
       l_ts_1             DATE :=NULL;
       l_ts_2               DATE :=NULL;
       l_rest_empno  emp_STG.mbr_nbr%TYPE :='0';
      l_Commitsize            NUMBER;
       CURSOR curTrnRecs(l_rest_empno VARCHAR)
       IS
        SELECT /* user_hash(tmp) PARALLEL(tmp,8) */  tmp.sec_lbl
        ,tmp.empno
         ,tmp.ename
        ,tmp.sal
        ,tmp.deptno
           FROM emp_stg tmp where tmp.mbr_nbr > l_rest_empno   order by tmp.mbr_nbr;
       TYPE rec_emp_stg is TABLE OF emp_STG%ROWTYPE index by PLS_INTEGER;
      stg_emp_stg rec_emp_stg   ;
       counter                 NUMBER         :=0;
       l_idx                  NUMBER;
       errors                  PLS_INTEGER;
        ins_errors EXCEPTION;
        PRAGMA EXCEPTION_INIT(ins_errors, -24381);
    BEGIN
        /* Copy values into local variables */
        l_pro:= pgm_id;
        l_schd_dt := schd_dt;
            /* Check if this is the first execution of the program; Get the last processed timestamp if the run is a restart */
        /* The restartability of this program is slightly differnt. Data_nbr =1 indicates that the last run was successful. The same program can*/
        /* be called multiple times for the same t47date. The restartability is designed accordingly */
        BEGIN
            SELECT /* SQL_TAG(<$RCSfile: t50lyt_can_hist_trans_load.sql,v $><2>) */
                   data_nbr,1,1,
                    NVL(key_text,'0')
            INTO l_data_nbr,
                 l_ts_1,
                 l_ts_2,
                 l_rest_mbr_nbr
            FROM inft
            WHERE TRUNC(key_ts)=TRUNC(l_schd_dt)
              AND pro_id = l_pro_id;
        EXCEPTION
            WHEN NO_DATA_FOUND THEN
              l_data_nbr:=9;
              NULL;
            WHEN OTHERS then
              g_ErrorString := g_log_error||' : SQLCODE = '||SQLCODE||' , ERRORMESSAGE = '||substr(SQLERRM, 1,200);
              RAISE;
        END;
           IF l_data_nbr = 1 THEN
          crm_msg.msg('Exiting:: Program already run');
          RETURN;
        ELSIF l_data_nbr = 0 THEN
          crm_msg.msg('This is a restart for the date '||l_schd_dt);
        ELSIF l_data_nbr= 9 THEN
            crm_msg.msg('First execution of this program');
       END IF;  
        BEGIN
            if l_data_nbr =9 THEN
             crm_msg.msg('This is the First execution of this program');
             INSERT
             INTO inft
               pgm_id,
               key_ts,
               key_text,
               data_nbr,
               data_ts,
               data_text
             VALUES
               l_pro,
               l_schd_dt,
               0,  --to hold empno
               sysdate,
               0   --no of recs processed
       COMMIT;
        END IF;
      END;
        OPEN curTrn(l_rest_empno);
        LOOP
          BEGIN
               FETCH curTrn BULK COLLECT INTO stg_emp_rec LIMIT 50000;
               IF nvl(curTrnRecs%ROWCOUNT,0)=0 THEN
                 crm_msg.msg('No Historical Data');
               END IF;
           FORALL i in 1..stg_emp_rec.COUNT SAVE EXCEPTIONS
             INSERT INTO emp values stg_emp_stg(i);
          counter := counter + 1;         
           g_recs_ins   := g_recs_ins+SQL%ROWCOUNT;
       EXCEPTION
          WHEN ins_errors THEN
             errors := SQL%BULK_EXCEPTIONS.COUNT;
            for j in 1..errors
            LOOP
            l_idx :=sql%bulk_exceptions(j).error_index;
          UPDATE emp SET src_id=stg_emp_rec(i).empno,ename=stg_emp_rec(i).ename,sal = stg_emp_rec(i).sal,
                 WHERE deptno= stg_emp_rec(i).deptno;  
           g_recs_upd := g_recs_upd + SQL%ROWCOUNT;
       ---END;
    -- EXIT WHEN curTrnRecs%NOTFOUND;
    -- END LOOP;
    -- CLOSE curTrnRecs;
      EXCEPTION
       WHEN OTHERS THEN
       g_ErrorString := g_log_error||' : SQLCODE = '||SQLCODE||' , ERRORMESSAGE = '||substr(SQLERRM, 1,200);
       crm_msg.msg(g_ErrorString);
       RAISE;
       END;
    END
        IF (counter >= l_CommitSize) THEN
            BEGIN /* To keep track of the timestamp of the last record processed inthe batch; for restartability */
                                            UPDATE   inft
                        SET      data_ts      = SYSDATE
                               ,key_text     = l_empno (idx)
                        WHERE    pgm_id       = l_pgm_id
                         AND     TRUNC(key_ts)= TRUNC(l_schd_dt);
                        COMMIT;
                    counter:=0;
                    END IF;
                EXCEPTION
                        WHEN OTHERS THEN
                          g_ErrorString := g_log_error||' : SQLCODE = '||SQLCODE||' , ERRORMESSAGE = '||substr(SQLERRM, 1,200);
                          crm_msg.msg(g_ErrorString);
                          RAISE;
                END;
       COMMIT;
      EXIT WHEN curTrn%NOTFOUND;
    --       END LOOP; --End of looping for the main cursor  fetch
       END LOOP;
      CLOSE curTrn;
       BEGIN /* Update the data_nbr to 1 to indicate the update is complete */
             UPDATE inft
             SET data_nbr=1,
                 data_ts=nvl(g_aud_upd_ts,data_ts),
                 data_text = counter
             WHERE pro_id = l_pgm_id
              AND TRUNC(key_ts)=TRUNC(l_schd_dt);
            COMMIT;
           EXCEPTION
             WHEN OTHERS THEN
               g_ErrorString := g_log_error||' : SQLCODE = '||SQLCODE||' , ERRORMESSAGE = '||substr(SQLERRM, 1,200);
               crm_msg.msg(g_ErrorString);
               RAISE;
        END;
        g_log_error := 'LOGGING SUMMARY';
        crm_msg.msg_tab('RECS UPDATED',g_recs_upd);
        crm_msg.msg_tab('RECS INSERTED',g_recs_ins);
        crm_msg.msg('Program ends Successfully');
    EXCEPTION
       WHEN OTHERS THEN
         g_ErrorString := g_log_error||' : SQLCODE = '||SQLCODE||' , ERRORMESSAGE = '||substr(SQLERRM, 1,200);
         crm_msg.msg(g_ErrorString);
    END;
    Elapsed: 00:00:00.00
      EXCEPTION
    ERROR at line 248:
    ORA-06550: line 248, column 3:
    PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:
    ( begin case declare end exit for goto if loop mod null
    pragma raise return select update when while with
    <an identifier> <a double-quoted delimited-identifier>
    <a bind variable> << continue close current delete fetch lock
    insert open rollback savepoint set sql execute commit forall
    merge pipe purge
    ORA-06550: line 255, column 5:
    PLS-00103: Encountered the symbol "IF" when expecting one of the following:
    ORA-06550: line 314, column 2:
    PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:
    ( begin case declare end exit for goto if loop mod null
    pragma raise return select update while with <an identifier>
    <a double-quoted delimited-
    ORA-06550: line 322, column 0:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    end not pragma final instantiable order overriding static
    member constructor mapAppreciate ur help on the above?
    Edited by: user1014019 on Oct 3, 2011 6:45 AM
    Edited by: BluShadow on 03-Oct-2011 15:08
    added {noformat}{noformat} tags. Please read {message:id=9360002} and learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Please provide a code that can be compiled, the sample that you provided has compilation errors:
    Have made change to your code block, so that it compiles.Try to run the below code block:
    /* Formatted on 2011/10/03 21:08 (Formatter Plus v4.8.5) */
    DECLARE
       pgm_id              NUMBER                 := &1;
       schd_dt             DATE                   := TO_DATE ('&2', 'MM/DD/YYYY');
       l_schd_dt           DATE                   := NULL;
       l_pgm_id            NUMBER                 := 0;
       l_src_id            NUMBER;
       l_bulkcollectsize   NUMBER;
       l_trace_level       NUMBER                 := 0;
       l_commitallowance   inft1.prm_value%TYPE;
       v_insrcdcnt         NUMBER                 := 0;
       g_errorstring       VARCHAR2 (500)         := NULL;
       g_log_error         VARCHAR2 (300)         := NULL;
       g_recs_upd          NUMBER                 := 0;
       g_recs_ins          NUMBER                 := 0;
       g_aud_upd_ts        DATE                   := NULL;
       l_data_nbr          NUMBER                 := 0;
       l_ts_1              DATE                   := NULL;
       l_ts_2              DATE                   := NULL;
       l_rest_empno        emp_stg.mbr_nbr%TYPE   := '0';
       l_commitsize        NUMBER;
       CURSOR curtrnrecs (l_rest_empno VARCHAR)
       IS
          SELECT /* user_hash(tmp) PARALLEL(tmp,8) */ tmp.sec_lbl, tmp.empno,
                    tmp.ename, tmp.sal, tmp.deptno
              FROM emp_stg tmp
             WHERE tmp.mbr_nbr > l_rest_empno
          ORDER BY tmp.mbr_nbr;
       TYPE rec_emp_stg IS TABLE OF emp_stg%ROWTYPE
          INDEX BY PLS_INTEGER;
       stg_emp_stg         rec_emp_stg;
       counter             NUMBER                 := 0;
       l_idx               NUMBER;
       ERRORS              PLS_INTEGER;
       ins_errors          EXCEPTION;
       PRAGMA EXCEPTION_INIT (ins_errors, -24381);
    BEGIN
       /* Copy values into local variables */
       l_pro := pgm_id;
       l_schd_dt := schd_dt;
           /* Check if this is the first execution of the program; Get the last processed timestamp if the run is a restart */
       /* The restartability of this program is slightly differnt. Data_nbr =1 indicates that the last run was successful. The same program can*/
       /* be called multiple times for the same t47date. The restartability is designed accordingly */
       BEGIN
          SELECT /* SQL_TAG(<$RCSfile: t50lyt_can_hist_trans_load.sql,v $><2>) */
                 data_nbr, 1, 1, NVL (key_text, '0')
            INTO l_data_nbr, l_ts_1, l_ts_2, l_rest_mbr_nbr
            FROM inft
           WHERE TRUNC (key_ts) = TRUNC (l_schd_dt) AND pro_id = l_pro_id;
       EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             l_data_nbr := 9;
             NULL;
          WHEN OTHERS
          THEN
             g_errorstring :=
                   g_log_error
                || ' : SQLCODE = '
                || SQLCODE
                || ' , ERRORMESSAGE = '
                || SUBSTR (SQLERRM, 1, 200);
             RAISE;
       END;
       IF l_data_nbr = 1
       THEN
          crm_msg.msg ('Exiting:: Program already run');
          RETURN;
       ELSIF l_data_nbr = 0
       THEN
          crm_msg.msg ('This is a restart for the date ' || l_schd_dt);
       ELSIF l_data_nbr = 9
       THEN
          crm_msg.msg ('First execution of this program');
       END IF;
       BEGIN
          IF l_data_nbr = 9
          THEN
             crm_msg.msg ('This is the First execution of this program');
             INSERT INTO inft
                         (pgm_id, key_ts, key_text, data_nbr, data_ts, data_text
                  VALUES (l_pro, l_schd_dt, 0,                     --to hold empno
                                              SYSDATE, 0    --no of recs processed
             COMMIT;
          END IF;
       END;
       OPEN curtrn (l_rest_empno);
       LOOP
          BEGIN
             FETCH curtrn
             BULK COLLECT INTO stg_emp_rec LIMIT 50000;
             IF NVL (curtrnrecs%ROWCOUNT, 0) = 0
             THEN
                crm_msg.msg ('No Historical Data');
             END IF;
             FORALL i IN 1 .. stg_emp_rec.COUNT SAVE EXCEPTIONS
                INSERT INTO emp
                     VALUES stg_emp_stg (i);
             counter := counter + 1;
             g_recs_ins := g_recs_ins + SQL%ROWCOUNT;
          EXCEPTION
             WHEN ins_errors
             THEN
                ERRORS := SQL%BULK_EXCEPTIONS.COUNT;
                FOR j IN 1 .. ERRORS
                LOOP
                   l_idx := SQL%BULK_EXCEPTIONS (j).ERROR_INDEX;
                   UPDATE emp
                      SET src_id = stg_emp_rec (i).empno,
                          ename = stg_emp_rec (i).ename,
                          sal = stg_emp_rec (i).sal
                    WHERE deptno = stg_emp_rec (i).deptno;
                   g_recs_upd := g_recs_upd + SQL%ROWCOUNT;
                END LOOP;
    --END;
             -- EXIT WHEN curTrnRecs%NOTFOUND;
    --END LOOP;
    --CLOSE curTrnRecs;
             WHEN OTHERS
             THEN
                g_errorstring :=
                      g_log_error
                   || ' : SQLCODE = '
                   || SQLCODE
                   || ' , ERRORMESSAGE = '
                   || SUBSTR (SQLERRM, 1, 200);
                crm_msg.msg (g_errorstring);
                RAISE;
          END;
          IF (counter >= l_commitsize)
          THEN
             BEGIN
    /* To keep track of the timestamp of the last record processed inthe batch; for restartability */
                UPDATE inft
                   SET data_ts = SYSDATE,
                       key_text = l_empno (idx)
                 WHERE pgm_id = l_pgm_id AND TRUNC (key_ts) = TRUNC (l_schd_dt);
                COMMIT;
                counter := 0;
             EXCEPTION
                WHEN OTHERS
                THEN
                   g_errorstring :=
                         g_log_error
                      || ' : SQLCODE = '
                      || SQLCODE
                      || ' , ERRORMESSAGE = '
                      || SUBSTR (SQLERRM, 1, 200);
                   crm_msg.msg (g_errorstring);
                   RAISE;
             END;
          END IF;
          COMMIT;
          EXIT WHEN curtrn%NOTFOUND;
    --       END LOOP; --End of looping for the main cursor  fetch
       END LOOP;
       CLOSE curtrn;
       BEGIN     /* Update the data_nbr to 1 to indicate the update is complete */
          UPDATE inft
             SET data_nbr = 1,
                 data_ts = NVL (g_aud_upd_ts, data_ts),
                 data_text = counter
           WHERE pro_id = l_pgm_id AND TRUNC (key_ts) = TRUNC (l_schd_dt);
          COMMIT;
       EXCEPTION
          WHEN OTHERS
          THEN
             g_errorstring :=
                   g_log_error
                || ' : SQLCODE = '
                || SQLCODE
                || ' , ERRORMESSAGE = '
                || SUBSTR (SQLERRM, 1, 200);
             crm_msg.msg (g_errorstring);
             RAISE;
       END;
       g_log_error := 'LOGGING SUMMARY';
       crm_msg.msg_tab ('RECS UPDATED', g_recs_upd);
       crm_msg.msg_tab ('RECS INSERTED', g_recs_ins);
       crm_msg.msg ('Program ends Successfully');
    EXCEPTION
       WHEN OTHERS
       THEN
          g_errorstring :=
                g_log_error
             || ' : SQLCODE = '
             || SQLCODE
             || ' , ERRORMESSAGE = '
             || SUBSTR (SQLERRM, 1, 200);
          crm_msg.msg (g_errorstring);
    END;Hope its useful.
    Cheers

  • Error consuming Web service - content type text/xml;charset=utf-8 of the response message does not match the content type of the binding

    Hi all,
    We are trying to interact with Documentum server through DFS exposed WCF which communicates through port 9443 and we are provided with documentum issued Public Key certificates. We have successfully imported the certificates in client machine and configured
    the bindings as below in our .Net web application config file.
    <system.serviceModel>
    <bindings>
    <wsHttpBinding>       
    <binding
    name="ObjectServicePortBinding1">
    <security
    mode="Transport">
    <transport
    clientCredentialType="None"
    proxyCredentialType="None"
    realm=""
    />
    <message
    clientCredentialType="Certificate"
    algorithmSuite="Default"
    />
    </security>
    </binding>
    <binding
    name="QueryServicePortBinding">
    <security
    mode="Transport">
    <transport
    clientCredentialType="None"
    proxyCredentialType="None"
    realm=""
    />
    <message
    clientCredentialType="Certificate"
    algorithmSuite="Default"
    />
    </security>
    </binding>
    </wsHttpBinding>
    </bindings>
    Also, we set the message encoding as MTOM and the wcf client object initialization code snippet is as below,
    ObjectServicePortClient
    serviceClient = new
    ObjectServicePortClient(new
    WSHttpBinding("ObjectServicePortBinding1"),
    new
    EndpointAddress(UriUtil.ObjectServiceUri));
    if (serviceClient.Endpoint.Binding
    is
    WSHttpBinding)
       WSHttpBinding
    wsBinding = serviceClient.Endpoint.Binding as
    WSHttpBinding;
    wsBinding.MessageEncoding =
    "MTOM".Equals(transferMode) ?
    WSMessageEncoding.Mtom :
    WSMessageEncoding.Text;
    serviceClient.Endpoint.Behaviors.Add(new
    ServiceContextBehavior(Config.RepositoryName,
    Config.DocumentumUserName,
    Config.DocumentumPassword));
    When we execute the above code, we are getting error message as below,
    Exception: The content type text/xml;charset=utf-8 of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported
    method is implemented properly. The first 407 bytes of the response were: '<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:VersionMismatch</faultcode><faultstring>Couldn't
    create SOAP message. Expecting Envelope in namespace http://schemas.xmlsoap.org/soap/envelope/, but got http://www.w3.org/2003/05/soap-envelope </faultstring></S:Fault></S:Body></S:Envelope>'
    Then, we changed the bindings as below
    <system.serviceModel>
    <bindings>
    <wsHttpBinding>       
    <binding
    name="ObjectServicePortBinding1">
    <security
    mode="Transport">
    <transport
    clientCredentialType="Certificate"
    proxyCredentialType="None"
    realm=""
    />
    <message
    clientCredentialType="Certificate"
    algorithmSuite="Default"
    />
    </security>
    </binding>
    <binding
    name="QueryServicePortBinding">
    <security
    mode="Transport">
    <transport
    clientCredentialType="
    Certificate"
    proxyCredentialType="None"
    realm=""
    />
    <message
    clientCredentialType="Certificate"
    algorithmSuite="Default"
    />
    </security>
    </binding>
    </wsHttpBinding>
    </bindings>
    We are getting another error message,
    Exception: The client certificate is not provided. Specify a client certificate in ClientCredentials.
    Any pointers on resolving this issue would be highly helpful.
    Thanks

    Hi Dhanasegaran,
      As per your case, the corresponding details which may guide you to resolve this issue:
    1. First of all, you can try to call the wcf service directly from the browser & check where it will point out the correct location.
    2. In config file ,Set IncludeExceptionDetailInFaults to true to enable exception information to flow to clients for debugging purposes .
    Set this to true only during development to troubleshoot a service like below :
    <serviceBehaviors>
      <behavior name="metadataAndDebugEnabled">
        <serviceDebug
          includeExceptionDetailInFaults="true"   
    />
        <serviceMetadata
          httpGetEnabled="true"
          httpGetUrl=""   
    />
      </behavior>
    </serviceBehaviors>
    3. I suggest you to change that <security mode ="TransportWithMessageCredential"> instead of <security mode ="Transport">
     for more information, refer the following link :
    https://msdn.microsoft.com/en-us/library/aa354508(v=vs.110).aspx

  • Deep DDIC-Structure - Method to get the Comp.Type of a sub-structure

    Dear colleagues,
    thought the subsequent piece of coding might be helpful for the following problem:
    In DDIC you have created a deep/nested Structure e.g. a complete Business Document representation like
    s_doc_header type struct_doc_header
         (incl.) item  type tab_item
            (incl) party type tab_party etc.
    Now for some purpose you need to access somewhere a sub-part of this structure, e.g. the party-part. You only know (dynamically) the component name "party", but need for dynamic access also the Component Type ("tab_party") (in order to make use of  a "CREATE DATA lr_reftodata TYPE (determined_comp_type)." )
    The following piece of coding should help to query any start component type (here "struct_doc_header") for its embedded components.
    Its a recursive use of features provided by the very nice class(set) of cl_abap_structdescr.
    I implemented it as a static method.
    When doing so, you need to ensure, that the TYPE-GROUP "ABAP" is linked to the class (class properties --> forward declarations),
    Let me know if you find it useful.
    And apologies in advance, if the same problem was already posted in the forum. I did only a rough search before due to a lag of ideas for appropriate search-strings ...
    Best regards,
    Rudy
    Signature:
    Importing:
    IV_COMPNAME     TYPE ABAP_COMPNAME
    IV_START_STRUCTR     TYPE KOMP_TYPE
    Exporting/returning
    EV_DDIC_STRUCT     TYPE KOMP_TYPE
    METHOD search_deep_ddic_by_comp.
    * Description      -------------------------------------------
    *  Methods looks into a deep DDIC-Structure and returns the
    *  corresponding TYPE
    *  Prerequsite for usage: Structures component names are unique.
    * Local Data Defintions --------------------------------------
    * Locals -----------------------------------------------------
    * TYPES:
      DATA: lv_compname                 TYPE abap_compname.
      DATA: lt_componenttable           TYPE abap_component_tab.
      DATA: lv_relative_name            TYPE string.
      DATA: lv_ddic_header                  TYPE x030l.
      DATA: lv_ddic_struct              TYPE komp_type.
      DATA: lv_start_struct             TYPE komp_type.
    * supporting
      DATA: lv_lines                    TYPE i.
      DATA: lv_message                  TYPE string.
      DATA: lt_selopt                   TYPE sesf_selection_parameters_tab.
      DATA: ls_selopt                   TYPE sesf_selection_parameter.
    * References -------------------------------------------------
      DATA: lo_struct_descr             TYPE REF TO cl_abap_structdescr.
      DATA: lo_type_descr               TYPE REF TO cl_abap_typedescr.
    * Field-Symbols ----------------------------------------------
      FIELD-SYMBOLS:
            <fs_struct_descr_component> TYPE abap_componentdescr.
      lo_struct_descr ?= cl_abap_structdescr=>describe_by_name( p_name = iv_start_structr ).
      IF lo_struct_descr IS BOUND.
    *   get all sub-structures/components of iv_start_structr
        CALL METHOD lo_struct_descr->get_components
          RECEIVING
            p_result = lt_componenttable.
        lv_compname = iv_compname.
        READ TABLE lt_componenttable ASSIGNING <fs_struct_descr_component>
                                               WITH KEY  name = lv_compname.
        IF sy-subrc = 0.
    *     matching component found - search for DDIC structure
          CALL METHOD <fs_struct_descr_component>-type->get_relative_name
            RECEIVING
              p_relative_name = lv_relative_name.
          ASSERT lv_relative_name IS NOT INITIAL.
          CASE <fs_struct_descr_component>-type->type_kind.
            WHEN 'u' OR 'v'. "structure
              ev_ddic_struct = lv_relative_name.
              RETURN.
            WHEN 'h'. "table type - derive the line type
              lo_type_descr ?= cl_abap_datadescr=>describe_by_name( p_name = lv_relative_name ).
              CALL METHOD lo_type_descr->get_ddic_header
                RECEIVING
                  p_header = lv_ddic_header.
              IF sy-subrc = 0.
                ev_ddic_struct   = lv_ddic_header-refname.
                RETURN.
              ELSE.
                "error
              ENDIF.
            WHEN OTHERS.
              "error
          ENDCASE.
        ELSE.
    *     go deeper into structure and look into each sub-structure via recursion
          LOOP AT lt_componenttable ASSIGNING <fs_struct_descr_component>.
            CALL METHOD <fs_struct_descr_component>-type->get_relative_name
              RECEIVING
                p_relative_name = lv_relative_name.
            ASSERT lv_relative_name IS NOT INITIAL.
            CASE <fs_struct_descr_component>-type->type_kind.
              WHEN 'u' OR 'v'. "structure
              WHEN 'h'. "table type - derive the line type
                lo_type_descr ?= cl_abap_datadescr=>describe_by_name( p_name = lv_relative_name ).
                CALL METHOD lo_type_descr->get_ddic_header
                  RECEIVING
                    p_header = lv_ddic_header.
                IF sy-subrc = 0.
                  lv_relative_name = lv_ddic_header-refname.
                ELSE.
                  "error
                ENDIF.
              WHEN OTHERS.
                EXIT. "next loop, investigate only struct and table
            ENDCASE.
    *        lv_compname     = <fs_struct_descr_component>-name.
            lv_start_struct = lv_relative_name.
            CALL METHOD /scmtms/cl_ddic_utility=>search_deep_ddic_by_comp
              EXPORTING
                iv_compname      = iv_compname
                iv_start_structr = lv_start_struct
              IMPORTING
                ev_ddic_struct   = lv_ddic_struct.
            IF lv_ddic_struct IS NOT INITIAL.
              ev_ddic_struct = lv_ddic_struct.
              EXIT.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDMETHOD.

    Using command:
    ASSIGN COMPONENT idx OF STRUCTURE struc TO <fs>.
    For example:
    DESCRIBE FIELD pi_output TYPE pi_output COMPONENTS lv_columns. "For number of columns
    DO lv_columns TIMES.
    ASSIGN COMPONENT SY-INDEX OF
    STRUCTURE (name of structure) TO <l_fs_output>. "<l_fs_output> - field of structure
    DESCRIBE FIELD <l_fs_output>... "with other options.
    ENDDO.

  • Apex_web_service.make_rest_request: Passing parameters and the content type

    Not sure if I am missing something, but should this API be setting the content type (to application/x-www-url-formencoded) when there are values present for the parameters p_parm_name and p_parm_value.
    The example in the docs is to a yahoo API. I'm not sure about that particular one (see: http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_web_service.htm#BABEDJHJ), and I think it requires an appid (yahoo account), so i just went with the example here:
    http://developer.yahoo.com/yql/guide/yql-code-examples.html#yql_php
    If I run the following from a html file on my desktop it works:
    <form method="POST" action="http://query.yahooapis.com/v1/public/yql">
    <input type="hidden" name="q" value="select * from upcoming.events where location='San Francisco' and search_text='dance'"></input>
    <input type="hidden" name="format" value="json"></input>
    <input type="submit"></input>
    </form>That is, it returns a JSON result.
    The raw HTTP data is as follows:
    POST http://query.yahooapis.com/v1/public/yql HTTP/1.1
    Host: query.yahooapis.com
    Connection: keep-alive
    Content-Length: 110
    Cache-Control: max-age=0
    Origin: null
    User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11
    Content-Type: application/x-www-form-urlencoded
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: en-AU,en;q=0.8,en-US;q=0.6
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
    q=select+fromupcoming.events+where+location%3D%27San+Francisco%27+and+search_text%3D%27dance%27&format=json>
    However, running the following returns nothing: (nothing, as in nothing that depends on the parameters passed in)
    set serveroutput on
    declare
    l_c CLOB;
    begin
      l_c := apex_web_service.make_rest_request(
        p_url => 'http://query.yahooapis.com/v1/public/yql',
        p_http_method => 'POST',
        p_parm_name => apex_util.string_to_table('q:format'),
        p_parm_value => apex_util.string_to_table('select * from upcoming.events where location=''San Francisco'' and search_text=''dance'':json'),
        p_proxy_override => 'http://192.168.1.3:8888');
      dbms_output.put_line(substr(l_c, 1, 4000));
    end;Raw HTTP data:
    POST http://query.yahooapis.com/v1/public/yql HTTP/1.1
    Host: query.yahooapis.com
    Connection: Keep-Alive
    Content-Length: 106
    Connection: close
    q=select+%2A+from+upcoming%2Eevents+where+location%3D'San+Francisco'+and+search_text%3D'dance'&format=json>
    I do note a key difference is that content type isn't being set in the web service API.
    This was just to test a public service. I do note that the above has slighty different request data (percentage encoding on some chars). However, I experienced the same behaviour on a procedure I had written (I can also provide this example test case if you like), which is where I first noticed the issue.
    Using utl_http and setting the content type to application/x-www-url-formencoded, does resolve the issue. However, just thought i'd see the possibility of using the Web service API that is made available.
    Is the example in the docs valid, or am I missing something obvious?
    This is on ApEx 4.1 on the OTN Dev Days VM.
    Thoughts?

    Hi trent,
    I too have had issues with this API , so moved forward with UTL_HTTP API.
    There is something amiss.
    If you change your code to the one below it works.
    SET SERVEROUT ON
    declare
    l_c CLOB;
    l_param varchar2(1000) ;
    begin
    l_param := 'select * from upcoming.events where location=''San Francisco'' '||
            ' and search_text=''dance'''||'&'||'format=json';
    l_c := apex_web_service.make_rest_request(
        p_url => 'http://query.yahooapis.com/v1/public/yql?q='||
            utl_url.escape(l_param)
        ,p_http_method => 'POST'
      dbms_output.put_line(substr(l_c, 1, 4000));
    end;
    /Note the use of UTL_URL.ESCAPE. The call does not work without it.
    I do not use a proxy, so that parameter does not feature in my snippet above.
    Cheers,
    PS: However, the below does not work. So, it appears that the p_parm_name and p_parm_value do not quite work.
    SET SERVEROUT ON;
    declare
    l_c CLOB;
    l_param varchar2(1000) ;
    begin
    l_param := 'select * from upcoming.events where location=''San Francisco'' and search_text=''dance''';
    l_c := apex_web_service.make_rest_request(
        p_url => 'http://query.yahooapis.com/v1/public/yql'
        ,p_http_method => 'POST'
        ,p_parm_name => apex_util.string_to_table('q:format')
        ,p_parm_value => apex_util.string_to_table(utl_url.escape(l_param)||':json')
      dbms_output.put_line(substr(l_c, 1, 4000));
    end;
    / Edited by: Prabodh on Oct 13, 2012 2:04 PM

Maybe you are looking for