View for CDPOS & CDHDR tables

Hi all,
I am developing a report for which I am fetching fields from CDPOS & CDHDR tables (both r cluster tables). when i run st05, it fetches values from a cluster table CDCLS which takes most of the database time.
Is there any view for CDPOS & CDHDR tables?
How to find the views for cluster tables?
Thanx in advance.
Vijay.

hi,
check this code,
here i used function module to get details of cdhdr,cdpos.
TABLES : MARC.
DATA :BEGIN OF GI_MARC OCCURS 0,
      MATNR LIKE MARC-MATNR,
      WERKS LIKE MARC-WERKS,
      DISPO LIKE MARC-DISPO,
      END OF GI_MARC.
DATA : CHAR TYPE I,
       COUNT TYPE I,
       VAR TYPE I.
DATA : BEGIN OF GI_FINAL OCCURS 2000,
       MATNR LIKE MARC-MATNR,
       DISPO LIKE MARC-DISPO,
       USERNAME LIKE CDHDR-USERNAME,
       UDATE LIKE CDHDR-UDATE,
       UTIME LIKE CDHDR-UTIME,
       TCODE LIKE CDHDR-TCODE,
       TABNAME LIKE CDPOS-TABNAME,
       TABKEY  LIKE CDPOS-TABKEY,
       FNAME  LIKE CDPOS-FNAME,
       VALUE_NEW  LIKE CDPOS-VALUE_NEW,
       VALUE_OLD   LIKE CDPOS-VALUE_OLD,
       CHANGENR LIKE CDHDR-CHANGENR,
       END OF GI_FINAL.
DATA : MATNR LIKE MARC-MATNR,
       DISPO LIKE MARC-DISPO,
       USERNAME1 LIKE CDHDR-USERNAME,
       UDATE1 LIKE CDHDR-UDATE,
       UTIME LIKE CDHDR-UTIME,
       TCODE LIKE CDHDR-TCODE,
       CHANGENR LIKE CDHDR-CHANGENR.
DATA : GI_CDHDR LIKE CDHDR OCCURS 0 WITH HEADER LINE.
DATA : GI_CDPOS LIKE CDPOS OCCURS 0 WITH HEADER LINE.
DATA : OBJECTCLAS LIKE CDHDR-OBJECTCLAS VALUE 'MATERIAL',
       OBJECTID LIKE CDHDR-OBJECTID,
       USERNAME LIKE CDHDR-USERNAME VALUE 'RSS-SPE',
       UDATE LIKE CDHDR-UDATE VALUE '20070101',
       CHANGE_IND LIKE CDHDR-CHANGE_IND VALUE 'U'.
type-pools: slis.
data: gt_slis_fcat type slis_t_fieldcat_alv.
data: gt_fieldcat type slis_t_fieldcat_alv.
*data: gt_fieldcatall type slis_t_fieldcat_alv.
data: g_repid like sy-repid.
data: gs_layout type slis_layout_alv.
gs_layout-zebra             = 'X'.
gs_layout-colwidth_optimize = 'X'.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-110.
SELECT-OPTIONS :  P_DISPO FOR MARC-DISPO.
SELECT-OPTIONS : RECORDS FOR CHAR.
SELECTION-SCREEN : END OF BLOCK B1.
START-OF-SELECTION.
perform process_data.
perform f_fieldcat_init using gt_fieldcat[].
perform alv_display tables gi_final using gt_fieldcat[].
form process_data.
  SELECT MATNR WERKS DISPO FROM MARC INTO TABLE GI_MARC
                            WHERE DISPO IN P_DISPO
                            AND WERKS = '1011'." Becoz we hav to chk the
the changes made in the material while extendin tht matrl frm 1011 to
*other plant.
  IF NOT GI_MARC[] IS INITIAL.
    IF NOT RECORDS-LOW IS INITIAL .
      IF NOT RECORDS-HIGH IS INITIAL.
        DESCRIBE TABLE GI_MARC LINES COUNT.
        IF RECORDS-HIGH < COUNT.
          DELETE GI_MARC FROM RECORDS-HIGH TO COUNT.
        ENDIF.
        IF RECORDS-LOW <> 1.
          IF RECORDS-LOW <> 0.
            DELETE GI_MARC FROM 1 TO RECORDS-LOW.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
  LOOP AT GI_MARC.
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
      EXPORTING
        INPUT              = GI_MARC-MATNR
     IMPORTING
       OUTPUT             = GI_MARC-MATNR
