Queries in abap

Hi ,
Please provide the answers to the following:
Idocs:
1.How are where are the change pointers used and their purpose?
2.How is the idoc configured with message control technology?
3.There are 16 idocs for execution. Among them the 5th idoc contains error. so,please let me know if the remaining idocs will be executed or will be stopped at 5th  idoc?
4.How to enhance an Idoc?
5.How the idocs can be deleted?
6.if the idoc status is 64,  what does it mean?
7.where  are the idocs monitored?
8.What is the tcode to test a idoc with creating a new idoc from it?
9. what are the settings that are needed to be done for change pointers?
10. How to debug a outbound idoc?
BDC.
1. You have uploaded a file with the path from desktop and scheduled a background job. Then what happens?
2. When there are 1000's of records which method(call transacton or session method) is better and what is the reason for it?
3.There are 40000 records that are to be updated through session method. And for this background job is scheduled. And the mid of
this execution in background. The power is off and server is shut down. Now again when the power is on, in sm35 in what mode that corresponding session exists(in which mode processing more or error mode) and what is the reason for it.
How to analyze upto how many records are updated. And how to process the remiaing records which are not processed?
4. what is the difference between call transaction and bapi. In which case bapi is better than call transaction.
5. can exception handling can be done in bapi. If yes how?If no why and what happens if exception handling is done for bapi?
6. For BDC table control, fixed size is set with cpu params. Now assume that at a glance only  5 records are visible in table control.
now when the enter is pressed, what will be index for remaining next set of records. please let me know if it starts fresh with index 1 or it continues with next index 6.
7. Why we can't use enjoy transactions for BDC?
Module pool:
1.What is the prequisite for table control?
2. How many number of tabs can be created with tab strip?
3. can we call a report from module pool? if yes how?
4. what is leave to list processing and what happens if it is used?
5. can we call a selecion screen from module pool?
oops:
1. what are the advantages and disadvantages of using reference  variables?
2. what is narrow and widening casts?
3. what is is-bound in oops?
4. You have created report  using alv with oops(using screen and grid container etc.,).
Now, if the above report is scheduled in background, what happens? If it goes to dump, what code and where it has to be written to resolve tjhat dump?
scripts and smartforms:
1.How many main windows can be created in scripts and smartforms?
2. Can a scripts works with out main window and can a smartform works without mainwindow?
3. Types of windows in scripts and smartforms?
4.How a table can be created in scripts and smartforms?
5.The data from smartform is in 4 pages. One page has to be printed in A4 size ans second page has to be printed in A2 size etc., i.e different pages has to be printed in different formats. Is it possbile to do? If possible, where the corresponding required settings has to be made?
abap dictionary?
1. what is search help and how it is used?
2. what is the purpose of primary index and secondary index?
   How the searching takes placed with respect to above indexes?
user exits and badi's?
1.if the break point kept in function module of user exit is not triggered? what is the reason?
2. How a filter level badi's can be done?
4. How to use or create pricing routines in sd?

Moderator message - this is wrong on so many levels, I don't know where to begin, Maybe someone can help me.
Rob