EXCEPTIONS
  LENGTH_ERROR       = 1
  OTHERS             = 2
    IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    OBJECTID = GI_MARC-MATNR .
    CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
      EXPORTING
  ARCHIVE_HANDLE                   = 0
       DATE_OF_CHANGE                   = UDATE
        OBJECTCLASS                      = OBJECTCLAS
        OBJECTID                         = OBJECTID
  TIME_OF_CHANGE                   = '000000'
       USERNAME                         = USERNAME
  LOCAL_TIME                       = ' '
  DATE_UNTIL                       = '99991231'
  TIME_UNTIL                       = '235959'
      TABLES
        I_CDHDR                          = GI_CDHDR
     EXCEPTIONS
       NO_POSITION_FOUND                = 1
       WRONG_ACCESS_TO_ARCHIVE          = 2
       TIME_ZONE_CONVERSION_ERROR       = 3
       OTHERS                           = 4
    IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'
         EXPORTING
              TEXT = 'Processing'.
    IF NOT GI_CDHDR[] IS INITIAL.
      LOOP AT GI_CDHDR.
      MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.
      MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.
      MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.
      MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.
      MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.
      MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.
        VAR = 1.
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
          EXPORTING
            INPUT              = GI_FINAL-MATNR
            IMPORTING
           OUTPUT             = GI_FINAL-MATNR
         EXCEPTIONS
           LENGTH_ERROR       = 1
           OTHERS             = 2
        IF SY-SUBRC <> 0.
        ENDIF.
        OBJECTID = GI_FINAL-MATNR ."to ensure that objid is in proper
*format
        SELECT *
               FROM CDPOS
               INTO TABLE GI_CDPOS
          PACKAGE SIZE 100
          FOR ALL ENTRIES IN GI_cdhdr
               WHERE OBJECTID = OBJECTID
                 AND CHANGENR = GI_CDHDR-CHANGENR
                 AND OBJECTCLAS = OBJECTCLAS
                 AND CHNGIND =  CHANGE_IND." only those values will b
*takn which have been modified nd nt created
        IF SY-SUBRC = 0.
          LOOP AT GI_CDPOS.
      MOVE GI_MARC-MATNR TO GI_FINAL-MATNR.
      MOVE GI_MARC-DISPO TO GI_FINAL-DISPO.
      MOVE GI_CDHDR-USERNAME TO GI_FINAL-USERNAME.
      MOVE GI_CDHDR-UDATE TO GI_FINAL-UDATE.
      MOVE GI_CDHDR-TCODE TO GI_FINAL-TCODE.
      MOVE GI_CDHDR-CHANGENR TO GI_FINAL-CHANGENR.
            MOVE GI_CDPOS-TABNAME TO GI_FINAL-TABNAME.
            MOVE GI_CDPOS-TABKEY TO GI_FINAL-TABKEY.
            MOVE GI_CDPOS-FNAME TO GI_FINAL-FNAME.
            MOVE GI_CDPOS-VALUE_NEW TO GI_FINAL-VALUE_NEW.
            MOVE GI_CDPOS-VALUE_OLD TO GI_FINAL-VALUE_OLD.
              APPEND GI_FINAL.
              CLEAR GI_FINAL.
           ENDIF.
            VAR = VAR + 1.
   ENDSELECT.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
          CALL FUNCTION 'ARCH_ANA_PROGRESS_INDICATOR'
         EXPORTING
              TEXT = 'Processing'.
    ENDIF.
  ENDLOOP.
  endform.
form f_fieldcat_init using lt_fieldcat type slis_t_fieldcat_alv.
  data: ls_fieldcat type slis_fieldcat_alv.
   clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'MATNR'.
  ls_fieldcat-seltext_l    = 'Material number'.
ls_fieldcat-tabname      = 'GI_final'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'DISPO'.
  ls_fieldcat-seltext_l    = 'mrp controller'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'USERNAME'.
  ls_fieldcat-seltext_l    = 'Username'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'CHANGENR'.
  ls_fieldcat-seltext_l    = 'Change Number'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'UDATE'.
  ls_fieldcat-seltext_l    = 'modified date'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'UTIME'.
  ls_fieldcat-seltext_l    = 'MODIFIED TIME'.
  append ls_fieldcat to lt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname    = 'UDATE'.
ls_fieldcat-seltext_l    = 'MODIFIED DATE'.
append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'TCODE'.
  ls_fieldcat-seltext_l    = 'TRANSACTION CODE'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'TABNAME'.
  ls_fieldcat-seltext_l    = 'TABLE NAME'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'TABKEY'.
  ls_fieldcat-seltext_l    = 'TABLE KEY'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'FNAME'.
  ls_fieldcat-seltext_l    = 'FNAME'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'FVALUE'.
  ls_fieldcat-seltext_l    = 'FVALUE'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'VALUE_NEW'.
  ls_fieldcat-seltext_l    = 'NEW VALUE'.
  append ls_fieldcat to lt_fieldcat.
  clear ls_fieldcat.
  ls_fieldcat-fieldname    = 'VALUE_OLD'.
  ls_fieldcat-seltext_l    = 'OLD VALUE'.
  append ls_fieldcat to lt_fieldcat.
endform.                    " f_fieldcat_init
form alv_display tables  gi_final using gt_fieldcat .
  call function 'REUSE_ALV_LIST_DISPLAY'
   exporting
  I_INTERFACE_CHECK              = ' '
  I_BYPASSING_BUFFER             =
  I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             = ' Material list '
  I_CALLBACK_PF_STATUS_SET       = ' '
  I_CALLBACK_USER_COMMAND        = ' '
  I_STRUCTURE_NAME               =
     is_layout                      = gs_layout
     it_fieldcat                    = gt_fieldcat
  IT_EXCLUDING                   =
  IT_SPECIAL_GROUPS              =
  IT_SORT                        =
  IT_FILTER                      =
  IS_SEL_HIDE                    =
  I_DEFAULT                      = 'X'
  I_SAVE                         = ' '
  IS_VARIANT                     =
  IT_EVENTS                      =
  IT_EVENT_EXIT                  =
  IS_PRINT                       =
  IS_REPREP_ID                   =
  I_SCREEN_START_COLUMN          = 0
  I_SCREEN_START_LINE            = 0
  I_SCREEN_END_COLUMN            = 0
  I_SCREEN_END_LINE              = 0
IMPORTING
  E_EXIT_CAUSED_BY_CALLER        =
  ES_EXIT_CAUSED_BY_USER         =
    tables
      t_outtab                       = gi_final
EXCEPTIONS
  PROGRAM_ERROR                  = 1
  OTHERS                         = 2
  if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.
endform.
regards
siva