Similar Messages

  • Regarding parallel queries in ABAP same as in oracle 10g

    Hi,
       Is there any way we can write parallel queries in ABAP, in the same way we do in oracle 10g.Kindly see below;
    alter table emp parallel (degree 4);
    select degree from user_tables where table_name = 'EMP';
    select count(*) from emp;
    alter table emp noparallel;
    SELECT /*+ PARALLEL(emp,4) / COUNT()
    FROM emp;
    The idea here is to distribute the load of select query in multiple CPUs for load balancing & performance improvement.
    Kindly advise.
    Thanks:
    Gaurav

    Hi,
    >    Is there any way we can write parallel queries in ABAP, in the same way we do in oracle 10g.
    sure. Since it is just a hint...
    SELECT *
      FROM t100 INTO TABLE it100
      %_HINTS ORACLE 'PARALLEL(T100,4)'.
    will give you such an execution plan for example:
    SELECT STATEMENT ( Estimated Costs = 651 , Estimated #Rows = 924.308 )
           4 PX COORDINATOR
               3 PX SEND QC (RANDOM) :TQ10000
                 ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                 Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
                   2 PX BLOCK ITERATOR
                     ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                     Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
                       1 TABLE ACCESS FULL T100
                         ( Estim. Costs = 651 , Estim. #Rows = 924.308 )
                         Estim. CPU-Costs = 33.377.789 Estim. IO-Costs = 646
    PX = Parallel eXecution...
    But be sure that you know what you do with the parallel execution option... it is not scalable.... .
    Kind regards,
    Hermann

  • SELECT  QUERIES IN ABAP.....

    Can you give some idea about writing efficient select queries in ABAP?

    Hi kishan,
      i can give you some hint from one document, please reward point.
    The hit list is the set of rows determined by the WHERE clause. In other words, it is the set of table rows that the database system must take into account to respond to the query. Don’t confuse the hit list with the solution set, which is the set of rows (not necessarily from the table the query deals with) the database system returns to the program. Notice that in many cases the query’s hit list and the solution set are different.
    What is the reason behind this rule? A smaller hit list saves disk I/Os by the database system and often reduces network load. Both of these factors have a strong influence on your program’s runtime performance.
    How can you use ABAP to limit a hit list? First, use a WHERE clause whenever possible. Second, always try to describe the full search condition (not just part of it) within a single WHERE clause. ABAP provides a variety of arithmetical and logical operators to do this. Compared with your application program, the database server is usually the better place to evaluate search conditions.
    Let me give you an example: Run a query against the flight table to produce a list of all flight dates for Lufthansa flight 0300 in 1998. Air carrier and air connection are known and can easily be used within the WHERE clause of the SELECT statement. The relevant year is also given, but at first glance it is difficult to build an appropriate search condition. Faced with this situation, you could be tempted to use the ABAP CHECK statement.
    CHECK evaluates the subsequent logical expression. If it is true, the processing continues with the next statement. CHECK with a negative outcome terminates the current SELECT-ENDSELECT loop to start with the next row of the solution set, if there is one. Considering that fldateis a type D(YYYYMMDD) column of the sflighttable, a correct fragment of an ABAP program could look like this:
    SELECT fldate
      FROM sflight INTO xdate
      WHERE carrid = 'LH'
        AND connid = '0300'.
      CHECK xdate = '1998'.
        WRITE: / xdate.
    ENDSELECT.
    With ABAP in general, CHECK does the job of pattern matching in character variables. But in the WHERE clause of a SELECT statement, pattern matching also can be done easily by applying the LIKE operator. Within the search pattern, two characters have a particular meaning: “_” stands for any one character and “%” stands for any character string. With this in mind, a better solution would be:
    SELECT fldate
      FROM sflight INTO xdate
      WHERE carrid ='LH'
        AND connid ='0300'
        AND fldate LIKE '1998%'.
      WRITE: / xdate.
    ENDSELECT.

  • Tracing queries from abap to a custom database via dblink

    I' m connecting to a database by dblink (name magiap).
    I would like to know if somewhere I can trace all the queries from abap to oracle in this specific session , to dbs ='MAGIAP'.
    For istance, i would like that the query "SELECT "DESPARTY1"
    into :v_DESPARTY1
    FROM "T040PARTY"
    WHERE "CODPARTY" = '305142941' will be stored some where (in a file??).
    I would like that parameters - w_CODPARTY- will be substituted and stored in the trace file with the value (305142941), as shown in the previous
    Here is the piece of code ..(a very short example of course)..
    DATA : dbs LIKE dbcon-con_name,
    v_CODPARTY(15),
    v_DESPARTY1(60).
    data : w_CODPARTY(15) value '305142941'.
    dbs = 'MAGIAP'.
    TRY.
    EXEC SQL.
    CONNECT TO :dbs
    ENDEXEC.
    IF sy-subrc <> 0.
    EXEC SQL.
    CONNECT TO :dbs
    ENDEXEC.
    ENDIF.
    IF sy-subrc <> 0.
    * RAISE err_conn_aea.
    ENDIF.
    EXEC SQL.
    set connection :dbs
    ENDEXEC.
    EXEC SQL .
    SELECT "DESPARTY1"
    into :v_DESPARTY1
    FROM "T040PARTY"
    WHERE "CODPARTY" = :w_CODPARTY
    ENDEXEC.
    IF sy-subrc NE 0.
    * rc = 4.
    ENDIF.
    EXEC SQL.
    DISCONNECT :dbs
    ENDEXEC.
    ENDTRY.

    Hi Silvana,
    The SQL statements have been stored in the SQL Cursor Cache, on the database and they will be available until they have been invalidated. You can access the statements at the 'MAGIAP' side and see the last executed queries in the cache.
    You can access bind variables by query on the V$SQL_BIND_CAPTURE table, also.
    On the other hand, you can activate the trace by the statement, below;
    ALTER SYSTEM SET sql_trace = true SCOPE=MEMORY;
    Then, the sql statements will be available in the usertrace file. Please note that you should execute and investigate all the statements that I noted above, at the remote side. Plus, as far as I know that it is not able to distinguish the records by the "dblink name". You should check all the statements and try to figure out what queries have been executed remotely.
    Best regards,
    Orkun Gedik

  • Trace queries from abap to a custom oracle database via dblink

    I' m
    connecting to a database by dblink (name magiap).
    I
    would like to know if somewhere I can trace all the queries from abap to oracle
    in this specific session , to dbs ='MAGIAP'.
    For istance, i would like that the query
    "SELECT "DESPARTY1"
    into :v_DESPARTY1
    FROM "T040PARTY"
    WHERE "CODPARTY" = '305142941' will
    be stored some where (in a file??).
    I would like that parameters - w_CODPARTY- will be substituted and stored in the trace
    file with the value (305142941), as shown in the previous
    Here
    is the piece of code ..(a very short example of course)..
    DATA : dbs LIKE dbcon-con_name,
    v_CODPARTY(15),
    v_DESPARTY1(60).
    data : w_CODPARTY(15) value '305142941'.
    dbs = 'MAGIAP'.
    TRY.
    EXEC SQL.
    CONNECT TO :dbs
    ENDEXEC.
    IF sy-subrc <> 0.
    EXEC SQL.
    CONNECT TO :dbs
    ENDEXEC.
    ENDIF.
    IF sy-subrc <> 0.
    * RAISE err_conn_aea.
    ENDIF.
    EXEC SQL.
    set connection :dbs
    ENDEXEC.
    EXEC SQL .
    SELECT "DESPARTY1"
    into :v_DESPARTY1
    FROM "T040PARTY"
    WHERE "CODPARTY" =
    :w_CODPARTY
    ENDEXEC.
    IF sy-subrc NE 0.
    * rc = 4.
    ENDIF.
    EXEC SQL.
    DISCONNECT :dbs
    ENDEXEC.
    ENDTRY.

    Hi Silvana,
    The SQL statements have been stored in the SQL Cursor Cache, on the database and they will be available until they have been invalidated. You can access the statements at the 'MAGIAP' side and see the last executed queries in the cache.
    You can access bind variables by query on the V$SQL_BIND_CAPTURE table, also.
    On the other hand, you can activate the trace by the statement, below;
    ALTER SYSTEM SET sql_trace = true SCOPE=MEMORY;
    Then, the sql statements will be available in the usertrace file. Please note that you should execute and investigate all the statements that I noted above, at the remote side. Plus, as far as I know that it is not able to distinguish the records by the "dblink name". You should check all the statements and try to figure out what queries have been executed remotely.
    Best regards,
    Orkun Gedik

  • Executing Abap Queries in Abap Code and processing the result

    Hi,
    I want to execute ABAP Queries (designed by sq01) in an abap report and processing the result in an internal table.
    How could it be work?
    Thanks a lot for your responses,
    with kind Regards
    Reinhold Strobl

    Hello,
    GO to SQ01 and select your query. Go to Menu QUERY-->More Functions->Display Report Name.
    You can then take that report name and go to SE38. Copy the code before END-OF_SELECTION and then modify as per your own requirements.
    Regrads
    Saket Sharma

  • Call of BW queries from ABAP code

    Has anybody information about how is it possible to call a BW query from ABAP code with parametrization (specifying characteristics) ? In our development project it's a crucial part, beacuse we have to provide interim function modules to carry out some conversion routine on BW provided data, before we put it on the screen embedded in a Visual composer Iview.

    Have a look at this:
    Calling BW queries programatically (also posted on BW forum)
    Hope it helps.
    Regards

  • Preloading Queries via ABAP

    Hello Experts,
    Using standard below function modules I want to preload queries with variants.
    RRI_REPDIR_READ
    RRI_REPORT_GENERATE
    RRX_REPORT_OPEN
    RRX_VARIABLES_FLUSH
    RRX_GRID_CMD_PROCESS
    RRX_REPORT_CLOSE
    All abap staffs are ready, but somewhere deep inside the sap someone hide an functionality to start sap function modules one after another automatically.
    All is ok when i'm starting it by hand one after another, but when i'm trying to start it via function module (also via RFC), another report (submits with different background jobs) or a process chain, even when I set a huge delay between respective queries only the last query has working entry in cache. Sap for unknown reason not used the rest of good entires. I suppose that one of user temporary table should be cleaned before report runs. 
    Did you have similiar situation with starting report or fm automatically one after another?

    HI Karl,
      Some good news for you ! I know for sure that Blackberry is supported by SAP, because I saw their demo of Travel Expenses and Time Sheets applications on the Blackberry devices !!!
      I also heard, that there are some limitations on what you can do with BW reports on Bleckberry device, e.g. you can see pre-configured report, but can not drill it down.
      Here is another quote from SAP: "Every mobile application based on WebDynpro is rendered appropriately for a BlackBerry device.
      For user convenience, SAP has integrated single sign on to SAP systems via the BlackBerry device. The user only has to enter the password to unlock his BlackBerry, and is able to access SAP applications online without any further logon screens".
      To get more detailed info on your query, you may contact one of the following guys in UK, who can have first-hand info:
      - Alberto Zamora (Solution Principal, SAP Mobile Business): [email protected]
      - Nicola Grant (Business Manager, O2 Solutions): [email protected]
      - Nicole Van Gheluwe (Alliances Marketing Manager, EMEA, Research in Motion): [email protected]
      Hope it helps.
    Best regards,
    Laziz

  • Dynamic Queries in ABAP?

    Hi,
    I'm currently trying to develop an RFC FM that can create a dynamic query. I want to use the FM to query different tables without having to write n number of different cases.
    For example a particular application might need to query table xyz with three fields defined in the where clause. Another app might need to query the same table with only two fields defined in the where clause. In the same way I would like to be able to use the very same FM to query another table abc with x number of parameters.
    I'd like to send the where clause in a table.
    Is that possible?

    hi Roberto,
    try with this function.
    FUNCTION ztest.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(EXTRACT_TABLE) TYPE  DD02L-TABNAME
    *"     REFERENCE(WHERE_TAB) TYPE  WHERECONDS
    *"     REFERENCE(FIELD_LIST) TYPE  WHERECONDS
    *"  EXPORTING
    *"     REFERENCE(RETURN_TABLE) TYPE  TABLE
      TYPE-POOLS: abap.
      FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                     <dyn_wa> TYPE ANY.
      DATA: dy_table TYPE REF TO data,
            dy_line  TYPE REF TO data,
            xfc TYPE lvc_s_fcat,
            ifc TYPE lvc_t_fcat,
            field_line TYPE wherecond.
    data: fields(1000).
      DATA : idetails TYPE abap_compdescr_tab,
             xdetails TYPE abap_compdescr.
      DATA : ref_table_des TYPE REF TO cl_abap_structdescr.
    Get the structure of the table.
      ref_table_des ?= cl_abap_typedescr=>describe_by_name( extract_table ).
      idetails[] = ref_table_des->components[].
      LOOP AT idetails INTO xdetails.
        READ TABLE field_list WITH KEY text = xdetails-name TRANSPORTING NO FIELDS.
        check sy-subrc = 0.
        CLEAR xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-inttype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        APPEND xfc TO ifc.
      ENDLOOP.
    Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = ifc
        IMPORTING
          ep_table        = dy_table.
      ASSIGN dy_table->* TO <dyn_table>.
      LOOP AT field_list INTO field_line.
        CONCATENATE fields field_line-text INTO fields SEPARATED BY space.
      ENDLOOP.
    Select Data from table.
      SELECT (fields) FROM (extract_table) INTO TABLE <dyn_table> WHERE (WHERE_TAB).
      return_table[] = <dyn_table>.
    ENDFUNCTION.
    where
    EXTRACT_TABLE -->  name of the table
    WHERE_TAB       -->  internal table contains the where conditions
    FIELD_LIST          -->  list of fields that u want
    RETURN_TABLE  -->  dynamic table returns the selected values

  • Creating or Updating BW Queries at runtime using ABAP

    Hi everybody,
    How can we create BW Query programmatically (using ABAP) or How can we update structure of BW queries at run time using ABAP? We have requirement where we want to add/remove characteristics from rows section of query at run time based on user’s input, we are making a BSP module for that, is there any function module provided to create or update BW queries in ABAP?

    Hi Annabelle,
    I think there is a very simple solution to your problem - use lexical parameters.
    You define a user parameter e.g. P_TABLE with a default value e.g. EMP. This must be the name of an existing table. The you write your select like this: SELECT ENAME,SAL from &P_TABLE. This will work as long as the default value is the name of an existing table. You can now change the value of P_TABLE as long as the column names are the same. If the column names also changes then you can write the select as: SELECT &P_COL1 ENAME,&P_COL2 SAL from &P_TABLE.
    Regards,
    Hans Peter Guldager
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by AnnabelleJones:
    Hello!
    I want to create queries and charts, one for each of a number of tables which each have the same format. I dont know how many tables at design time but will do at runtime. Is there any way of creating charts and tables at runtime or will I have to generate a seperate report for each table?
    Thanks for any help!<HR></BLOCKQUOTE>
    null

  • To find Queries by InfoObjects

    Hi SDN Community
    Here is a reversal of a post made by another developer
    List of infoobjects used in a Query
    This has the reverse logic... thanks for the tip.
    *& Report  ZBW_FIND_CHARACTERISTICS_QUERY
    SAP Consulting BW Tools:
    *& Find Characteristics in BEx Queries using ABAP
    *& List of infoobjects used in a Query
    *& Developer: WBHADS 07/06/2011
    REPORT  ZBW_FIND_CHARACTERISTICS_QUERY.
    PARAMETER:  CHARACT   LIKE rszrange-IOBJNM.
    DATA:  s_characteristic LIKE rszrange-IOBJNM.
    s_characteristic  = CHARACT.
    DATA: lv_count        TYPE i.
    DATA: lv_count1       TYPE i.
    DATA: lv_count2       TYPE i.
    Data Declaration
    DATA:  D_MSG_TEXT(50).
    DATA:  lc_DIRECTORY(30)         TYPE c.
    DATA:  P_FILE(128).
    DATA:  FILENAME(128).
    DATA:  lc_query(60)             TYPE c.
    DATA:  lc_date(30)              TYPE c.
    DATA:  lc_time(30)              TYPE c.
    DATA:  lc_start_time(60)        TYPE c.
    DATA:  lc_syst(30)              TYPE c.
    DATA:  lc_exception(120)        TYPE c.
    RSZELTDIR   Directory of the reporting component elements
    RSZELTTXT   Texts of reporting component elements
    RSZELTXREF  Directory of query element references
    RSRREPDIR   Directory of all reports (Query GENUNIID)
    RSZCOMPDIR  Directory of reporting components
    RSZRANGE    Selection specification for an element
    RSZSELECT   Selection properties of an element
    RSZELTDIR   Directory of the reporting component elements
    RSZCOMPIC   Assignment reuseable component <-> InfoCube
    RSZELTPRIO  Priorities with element collisions
    RSZELTPROP  Element properties (settings)
    RSZELTATTR  Attribute selection per dimension element
    RSZCALC     Definition of a formula element
    RSZCEL      Query Designer: Directory of Cells
    RSZGLOBV    Global Variables in Reporting
    data: gi_data like rszrange occurs 0 with header line.
    Determine the queries
    tables:
    RSZELTTXT,
    rszeltdir,
    rszeltxref,
    rszrange.
    data: begin of lt_line occurs 0,
            ELTUID  like RSZELTDIR-ELTUID,      "char 25
            MAPNAME like RSZELTDIR-MAPNAME,       "char 30
          end of lt_line.
    data: begin of lt_line1 occurs 0,
            SELTUID  like rszeltxref-SELTUID,      "char 25
            TELTUID  like rszeltxref-TELTUID,     "char 25
            LAYTP    like rszeltxref-LAYTP,       "char 30
          end of lt_line1.
    data: begin of lt_line2 occurs 0,
            ELTUID  like rszrange-ELTUID,      "char 25
            IOBJNM  like rszrange-IOBJNM,     "char 25
          end of lt_line2.
    data: lt_tab like standard table of lt_line initial size 0.
    data: lt_tab1 like standard table of lt_line initial size 0.
    data: lt_tab2 like standard table of lt_line initial size 0.
    data: lt_line20(128) TYPE c.  " LIKE RSZELTXREF-SELTUID.
    data: lt_line30(128) TYPE c.  " LIKE RSZELTXREF-SELTUID.
      clear lt_line.
      lv_count  = 0.
      lv_count2 = 0.
    Loop through all the queries
      select * from RSZELTDIR
               into corresponding fields of lt_line
               where DEFTP = 'REP'
               and OBJVERS  = 'A'.
             Filter by the Z Developed Queries
               IF lt_line-MAPNAME CP 'Z*'.
                clear lt_line20.
                Get the Query Long Name
                  select single * from RSZELTTXT
                    into lt_line20
                    where eltuid = lt_line-eltuid           "rszeltdir-eltuid
                    and objvers = 'A'
                    and langu = 'EN'.
                  Find all the query elements within the query
                    select * from rszeltxref
                     into corresponding fields of lt_line1
                      where seltuid = lt_line-eltuid        "rszeltdir-eltuid
                      and objvers = 'A'.
                      IF lt_line1-laytp = 'FIX' OR lt_line1-laytp = 'COL' OR lt_line1-laytp = 'ROW'.
                        Determine if the Query Element is matching to the characteristic
                          select * from rszrange             "appending table gi_data
                             into corresponding fields of lt_line2
                             where eltuid = lt_line1-teltuid    "rszeltxref-teltuid
                             and objvers = 'A'
                             and enum = 1.
                              Populate tables
                                IF lt_line2-IOBJNM = s_characteristic.
                                    append  lt_line-MAPNAME to lt_tab.
                                    lv_count = lv_count + 1.
                                ENDIF.
                          endselect.
                      ENDIF.
                   endselect.
               ENDIF.
      endselect.
        sort lt_tab by MAPNAME.
        delete adjacent duplicates from lt_tab comparing MAPNAME.
       DIRECTORY represents path where file is stored .
        lc_DIRECTORY = '/interfaces/EDW/data/CSM/'.
        CONCATENATE 'EDW Queries by Characteristic -' SY-DATUM
        '.txt' into P_FILE SEPARATED BY SPACE.
      CONCATENATE lc_DIRECTORY P_FILE into FILENAME.
    Opening the Log File
      OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
                           ENCODING DEFAULT.
        IF SY-SUBRC NE 0.
          WRITE: 'File cannot be opened. Reason:'.  ", D_MSG_TEXT.
          EXIT.
        ENDIF.
       CONCATENATE 'System Date -' SY-DATUM 'YYYYMMDD' into lc_date
              SEPARATED BY SPACE.
       CONCATENATE 'EDW System -' SY-SYSID into lc_syst
              SEPARATED BY SPACE.
          TRANSFER lc_date TO FILENAME.
          TRANSFER lc_start_time TO FILENAME.
          TRANSFER lc_syst TO FILENAME.
      Queries for the parameters
         loop at gi_data into lt_line.
          loop at lt_tab into lt_line.
             TRANSFER lt_line TO FILENAME.
          endloop.    "Query Loop
    Closing the Log File
      CLOSE DATASET FILENAME.

    We have successfully created an ABAP program to do this.
    Thank you.
    Simon
    *& Report  ZBW_FIND_CHARACTERISTICS_QUERY
    SAP Consulting BW Tools:
    *& Find Characteristics in BEx Queries using ABAP
    *& List of infoobjects used in a Query
    *& Developer: WBHADS 07/06/2011
    REPORT  ZBW_FIND_CHARACTERISTICS_QUERY.
    PARAMETER:  CHARACT   LIKE rszrange-IOBJNM.
    PARAMETER:  VARIABN   LIKE RSZGLOBV-VNAM.
    DATA: query_name TYPE RSZCOMPID.
    DATA: s_varname  TYPE RSZGLOBV-VNAM,
          s_varnameu TYPE RSZGLOBV-VARUNIID.
    DATA:  s_characteristic LIKE rszrange-IOBJNM.
    DATA: lv_count        TYPE i.
    DATA: lv_count1       TYPE i.
    DATA: lv_count2       TYPE i.
    Data Declaration
    DATA:  D_MSG_TEXT(50).
    DATA:  lc_DIRECTORY(30)         TYPE c.
    DATA:  P_FILE(128).
    DATA:  FILENAME(128).
    DATA:  lc_query(60)             TYPE c.
    DATA:  lc_date(30)              TYPE c.
    DATA:  lc_time(30)              TYPE c.
    DATA:  lc_start_time(60)        TYPE c.
    DATA:  lc_syst(30)              TYPE c.
    DATA:  lc_exception(120)        TYPE c.
    RSZELTDIR   Directory of the reporting component elements
    RSZELTTXT   Texts of reporting component elements
    RSZELTXREF  Directory of query element references
    RSRREPDIR   Directory of all reports (Query GENUNIID)
    RSZCOMPDIR  Directory of reporting components
    RSZRANGE    Selection specification for an element
    RSZSELECT   Selection properties of an element
    RSZELTDIR   Directory of the reporting component elements
    RSZCOMPIC   Assignment reuseable component <-> InfoCube
    RSZELTPRIO  Priorities with element collisions
    RSZELTPROP  Element properties (settings)
    RSZELTATTR  Attribute selection per dimension element
    RSZCALC     Definition of a formula element
    RSZCEL      Query Designer: Directory of Cells
    RSZGLOBV    Global Variables in Reporting
    data: gi_data like rszrange occurs 0 with header line.
    Determine the queries
    tables:
    RSZELTTXT,
    rszeltdir,
    rszeltxref,
    rszrange.
    data: begin of lt_line occurs 0,
            ELTUID      like RSZELTDIR-ELTUID,        "char 25
            MAPNAME     like RSZELTDIR-MAPNAME,       "char 30
            TXTLG(60)   TYPE c,
          end of lt_line.
    data: begin of lt_line1 occurs 0,
            SELTUID  like rszeltxref-SELTUID,      "char 25
            TELTUID  like rszeltxref-TELTUID,      "char 25
            LAYTP    like rszeltxref-LAYTP,
          end of lt_line1.
    data: begin of lt_line2 occurs 0,
            ELTUID    like rszrange-ELTUID,      "char 25
            IOBJNM    like rszrange-IOBJNM,
            LOW       like rszrange-LOW,
            LOWFLAG   like rszrange-LOWFLAG,
          end of lt_line2.
    data: begin of lt_line3 occurs 0,
            VARUNIID  like RSZGLOBV-VARUNIID,      "char 25
            VNAM      like RSZGLOBV-VNAM,
            IOBJNM    like RSZGLOBV-IOBJNM,
          end of lt_line3.
    data: lt_tab like standard table of lt_line initial size 0.
    data: lt_tab1 like standard table of lt_line1 initial size 0.
    data: lt_tab2 like standard table of lt_line2 initial size 0.
    data: lt_tab3 like standard table of lt_line3 initial size 0.
    data: lt_line20(128) TYPE c.  " LIKE RSZELTXREF-SELTUID.
    data: lt_line30(128) TYPE c.  " LIKE RSZELTXREF-SELTUID.
    type-pools:
          rs,   "BW global
          rrms, "message server
          rsz,  "Qry definition global
          rzx0, "Qry RFC interface
          rzd1. "Qry definition database
    DATA: l_target_compid   TYPE rszcompdir-compid,
          l_t_uid_server    TYPE rzx0_t_uid_server,
          l_s_uid_server    TYPE rzx0_s_uid_server_x,
          l_s_msg           TYPE rs_s_msg,
          l_s_compdir       TYPE rzx0_s_compdir,
          l_s_eltdir        TYPE rzx0_s_eltdir,
          l_s_elttxt        TYPE rzx0_s_elttxt,
          l_t_eltdir        TYPE rzx0_t_eltdir,
          l_t_eltprop       TYPE rzx0_t_eltprop,
          l_t_eltprio       TYPE rzx0_t_eltprio,
          l_t_eltattr       TYPE rzx0_t_eltattr,
          l_t_eltxref       TYPE rzx0_t_eltxref,
          l_t_compdir       TYPE rzx0_t_compdir,
          l_t_compic        TYPE rzx0_t_compic,
          l_t_select        TYPE rzx0_t_select,
          l_t_range         TYPE rzx0_t_range,
          l_t_calc          TYPE rzx0_t_calc,
          l_t_elttxt        TYPE rzx0_t_elttxt,
          l_t_cell          TYPE rzx0_t_cel.
    data: c_subrc LIKE sy-subrc.
    data:
      l_GENUNIID                  LIKE RSRREPDIR-GENUNIID,
      l_COMPID                  LIKE RSZCOMPDIR-COMPID,
      l_COMPUID                  LIKE RSZCOMPDIR-COMPUID,
      I_OBJVERS                  LIKE RSZCOMPDIR-OBJVERS,
      I_WITH_TEMPLATES         LIKE RSGENERAL-BOOL,
      I_BY_INFOCUBE           LIKE RSZCOMPIC-INFOCUBE,
      I_TEMPLATE_TYPE           LIKE RSZELTDIR-DEFTP,
      I_VARIABLE_TYPES           LIKE RSZHELP-VARTYPES,
      I_VARIABLE_INFOOBJECT    LIKE RSZGLOBV-IOBJNM,
      I_LANGUAGE                  LIKE SY-LANGU,
      I_USE_BUFFER           TYPE RS_BOOL.
    FIELD-SYMBOLS:
                   <l_s_eltdir>        TYPE rzx0_s_eltdir,
                   <l_s_compdir>       TYPE rzx0_s_compdir,
                   <l_s_compic>        TYPE rzx0_s_compic,
                   <l_s_eltxref>       TYPE rzx0_s_eltxref.
    DATA:
        l_t_eltxref_seltuid   LIKE rszeltxref-seltuid,
        l_t_eltxref_teltuid   LIKE rszeltxref-teltuid,
        l_t_eltxref_laytp     LIKE rszeltxref-laytp.
      s_characteristic  = CHARACT.
    Find instances of the Forecast/Budget Variable in queries
      s_varname  = VARIABN.  "'ZE_BFC01'.
      SELECT SINGLE VARUNIID from RSZGLOBV
          INTO s_varnameu where VNAM = s_varname.
      clear lt_line.
      lv_count  = 0.
      lv_count2 = 0.
    Loop through all the queries
      select * from RSZELTDIR
               into corresponding fields of lt_line
               where DEFTP = 'REP'
               and OBJVERS  = 'A'.
               l_COMPUID = lt_line-ELTUID.
               l_GENUNIID = lt_line-MAPNAME.
             Filter by the Z Developed Queries
               IF l_GENUNIID CP 'Z*'.
                clear lt_line20.
                Get the Query Long Name
                  select single * from RSZELTTXT
                    into lt_line20
                    where eltuid = lt_line-eltuid           "rszeltdir-eltuid
                    and objvers = 'A'
                    and langu = 'EN'.
                  Find all the query elements within the query using function module
                  Get the tables of source query and its components
                    CALL FUNCTION 'RSZ_X_COMPONENT_GET'
                      EXPORTING
                       i_genuniid   =
                       I_COMPID     =
                        I_COMPUID     = l_COMPUID
                      IMPORTING
                        e_subrc       = c_subrc
                      TABLES
                       c_t_eltdir    = l_t_eltdir
                       c_t_eltprop   = l_t_eltprop
                       c_t_eltprio   = l_t_eltprio
                       c_t_eltattr   = l_t_eltattr
                        c_t_eltxref   = l_t_eltxref.
                       c_t_compdir   = l_t_compdir
                       c_t_compic    = l_t_compic
                       c_t_select    = l_t_select
                       c_t_range     = l_t_range
                       c_t_calc      = l_t_calc
                       c_t_elttxt    = l_t_elttxt
                       c_t_cell      = l_t_cell.
                    LOOP AT l_t_eltxref ASSIGNING <l_s_eltxref>.
                      l_t_eltxref_seltuid = <l_s_eltxref>-seltuid.
                      l_t_eltxref_teltuid = <l_s_eltxref>-teltuid.
                      l_t_eltxref_laytp  = <l_s_eltxref>-laytp.
                      IF l_t_eltxref_laytp = 'FIX' OR l_t_eltxref_laytp = 'COL' OR l_t_eltxref_laytp = 'ROW' OR l_t_eltxref_laytp = 'AGG'.
                        Determine if the Query Element is matching to the characteristic
                          select * from rszrange
                             into corresponding fields of lt_line2
                             where eltuid = l_t_eltxref_teltuid        "rszeltxref-teltuid
                             and objvers = 'A'.
                        Determine the variable name or master data value
                              IF lt_line2-LOWFLAG = 1.
                                Populate tables if match for Characterisic
                                  IF lt_line2-IOBJNM = s_characteristic.
                                      move lt_line-ELTUID  to lt_line-ELTUID.
                                      move lt_line-MAPNAME to lt_line-MAPNAME.
                                      move lt_line2-LOW    to lt_line-TXTLG.
                                      append  lt_line to lt_tab.
                                      lv_count = lv_count + 1.
                                      clear lt_line2-LOW.
                                  ENDIF.
                              ELSE.
                                 select * from RSZGLOBV
                                   into corresponding fields of lt_line3
                                   where VARUNIID = lt_line2-LOW
                                   and objvers = 'A'.
                                  Populate tables if match for Characterisic
                                    IF lt_line2-IOBJNM = s_characteristic.
                                        move lt_line-ELTUID  to lt_line-ELTUID.
                                        move lt_line-MAPNAME to lt_line-MAPNAME.
                                        move lt_line3-VNAM   to lt_line-TXTLG.
                                        append  lt_line to lt_tab.
                                        lv_count = lv_count + 1.
                                        clear lt_line3-VNAM.
                                    ENDIF.
                                endselect.
                              ENDIF.
                          endselect.
                      ENDIF.
                      clear l_t_eltxref_seltuid.
                      clear l_t_eltxref_teltuid.
                      clear l_t_eltxref_laytp.
                    ENDLOOP.
               ENDIF.
               clear lt_line-ELTUID.
               clear lt_line-MAPNAME.
               clear lt_line-TXTLG.
      endselect.
        sort lt_tab by MAPNAME.
        delete adjacent duplicates from lt_tab comparing ELTUID MAPNAME TXTLG.
       DIRECTORY represents path where file is stored .
        lc_DIRECTORY = '/interfaces/EDW/data/CSM/'.
        CONCATENATE 'EDW Queries by Characteristic -' SY-DATUM
        '.txt' into P_FILE SEPARATED BY SPACE.
      CONCATENATE lc_DIRECTORY P_FILE into FILENAME.
    Opening the Log File
      OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
                           ENCODING DEFAULT.
        IF SY-SUBRC NE 0.
          WRITE: 'File cannot be opened. Reason:'.  ", D_MSG_TEXT.
          EXIT.
        ENDIF.
       CONCATENATE 'System Date -' SY-DATUM 'YYYYMMDD' into lc_date
              SEPARATED BY SPACE.
       CONCATENATE 'EDW System -' SY-SYSID into lc_syst
              SEPARATED BY SPACE.
          TRANSFER lc_date TO FILENAME.
          TRANSFER lc_start_time TO FILENAME.
          TRANSFER lc_syst TO FILENAME.
      Queries for the parameters
          loop at lt_tab into lt_line.
             TRANSFER lt_line TO FILENAME.
          endloop.    "Query Loop
    Closing the Log File
      CLOSE DATASET FILENAME.

  • ABAP Real Time Questions..

    Dear Friends,
    please help me out in getting some real time question and answers related to ABAP.

    Dear Hazi Valli,
    Post ABAP related queries in ABAP Forums. Search the forum for generic queries.
    Wiki link for ABAP:
    https://wiki.sdn.sap.com/wiki/display/ABAP
    Have moved the thread to ABAP General.
    Regards,
    Naveen.

  • Complex queries in Open SQL

    Moved to performance forum by moderator
    Hi Experts,
    This is more of a discussion rather than a question. I would like to know the advantages of Open SQL. It prevents you from writing complex queries, the kind of queries that you can write in native sql.
    The biggest disadvantage I feel is that you have to fetch data into internal tables and loop. This takes a lot of processing time when you have a report having a lot of lines. A complex query using complex joins and subqueries will always perform better than having to loop and process data and simple things like generating sequence.
    The best thing about open sql is the way it handles select options.
    I would like to get your opinions and suggestions how to write complex queries in ABAP with some code snippets if possible.
    Warm Regards,
    Abdullah
    Edited by: Matt on Jan 21, 2009 6:54 PM

    > select - endselect will query the database repeatedly and wont be any different from using a loop on
    > internal table.
    that is a  very common misunderstanding, but not true, it uses the arry interface, but gives you the possibility to react on every line. But interaction with DB is in blocks.
    The biggest advantage of Open SQL is the implementation of the table buffer, every Open SQL Statement checks the buffers first.
    Other advantage, all statements changing table definitions are not allowed.
    And of course, as already said, it is a set of commands available on all DB platforms certified for SAP software, i.e. IBM, Oracle, Max DB and Microsoft.
    Complex queries, even with the available joins you can write very very complex queries ... sometimes too complex. I see not advantage for a competetion of writing the most complex statement
    Siegfried

  • BI upgrade: abap menu role, url format conversion ?

    hi all,
    I'm upgrading from BW3.5 to BI7.0.
    In BW3.5 abap role I am using menus wich include BW3.5 queries. URL format for query is like <bsp_protcl>://<bsp_server>/sap/bw/BEx?...
    The system gets upgraded in BI 7.0. Abap menu role still have the URL format for the query (like above). I would like to have the new BI format wich is like <prt_protcl>://<prt_server>/<bi_launcher>?...
    Is there a way to make URL format mass conversion ?
    There are thousand of queries in abap menu roles, I do not imagine this has to be changed manually ...?????
    Thanks in advance for your reply.
    Jean

    You could write a short SE38 program against the AGR_BUFFI table on the URL field:
    Replace <bsp_protcl> with <prt_protcl>
    Replace <bsp_server> with <prt_server>
    Replace sap/bw/BEx with <bi_launcher>
    Replace VARIABLES_CLEAR with CLEAR_VARIABLES
    Replace DATA_PROVIDER_ID with initial_state=VIEW&initial_state-view
    Keep in mind that you would not want to automatically convert entries that reference a 3.5 Web Template, or a table API.

  • Scripts in ABAP

    Hello gurus!
    I have a question about scripts in ABAP. We have a program that requires a lot of queries to obtain info from oracle; we already have a functional version of it but we need to upgrade and this means we have to write a lot more of queries in ABAP. Is there a way to import a script to put in a variable an execute it in ABAP to avoid all this code writing?.
    Regards IA

    Hi Armando,
    if You want to use already programed Oracle SQL Queries in ABAP with no neccessity to recode them into Open SQL (SQL in ABAP), You can probably use [Native SQL|http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3b8b358411d1829f0000e829fbfe/content.htm]. This can be done using [EXEC SQL statement|http://help.sap.com/abapdocu_70/en/ABAPEXEC_CURSOR.htm].
    Regards,
    Adrian

Maybe you are looking for

  • Is there any way to embed chord information in a song?

    Can Logic Pro X embed 'chord change' information in a song in some way?  For example, is there an a simple obvious way, like a 'chord information global  track',  that I'm overlooking?  Or is there a more convoluted way to get chord information in a

  • HTML Charset  for WAD template

    Hi all, is it possible to change the charset in the web report, which is added to meta tag? I need to change the way in which the data in tables is shown, not just that tag. Thanks a lot Best regards, Pavel

  • Transferring edited clips between projects

    Does anyone know the correct way to transfer edited clips from the timeline and paste into another cs4 project? When I copy and paste now, only the video appears, not the audio, making it necessary to redo all my edits. I saw info online about transf

  • How do I omit an object when serializing?

    I want to serialize a class that has an object of a class that has an AudioClip object in it and Java is not letting me serialize it. I think there is a way to tell the output stream to skip an object in a class but I can't remember how and I can't f

  • Premiere CC can't import Apple Motion files after clean install

    Got a new SSD so I decided to do a spankin new install of everything except Final Cut Pro legacy (which I thought I could finally do without). Only snag has been that Premiere CC can't import my Apple Motion projects (version 3) and I can't encode Pr