Similar Messages

  • Reg :-maintain a table maintenance view for the z table.suggest me the code

    i have question.i have created a z table related to pp module.the requirement is to maintain {table maintenance view} for this z table.how could this be done.can any one suggest me the code for this?

    Hi ,
    We have a lots of queries on table maintainance creation in the forum posted and replied to.Pls have a look at it first.
    In se11 -> change mode of the ztable -> goto -> utilities -> table maintainance generator -> click on it...
    it will give a new screen-> enter the required details like function group , authorisation(use &NC& or leave it blank if you dont know)  and screens
    2 step and 1 step means=> number of screens displayed in maintainace
    if step1 is selected then we have a screen which will be like a table control for data entry.........
    for step2 we have a table control screen and a more detailed individual field display as second screen
    click on the button 'find screen numbers' so that system automatically proposes the screen numbers
    after which click on the "create" button and follow the required instructions/messages
    once done go to SM30 enter the table name to check if maintainance has been created properly
    Hope it helps,Pls check and revert
    Regards
    Byju

  • Creating 2 table maintainance views for one custom table

    Hello All,
    I want to create 2 table maintainace views for one custom table.
    I know how to create table maintainace but I want to know whether we can create only one maintainance view or we cal also create 2 maintainace views for a single custom table.
    Regards
    Mahesh

    Hello,
    You can create as many maintenance views one one table as you want.
    Kind regards,
    Bart

  • I Need to update CDPOS, CDHDR table

    Hi,
    in my system. CO01, CO02 status blank i need to update this table CDPOS, CDHDR
    I need operation release time and date. any configuration for Change documents update
    MANOJ
    Edited by: SAPPPCONSULTANT on Feb 26, 2012 9:38 AM

    pl check oss note 390635

  • View for mseg database table

    I want to extract data from MSEG. Its becoming performance issue. Can anybody advice me regarding any view which i can use in place of MSEG

    a view won't increase performance, have you tried to force the index or create an index for the fields you use for the mseg table
    perhaps if you need specific data you can also check BSAK BSIK  BSAD BSID  tables which are related to BSEG .
    kind regards
    arthur de smidt
    Edited by: A. de Smidt on Jul 30, 2008 1:03 PM

  • Views for PO related tables?

    Hi Guys,
               Can anybody tell me any views for PO tables with EKKO,EKPO,EKKN and EKBE ?
                         I am using these tables for displaying a report and i have to get EKBE-BELNE ,EKKN-(PRCTR,ANLN1) , EKPO-(EBELP,NETPR,KNTTP),EKKO(EBELN,BEDAT,LIFNR) into a single internal table.The reason for views is if i link these tables its taking so much of time.
    Thanks,
    Gopi Anne.

    the statement "don't use joins, use for all entries" is simply not correct, but you seemingly can't get this out of people's heads anymore.
    I would try something like this
    SELECT ... INTO ...
    FROM EKKO
    JOIN EKPO ON EKKO~EBELN = EKPO~EBELN
    JOIN EKKN ON EKPO~EBELN = EKKN~EBELN
             AND EKPO~EBELP = EKKN~EBELP
    JOIN EKBE ON EKPO~EBELN = EKBE~EBELN
             AND EKPO~EBELP = EKBE~EBELP
    WHERE ...
    If we're lucky, the optimizer will choose the correct index from either EKKO (LIFNR, BEDAT) or EKKN (ANLN1) and the thing might actually run quite quickly...
    Make sure you include EKKO-BSTYP = "F" in your WHERE-clause (for the EKKO-BEDAT index).
    Cheers
    Thomas

  • Create view for Global Temporary Table

    if view is create for global temporary table so exactly how it works which helps regarding application performance.
    Regaards,
    Sambit Ray

    A view is just a stored query. It can be on global temporary tables or regular one, makes no difference.

  • DB view for union of table

    hi guys.
    Is it possibile to create an ABAP DataBase view for an UNION ALL of 2 tables with same fields ?
    From SE11 is possible to create only joined tables, i think...is it true ?
    I must split records of one custom table into two tables (active records and archived records); so, i thought to create an union all (view) to semplify modification on abap programs needs both tables's record.
    thanks a lot.

    hi.
    Thanks for confirmation it isn't possible to create union on abap DB view (se11).
    for Yukonkid:
    - on sql-92 "union join" is included
    - "SELECT form both tables and "union" them in an internal table"...a DB view intend to be a same solution but more easy to develop (easy=few abap's rows)
    for Sneha:
    my target is performance: i have a big table (a lot of rows) with 95% archived and using index not resulted a good solution
    bye

  • Creating maintainance view for a customising table

    Hello Team,
    I have a scenario where we have to create a maintainance view for a standard customising table. But all changes to entries for customising tables will prompt for a transportable change request. How to switch off this prompt for change request? Please let me know your views on this.
    Thanks!

    create a maintainance view for a standard customising table
    Doing that wont be a good idea.
    If you only want to disable the transport request in a production system, then call transaction SOBJ. Give the name of the object = the maintenace view, set the "[Current Settings|http://help.sap.com/saphelp_glossary/en/35/2a2c6ad9685cd5e10000009b38f974/content.htm]" flag on. (eg. F-60 on V_T001B for "Posting Periods: Specify Time Intervals")
    Regards,
    Raymond

  • Creating view for DataSource from table containing Structures.

    Hello All,
    I need to make a datasource for HR PY master data from a table PA9004(its special for a HR infotype) which needs some fields like PFOBEE(PF-Opening Balance-Ee).
    Field(PFOBEE) is part of a structure(PS0008) which is included in the table PA9004.I tried where-used list for this structure in programs,FuncModules,Tables but got no result of any transparent table.
    To form my Datasource I tried creating the Database view, which had inconsistencies. I tried using the table PA9004, which said "This operation failed, because the template structure quantity fields or currency fields, for example, field PFOBEE refer to a different table."
    Also Projection view cant be used for generic datasources.
    Even Create Infostructure(MC21) does not work for HR: PY-IO.
    All suggestions welcome.Mail me at [email protected]

    Hello All,
    I solved this problem by forming my generic datasource(TCode RSO2) on a Infoset which had the table pa9004. There were some warnings regarding the use of the development class, but finally I had the datasource ready.
    I checked the datasource is working using the RSA3 TCode and the DS is perfectly extracting the data. I replicated this DS in BW server and it appears exactly where I wanted.
    Some colleages had suggested writing a functional module to extract the data, which must be right but I have not tried this option yet.
    Experts may please review my solution and offer tips. I am willing to offer points to anyone offering a more elegant solution.

  • Maintaince view creation for a cluster table

    Hi friends,
    I have created a maintaince view for a cluster table bseg and i have activated it its working fine..
    now my problem is i can create maintaince view for mutiple tables if other tables are linked with primary table using foriegn key relationship..
    Now can any one tell me is it possible to create maintance view for cluster table with multiple tables as i need a linked table with bseg which iam not able to get... ie : when i click on the relationship tab iam not getting the linked tables for bseg...
    now can i create a maintaince view with 2 linked cluster tables..
    if so can any one tell me how to create it.
    As sap says we can create projection view for cluster and pooled table and we cannot create database view for cluster and pooled tables , but it does not mentioned like that for maintaince view....
    I assume we can do it.... as iam trying to create a maintaince view with single cluster table then it shoudl allow me to create for multiple linked cluster tables.... and is it mandatory to maintain TMG for this maintaince view....?
    Regards
    KUMAR

    yes.. ur right inserting values into a cluster table other than standard sap tarnactions is dangerious....
    But sap didnot mentioned any where that we cannot maintain data for cluster tables using maintaince view... which it said for database view..that pooled and cluster table cannot be used for database view..
    Regards
    Kumar

  • How to create editable tablecells for a single table row dynamically?

    Hi
    How to make the cell of a tablerow editable based on flag in backing list object bound to row? I can't decide the editable property while creating table columns. So i can't use setCellFactory() during creation. However setCellFactory() makes all cells in table column editable.How to make non-editable table row cell editable and vice-versa based on flag?

    hi
    good
    if you want to create two different view for a same table than you cant give the same name for the same view,otherwise it would allow you to create the view.Try out with different view name as well as the function group name,i hope this ll work.
    thanks
    mrutyun^

  • How to create transaction code for a Z-table

    How to create transaction code for a Z-table?
    Se93 --> then which radio button to be selected? and what is the program nam e to  be given

    Hi Sam,
    <b>Procedure to create a TCODE for ZTABLE:</b>
    Create a table maintainance/View for the Z* Table.
    Once you create the view goto SE93>Select Parameter transaction and give the short desc.>
    Give the transaction as SM30(Skip the first screen-optional)>Check all check boxes under GUI support>In the default values(grid)section first row give the VIEWNAME as you created initially and the second row UPDATE as X.
    <u><i>Se93 --> then which radio button to be selected</i></u>
    Select the parameter transaction as a radio button.
    <u><i>what is the program nam e to be given</i></u>
    no need to give any program name. Instead you have to give the transaction code name as SM30.
    Pls mark the helpful answers.
    Thanks
    Eswar

  • Help view to get two table entries in search help

    Hi,
    I have created the help view for join two tables and that help view was  called in the selection method for creating search help of the custom table field. since it has show inthe selection screen , it is fetching only one table entries. and the shown entries are displaying but not passing.
    Please provide the steps to get the two table entries and the displayed entries should pass.
    Thanks in Advance,
    siva

    Hi sivanag,
    1. Try your view with SE16/SE16N to see if it really finds what you expect
    2. Use the same data elements in help view as on selection screen
    3. read documentation and F1 help on all fields you see in the search help definition - especially only field marked as EXPORT parameter will be put back on screen.
    But, sincerely, I don't know what your selection-screen looks like.
    Regards,
    Clemens

  • View on a single table

    Hi all,
    my question is: does have any sense to use a view for a single table selection ?
    I need to make a selection on a db table and I haven't any value neither for the primary key nor for any secondary index.
    Can I improve the table access speed in any other way ???

    Hello
    But there are side effects affecting db performance or things like that if I create an index on a table?
    Yes. For db-tables with creating new index:
    1. increase the performance of READ-operations
    2. decrease the performance of INSERT/MODIFY-operations

Maybe you are looking for