Initializing a collection

Hi everybody,
This might be an easy question, but I can't figure out why the method below doesn't compile. I'm trying to, when reading in a file, either get a list of unique words, or a map of unique words with frequencies. I thought that returning a Collection would do the trick, but I'm getting a compiler error, a type mismatch, anytime I declare a collection as a map. I also get errors anytime I try to use a map. I have all the proper imports, so I know that's not it. If anyone could explain to me why this is, and how to fix this method (preferably without warnings), I'd be much obliged. My code is:
public Collection readWords( String wordType, boolean frequencies ) throws IOException {
          Collection words;
          if( wordType.equals( "alpha" ) ) {
               if( !frequencies ) words = new TreeSet<String>();
               else words = new TreeMap<String, Integer>();
          else if( wordType.equals( "order" ) ) {
               if( !frequencies ) words = new LinkedHashSet<String>();
               else words = new LinkedHashMap<String, Integer>();
          else if( wordType.equals( "random" ) ){
               if( !frequencies ) words = new HashSet<String>();
               else words = new HashMap<String, Integer>();
          String line = null;
          while( ( line = reader.readLine() ) != null ) {
               StringTokenizer parser = new StringTokenizer( line, delimiters );
               while( parser.hasMoreTokens() ) {
                    if( !frequencies ) words.add( parser.nextToken().toLowerCase() );
                    else {
                         String next = parser.nextToken();
                         if( !words.containsKey( next ) ) words.put( next, 1 );
                         else {
                              int value = words.get( next );
                              words.put( next, value + 1 );
          return words;
     }Thanks,
Jezzica85
Edited by: jezzica85 on May 9, 2008 11:26 PM
Edited by: jezzica85 on May 9, 2008 11:27 PM

A List or a Set is a Collection.
You can get a Set<Map.Entry<K,V>> from a map with [entrySet()|http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html#entrySet()]
but why don't you just deal with the map?

Similar Messages

  • SMD installation - Initial Data Collect ERROR

    I installed the SMD on several machines already, SP13 and NW2004 are used. When I try to configure the production system, I get this error:
    Initial Data Collect ERROR for host sapbp5a0.agfa.be
    !! Exception : Thu Jul 17 13:57:39 MEST 2008 | storeHost(...):Host [][sapbp5a0][10.233.9.188][/usr/sap/BP5/]:Cannot insert/update the host '[IHost: key=1216295859558156, hostName=sapbp5a0, hostFullQualifiedName=, serverName=sapbp5a0, ip=10.233.9.188, agentHostName=sapbp5a0, agentFullQualifiedName=sapbp5a0.agfa.be, agentIp=10.233.9.188, path=/usr/sap/BP5/, pathName=null, SmStatus=U, creation=Thu Jul 17 13:57:39 MEST 2008]'! Please see log for next error(s).
    We (I) know we need to input the hostFullQualifiedName somewhere, but we cannot find the place to put it.  Can anyone please give us a clue to where we need to put this?

    Hi, thank you for the input, but I think I gave too little information. Let me elaborate:
    The monitoring system we are using is YP5, the monitored system is BP5.  On BP5 is where the problem is situated. I installed the SMD according to the SAP specs and now I am at the end of the installation, just before installing the Wily.
    I log on via http://sapyp5a0.agfa.be:55100/webdynpro/dispatcher/sap.com/tcsmdnavigation/SmdNavigation to setup the final things (collection of data and so on, running Wily, ...) and this is where I get the error, after I entered all the correct information.
    We checked the SLD settings in ABAP and everything is connecting as it should.
    Anyone has any more ideas where we could look?
    Edited by: David Liekens on Jul 17, 2008 3:43 PM

  • How to initialize this collection?

    Hello:
    Is it correct?
    In a package I have defined
    TYPE REG_SITUACION_TRIB IS RECORD (
    SITR VARCHAR2(50),
    ESTADO_SITUACION Varchar2(1)
    TYPE TABLA_SITUACION_TRIB IS TABLE OF REG_SITUACION_TRIB INDEX BY BINARY_INTEGER;
    g_tabla_situacion_trib TABLA_SITUACION_TRIB;
    And in the package body, inside a function
    v_cont_sit:=0;
    FOR v_cursor IN c_cursor( parameter1 )
    LOOP
         v_cont_sit:= v_cont_sit + 1;
         g_TABLA_SITUACION_TRIB( v_cont_sit ).SITR := V_cursor.SITR;
         g_tabla_situacion_trib( v_cont_sit ).ESTADO_SITUACION:='S';
    END LOOP;
    Am I properly initializing the collection g_tabla_situacion_trib?
    Do I need an EXTEND method?
    If cursor returns no results, is g_tabla_situacion_trib variable initialized to NULL?
    Thanks

    If cursor returns no results, is g_tabla_situacion_trib variable initialized to NULL?Contrary to previous replies, No. It is an empty collection, not the same. See below.
    Also, if you going to do this:
    v_cont_sit:=0;
    FOR v_cursor IN c_cursor( parameter1 )
    LOOP
    v_cont_sit:= v_cont_sit + 1;
    g_TABLA_SITUACION_TRIB( v_cont_sit ).SITR := V_cursor.SITR;
    g_tabla_situacion_trib( v_cont_sit ).ESTADO_SITUACION:='S';
    END LOOP;Why not just bulk collect into a collection with a type of cursor%rowtype?
    using the limit clause if necessary (but [being aware of SQL%NOTFOUND|http://www.oracle.com/technology/oramag/oracle/08-mar/o28plsql.html])
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> CREATE OR REPLACE PROCEDURE p3
      2  AS
      3    CURSOR c1
      4    IS
      5      SELECT SYSDATE dt
      6      FROM   DUAL;
      7    --
      8    TYPE t1 IS TABLE OF c1%ROWTYPE INDEX BY PLS_INTEGER;
      9    --
    10    l1 t1;
    11    --
    12  BEGIN
    13     --
    14     IF l1 IS NULL
    15     THEN
    16         DBMS_OUTPUT.PUT_LINE('Is Null');
    17     ELSE
    18         DBMS_OUTPUT.PUT_LINE('Is Not Null');
    19     END IF;
    20     DBMS_OUTPUT.PUT_LINE('Empty collection: '||l1.COUNT);
    21     --
    22     OPEN c1;
    23     FETCH c1 BULK COLLECT INTO l1;
    24     CLOSE c1;
    25     DBMS_OUTPUT.PUT_LINE(l1.COUNT);
    26     --
    27  END;
    28  /
    Procedure created.
    SQL> set serveroutput on
    SQL> exec p3;
    Is Not Null
    Empty collection: 0
    1
    PL/SQL procedure successfully completed.
    SQL>

  • Function module of smart form delivered an error

    Hi All,
    I am getting an error like this
    "Function module /1BCDWB/SF00000007 of smart form delivered an error"
    FUNCTION /1BCDWB/SF00000007.
    ""Global interface:
    *"       IMPORTING
    *"             VALUE(ARCHIVE_INDEX) TYPE  TOA_DARA OPTIONAL
    *"             VALUE(ARCHIVE_PARAMETERS) TYPE  ARC_PARAMS OPTIONAL
    *"             VALUE(CONTROL_PARAMETERS) TYPE  SSFCTRLOP OPTIONAL
    *"             VALUE(MAIL_APPL_OBJ) TYPE  SWOTOBJID OPTIONAL
    *"             VALUE(MAIL_RECIPIENT) TYPE  SWOTOBJID OPTIONAL
    *"             VALUE(MAIL_SENDER) TYPE  SWOTOBJID OPTIONAL
    *"             VALUE(OUTPUT_OPTIONS) TYPE  SSFCOMPOP OPTIONAL
    *"             VALUE(USER_SETTINGS) TYPE  TDBOOL DEFAULT 'X'
    *"             VALUE(ARCHIVE_INDEX_TAB) TYPE  TSFDARA OPTIONAL
    *"             REFERENCE(ORDERADM_H) TYPE  CRMT_OUTPUT_ORDERADM_H_COM
    *"             REFERENCE(ACTIVITY_H) TYPE  CRMT_OUTPUT_ACTIVITY_H_COM
    *"             REFERENCE(OPPORT_H) TYPE  CRMT_OUTPUT_OPPORT_H_COM
    *"             REFERENCE(ORGMAN_H) TYPE  CRMT_OUTPUT_ORGMAN_H_COM
    *"             REFERENCE(PARTNER_H) TYPE  CRMT_OUTPUT_PARTNER_H_COMT
    *"             REFERENCE(PRICINGDATA_H) TYPE
    *"                             CRMT_OUTPUT_PRICINGDATA_H_COM
    *"             REFERENCE(SALES_H) TYPE  CRMT_OUTPUT_SALES_H_COM
    *"             REFERENCE(SHIPPING_H) TYPE  CRMT_OUTPUT_SHIPPING_H_COM
    *"             REFERENCE(PAYPLAN_D_H) TYPE
    *"                             CRMT_OUTPUT_PAYPLAN_D_H_COMT
    *"             REFERENCE(CUMULAT_H) TYPE  CRMT_OUTPUT_CUMULAT_H_COM
    *"             REFERENCE(CUSTOMER_H) TYPE  CRMT_OUTPUT_CUSTOMER_H_COM
    *"             REFERENCE(ACS_H) TYPE  CRMT_ACS_H_COM
    *"             REFERENCE(BILLING_H) TYPE  CRMT_OUTPUT_BILLING_H_COMT
    *"             REFERENCE(CANCEL_H) TYPE  CRMT_OUTPUT_CANCEL_H_COMT
    *"             REFERENCE(APPOINTMENT_H) TYPE
    *"                             CRMT_OUTPUT_APPOINTMENT_H_COMT
    *"             REFERENCE(BILLPLAN_D_H) TYPE
    *"                             CRMT_OUTPUT_BILLPLAN_D_H_COMT
    *"             REFERENCE(BILLPLAN_H) TYPE  CRMT_OUTPUT_BILLPLAN_H_COMT
    *"             REFERENCE(STATUS_D_H) TYPE  CRMT_OUTPUT_STATUS_D_H_COMT
    *"             REFERENCE(STATUS_H) TYPE  CRMT_OUTPUT_STATUS_H_COMT
    *"             REFERENCE(SRV_SUBJECT_H) TYPE
    *"                             CRMT_OUTPUT_SRV_SUBJECT_H_COMT
    *"             REFERENCE(SRV_SUBJECT_I) TYPE
    *"                             CRMT_OUTPUT_SRV_SUBJECT_H_COMT
    *"             REFERENCE(SRV_REASON_H) TYPE
    *"                             CRMT_OUTPUT_SRV_REASON_H_COMT
    *"             REFERENCE(SRV_RESULT_H) TYPE
    *"                             CRMT_OUTPUT_SRV_RESULT_H_COMT
    *"             REFERENCE(SRV_REFOBJ_H) TYPE
    *"                             CRMT_OUTPUT_SRV_REFOBJ_H_COMT
    *"             REFERENCE(SRV_REFOBJ_I) TYPE
    *"                             CRMT_OUTPUT_SRV_REFOBJ_H_COMT
    *"             REFERENCE(ORDERADM_I) TYPE  CRMT_OUTPUT_ORDERADM_I_COMT
    *"             REFERENCE(ORDERADM_I_IN) TYPE
    *"                             CRMT_OUTPUT_ORDERADM_I_IN_COMT
    *"             REFERENCE(ORDERADM_I_QT) TYPE
    *"                             CRMT_OUTPUT_ORDERADM_I_QT_COMT
    *"             REFERENCE(ORGMAN_I) TYPE  CRMT_OUTPUT_ORGMAN_I_COMT
    *"             REFERENCE(PRICINGDATA_I) TYPE
    *"                             CRMT_OUTPUT_PRICINGDATA_I_COMT
    *"             REFERENCE(PRICING_I) TYPE  CRMT_OUTPUT_PRICING_I_COMT
    *"             REFERENCE(PRODUCT_I) TYPE  CRMT_OUTPUT_PRODUCT_I_COMT
    *"             REFERENCE(SALES_I) TYPE  CRMT_OUTPUT_SALES_I_COMT
    *"             REFERENCE(SERVICE_I) TYPE  CRMT_OUTPUT_SERVICE_I_COMT
    *"             REFERENCE(SCHEDLIN_I) TYPE  CRMT_OUTPUT_SCHEDLIN_I_COMT
    *"             REFERENCE(SCHEDLIN_I_CF) TYPE
    *"                             CRMT_OUTPUT_SCHEDLIN_I_CF_COMT
    *"             REFERENCE(SHIPPING_I) TYPE  CRMT_OUTPUT_SHIPPING_I_COMT
    *"             REFERENCE(PARTNER_I) TYPE  CRMT_OUTPUT_PARTNER_I_COMT
    *"             REFERENCE(ITEM_CSTICS_I) TYPE  CRMT_ITEM_CSTICS_TAB
    *"             REFERENCE(CUSTOMER_I) TYPE  CRMT_OUTPUT_CUSTOMER_I_COMT
    *"             REFERENCE(BILLING_I) TYPE  CRMT_OUTPUT_BILLING_I_COMT
    *"             REFERENCE(CANCEL_I) TYPE  CRMT_OUTPUT_CANCEL_I_COMT
    *"             REFERENCE(FINPROD_I) TYPE  CRMT_OUTPUT_FINPROD_I_COMT
    *"             REFERENCE(ORDPRP_I) TYPE  CRMT_OUTPUT_ORDPRP_I_COMT
    *"             REFERENCE(APPOINTMENT_I) TYPE
    *"                             CRMT_OUTPUT_APPOINTMENT_I_COMT
    *"             REFERENCE(BILLPLAN_D_I) TYPE
    *"                             CRMT_OUTPUT_BILLPLAN_D_I_COMT
    *"             REFERENCE(BILLPLAN_I) TYPE  CRMT_OUTPUT_BILLPLAN_I_COMT
    *"             REFERENCE(STATUS_I) TYPE  CRMT_OUTPUT_STATUS_I_COMT
    *"             REFERENCE(WORKING_SET_E_S_BBP) TYPE
    *"                             /1CN/WORKING_SET_E_S_BBP_T
    *"             REFERENCE(LANGUAGE) TYPE  SY-LANGU
    *"             REFERENCE(SERVICE_I_ASSI) TYPE
    *"                             CRMT_OUTPUT_SERVICE_I_***_COMT
    *"             VALUE(FORM_TYPE) TYPE  C OPTIONAL
    *"             REFERENCE(Y_V_PARTNER_FLAG) TYPE  C OPTIONAL
    *"       EXPORTING
    *"             VALUE(DOCUMENT_OUTPUT_INFO) TYPE  SSFCRESPD
    *"             VALUE(JOB_OUTPUT_INFO) TYPE  SSFCRESCL
    *"             VALUE(JOB_OUTPUT_OPTIONS) TYPE  SSFCRESOP
    *"       EXCEPTIONS
    *"              FORMATTING_ERROR
    *"              INTERNAL_ERROR
    *"              SEND_ERROR
    *"              USER_CANCELED
    DATA: %INPUT     TYPE SSFCOMPIN,
          %RESULT_OP TYPE SSFCRESOP,
          %RESULT_PD TYPE SSFCRESPD,
          %RESULT_CL TYPE SSFCRESCL,
          %TABDEF    LIKE LINE OF %TABDEFS,
          %ARCTAB    TYPE TSFDARA,
          BEGIN OF %FULLNAME,
            FORM TYPE TDSFNAME VALUE 'YCRM_ORDER_SERVICE_RMA',
            VARI TYPE TDVARIANT,
            ACTV TYPE TDBOOL VALUE 'X',
          END OF %FULLNAME.
    TYPES: T_XDF_ELEM(255)    TYPE C,
           T_XDF_ATTR(255)    TYPE C.
    DATA:  IMPORT_PARAMETER   TYPE TABLE OF RSIMP WITH HEADER LINE,
           CHANGING_PARAMETER TYPE TABLE OF RSCHA WITH HEADER LINE,
           TABLES_PARAMETER   TYPE TABLE OF RSTBL WITH HEADER LINE,
           EXPORT_PARAMETER   TYPE TABLE OF RSEXP WITH HEADER LINE,
           EXCEPTION_LIST     TYPE TABLE OF RSEXC WITH HEADER LINE.
    DATA:  XDF_TABLE          TYPE TSFIXML,
           XDF_LENGTH         TYPE I.
    DATA:  XDF_DOCUMENT       TYPE REF TO IF_IXML_DOCUMENT,
           XDF_PARAMETER      TYPE REF TO IF_IXML_ELEMENT,
           L_NAME             TYPE STRING,
           L_VALUE            TYPE STRING,
           L_OBJECT           TYPE STRING,
           L_DATE             TYPE STRING,
           L_TIME             TYPE STRING,
           RC                 TYPE SY-SUBRC.
    FIELD-SYMBOLS: <DATA_OBJECT> TYPE ANY.
    CLASS CL_IXML DEFINITION LOAD.
    CONSTANTS: C_XDF_ROOT_ELEMENT TYPE T_XDF_ELEM VALUE 'XDF',
           C_XDF_ATTR_TYPE       TYPE T_XDF_ATTR VALUE 'TYPE',
           C_XDF_ATTR_TIMESTAMP  TYPE T_XDF_ATTR VALUE 'TIMESTAMP',
           C_XDF_ATTR_OBJ        TYPE T_XDF_ATTR VALUE 'OBJECT'.
    DATA:  XDF_FACTORY      TYPE REF TO IF_IXML,
           XDF_ROOT_ELEMENT TYPE REF TO IF_IXML_ELEMENT.
    DATA:  L_GETSTATE    TYPE DDTYPEGET,
           L_TYPE        TYPE DDTYPEKIND,
           L_TYPE_NAME   TYPE TYPENAME,
           L_DDIC_OBJ    TYPE DDTYPES OCCURS 0 WITH HEADER LINE,
           L_DD02L_STATE TYPE DD02L   OCCURS 0 WITH HEADER LINE,
           L_DD04L_STATE TYPE DD04L   OCCURS 0 WITH HEADER LINE,
           L_DD40L_STATE TYPE DD40L   OCCURS 0 WITH HEADER LINE,
           L_XMLOUTPUT   TYPE SSFXMLOUT,
           L_SFSY        TYPE SFSY.
    TYPE-POOLS: ABAP.
    DATA: XDF2_IXML        TYPE REF TO IF_IXML,
          XDF2_DOCUMENT    TYPE REF TO IF_IXML_DOCUMENT,
          XDF2_SRC_OBJECTS TYPE ABAP_TRANS_SRCBIND_TAB,
          XDF2_SRC_OBJECT  LIKE LINE OF XDF2_SRC_OBJECTS.
    DEFINE XDF2_APPEND_SRC_OBJECT.
      XDF2_SRC_OBJECT-NAME  = '&1'.
      TRANSLATE XDF2_SRC_OBJECT-NAME TO UPPER CASE.
      GET REFERENCE OF &2 INTO XDF2_SRC_OBJECT-VALUE.
      APPEND XDF2_SRC_OBJECT TO XDF2_SRC_OBJECTS.
    END-OF-DEFINITION.
    DEFINE XDF_GET_DDIC_INFO.
      CLEAR L_DDIC_OBJ.
      IF NOT &2 IS INITIAL.
        L_TYPE_NAME = &2.
      ELSEIF NOT &1-TYP IS INITIAL.
        L_TYPE_NAME = &1-TYP.
      ELSEIF NOT &1-LINE_OF IS INITIAL.
        L_TYPE_NAME = &1-LINE_OF.
      ELSEIF NOT &1-TABLE_OF IS INITIAL.
        L_TYPE_NAME = &1-TABLE_OF.
      ELSE.
        CLEAR L_TYPE_NAME.
      ENDIF.
      CALL FUNCTION 'DDIF_TYPEINFO_GET'
           EXPORTING TYPENAME = L_TYPE_NAME
           IMPORTING TYPEKIND = L_TYPE.
      L_DDIC_OBJ-TYPENAME = L_TYPE_NAME.
      L_DDIC_OBJ-TYPEKIND = L_TYPE.
      IF NOT L_DDIC_OBJ IS INITIAL.
        COLLECT L_DDIC_OBJ.
      ENDIF.
    END-OF-DEFINITION.
    DEFINE XDF_CREATE_DATA_STREAM.
      CLEAR: L_OBJECT, L_DATE, L_TIME, L_NAME, L_TYPE_NAME, L_VALUE.
      IF &3 = 'T'.
        CONCATENATE &1-PARAMETER '[]' INTO L_NAME.
      ELSE.
        L_NAME = &1-PARAMETER.
      ENDIF.
      IF NOT &2 IS INITIAL.
        ASSIGN (L_NAME) TO <DATA_OBJECT>
               CASTING TYPE (&2).
        L_TYPE_NAME = &2.
      ELSEIF NOT &1-TYP IS INITIAL.
        ASSIGN (L_NAME) TO <DATA_OBJECT>
               CASTING TYPE (&1-TYP).
        L_TYPE_NAME = &1-TYP.
      ELSEIF NOT &1-LINE_OF IS INITIAL.
        ASSIGN (L_NAME) TO <DATA_OBJECT>.
        L_TYPE_NAME = &1-LINE_OF.
      ELSEIF NOT &1-TABLE_OF IS INITIAL.
        ASSIGN (L_NAME) TO <DATA_OBJECT>.
        L_TYPE_NAME = &1-TABLE_OF.
      ELSE.
        ASSIGN (L_NAME) TO <DATA_OBJECT>.
        CLEAR L_TYPE_NAME.
      ENDIF.
      CALL FUNCTION 'SDIXML_DATA_TO_DOM'
           EXPORTING
                 NAME        = L_NAME
                 DATAOBJECT  = <DATA_OBJECT>
           IMPORTING
                 DATA_AS_DOM = XDF_PARAMETER
           CHANGING
                  DOCUMENT    = XDF_DOCUMENT
             EXCEPTIONS
                  OTHERS      = 1.
      L_NAME  = C_XDF_ATTR_TYPE.
      L_VALUE = L_TYPE_NAME.
      CALL METHOD XDF_PARAMETER->SET_ATTRIBUTE
           EXPORTING NAME      = L_NAME
                        VALUE     = L_VALUE
           RECEIVING RVAL      = RC.
      CLEAR L_DDIC_OBJ.
      READ TABLE L_DDIC_OBJ WITH KEY TYPENAME = L_TYPE_NAME.
      CASE L_DDIC_OBJ-TYPEKIND.
        WHEN 'S'.
          READ TABLE L_DD02L_STATE WITH KEY TABNAME = &1-TYP.
          L_DATE = L_DD02L_STATE-AS4DATE.
          L_TIME = L_DD02L_STATE-AS4TIME.
          L_OBJECT = 'TABL'.
        WHEN 'E'.        " data elements
          READ TABLE L_DD04L_STATE WITH KEY ROLLNAME = &1-TYP.
          L_DATE = L_DD04L_STATE-AS4DATE.
          L_TIME = L_DD04L_STATE-AS4TIME.
          L_OBJECT = 'DTEL'.
        WHEN 'L'.        " table types
          READ TABLE L_DD40L_STATE WITH KEY TYPENAME = &1-TYP.
          L_DATE = L_DD40L_STATE-AS4DATE.
          L_TIME = L_DD40L_STATE-AS4TIME.
          L_OBJECT = 'TTYP'.
        WHEN OTHERS.
          CLEAR: L_DATE, L_TIME, L_OBJECT.
      ENDCASE.
      L_NAME  = C_XDF_ATTR_OBJ.
      CALL METHOD XDF_PARAMETER->SET_ATTRIBUTE
           EXPORTING NAME      = L_NAME
                     VALUE     = L_OBJECT
           RECEIVING RVAL      = RC.
      L_NAME  = C_XDF_ATTR_TIMESTAMP.
      CONCATENATE L_DATE L_TIME INTO L_VALUE.
      CALL METHOD XDF_PARAMETER->SET_ATTRIBUTE
           EXPORTING NAME      = L_NAME
                     VALUE     = L_VALUE
           RECEIVING RVAL      = RC.
      CALL METHOD XDF_ROOT_ELEMENT->APPEND_CHILD
           EXPORTING NEW_CHILD = XDF_PARAMETER
           RECEIVING RVAL      = RC.
      CHECK RC = 0.
    END-OF-DEFINITION.
    CLEAR DOCUMENT_OUTPUT_INFO.
    CLEAR JOB_OUTPUT_INFO.
    CLEAR JOB_OUTPUT_OPTIONS.
    L_SFSY = SFSY.
    CLEAR SFSY.
    SFSY-PAGE = L_SFSY-PAGE.
    SFSY-FORMPAGES = L_SFSY-FORMPAGES.
    SFSY-JOBPAGES = L_SFSY-JOBPAGES.
    SFSY-XDF = L_SFSY-XDF.
    SFSY-XDF2 = L_SFSY-XDF2.
    CLEAR INTSFSY.
    IF CONTROL_PARAMETERS-NO_OPEN = SPACE.
       CALL FUNCTION 'SSF_CREATE_COMPOSER_INPUT'
            EXPORTING
                 ARCHIVE_PARAMETERS = ARCHIVE_PARAMETERS
                 USER_SETTINGS      = USER_SETTINGS
                 MAIL_SENDER        = MAIL_SENDER
                 MAIL_RECIPIENT     = MAIL_RECIPIENT
                 MAIL_APPL_OBJ      = MAIL_APPL_OBJ
                 OUTPUT_OPTIONS     = OUTPUT_OPTIONS
                 CONTROL_PARAMETERS = CONTROL_PARAMETERS
            IMPORTING
                 INPUT              = %INPUT.
      IF OUTPUT_OPTIONS-XSFCMODE = SPACE.
        %INPUT-XSF        = ' '.
        %INPUT-XSFOUTMODE = ' '.
        %INPUT-XSFOUTDEV  = ' '.
        %INPUT-XSFACTION  = ' '.
        %INPUT-XSFFORMAT  = ' '.
      ENDIF.
      CALL FUNCTION 'SSFCOMP_OPEN'
           EXPORTING  INPUT  = %INPUT
           IMPORTING  RESULT = %RESULT_OP
           EXCEPTIONS OTHERS = 1.
      IF SY-SUBRC <> 0.
        %VARIANT = SPACE.
        PERFORM %RAISE.
      ENDIF.
      JOB_OUTPUT_OPTIONS = %RESULT_OP.
    ENDIF.
    IF SFSY-XDF = 'X'.
      CALL FUNCTION 'FUNCTION_IMPORT_INTERFACE'
           EXPORTING
                FUNCNAME           = '/1BCDWB/SF00000007'
                INACTIVE_VERSION   = SPACE
           TABLES
                IMPORT_PARAMETER   = IMPORT_PARAMETER
                CHANGING_PARAMETER = CHANGING_PARAMETER
                TABLES_PARAMETER   = TABLES_PARAMETER
                EXPORT_PARAMETER   = EXPORT_PARAMETER
                EXCEPTION_LIST     = EXCEPTION_LIST
           EXCEPTIONS
                OTHERS             = 1.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      L_GETSTATE-TBHD = L_GETSTATE-TBFD = L_GETSTATE-DTEL = 'X'.
      L_GETSTATE-TTHD = L_GETSTATE-TTFD = 'X'.
      LOOP AT IMPORT_PARAMETER.
        XDF_GET_DDIC_INFO IMPORT_PARAMETER IMPORT_PARAMETER-DBFIELD.
      ENDLOOP.
      LOOP AT CHANGING_PARAMETER.
        XDF_GET_DDIC_INFO CHANGING_PARAMETER
                          CHANGING_PARAMETER-DBFIELD.
      ENDLOOP.
      LOOP AT TABLES_PARAMETER.
        XDF_GET_DDIC_INFO TABLES_PARAMETER TABLES_PARAMETER-DBSTRUCT.
      ENDLOOP.
      CALL FUNCTION 'DD_TYPEINFO_GET'
           EXPORTING  GETSTATE    = L_GETSTATE
           TABLES     DDTYPES_TAB = L_DDIC_OBJ[]
                      DD02L_TAB   = L_DD02L_STATE[]
                      DD04L_TAB   = L_DD04L_STATE[]
                      DD40L_TAB   = L_DD40L_STATE[].
      XDF_FACTORY = CL_IXML=>CREATE( ).
      XDF_DOCUMENT = XDF_FACTORY->CREATE_DOCUMENT( ).
      L_NAME = C_XDF_ROOT_ELEMENT.
      XDF_ROOT_ELEMENT
           = XDF_DOCUMENT->CREATE_ELEMENT( NAME = L_NAME ).
      CALL METHOD XDF_DOCUMENT->APPEND_CHILD
           EXPORTING  NEW_CHILD  = XDF_ROOT_ELEMENT
           RECEIVING  RVAL       = RC.
      CHECK RC = 0.
      LOOP AT IMPORT_PARAMETER.
        XDF_CREATE_DATA_STREAM IMPORT_PARAMETER
                               IMPORT_PARAMETER-DBFIELD 'I'.
      ENDLOOP.
      LOOP AT CHANGING_PARAMETER.
        XDF_CREATE_DATA_STREAM CHANGING_PARAMETER
                               CHANGING_PARAMETER-DBFIELD 'C'.
      ENDLOOP.
      LOOP AT TABLES_PARAMETER.
        XDF_CREATE_DATA_STREAM TABLES_PARAMETER
                               TABLES_PARAMETER-DBSTRUCT 'T'.
      ENDLOOP.
      CALL FUNCTION 'SSFCOMP_XDF_OUTPUT'
           EXPORTING  DOCUMENT = XDF_DOCUMENT
           EXCEPTIONS OTHERS   = 1.
    ELSEIF SFSY-XDF2 = 'X'.
      XDF2_IXML     = CL_IXML=>CREATE( ).
      XDF2_DOCUMENT = XDF2_IXML->CREATE_DOCUMENT( ).
      XDF2_APPEND_SRC_OBJECT ARCHIVE_INDEX ARCHIVE_INDEX.
      XDF2_APPEND_SRC_OBJECT ARCHIVE_PARAMETERS ARCHIVE_PARAMETERS.
      XDF2_APPEND_SRC_OBJECT CONTROL_PARAMETERS CONTROL_PARAMETERS.
      XDF2_APPEND_SRC_OBJECT MAIL_APPL_OBJ MAIL_APPL_OBJ.
      XDF2_APPEND_SRC_OBJECT MAIL_RECIPIENT MAIL_RECIPIENT.
      XDF2_APPEND_SRC_OBJECT MAIL_SENDER MAIL_SENDER.
      XDF2_APPEND_SRC_OBJECT OUTPUT_OPTIONS OUTPUT_OPTIONS.
      XDF2_APPEND_SRC_OBJECT USER_SETTINGS USER_SETTINGS.
      XDF2_APPEND_SRC_OBJECT ARCHIVE_INDEX_TAB ARCHIVE_INDEX_TAB.
      XDF2_APPEND_SRC_OBJECT ORDERADM_H ORDERADM_H.
      XDF2_APPEND_SRC_OBJECT ACTIVITY_H ACTIVITY_H.
      XDF2_APPEND_SRC_OBJECT OPPORT_H OPPORT_H.
      XDF2_APPEND_SRC_OBJECT ORGMAN_H ORGMAN_H.
      XDF2_APPEND_SRC_OBJECT PARTNER_H PARTNER_H.
      XDF2_APPEND_SRC_OBJECT PRICINGDATA_H PRICINGDATA_H.
      XDF2_APPEND_SRC_OBJECT SALES_H SALES_H.
      XDF2_APPEND_SRC_OBJECT SHIPPING_H SHIPPING_H.
      XDF2_APPEND_SRC_OBJECT PAYPLAN_D_H PAYPLAN_D_H.
      XDF2_APPEND_SRC_OBJECT CUMULAT_H CUMULAT_H.
      XDF2_APPEND_SRC_OBJECT CUSTOMER_H CUSTOMER_H.
      XDF2_APPEND_SRC_OBJECT ACS_H ACS_H.
      XDF2_APPEND_SRC_OBJECT BILLING_H BILLING_H.
      XDF2_APPEND_SRC_OBJECT CANCEL_H CANCEL_H.
      XDF2_APPEND_SRC_OBJECT APPOINTMENT_H APPOINTMENT_H.
      XDF2_APPEND_SRC_OBJECT BILLPLAN_D_H BILLPLAN_D_H.
      XDF2_APPEND_SRC_OBJECT BILLPLAN_H BILLPLAN_H.
      XDF2_APPEND_SRC_OBJECT STATUS_D_H STATUS_D_H.
      XDF2_APPEND_SRC_OBJECT STATUS_H STATUS_H.
      XDF2_APPEND_SRC_OBJECT SRV_SUBJECT_H SRV_SUBJECT_H.
      XDF2_APPEND_SRC_OBJECT SRV_SUBJECT_I SRV_SUBJECT_I.
      XDF2_APPEND_SRC_OBJECT SRV_REASON_H SRV_REASON_H.
      XDF2_APPEND_SRC_OBJECT SRV_RESULT_H SRV_RESULT_H.
      XDF2_APPEND_SRC_OBJECT SRV_REFOBJ_H SRV_REFOBJ_H.
      XDF2_APPEND_SRC_OBJECT SRV_REFOBJ_I SRV_REFOBJ_I.
      XDF2_APPEND_SRC_OBJECT ORDERADM_I ORDERADM_I.
      XDF2_APPEND_SRC_OBJECT ORDERADM_I_IN ORDERADM_I_IN.
      XDF2_APPEND_SRC_OBJECT ORDERADM_I_QT ORDERADM_I_QT.
      XDF2_APPEND_SRC_OBJECT ORGMAN_I ORGMAN_I.
      XDF2_APPEND_SRC_OBJECT PRICINGDATA_I PRICINGDATA_I.
      XDF2_APPEND_SRC_OBJECT PRICING_I PRICING_I.
      XDF2_APPEND_SRC_OBJECT PRODUCT_I PRODUCT_I.
      XDF2_APPEND_SRC_OBJECT SALES_I SALES_I.
      XDF2_APPEND_SRC_OBJECT SERVICE_I SERVICE_I.
      XDF2_APPEND_SRC_OBJECT SCHEDLIN_I SCHEDLIN_I.
      XDF2_APPEND_SRC_OBJECT SCHEDLIN_I_CF SCHEDLIN_I_CF.
      XDF2_APPEND_SRC_OBJECT SHIPPING_I SHIPPING_I.
      XDF2_APPEND_SRC_OBJECT PARTNER_I PARTNER_I.
      XDF2_APPEND_SRC_OBJECT ITEM_CSTICS_I ITEM_CSTICS_I.
      XDF2_APPEND_SRC_OBJECT CUSTOMER_I CUSTOMER_I.
      XDF2_APPEND_SRC_OBJECT BILLING_I BILLING_I.
      XDF2_APPEND_SRC_OBJECT CANCEL_I CANCEL_I.
      XDF2_APPEND_SRC_OBJECT FINPROD_I FINPROD_I.
      XDF2_APPEND_SRC_OBJECT ORDPRP_I ORDPRP_I.
      XDF2_APPEND_SRC_OBJECT APPOINTMENT_I APPOINTMENT_I.
      XDF2_APPEND_SRC_OBJECT BILLPLAN_D_I BILLPLAN_D_I.
      XDF2_APPEND_SRC_OBJECT BILLPLAN_I BILLPLAN_I.
      XDF2_APPEND_SRC_OBJECT STATUS_I STATUS_I.
      XDF2_APPEND_SRC_OBJECT WORKING_SET_E_S_BBP WORKING_SET_E_S_BBP.
      XDF2_APPEND_SRC_OBJECT LANGUAGE LANGUAGE.
      XDF2_APPEND_SRC_OBJECT SERVICE_I_ASSI SERVICE_I_ASSI.
      XDF2_APPEND_SRC_OBJECT FORM_TYPE FORM_TYPE.
      XDF2_APPEND_SRC_OBJECT Y_V_PARTNER_FLAG Y_V_PARTNER_FLAG.
      XDF2_APPEND_SRC_OBJECT JOB_OUTPUT_INFO JOB_OUTPUT_INFO.
      CALL TRANSFORMATION ID
           SOURCE (XDF2_SRC_OBJECTS)
           RESULT XML XDF2_DOCUMENT.
      CALL FUNCTION 'SSFCOMP_XDF2_OUTPUT'
        EXPORTING
          DOCUMENT = XDF2_DOCUMENT
        EXCEPTIONS
          OTHERS   = 1.
      IF SY-SUBRC <> 0. RAISE ERROR. ENDIF.
    ELSE.
      %FULLNAME-VARI = %VARIANT.
      %VARIANT = SPACE.
      IF %HEADER IS INITIAL.
        IMPORT HEADER   TO %HEADER
               REFTAB   TO %REFTAB
               DOCSTRUC TO %DOCSTRUC
               TABDEF   TO %TABDEFS
               FROM DATABASE STXFCONTR(SF) ID %FULLNAME.
        IF SY-SUBRC <> 0.
          CALL FUNCTION 'SSFRT_SET_ERROR_PARAMETERS'
               EXPORTING I_FORM      = 'YCRM_ORDER_SERVICE_RMA'.
          CALL FUNCTION 'SSFRT_WRITE_ERROR'
               EXPORTING I_ERRNUMBER = SSF_ERR_NO_RUNTIME_OBJECT
                         I_MSGID     = 'SSFCOMPOSER'
                         I_MSGNO     = '002'
                         I_MSGV1     = 'YCRM_ORDER_SERVICE_RMA'.
          PERFORM %RAISE.
        ENDIF.
        SELECT SINGLE SDATE STIME FROM D010SINF
          INTO (%HEADER-SDATE, %HEADER-STIME)
          WHERE PROG    = '/1BCDWB/SAPLSF00000007'
            AND R3STATE = 'A'.
        IF SY-SUBRC <> 0.
          CLEAR: %HEADER-SDATE,
                 %HEADER-STIME.
        ENDIF.
      ENDIF.
      LOOP AT %TABDEFS INTO %TABDEF.
        CALL FUNCTION 'SSFCOMP_TABLE_DEFINITION'
             EXPORTING  CPI    = %HEADER-CPI
                        LPI    = %HEADER-LPI
             CHANGING   TABDEF = %TABDEF
             EXCEPTIONS OTHERS = 1.
        IF SY-SUBRC <> 0. PERFORM %RAISE. ENDIF.
      ENDLOOP.
      CALL FUNCTION 'SSFRT_SET_REFERENCES'
           EXPORTING I_REFTAB = %REFTAB .
      CALL FUNCTION 'SSFRT_SET_LANGUAGES'
           EXPORTING I_CONTROL_PARAMETERS = CONTROL_PARAMETERS
                     I_MASTERLANGUAGE     = 'E'
                     I_THRULANG           = ' '
                     I_INSTALL_LANG       = ' '
           IMPORTING O_LANGUAGES          = %LANGUAGES.
      %HEADER-LANGU = %LANGUAGES-LANGU1.
      %WEXIT = SPACE.
      PERFORM %GLOBAL_CLEAR.
      PERFORM %GLOBAL_INIT.
      CLEAR %ARCTAB.
      IF ARCHIVE_INDEX_TAB[] IS INITIAL.
        APPEND ARCHIVE_INDEX TO %ARCTAB.
      ELSE.
        %ARCTAB = ARCHIVE_INDEX_TAB.
      ENDIF.
    > CALL FUNCTION 'SSFCOMP_PROCESS_DOCUMENT'
           EXPORTING  HEADER           = %HEADER
                      DOCSTRUC         = %DOCSTRUC
                      STARTPAGE        = CONTROL_PARAMETERS-STARTPAGE
                      ARCHIV_INDEX_TAB = %ARCTAB
                      MAIL_APPL_OBJECT = MAIL_APPL_OBJ
           IMPORTING  RESULT           = %RESULT_PD
           EXCEPTIONS OTHERS           = 1.
      IF SY-SUBRC <> 0. PERFORM %RAISE. ENDIF.
      DOCUMENT_OUTPUT_INFO = %RESULT_PD.
    ENDIF.
    The function module 'SSFCOMP_PROCESS_DOCUMENT' is returning sy-subrc value 1.
    Could you please tell me how to rectify this error
    Thanks and Regards,
    Soumya.

    The error I am getting is a formatting error as shown below:
    L_ERROR-MSGTY                  E
    L_ERROR-MSGID                  SSFCOMPOSER
    L_ERROR-MSGV1                  YTI_FCR004_RETREP_TYPE

  • Do I need to declare a transaction in this case?

    I am struggling to understand when it is necessary to declare my own transaction to ensure the data is properly updated.
    For example, in the following code, which is part of a java bean in the EJB project, KeyFacade is a stateless session bean tied to the entity "Key". it is a standard EJB created with the netBeans 5.5 wizard. I have changed no defaults.
    Do I need to declare a transaction, commit the transaction and close it when I use the "KeyFacade.edit(key);" in order to ensure the database is updated? Or is it automatically done because the .edit() method uses the entityManager and the persistence is container managed?
    Would it make a difference if this bean was part of a WAR project?
        public BigInteger getNextKey(String tableName){
            KeyFacadeLocal KeyFacade = this.lookupKeyFacade();
            Key key = KeyFacade.findByTablename(tableName);
            long nextKey = key.getKeyvalue();
            BigInteger BINextKey =BigInteger.valueOf((int)nextKey);
            //  now update the table by incrementing the key value by 1
            long incrementKey = nextKey + 1;
            key.setKeyvalue(incrementKey);
            KeyFacade.edit(key);
            return BINextKey;
        }

    808239 wrote:
    I have a Map<Integer, List<T>> data, and all the lists are initialized using Collections.synchronizedList().Seems like overkill to me. Your Map also looks like a Multimap, of which there are several existing implementations.
    When I do the traversal, I want to traverse ALL lists in the map at the same timeI suspect not. What you want to do is to traverse each one in sequence.
    so I have to sync all lists as shown in the API doc as follows: ...Seems like overkill to me, and will probably result in a very slow Map (not that there's any problem with that if it's the right thing to do; in this case, I suspect it isn't).
    Is this approach ok?What are you trying to achieve? If you need full consistency for your iterators (ie, a snapshot of the entire Map at the time the iterator is created), you have a two choices (assuming you don't want to deal with update journals):
    1. Lock the Map.
    2. Clone the Map (and your clone() method should be synchronized).
    Of the two, the second seems best to me, but neither is all that wonderful.
    However, if all you need is weak consistency - that is to say, what you return reflects the state of the Map when Iterator.next() is called - all you really need to do is make sure that your Lists are synchronized when you do the read.
    Since the List updates are the responsibility of your Map (I'm still presuming this is some sort of Multimap implementation), there's no real need to synchronize them; just synchronize the Map's own update methods.
    I'd also suggest that you make sure your getValue() method hands back an [url http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#unmodifiableList%28java.util.List%29]unmodifiable List to clients; otherwise they could start adding or removing values themselves.
    HIH
    Winston

  • Resource planning in cprojects with xRPM or MRS?

    Dear Experts,
    To my understanding there are four options to perform resource planning in combination with cprojects:
    1.     Do a planning in cprojects only
    2.     Use resource planning application (RPA) from SAP CRM
    3.     Schedule resources with xRPM
    4.     Schedule resources with SAP MRS (Multi Resource Scheduling)
    I have a couple of questions:
    (a) Is it correct that I cannot assign resources to project roles in xRPM based on qualification matching? Is it right that xRPM is used rather for a long-term view to define the available capacity of projects/roles than assigning specific resources to roles?
    (b) How can help SAP MRS in comparison to option 1 (planning in cprojects)? I assume that I can do also in cprojects itself a qualification matching. MRS provides a more detailed qualification object to cover complex requirements, right? What else provides MRS what cannot be managed in cprojects itself?
    (c ) If we want to use a staffing process were project lead and resource manager doing the staffing and have the option to suggest or reject roles, we have the option to use xRPM or MRS, right? What are the differences? In MRS we have options like using several resource managers, softbooking/hardbooking or itu2019s possible to define the workflow who proposes resources and who is doing the final staffing (project lead or staffing manager), reasons for rejections can be configured etc. Are these options in xRPM available as well?
    Thanks,
    Angie

    Hi Angie,
    I have not implemented MRS or RPA so can only answer your first question. You cannot do a resource search via qualification in Portfolio Management (aka xRPM), typically you would do this in Project Management (aka cProjects) and this functionality works fine provided you have maintained qualification data for BP's and roles. Portfolio Management financial planning function can be used for a long term view as you have mentioned. However, it is also typically used to summarize and/or roll up resource demand / assignment to a bucket or portfolio level or summarize resources for multiple projects via initiatives or collections. You can also use a top down approach and at a high level plan values at the bucket level (i.e. forecasted demand or business case demand) and compare against detailed planned / assigned demand rolled up from project management.
    Hope this helps.
    Regards,
    Lashan

  • Mutating tirgger issue while setting a value

    I have a table and records as below:
    CREATE TABLE set_time
    NUM NUMBER,
    ID NUMBER,
    SET_VALUE CHAR(1 BYTE),
    D_TIME DATE
    Insert into SET_TIME (NUM, ID) Values (1, 1);
    Insert into SET_TIME (NUM, ID) Values (2, 1);
    Insert into SET_TIME (NUM, ID) Values (3, 1);
    Insert into SET_TIME (NUM, ID) Values (4, 1);
    Insert into SET_TIME (NUM, ID) Values (5, 1);
    Insert into SET_TIME (NUM, ID) Values (1, 2);
    Insert into SET_TIME (NUM, ID) Values (2, 2);
    Insert into SET_TIME (NUM, ID) Values (3, 2);
    I need a trigger,whenever all the set_values for a particular id is set to 'Y', I need to update the column d_time as sys_date.For that I wrote below trigger
    CREATE OR REPLACE TRIGGER set_time_trigger
    before update
    ON set_time for each row
    DECLARE
    v_count number;
    BEGIN
    if :new.set_value = 'Y' then
    select 1 into v_count
    from dual
    where exists ( select null
    from set_time
    where ID = :new.id
    AND ( set_value != 'Y'));
    if v_count is null then
    update set_time
    set d_time = sysdate where ID =:new.id;
    end if;
    end if;
    end;
    But while executing the below statement:
    update set_time set set_value ='Y' where id = 1;
    I am gettign the follwoing error:
    ORA-04091: table SET_TIME is mutating, trigger/function may not see it
    ORA-06512: at "SET_TIME_TRIGGER", line 13
    ORA-04088: error during execution of trigger 'SET_TIME_TRIGGER'
    Is there anyway that I can achieve this?. I am using Oracle 11G.
    Thanks in Advance

    1) If D_TIME depends on the data that is set for multiple rows in your table, you have a normalization problem. It sounds like you need to rethink your data model and break out the ID column into a separate table.
    2) A row-level trigger cannot generally query the table on which it is defined. So you generally cannot code a row-level trigger that would query the data in other rows of the table. You could define a package which had a collection of ID values, create a before update statement-level trigger that initialized the collection, create a row-level trigger that inserted the :new.id into this packaged collection, and create an after update statement-level trigger that read the data from the collection, queried the table, and did the updates as appropriate. That's a lot of work to go through and a lot of complexity to introduce.
    Additionally, this sort of trigger-based approach does not generally work in a multiuser environment. If Session A is inserting a new row with an ID of 1 and a SET_TIME of N at the same time that Session B is setting the SET_TIME of all the committed rows with an ID of 1 to Y, the trigger in Session B can update the D_TIME before session A commits its data leaving you with a case where D_TIME is set and not every row with an ID of 1 has a SET_TIME of Y.
    Justin

  • Error Ocurred while processing a data cube

    While processing a cube i am getting following errors:- please help me out to fix it
    1) Errors in the high-level relational engine. The following exception occurred while an operation was being performed on a data source view: Method not found: 'System.Threading.Tasks.Task`1<!!0> System.Threading.Tasks.Task.FromResult(!!0)'..
    2)Errors in the high-level relational engine. The following exception occurred while an operation was being performed on a data source view: .
    3)Errors in the OLAP storage engine: An error occurred while the dimension, with the ID of 'Dimension Metier', Name of 'Dimension Metier' was being processed.
    4)Errors in the OLAP storage engine: An error occurred while the 'Metier ID' attribute of the 'Dimension Metier' dimension from the 'MultidimensionalProject1' database was being processed.
    5)Internal error: The operation terminated unsuccessfully.
    6)Server: The current operation was cancelled because another operation in the transaction failed.
    thank you

    Hi Immortal12,
    What's the version of your SQL Server Analysis Services? Are you encountered this issue while process the cube in SQL Server Management Studio? Please elaborate your scenrio with more deail.
    Currently, we can't figure out the root casue of this issue. So, please help to collect more log information which are benefit for us to do further investigation. Here are some good articles to collect SSAS log informtion:
    Error Configuration for Cube, Partition, and Dimension Processing (SSAS - Multidimensional):
    http://msdn.microsoft.com/en-us/library/ms180058.aspx
    Data collection for troubleshooting Analysis Services issues:
    http://blogs.msdn.com/b/as_emea/archive/2012/01/02/initial-data-collection-for-troubleshooting-analysis-services-issues.aspx
    Regards,
    Elvis Long
    TechNet Community Support

  • Error setting up new Managed System in SMD

    Hi,
    we get the following error after trying to setup a new (Java)-System:
    DataCollect Initial Data Collect ERROR for host xyz
    Step DataCollect Details
    Initial Data Collect ERROR for host xyz
    !! Exception : An error occurred while uploading the Configuration Data from host [xyz] !(cause=java.lang.Exception [DataCollectorClientUtil_xyz] Error collecting initial configuration files on host [xyz])
    Exceptions
    com.sap.sup.admin.scheduler.exception.FatalTaskExecutionException: An error occurred while uploading the Configuration Data from host [xyz] !
    at com.sap.sup.admin.scheduler.task.remote.config.InitialConfigGatherTask.process(InitialConfigGatherTask.java:72)
    at com.sap.sup.admin.scheduler.config.DataCollect.execute(DataCollect.java:138)
    at com.sap.sup.admin.setup.AppCfgTasks.runInitialDataCollect(AppCfgTasks.java:57)
    at com.sap.sup.admin.setup.SetupStep.execute(SetupStep.java:348)
    at com.sap.smd.agent.plugins.remotesetup.SapInstance.setup(SapInstance.java:304)
    at com.sap.sup.admin.setup.SapCluster.setup(SapCluster.java:736)
    at com.sap.sup.admin.setup.SapCluster.access$000(SapCluster.java:28)
    at com.sap.sup.admin.setup.SapCluster$SetupRunner.run(SapCluster.java:1000)
    at java.lang.Thread.run(Thread.java:534)
    Caused by: java.lang.Exception: [DataCollectorClientUtil_xyz] Error collecting initial configuration files on host [xyz]
    at com.sap.smd.agent.plugins.datacollector.util.DataCollectorClientUtil.collectInitialConfigurationData(DataCollectorClientUtil.java:315)
    at com.sap.sup.admin.scheduler.task.remote.config.InitialConfigGatherTask.process(InitialConfigGatherTask.java:67)
    ... 8 more
    Caused by: com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: [DataCollector] Error during collectInitialConfigurationData() on host [xyz]; nested exception is:
    com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: Error installing template files in the working directory; nested exception is:
    com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: No cca_systemlandscape.xml file found
    at com.sap.smd.agent.plugins.datacollector.DataCollectorService.collectInitialConfigurationData(DataCollectorService.java:684)
    at com.sap.smd.agent.plugins.datacollector.DataCollectorServicep4_Skel.dispatch(DataCollectorServicep4_Skel.java:290)
    at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319)
    at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200)
    at com.sap.engine.services.rmi_p4.DispatchImpl.run(DispatchImpl.java:716)
    ... 1 more
    Caused by: com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: Error installing template files in the working directory; nested exception is:
    com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: No cca_systemlandscape.xml file found
    at com.sap.smd.agent.plugins.datacollector.DataCollectorService.installTemplateFiles(DataCollectorService.java:792)
    at com.sap.smd.agent.plugins.datacollector.DataCollectorService.collectInitialConfigurationData(DataCollectorService.java:710)
    at com.sap.smd.agent.plugins.datacollector.DataCollectorService.collectInitialConfigurationData(DataCollectorService.java:654)
    ... 5 more
    Caused by: com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: No cca_systemlandscape.xml file found
    at com.sap.smd.agent.plugins.datacollector.DataCollectorService.installTemplateFiles(DataCollectorService.java:766)
    ... 7 more
    in file SMDAgentApplication.0.log of the server, that hosts the system and the SMD agent, I get: 
    Nov 27, 2008 2:22:57 PM [Thread[Thread-25,5,main]] Error      DataCollectorService@40c5f303: collectInitialConfigurationData()
    [EXCEPTION]
    com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: Error installing template files in the working directory; nested exception is:
         com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: No cca_systemlandscape.xml file found
         at com.sap.smd.agent.plugins.datacollector.DataCollectorService.installTemplateFiles(DataCollectorService.java:792)
         at com.sap.smd.agent.plugins.datacollector.DataCollectorService.collectInitialConfigurationData(DataCollectorService.java:710)
         at com.sap.smd.agent.plugins.datacollector.DataCollectorService.collectInitialConfigurationData(DataCollectorService.java:654)
         at com.sap.smd.agent.plugins.datacollector.DataCollectorServicep4_Skel.dispatch(DataCollectorServicep4_Skel.java:290)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200)
         at com.sap.engine.services.rmi_p4.DispatchImpl.run(DispatchImpl.java:716)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: com.sap.smd.agent.plugins.datacollector.exc.RemoteDataCollectException: No cca_systemlandscape.xml file found
         at com.sap.smd.agent.plugins.datacollector.DataCollectorService.installTemplateFiles(DataCollectorService.java:766)
         ... 7 more
    Nov 27, 2008 2:23:03 PM [Thread[Thread-35,5,main]] Warning    com.sap.smd.wily.hostagent.action.SapOsColAction - launchDaemon(): launchDaemon: saposcol exited with -1
    the mentioned cca_systemlandscape.xml that should be located in usr\sap\SMD\J98\SMDAgent\applications.config\com.sap.smd.agent.application.datacollector is 0 byte.
    where should this file be generated/has its source?
    kr, achim

    Helpfull notes:
    987835 - How to define Solutions in SMSY for Diagnostics
    986350 - SM Diagnostics: "Monitored setup" fails during data collect

  • How to clear the fields within copy routines in the copy contorl

    HI Gurus,
    I need to clear  the fields VBP-VBELV and VBAP-PSSNV within the copy routines 303 in the copy control between quote item and sales order item. I am not sure how to do that... Can some body please help.
    This is required because we had sales order and quote using the same requirement type which controls the special stock indicator. This leads to the stock getting update in quotation instead of the sales order, because the quotation is initiating document (collecting all cost etc).Now i know requirement should only be passed to production from sales order and not from quotation so i changed the config but there are some existing documents using same requirement type on both quotation and sales order and to correct those i need to clear fields VBP-VBELV and VBAP-PSSNV within the copy routines 303.
    Please help!
    Regards,
    Sam

    Hi ,
    just use this code in ur save button action handler , this will clear the field after entered in to the database and will ready for the next set of data.
    String password=wdContext.currentContextElement().getpwd();
    try{
         InitialContext ctx=new InitialContext();
         DataSource ds=(DataSource)ctx.lookup("jdbc/SAPJ2EDB");
         Connection con=ds.getConnection();
         con.setAutoCommit(false);
         Statement stmt=con.createStatement();
         int retIns = stmt.executeUpdate("insert into TMP_NEWUSERDETAIL(PASSWORD) values("password")");
         con.commit();
         con.setAutoCommit(true);
         wdContext.currentContextElement().setpwd(null);
    or use a seperate button to clear the field.
    wdContext.currentContextElement().set<Attributename>(null);
    Regards
    Vijayakhanna Raman

  • Check boxes in ALV report

    Can any one please give me any test program for displaying checkboxes in the ALV Report Layout .
    Points will be rewarded even for helpfull answers.
    Thanks ,
    Veerendranath Maddula.

    Hi Veerendranath,
    below is the sample code for that,
    TYPES:
           BEGIN OF TY_VB_AKAP,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             POSNR      TYPE POSNR_VA,                       "Item Number
             MATNR      TYPE MATNR,                          "Material Number
             PMATN      TYPE PMATN,                          "Pricing Reference Material/Newly Created Material
             KWMENG     TYPE KWMENG,                         "Cumulative Order Qty. in Sales Units
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             VKAUS      TYPE ABRVW,                          "Usage Indicator
             WAERK      TYPE WAERK,                          "SD Document Currency
           END   OF TY_VB_AKAP,
           BEGIN OF TY_MARA,
             MATNR      TYPE MATNR,                          "Material Number
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
           END   OF TY_MARA,
           BEGIN OF TY_MVKE,
             MATNR      TYPE MATNR,                          "Material Number
             VKORG      TYPE VKORG,                          "Sales Organization
             VTWEG      TYPE VTWEG,                          "Distribution Channel
             KONDM      TYPE KONDM,                          "Material Pricing Group
    *--Begin of changes for the change request 2007096--26th July 2007--
             VRKME      TYPE VRKME,                          "Sales Unit according to the Material Master
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_MVKE,
           BEGIN OF TY_VBKD,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             POSNR      TYPE POSNR_VA,                       "Item Number
             BSTKD_E    TYPE BSTKD_E,                        "Used to capture New Material Number
           END   OF TY_VBKD,
           BEGIN OF TY_IHEADER,
             SELECT(1)  TYPE C,                              "Check Box
             VBELN      TYPE VBELN,                          "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to Party
           END   OF TY_IHEADER,
           BEGIN OF TY_MESSAGE1,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            KONDM     TYPE KONDM,                            "Material pricing group
            ZCOUNT(2) TYPE N,                                "Zcount
            MSGTYP(1) TYPE C,                                "Message type
            TEXT      TYPE STRING,                           "Message text
           END   OF TY_MESSAGE1,
    *--Begin of changes for the change request 2007106--25th July 2007--
           BEGIN OF TY_MESSAGE1_2,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            KONDM     TYPE KONDM,                            "Material pricin
            MSGTYP(1) TYPE C,                                "Message type
            TEXT      TYPE STRING,                           "Message text
           END   OF TY_MESSAGE1_2,
    *--End   of changes for the change request 2007106--25th July 2007--
           BEGIN OF TY_MESSAGE2,
            VKORG     TYPE VKORG,                            "Sales Organization
            VTWEG     TYPE VTWEG,                            "Distribution Channel
            KUNNR     TYPE KUNAG,                            "Customer number
            MATNR     TYPE MATNR,                            "Material Number
            MSGTYP(1) TYPE C,                                "Message type
            TEXT      TYPE STRING,                           "Message text
           END   OF TY_MESSAGE2,
           BEGIN OF TY_IFINAL,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KWMENG     TYPE KWMENG,                         "Cumulative Order Qty. in Sales Units
             POSNR      TYPE POSNR_VA,                       "Item Number
             KUNNR      TYPE KUNAG,                          "Sold-to party
             MATNR      TYPE MATNR,                          "Material Number
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             VKAUS      TYPE ABRVW,                          "Usage Indicator
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             PMATN      TYPE PMATN,                          "Pricing Reference Material/Newly Created Material
             KONDM      TYPE KONDM,                          "Material Pricing Group
    *--Begin of changes for the change request 2007096--26th July 2007--
             WAERK      TYPE WAERK,                          "SD Document Currency
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_IFINAL,
           BEGIN OF TY_ACC1,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             KONDM      TYPE KONDM,                          "Material Pricing Group
             ZCOUNT(2)  TYPE N,                              "ZCount indicator
             KSTBM      TYPE KSTBM,                          "Quantity
             VRKME      TYPE VRKME,                          "Sales Unit
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error Field
    *--Begin of changes for the change request 2007096--26th July 2007--
             WAERK      TYPE WAERK,                          "SD Document Currency
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_ACC1,
    Important Note : Earlier there were only three accesses and hence this below type was coded as TY_ACC2 depicting
    the type for internal table as a holder of data for second access sequence, but later a new access sequence was
    introduced and was introduced as the second access by itself and hence the sequence which was previously considered
    as second access is going to be third access sequence in reality. The naming standards that are going to be followed
    for the newly introduced access sequence would be XXX_1_2. (For Change request 2007106)
           BEGIN OF TY_ACC2,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             MATNR      TYPE MATNR,                          "Material Number
             KSTBM      TYPE KSTBM,                          "Cumulative Order Qty. in Sales Units
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             VRKME      TYPE VRKME,                          "Sales Unit
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error field
    *--Begin of changes for the change request 2007096--26th July 2007--
             WAERK      TYPE WAERK,                          "SD Document Currency
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_ACC2,
    *--Begin of changes for the change request 2007106--24th July 2007--
           BEGIN OF TY_ACC1_2,
             VBELN      TYPE VBELN_VA,                       "Sales Document
             KUNNR      TYPE KUNAG,                          "Sold-to party
             KONDM      TYPE KONDM,                          "Material Pricing Group
             KSTBM      TYPE KSTBM,                          "Quantity
             VRKME      TYPE VRKME,                          "Sales Unit
             ZZTECHSPEC TYPE ZTECHSPEC,                      "Technical Specification
             KZWI1      TYPE KZWI1,                          "Sub Total 1 from pricing procedure for condition
             ERROR(1)   TYPE N,                              "Error field
    *--Begin of changes for the change request 2007096--26th July 2007--
             WAERK      TYPE WAERK,                          "SD Document Currency
    *--End   of changes for the change request 2007096--26th July 2007--
           END   OF TY_ACC1_2,
    *--End   of changes for the change request 2007106--24th July 2007--
    *--Begin of changes for the change request 2007096--26th July 2007--
           BEGIN OF TY_T006,
             MSEHI      TYPE MSEHI,                          "Unit of Measurement
             ZAEHL      TYPE DZAEHL,                         "Numerator for conversion to SI unit
             NENNR      TYPE NENNR,                          "Denominator for conversion into SI unit
           END   OF TY_T006,
    *--End   of changes for the change request 2007096--26th July 2007--
    *--Begin of changes for the change request xxx--2nd Aug 2007--
    *Types of MARM table
           BEGIN OF TY_MARM,
             MATNR TYPE MATNR,                               " Material Number
             MEINH TYPE LRMEI,                               " Alternative Unit of Measure
             UMREZ TYPE UMREZ,                               " Numerator for Conversion to Base UOM
             UMREN TYPE UMREN,                               " Denominator for Conversion to Base UOM
           END   OF TY_MARM.
    *--End   of changes for the change request xxx--2nd Aug 2007--
       D A T A                                                           *
    Internal Table Declarations
    DATA: T_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,           "Fieldcatalog IT
          T_EVENTS       TYPE SLIS_T_EVENT,                  "Event IT
          T_HEADER       TYPE SLIS_T_LISTHEADER,             "Header IT
          T_VB_AKAP      TYPE STANDARD TABLE OF TY_VB_AKAP,  "To hold records from VBAK & VBAP Table
          T_MARA         TYPE STANDARD TABLE OF TY_MARA,     "To hold records from MARA Table
          T_MVKE         TYPE STANDARD TABLE OF TY_MVKE,     "To hold records from MVKE Table
          T_VBKD         TYPE STANDARD TABLE OF TY_VBKD,     "To hold records from VBKD Table
          T_IHEADER      TYPE STANDARD TABLE OF TY_IHEADER,  "To hold records from VBAK Table
          T_IFINAL       TYPE STANDARD TABLE OF TY_IFINAL,   "To hold cumulative data for ALV
          T_BDCDATA      TYPE STANDARD TABLE OF BDCDATA,     "IT for bdcdata
          T_BDCMSGCOLL   TYPE STANDARD TABLE OF BDCMSGCOLL,  "IT for error messages
          T_MESSAGE1     TYPE STANDARD TABLE OF TY_MESSAGE1, "IT for conditions1 messages
    *--Begin of changes for the change request 2007106--25th July 2007--
          T_MESSAGE1_2   TYPE STANDARD TABLE OF TY_MESSAGE1_2,"ITfor conditions1_2 messages
    *--End   of changes for the change request 2007106--25th July 2007--
          T_MESSAGE2     TYPE STANDARD TABLE OF TY_MESSAGE2, "IT for conditions2 messages
          T_ACC2         TYPE STANDARD TABLE OF TY_ACC2,     "IT for holding data for Second Access Sequence Processing
          T_ACC1         TYPE STANDARD TABLE OF TY_ACC1,     "IT for holding data for First Access Sequence Processing
          T_SELECT       TYPE STANDARD TABLE OF RSPARAMS,    "IT for holding data related to the selection screen
    *--Begin of changes for the change request 2007106--24th July 2007--
          T_ACC1_2       TYPE STANDARD TABLE OF TY_ACC1_2,   "IT for holding data for new intermediate Access Sequence
    *--End   of changes for the change request 2007106--24th July 2007--
    *--Begin of changes for the change request 2007096--26th July 2007--
          T_T006         TYPE STANDARD TABLE OF TY_T006,     "IT for holding T006 Entries
    *--End   of changes for the change request 2007096--26th July 2007--
    *--Begin of changes for the change request xxx--2nd Aug 2007--
          T_MARM         TYPE STANDARD TABLE OF TY_MARM,     "IT for holding entries from MARM
    *--End   of changes for the change request xxx--2nd Aug 2007--
    Work area Declarations
          W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV,             "Fieldcatalog WA
          W_EVENT        TYPE SLIS_ALV_EVENT,                "Event WA
          W_HEADER       TYPE SLIS_LISTHEADER,               "Header WA
          W_LAYOUT       TYPE SLIS_LAYOUT_ALV,               "Layout WA
          W_KEYINFO      TYPE SLIS_KEYINFO_ALV,              "Key Information WA
          W_VB_AKAP      TYPE TY_VB_AKAP,                    "To hold records from T_VB_AKAP
          W_MARA         TYPE TY_MARA,                       "To hold records from T_MARA
          W_MVKE         TYPE TY_MVKE,                       "To hold records from T_MVKE
          W_VBKD         TYPE TY_VBKD,                       "To hold records from T_VBKD
          W_IHEADER      TYPE TY_IHEADER,                    "To hold records from T_IHEADER
          W_IFINAL       TYPE TY_IFINAL,                     "To hold records from T_IFINAL
          W_PARAMS       TYPE CTU_PARAMS,                    "CTU Params
          W_BDCDATA      TYPE BDCDATA,                       "Work Area for BDCDATA
          W_BDCMSGCOLL   TYPE BDCMSGCOLL,                    "Work Area to collect BDC Messages
          W_MESSAGE1     TYPE TY_MESSAGE1,                   "WA for price conditions1 messages
    *--Begin of changes for the change request 2007106--25th July 2007--
          W_MESSAGE1_2   TYPE TY_MESSAGE1_2,                 "WA for price conditions1_2 messages
    *--End   of changes for the change request 2007106--25th July 2007--
          W_MESSAGE2     TYPE TY_MESSAGE2,                   "WA for price conditions2 messages
          W_ACC2         TYPE TY_ACC2,                       "WA for holding records from T_ACC2
          W_ACC1         TYPE TY_ACC1,                       "WA for holding records from T_ACC1
    *--Begin of changes for the change request 2007106--24th July 2007--
          W_ACC1_2       TYPE TY_ACC1_2,                     "WA for holding records from T_ACC1_2
    *--End   of changes for the change request 2007106--24th July 2007--
    *--Begin of changes for the change request 2007096--26th July 2007--
          W_T006         TYPE TY_T006,                       "WA for holding T_T006 Entries
    *--End   of changes for the change request 2007096--26th July 2007--
    *--Begin of changes for the change request xxx--2nd Aug 2007--
          W_MARM         TYPE TY_MARM,                       "WA for holding entries of T_MARM
    *--End   of changes for the change request xxx--2nd Aug 2007--
    Variable declarations
          G_VKORG       TYPE VKORG,                          "Sales Organization
          G_VTWEG       TYPE VTWEG,                          "Distribution Channel
          G_AUDAT       TYPE AUDAT,                          "Document Date (Date Received/Sent)
          G_VBELN       TYPE VBELN_VA,                       "Sales Document
          G_KUNNR       TYPE KUNAG,                          "Sold-to party
          G_MATNR       TYPE MATNR,                          "Material Number
          G_REPID       TYPE SY-REPID,                       "Program Name
          G_MESSAGE(73) TYPE C,                              "To Capture Message
          G_FLAG1(1)    TYPE C,                              "Flag
          G_ANSWER(1)   TYPE C,                              "Optional Button
    *--Begin of changes for the change request 2007096--26th July 2007--
          G_NUM_SOURCE  TYPE DZAEHL,                         "Holds Numerator value for Source Unit of Measure
          G_NUM_TARGET  TYPE DZAEHL,                         "Holds Numerator value for Target Unit of Measure
          G_DEN_SOURCE  TYPE NENNR,                          "Holds Denominator value for Source Unit of Measure
          G_DEN_TARGET  TYPE NENNR.                          "Holds Denominator value for Target Unit of Measure
    *--End   of changes for the change request 2007096--26th July 2007--
    Constant declarations
    CONSTANTS:
          C_A(1)         TYPE C VALUE 'A',                    "Constant Value A
          C_S(1)         TYPE C VALUE 'S',                    "Constant Value S
          C_U(1)         TYPE C VALUE 'U',                    "Constant Value U
          C_X(1)         TYPE C VALUE 'X',                    "Constant Value X
          C_E(1)         TYPE C VALUE 'E',                    "Constant Value E
          C_I(1)         TYPE C VALUE 'I',                    "Constant Value I
          C_R(1)         TYPE C VALUE 'R',                    "Constant Value R
          C_B(1)         TYPE C VALUE 'B',                    "Document Category is Quotation
          C_HTNAME(10)   TYPE C VALUE 'T_IHEADER',            "Internal table for Header Data
          C_ITNAME(10)   TYPE C VALUE 'T_IFINAL',             "Internal Table with processed data
          C_Q2(2)        TYPE C VALUE 'Q2',                   "Constant Order Reason Q2
          C_100(3)       TYPE C VALUE '100',                  "Popup screen
          C_25(2)        TYPE C VALUE '25',                   "Popup screen
          C_5(1)         TYPE C VALUE '5',                    "Popup screen
          C_1            TYPE I VALUE  1,                     "Value 1 for Error Denotion
          C_2            TYPE I VALUE  2,                     "Value 2 for Error Denotion
          C_3            TYPE I VALUE  3,                     "Value 3 for BDC Error Denotion
          C_1000(4)      TYPE N VALUE 1000,                     "Value 1000
          C_01(2)        TYPE N VALUE '01',                   "Value 01 for Zcount
          C_VK11(4)      TYPE C VALUE 'VK11',                 "Transaction VK11
          C_DYNBEGIN(1)  TYPE C VALUE 'X',                    "Indicator
          C_UPDATE(1)    TYPE C VALUE 'S',                    "Update
          C_DISMODE(1)   TYPE C VALUE 'N',                    "Display
          C_Q3(2)        TYPE C VALUE 'Q3',                   "Quotation Approved
          C_ZBPR(4)      TYPE C VALUE 'ZBPR',                 "Condition Type ZBPR
    *--Begin of changes for the change request xxx--2nd Aug 2007--
          C_ZBPN(4)      TYPE C VALUE 'ZBPN',                 "Condition Type ZBPN
    *--End   of changes for the change request xxx--2nd Aug 2007--
          C_ERROR(5)     TYPE C VALUE 'ERROR'.                "Error screen title
       S E L E C T   O P T I O N S  &  P A R A M E T E R S               *
    Selection-screen Block 1
    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:     P_VKORG TYPE VKORG OBLIGATORY,           "Sales Organization
                    P_VTWEG TYPE VTWEG OBLIGATORY,           "Distribution Channel
                    P_SPART TYPE SPART DEFAULT '00'.         "Division
    SELECTION-SCREEN END OF BLOCK BLK1.
    SELECTION-SCREEN BEGIN OF BLOCK BLK2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: S_AUDAT FOR G_AUDAT,                     "Document Date (Date Received/Sent)
                    S_VBELN FOR G_VBELN,                     "Sales Document
                    S_KUNNR FOR G_KUNNR,                     "Sold-to party
                    S_MATNR FOR G_MATNR.                     "Material Number
    PARAMETERS:     P_VKAUS(2) TYPE N.                       "Usage Indicator
    SELECTION-SCREEN END OF BLOCK BLK2.
      I N I T I A L I Z A T I O N                                        *
    INITIALIZATION.
      CLEAR : G_REPID.                                       "Program Name
      G_REPID = SY-REPID.                                    "Program Name
      A T   S E L E C T I O N   S C R E E N                              *
      CLEAR: G_VKORG,
             G_VTWEG.
    AT SELECTION-SCREEN ON P_VKORG.
      SELECT SINGLE VKORG INTO G_VKORG
                          FROM TVKO
                          WHERE VKORG EQ P_VKORG.
      IF SY-SUBRC NE 0.
        MESSAGE E000(ZS) WITH TEXT-021.
      ENDIF.
    AT SELECTION-SCREEN ON P_VTWEG.
      SELECT SINGLE VTWEG INTO G_VTWEG
                          FROM TVKOV
                          WHERE VKORG EQ P_VKORG
                            AND VTWEG EQ P_VTWEG.
      IF SY-SUBRC NE 0.
        MESSAGE E000(ZS) WITH TEXT-022.
      ENDIF.
      CLEAR: G_VKORG,
             G_VTWEG.
      S T A R T   O F   S E L E C T I O N                                *
    START-OF-SELECTION.
    Data Selection
      PERFORM DATA_RETRIEVAL.
    Build Field Catalog
      PERFORM BUILD_FIELDCATALOG.
    Bulid layout
      PERFORM BUILD_LAYOUT.
    Build Events
      PERFORM BUILD_EVENTS.
    Captures the Values of Selection Screen
      PERFORM CAPTURE_SCREEN.
      E N D   O F   S E L E C T I O N                                    *
    END-OF-SELECTION.
    Display List
      PERFORM DISPLAY_ALV_REPORT.
      F O R M S                                                          *
    *&      Form  DATA_RETRIEVAL
          Retrieves Data for ALV Display
    *--Begin of changes for the change request 2007106--25th July 2007--
    *--End   of changes for the change request 2007106--25th July 2007--
    FORM DATA_RETRIEVAL .
      DATA : L_VKAUS   TYPE VKAUS.            "Variable to hold Usage Indicator
      CLEAR L_VKAUS.
      SELECT VBELN
             KUNNR
        INTO CORRESPONDING FIELDS OF TABLE T_IHEADER
        FROM VBAK
        WHERE VBELN IN S_VBELN
          AND KUNNR IN S_KUNNR
          AND VKORG EQ P_VKORG
          AND AUDAT IN S_AUDAT
          AND VTWEG EQ P_VTWEG
          AND SPART EQ P_SPART
          AND AUGRU EQ C_Q2
          AND VBTYP EQ C_B.
      IF NOT T_IHEADER IS INITIAL.
        IF NOT P_VKAUS IS INITIAL.
    *--Begin of changes for the change request 2007106--25th July 2007--COMMENTED FROM HERE---
         IF P_VKAUS EQ C_1.    "IF Zcount is given as 1 then quotation without zcount should be picked
           "for whom Material Pricing Group should be given.
           SELECT A~VBELN
                  A~KUNNR
                  B~POSNR
                  B~MATNR
                  B~PMATN
                  B~KWMENG
                  B~VRKME
                  B~KZWI1
                  B~VKAUS
            INTO  TABLE T_VB_AKAP
            FROM  VBAK AS A
            JOIN  VBAP AS B
              ON  AVBELN EQ BVBELN
            FOR ALL ENTRIES IN T_IHEADER
            WHERE A~VBELN EQ T_IHEADER-VBELN
              AND B~MATNR IN S_MATNR.
         ELSE.
    *--End   of changes for the change request 2007106--25th July 2007--COMMENTED TILL HERE---
          CONCATENATE 'C' P_VKAUS INTO L_VKAUS.
          SELECT A~VBELN
                 A~KUNNR
                 B~POSNR
                 B~MATNR
                 B~PMATN
                 B~KWMENG
                 B~VRKME
                 B~KZWI1
                 B~VKAUS
    *--Begin of changes for the change request 2007096--26th July 2007--
                 A~WAERK
    *--End   of changes for the change request 2007096--26th July 2007--
           INTO  TABLE T_VB_AKAP
           FROM  VBAK AS A
           JOIN  VBAP AS B
             ON  AVBELN EQ BVBELN
           FOR ALL ENTRIES IN T_IHEADER
            WHERE A~VBELN EQ T_IHEADER-VBELN
              AND B~MATNR IN S_MATNR
              AND B~VKAUS EQ L_VKAUS.
         ENDIF.
        ELSE.
          SELECT A~VBELN
                 A~KUNNR
                 B~POSNR
                 B~MATNR
                 B~PMATN
                 B~KWMENG
                 B~VRKME
                 B~KZWI1
                 B~VKAUS
    *--Begin of changes for the change request 2007096--26th July 2007--
                 A~WAERK
    *--End   of changes for the change request 2007096--26th July 2007--
           INTO  TABLE T_VB_AKAP
           FROM  VBAK AS A
           JOIN  VBAP AS B
             ON  AVBELN EQ BVBELN
           FOR ALL ENTRIES IN T_IHEADER
           WHERE A~VBELN EQ T_IHEADER-VBELN
             AND B~MATNR IN S_MATNR.
        ENDIF.
        IF NOT T_VB_AKAP IS INITIAL.
          SELECT  VBELN
                  POSNR
                  BSTKD_E
             INTO TABLE T_VBKD
             FROM VBKD
             FOR ALL ENTRIES IN T_VB_AKAP
             WHERE VBELN EQ T_VB_AKAP-VBELN
               AND POSNR EQ T_VB_AKAP-POSNR.
        ENDIF.
        SORT T_VBKD BY VBELN POSNR.
        CLEAR W_VB_AKAP.
      After much of coding was completed, Usage of PMATN was dropped and
      the first eighteen characters of the field BSTKD was proposed for usage
      Hence PMATN is overwritten by BSTKD value in the below loop
        LOOP AT T_VB_AKAP INTO W_VB_AKAP.
          CLEAR: W_VBKD,
                 W_VB_AKAP-PMATN.
          READ TABLE T_VBKD INTO W_VBKD
                            WITH KEY VBELN = W_VB_AKAP-VBELN
                                     POSNR = W_VB_AKAP-POSNR
                            BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_VB_AKAP-PMATN = W_VBKD-BSTKD_E+0(18).
          ENDIF.
          MODIFY T_VB_AKAP FROM W_VB_AKAP TRANSPORTING PMATN.
          CLEAR W_VB_AKAP.
        ENDLOOP.
        IF NOT T_VB_AKAP IS INITIAL.
        Collecting all Material Numbers along with their Technical Spec data for all the materials available in T_VB_AKAP.
          SELECT    MATNR
                    ZZTECHSPEC
            INTO    TABLE T_MARA
            FROM    MARA
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC EQ 0.
            SORT T_MARA BY MATNR.
          ENDIF.                     "Checking SY-SUBRC for T_MARA
          SELECT    MATNR
                    ZZTECHSPEC
            APPENDING TABLE T_MARA
            FROM    MARA
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC EQ 0.
            SORT T_MARA BY MATNR.
          ENDIF.                     "Checking SY-SUBRC for T_MARA
    *--Begin of changes for the change request xxx--2nd Aug 2007--
        Collecting information into T_MARM for all the available materials so that it could be used for conversion into Alternate UOM
          SELECT MATNR                          " Material Number
                 MEINH                          " Alternate UOM
                 UMREZ                          " Numerator for conversion
                 UMREN                          " Denominator for conversion
            FROM MARM
            INTO TABLE T_MARM
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC = 0.
            SORT T_MARM BY MATNR MEINH.
          ENDIF.                     "Checking SY-SUBRC for T_MARM
          SELECT MATNR                          " Material Number
                 MEINH                          " Alternate UOM
                 UMREZ                          " Numerator for conversion
                 UMREN                          " Denominator for conversion
            FROM MARM
            APPENDING TABLE T_MARM
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC = 0.
            SORT T_MARM BY MATNR MEINH.
          ENDIF.                     "Checking SY-SUBRC for T_MARM
    *--End   of changes for the change request xxx--2nd Aug 2007--
          SELECT    MATNR
                    VKORG
                    VTWEG
                    KONDM
    *--Begin of changes for the change request 2007096--26th July 2007--
                    VRKME
    *--End   of changes for the change request 2007096--26th July 2007--
            INTO    TABLE T_MVKE
            FROM    MVKE
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-PMATN.
          IF SY-SUBRC EQ 0.
            SORT T_MVKE BY MATNR VKORG VTWEG.
          ENDIF.                     "Checking SY-SUBRC for T_MVKE
          SELECT    MATNR
                    VKORG
                    VTWEG
                    KONDM
    *--Begin of changes for the change request 2007096--26th July 2007--
                    VRKME
    *--End   of changes for the change request 2007096--26th July 2007--
            APPENDING TABLE T_MVKE
            FROM    MVKE
            FOR ALL ENTRIES IN T_VB_AKAP
            WHERE   MATNR EQ T_VB_AKAP-MATNR.
          IF SY-SUBRC EQ 0.
            SORT T_MVKE BY MATNR VKORG VTWEG.
          ENDIF.                     "Checking SY-SUBRC for T_MVKE
    *--Begin of changes for the change request 2007096--26th July 2007--
          SELECT    MSEHI
                    ZAEHL
                    NENNR
             INTO   TABLE T_T006
             FROM   T006
             FOR ALL ENTRIES IN T_VB_AKAP
             WHERE  MSEHI EQ T_VB_AKAP-VRKME.
          IF SY-SUBRC EQ 0.
            SORT T_T006 BY MSEHI.
          ENDIF.                     "Checking SY-SUBRC for T_T006
          IF NOT T_MVKE IS INITIAL.
            SELECT MSEHI
                   ZAEHL
                   NENNR
            APPENDING TABLE T_T006
            FROM   T006
            FOR ALL ENTRIES IN T_MVKE
            WHERE MSEHI EQ T_MVKE-VRKME.
            IF SY-SUBRC EQ 0.
              SORT T_T006 BY MSEHI.
            ENDIF.                  "Checking SY-SUBRC for T_T006
          ENDIF.                     "Checking for Initial status of internal table T_MVKE
    *--End   of changes for the change request 2007096--26th July 2007--
        ENDIF.                    " FOR T_VB_AKAP NOT INITIAL.
      ENDIF.                    " FOR T_IHEADER NOT INITIAL.
      CLEAR: W_VB_AKAP,
             W_IFINAL.
      LOOP AT T_VB_AKAP INTO W_VB_AKAP.
        W_IFINAL-VBELN  = W_VB_AKAP-VBELN.
        W_IFINAL-KUNNR  = W_VB_AKAP-KUNNR.
        W_IFINAL-POSNR  = W_VB_AKAP-POSNR.
        W_IFINAL-MATNR  = W_VB_AKAP-MATNR.
        W_IFINAL-PMATN  = W_VB_AKAP-PMATN.
        W_IFINAL-KWMENG = W_VB_AKAP-KWMENG.
        W_IFINAL-VRKME  = W_VB_AKAP-VRKME.
        W_IFINAL-KZWI1  = ( W_VB_AKAP-KZWI1 / W_VB_AKAP-KWMENG ) * 1000.
        W_IFINAL-VKAUS  = W_VB_AKAP-VKAUS.
    *--Begin of changes for the change request 2007096--26th July 2007--
        W_IFINAL-WAERK  = W_VB_AKAP-WAERK.
    *--End   of changes for the change request 2007096--26th July 2007--
      Populating Material Pricing Group from New Material Group, if such Group doesn't exist
      Population of Material Pricing Group from Material Number is tried.
      Similar condition does suit for Tech Spec too.
        SORT: T_MVKE BY MATNR VKORG VTWEG,
              T_MARA BY MATNR.
        IF NOT W_VB_AKAP-PMATN IS INITIAL.
          CLEAR W_MVKE.
          READ TABLE    T_MVKE
               INTO     W_MVKE
               WITH KEY MATNR = W_VB_AKAP-PMATN
                        VKORG = P_VKORG
                        VTWEG = P_VTWEG
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-KONDM = W_MVKE-KONDM.
    *--Begin of changes for the change request 2007096--26th July 2007--
            IF ( W_IFINAL-VRKME NE W_MVKE-VRKME ) AND ( NOT W_MVKE-VRKME IS INITIAL ).
    *--Begin of changes for the change request xxx--2nd Aug 2007--
              CLEAR: W_MARM,
                     G_NUM_SOURCE,
                     G_DEN_SOURCE,
                     G_NUM_TARGET,
                     G_DEN_TARGET.
              READ TABLE T_MARM INTO W_MARM
                                WITH KEY MATNR = W_IFINAL-PMATN
                                MEINH = W_IFINAL-VRKME
                                BINARY SEARCH.
              IF SY-SUBRC EQ 0.
                G_NUM_SOURCE = W_MARM-UMREZ.
                G_DEN_SOURCE = W_MARM-UMREN.
                CLEAR W_MARM.
                READ TABLE T_MARM INTO W_MARM
                                  WITH KEY MATNR = W_IFINAL-PMATN
                                  MEINH = W_MVKE-VRKME
                                  BINARY SEARCH.
                IF SY-SUBRC EQ 0.
                  G_NUM_TARGET = W_MARM-UMREZ.
                  G_DEN_TARGET = W_MARM-UMREN.
                  CLEAR W_MARM.
                  W_IFINAL-KWMENG = W_IFINAL-KWMENG * ( G_NUM_SOURCE / G_DEN_SOURCE ) * ( G_DEN_TARGET / G_NUM_TARGET ).
                  CLEAR W_IFINAL-KZWI1.
                  W_IFINAL-KZWI1   = ( W_VB_AKAP-KZWI1 / W_IFINAL-KWMENG ) * 1000.
                  W_IFINAL-VRKME = W_MVKE-VRKME.
                ENDIF.              "Check SY-SUBRC for W_MARM using W_MVKE-VRKME (Sales UOM)
              ELSE.
    *--End   of changes for the change request xxx--2nd Aug 2007--
                CLEAR: W_T006,
                       G_NUM_SOURCE,
                       G_DEN_SOURCE,
                       G_NUM_TARGET,
                       G_DEN_TARGET.
                READ TABLE T_T006 INTO W_T006 WITH KEY MSEHI = W_IFINAL-VRKME
                                              BINARY SEARCH.
                IF SY-SUBRC EQ 0.
                  G_NUM_SOURCE = W_T006-ZAEHL.          "Numerator to convert specified UOM to SI UOM
                  G_DEN_SOURCE = W_T006-NENNR.          "Denominator to convert specified UOM to SI UOM
                  CLEAR W_T006.
                  READ TABLE T_T006 INTO W_T006 WITH KEY MSEHI = W_MVKE-VRKME
                                                BINARY SEARCH.
                  IF SY-SUBRC EQ 0.
                    G_NUM_TARGET = W_T006-ZAEHL.            "Numerator to convert specified UOM to SI UOM
                    G_DEN_TARGET = W_T006-NENNR.            "Denominator to convert specified UOM to SI UOM
                    CLEAR W_T006.
                    W_IFINAL-KWMENG = W_IFINAL-KWMENG * ( G_NUM_SOURCE / G_DEN_SOURCE ) * ( G_DEN_TARGET / G_NUM_TARGET ).
                    CLEAR W_IFINAL-KZWI1.
                    W_IFINAL-KZWI1   = ( W_VB_AKAP-KZWI1 / W_IFINAL-KWMENG ) * 1000.
                    W_IFINAL-VRKME = W_MVKE-VRKME.
                  ENDIF.          "Check for SY-SUBRC for READ TABLE T_T006 using W_MVKE-VRKME (Sales UOM)
                ENDIF.            "Check for SY-SUBRC for READ TABLE T_T006 using W_IFINAL-VRKME (Quotation UOM)
              ENDIF.              "Check SY-SUBRC for W_MARM using W_IFINAL-VRKME (Quotation UOM)
            ENDIF.              "Check for ( W_IFINAL-VRKME NE W_MVKE-VRKME ) AND ( NOT W_MVKE-VRKME IS INITIAL )
    *--End   of changes for the change request 2007096--26th July 2007--
          ENDIF.
          READ TABLE     T_MARA
               INTO      W_MARA
               WITH KEY  MATNR = W_VB_AKAP-PMATN
               BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_IFINAL-ZZTECHSPEC = W_MARA-ZZTECHSPEC.
          ENDIF.    

  • Persistence problems wit seam/hibernate and EntityHome

    This is the scenario(using JBoss Seam 2.2 and JBoss Application Server 5.1.0.):
    I've got TestCases and TestSteps. One TestCase has multiple TestSteps. I have a table that displays the steps and actions like "addStep" and "deleteStep".
    I use rich:inplaceInput to edit existing steps. This works perfectly.
    Adding or deleting a step however does not. When adding, I create an "empty" step which is displayed in the table and the user can then edit it.
    I can't explain how it persists changes to existing steps, but doesn't cooperate when list TestCaseHome.testSteps changes in size.
    Entity TestStep:
    @Entity
    @Table(name = "teststeps")
    public class TestStep implements java.io.Serializable {
         private static final long serialVersionUID = 6534546556882292702L;
         private long id;
         private TestCase testCase;
         private String test;
         private String expectedResult;
         private long ordering;
         @ManyToOne(fetch = FetchType.LAZY)
         @JoinColumn(name = "tc_id")
         public TestCase getTestCase() {
              return this.testCase;
         public void setTestCase(TestCase testCase) {
              this.testCase = testCase;
    }Entity TestCase: Entity CoreTestObject isn't really relevant, TestCase just inherits it's id from it.
    @Entity
    @Table(name = "testcases")
    @PrimaryKeyJoinColumn(name="id")
    public class TestCase extends CoreTestObject implements java.io.Serializable{     
         private Set<TestStep> testSteps = new HashSet<TestStep>(0);
         public TestCase(Set<TestStep> testSteps, ...) {
              this.testSteps = testSteps;
         @OneToMany(fetch = FetchType.LAZY, mappedBy = "testCase")
         @OrderBy("test")
         public Set<TestStep> getTestSteps() {
              return this.testSteps;
         public void setTestSteps(Set<TestStep> testSteps) {
              this.testSteps = testSteps;
    }TestCaseHome:
    @Name("testCaseHome")
    @Scope(ScopeType.CONVERSATION)
    public class TestCaseHome extends EntityHome<TestCase> {     
         @DataModel
         private List<TestStep> testSteps;
         /*@param step The Step after which the new Step is to be inserted*/
         public void addStep(TestStep step){
              testSteps = new ArrayList<TestStep>(this.getInstance().getTestSteps());
              long id, ordering;
              [...] // here I find the id and ordering of step
              testSteps.add(new TestStep(id+1, this.getInstance(), "", "", ordering+1));     
              this.getInstance().setTestSteps(new HashSet<TestStep>(testSteps));
         /*@param step The Step to be deleted*/
         public void deleteStep(TestStep step){
              int index = testSteps.indexOf(step);          
              testSteps.remove(index);
              this.getInstance().setTestSteps(new HashSet<TestStep>(testSteps));          
    }EntityHome:
    public class EntityHome<E> extends Home<EntityManager, E>
       @Transactional
       public String update()
          joinTransaction();
          getEntityManager().flush();
          updatedMessage();
          raiseAfterTransactionSuccessEvent();
          return "updated";
       @Transactional
       public String persist()
          getEntityManager().persist( getInstance() );
          getEntityManager().flush();
          assignId( PersistenceProvider.instance().getId( getInstance(), getEntityManager() ) );
          createdMessage();
          raiseAfterTransactionSuccessEvent();
          return "persisted";
    }View:
    <rich:dataTable value="#{testCaseHome.testSteps}" var="_testStep"
              id="testStepsTable" rowKeyVar="row" autoresize="true">
         <rich:column sortBy="#{_testStep.ordering}"
              sortOrder="ASCENDING" style=" width : 20px;">
              <f:facet name="header">Order</f:facet>
              <rich:inplaceInput layout="block" value="#{_testStep.ordering}"
                   selectOnEdit="true" editEvent="onclick">
                   <a:support event="onviewactivated" ajaxSingle="true"
                        reRender="testStepsTable" />
              </rich:inplaceInput>
         </rich:column>
         <rich:column sortBy="#{_testStep.expectedResult}" [...] </rich:column>     
         <rich:column sortBy="#{_testStep.test}"> [...] </rich:column>
         <rich:column style=" width : 80px;">
              <f:facet name="header">
                   Action
                        </f:facet>
              <a:commandLink ajaxSingle="true" id="deletelink"
                   reRender="testStepsTable"
                   action="#{testCaseHome.deleteStep(_testStep)}">
                   <h:graphicImage value="/img/delete.gif" />
                   <f:param name="testCaseId" value="#{testCaseHome.instance.id}" />
                   <f:param name="testStepFrom" value="TestCase" />
              </a:commandLink>
              <a:commandLink ajaxSingle="true" id="addlink"
                   reRender="testStepsTable"
                   action="#{testCaseHome.addStep(_testStep)}">
                   <h:graphicImage value="/img/plus_icon.gif" style=" width : 16px; height : 16px;"/>
                   <f:param name="testCaseId" value="#{testCaseHome.instance.id}" />
                   <f:param name="testStepFrom" value="TestCase" />
                   <s:conversationId />     <!-- <<<<I thought that might help but it didn't-->
              </a:commandLink>
         </rich:column>
    </rich:dataTable>
    <div class="actionButtons">
         <h:commandButton id="save"
              value="Save" action="#{testCaseHome.persist}"
              disabled="#{!testCaseHome.wired}"
              rendered="#{!testCaseHome.managed}" />
         <h:commandButton id="update"
              value="Save" action="#{testCaseHome.update}"
              rendered="#{testCaseHome.managed}" />
    </div>I cut a lot from the code, I hope I didn't leave anything relevant out. I also hope this is the right place for this question, excuse me if not (noob here).
    I would very much appreciate your help since I'm trying to fix this for weeks. Thank you!

    Hello gimbal2,
    yes, I initialized the collection by myself now and it works better.
    But I think there is a general Problem in the order-Example. The Example isn't implemented as described in the written part of the tutorial and has several other
    bugs with persistence in this example.
    I've installed the turorial with Update Tool. Is it possible that the samples in the update contain a newer/older version than the code that is described in the PDF?
    Thanks,
    Johann

  • Crm_order_maintain  . create items.

    hi all.
    i have to update order using fm crm_order_maintian.
    i am able to update header but when i c order using crm_order_read there is no item data  now i have to craete items of header.
    please suggest how to create items  in order using crm_order_maintain....
    Message was edited by:
            gaurav jain

    Hi Gaurav,
    The following the  code i used to add  a product( Item ) to Service order.
    Service Contract Updating while Sales Order Creation
    FUNCTION zzomotc_sc_update.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(IV_GUID) TYPE  CRMT_OBJECT_GUID
    *"  CHANGING
    *"     VALUE(CV_OWN_MESSAGE) TYPE  CRMT_BOOLEAN OPTIONAL
    ***&                             Constants                                             *
      CONSTANTS: c_stparty     TYPE comt_partner_fct VALUE '00000001'.     "Sold-To-Party
    *&                            Internal Tables  Declaration                           *
      DATA:i_orderadm_h        TYPE crmt_orderadm_h_wrkt,
           i_orderadm_i        TYPE crmt_orderadm_i_wrkt,
           i_orderadmsc_i      TYPE crmt_orderadm_i_wrkt,
           i_itemdet           TYPE crmt_orderadm_i_comt,
           i_product_i         TYPE crmt_product_i_wrkt,
           i_sales             TYPE crmt_sales_wrkt,
           i_orgman            TYPE crmt_orgman_wrkt,
           i_shipping          TYPE crmt_shipping_wrkt,
           i_schedlin          TYPE crmt_schedlin_wrkt,
           i_partner           TYPE crmt_partner_external_wrkt,
           i_guid_header       TYPE crmt_object_guid_tab,
           i_status            TYPE crmt_status_wrkt,
           i_text              TYPE crmt_text_wrkt,
           i_billing           TYPE crmt_billing_wrkt,
           i_service_contracts TYPE TABLE OF crmt_portal_resultlist,
           i_customer_h        TYPE crmt_customer_h_wrkt,
           i_customer_i        TYPE crmt_customer_i_wrkt,
           i_input_fields      TYPE crmt_input_field_tab,
           i_sales_sc          TYPE crmt_sales_comt,
           i_field_names       TYPE crmt_input_field_names_tab,
           i_guid_save         TYPE crmt_object_guid_tab.
    *&                 Local structure/Work Area Declaration                             *
      DATA:st_sales            TYPE crmt_sales_wrk,
           st_shipping         TYPE crmt_shipping_wrk,
           st_orderadm_i       TYPE crmt_orderadm_i_wrk,
           st_orderadmsc_i     TYPE crmt_orderadm_i_wrk,
           st_orderadmsc1_i    TYPE crmt_orderadm_i_wrk,
           st_partner          TYPE crmt_partner_external_wrk,
           st_billing          TYPE crmt_billing_wrk,
           st_customer_i       TYPE crmt_customer_i_wrk,
           st_service          TYPE crmt_portal_resultlist,
           st_input_fields     TYPE crmt_input_field,
           st_field_names      TYPE crmt_input_field_names,
           st_itemdet          TYPE crmt_orderadm_i_com.
    *&                         local Variables Declaration                               *
      DATA: l_guid            TYPE crmt_object_guid,
            l_flag            TYPE c VALUE ' ',
            l_partner_fct     TYPE crmt_portal_service_search-partner_fct,
            l_partner_no      TYPE crmt_portal_service_search-bu_partner.
      CHECK iv_guid IS NOT INITIAL.
      COLLECT iv_guid INTO i_guid_header.
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid       = i_guid_header
        IMPORTING
          et_orderadm_h        = i_orderadm_h
          et_orderadm_i        = i_orderadm_i
          et_product_i         = i_product_i
          et_customer_h        = i_customer_h
          et_customer_i        = i_customer_i
          et_sales             = i_sales
          et_orgman                = i_orgman
          et_shipping          = i_shipping
          et_billing           = i_billing
          et_schedlin          = i_schedlin
          et_partner           = i_partner
          et_text              = i_text
        EXCEPTIONS
          document_not_found   = 1
          error_occurred       = 2
          document_locked      = 3
          no_change_authority  = 4
          no_display_authority = 5
          no_change_allowed    = 6
          OTHERS               = 7.
      IF sy-subrc <> 0.
    ** SO Order doesn't exists
      ENDIF.
    ***Get partner function as sold-to-party
      DELETE ADJACENT DUPLICATES FROM i_partner.
      READ TABLE i_partner WITH KEY partner_fct = c_stparty  INTO st_partner.
      LOOP AT i_orderadm_i INTO st_orderadm_i.
        IF ( st_orderadm_i-itm_type EQ 'ZTAP' ) OR  ( st_orderadm_i-itm_type EQ 'ZWVN' ) OR
           ( st_orderadm_i-itm_type EQ 'ZCPP' ) OR  ( st_orderadm_i-itm_type EQ 'YWVN' ).
    **    Search a valid Service contract based on customer i.e.sold-to-party and product combination
          l_partner_fct = c_stparty.
          l_partner_no  = st_partner-partner_no.
          CALL FUNCTION 'CRM_SERVICE_CONTRACTS_SEARCH'
            EXPORTING
              partner_function      = l_partner_fct
              partner_number        = l_partner_no
    *          product_id            = st_orderadm_i-ordered_prod
    *          to                    = sy-datum
            TABLES
              service_contract_list = i_service_contracts.
          IF i_service_contracts[] IS NOT INITIAL.
            LOOP AT i_service_contracts INTO st_service WHERE date_end GE sy-datum.
              REFRESH  i_guid_header.
              COLLECT st_service-guid INTO  i_guid_header.
              CALL FUNCTION 'CRM_ORDER_READ'
                EXPORTING
                  it_header_guid       = i_guid_header
                IMPORTING
                  et_orderadm_i        = i_orderadmsc_i
                EXCEPTIONS
                  document_not_found   = 1
                  error_occurred       = 2
                  document_locked      = 3
                  no_change_authority  = 4
                  no_display_authority = 5
                  no_change_allowed    = 6
                  OTHERS               = 7.
              READ TABLE i_orderadmsc_i INTO st_orderadmsc_i
                  WITH KEY ordered_prod = st_orderadm_i-ordered_prod.
              IF sy-subrc EQ 0.
                l_flag = 'X'.
                l_guid = st_service-guid.
                EXIT.
              ENDIF.
            ENDLOOP.
    ****    Deactivate the line item of existing service contract and add new service item to this contract
            IF  l_flag EQ 'X'.
              REFRESH : i_guid_header, i_orderadm_h, i_orderadmsc_i.
              COLLECT l_guid INTO  i_guid_header.
              CALL FUNCTION 'CRM_ORDER_READ'
                EXPORTING
                  it_header_guid       = i_guid_header
                IMPORTING
                  et_orderadm_h        = i_orderadm_h
                  et_orderadm_i        = i_orderadmsc_i
    *              et_pricing_i         = i_pricing_i
                  et_status            = i_status
                EXCEPTIONS
                  document_not_found   = 1
                  error_occurred       = 2
                  document_locked      = 3
                  no_change_authority  = 4
                  no_display_authority = 5
                  no_change_allowed    = 6
                  OTHERS               = 7.
              READ TABLE i_orderadmsc_i INTO st_orderadmsc_i INDEX sy-tabix.
              st_input_fields-ref_guid     = st_orderadmsc_i-guid.
              st_input_fields-ref_kind     = 'B'.
              st_input_fields-objectname   = 'ORDERADM_I'.
              st_field_names-fieldname     = 'MODE'.
              APPEND st_field_names TO i_field_names.
              st_field_names-fieldname     = 'ORDERED_PROD'.
              APPEND st_field_names TO i_field_names.
              st_input_fields-field_names   = i_field_names.
              APPEND st_input_fields TO i_input_fields.
              REFRESH i_field_names.
              st_input_fields-ref_guid     = st_orderadmsc_i-guid.
              st_input_fields-ref_kind     = 'B'.
              st_input_fields-objectname   = 'PRODUCT_I'.
              st_field_names-fieldname     = 'PROCESS_QTY_UNIT'.
              APPEND st_field_names TO i_field_names.
              st_input_fields-field_names   = i_field_names.
              APPEND st_input_fields TO i_input_fields.
              REFRESH i_field_names.
              st_input_fields-ref_guid     = st_orderadmsc_i-guid.
              st_input_fields-ref_kind     = 'B'.
              st_input_fields-objectname   = 'SCHEDLIN'.
              st_field_names-fieldname     = 'QUANTITY'.
              APPEND st_field_names TO i_field_names.
              st_input_fields-field_names   = i_field_names.
              APPEND st_input_fields TO i_input_fields.
              REFRESH i_field_names.
              MOVE-CORRESPONDING st_orderadmsc_i TO st_itemdet.
    *          st_orderadmsc1_i-header       =  st_orderadmsc_i-header.
    *          st_orderadmsc1_i-ordered_prod =  st_orderadm_i-ordered_prod.
              APPEND  st_itemdet TO i_itemdet.
              CALL FUNCTION 'CRM_ORDER_MAINTAIN'
    *            EXPORTING
    **              it_pricing_i      = i_pricing_i
    *              it_product_i      = i_product_i
    *              it_schedlin_i     = i_schedlin_i
                CHANGING
                  ct_orderadm_i     = i_itemdet
                  ct_input_fields   = i_input_fields
                EXCEPTIONS
                  error_occurred    = 1
                  document_locked   = 2
                  no_change_allowed = 3
                  no_authority      = 4
                  OTHERS            = 5.
              IF sy-subrc EQ 0.
                COLLECT l_guid INTO i_guid_save.
                CALL FUNCTION 'CRM_ORDER_SAVE'
                  EXPORTING
                    it_objects_to_save = i_guid_save
                  EXCEPTIONS
                    document_not_saved = 1
                    OTHERS             = 2.
                CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
                REFRESH i_guid_save.
                l_flag = 'X'.
              ENDIF.
            ELSE.
              REFRESH: i_guid_header, i_orderadmsc_i.
              READ TABLE  i_service_contracts INTO st_service INDEX 1.
              COLLECT st_service-guid INTO  i_guid_header.
              CALL FUNCTION 'CRM_ORDER_READ'
                EXPORTING
                  it_header_guid       = i_guid_header
                IMPORTING
                  et_orderadm_h        = i_orderadm_h
                  et_orderadm_i        = i_orderadmsc_i
    *              et_pricing_i         = i_pricing_i
                  et_status            = i_status
                EXCEPTIONS
                  document_not_found   = 1
                  error_occurred       = 2
                  document_locked      = 3
                  no_change_authority  = 4
                  no_display_authority = 5
                  no_change_allowed    = 6
                  OTHERS               = 7.
              READ TABLE i_orderadmsc_i INTO st_orderadmsc_i INDEX sy-tabix.
              st_input_fields-ref_guid     = st_orderadmsc_i-guid.
              st_input_fields-ref_kind     = 'B'.
              st_input_fields-objectname   = 'ORDERADM_I'.
              st_field_names-fieldname     = 'MODE'.
              APPEND st_field_names TO i_field_names.
              st_field_names-fieldname     = 'ORDERED_PROD'.
              APPEND st_field_names TO i_field_names.
              st_input_fields-field_names   = i_field_names.
              APPEND st_input_fields TO i_input_fields.
              REFRESH i_field_names.
              st_input_fields-ref_guid     = st_orderadmsc_i-guid.
              st_input_fields-ref_kind     = 'B'.
              st_input_fields-objectname   = 'PRODUCT_I'.
              st_field_names-fieldname     = 'PROCESS_QTY_UNIT'.
              APPEND st_field_names TO i_field_names.
              st_input_fields-field_names   = i_field_names.
              APPEND st_input_fields TO i_input_fields.
              REFRESH i_field_names.
              st_input_fields-ref_guid     = st_orderadmsc_i-guid.
              st_input_fields-ref_kind     = 'B'.
              st_input_fields-objectname   = 'SCHEDLIN'.
              st_field_names-fieldname     = 'QUANTITY'.
              APPEND st_field_names TO i_field_names.
              st_input_fields-field_names   = i_field_names.
              APPEND st_input_fields TO i_input_fields.
              REFRESH i_field_names.
              st_orderadmsc1_i-header       =  st_orderadmsc_i-header.
              st_orderadmsc1_i-ordered_prod =  st_orderadm_i-ordered_prod.
              APPEND  st_orderadmsc1_i TO i_orderadmsc_i.
              MOVE-CORRESPONDING st_orderadmsc1_i TO st_itemdet.
              APPEND  st_itemdet TO i_itemdet.
              CALL FUNCTION 'CRM_ORDER_MAINTAIN'
    *            EXPORTING
    **              it_pricing_i      = i_pricing_i
    *              it_product_i      = i_product_i
    *              it_schedlin_i     = i_schedlin_i
                CHANGING
                  ct_orderadm_i     = i_itemdet
                  ct_input_fields   = i_input_fields
                EXCEPTIONS
                  error_occurred    = 1
                  document_locked   = 2
                  no_change_allowed = 3
                  no_authority      = 4
                  OTHERS            = 5.
              IF sy-subrc EQ 0.
                COLLECT st_service-guid INTO i_guid_save.
                CALL FUNCTION 'CRM_ORDER_SAVE'
                  EXPORTING
                    it_objects_to_save = i_guid_save
                  EXCEPTIONS
                    document_not_saved = 1
                    OTHERS             = 2.
                CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
                REFRESH i_guid_save.
                l_flag = 'X'.
              ENDIF.
            ENDIF.
          ELSE.
    *** Create a new service contract for it and add line item to it.
            DATA: st_servicec_h TYPE crmt_iservice_baskethead_il,
                  st_servicec_i TYPE crmt_srv_webreq_item_il ,
                  st_screate_h  TYPE crmt_orderadm_h_com,
                  st_screate_i  TYPE crmt_orderadm_i_com.
            READ TABLE i_partner INTO st_partner WITH KEY partner_fct  =  '00000001'.
            st_servicec_h-handle          = '00001'.
            st_servicec_h-ref_handle      = '00001'.
            st_servicec_h-process_type    = 'ZSC'.
            st_servicec_h-description     = 'Service Contract'.
            st_servicec_h-descr_language  = 'E'.
            st_servicec_i-handle       = '00002'.
            st_servicec_i-ref_handle   = '00001'.
    *          st_servicec_i-ITM_TYPE     =
            st_servicec_i-ordered_prod = st_orderadm_i-ordered_prod.
    *          st_servicec_i-ORDER_QTY    =
    *        st_servicec_i-QTY_UNIT     =
            CALL FUNCTION 'CRM_SERVICE_ORDER_CREATE'
              EXPORTING
                is_service_baskethead  = st_servicec_h
                is_service_basketitem  = st_servicec_i
                iv_service_productguid = st_orderadm_i-product
                iv_partner_ag          = st_partner-partner_no
                iv_partn_fct_ag        = '00000001'
              IMPORTING
                es_orderadm_h          = st_screate_h
                es_orderadm_i          = st_screate_i
              EXCEPTIONS
                error_occured          = 1
                OTHERS                 = 2.
            IF sy-subrc EQ 0.
              COLLECT st_screate_h-guid INTO i_guid_save.
              CALL FUNCTION 'CRM_ORDER_SAVE'
                EXPORTING
                  it_objects_to_save = i_guid_save
                EXCEPTIONS
                  document_not_saved = 1
                  OTHERS             = 2.
              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
              REFRESH i_guid_save.
              l_flag = 'X'.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFUNCTION.
    Actually, this FM was created for updating the service contract while creation of sales order with serivce product as its line item. It search for valid SC for sold-to-Party and checks for the products if not there adds the same product as line item to SC. If SC not avaliable , Creates SC and adds the same product
    Hope it will help you.
    Regards,
    Arjun
    <b>Pl. Reward points</b>

  • LMS 3.2 - CM 5.2.1 - UT Acquisition failed + Processes Down Strangely

    Hi,
    I just updated everything I could in LMS CiscoWorks 3.2.
    Software updates are all done.
    Device updates aswell.
    When I'm trying to do an UT acquisition, I recieve a strange message : Failed to start acquisition: Initial Data Collection is not done yet, please try  again later.
    I'm bored of this. I tried everything but nothing seems to work.
    Here are some screenshot of my LMS Server :
    The versions :
    The error message I recieve :
    I tried to go to Server >Admin >Processes and try to START EVERY PROCESSES.
    After 4-5 minutes, some of them are going down as you can see here :
    The UT.log file contains this :
    C:/CSCOpx/log/UT.log
    messages will remian logged to file: C:/CSCOpx/log\ut.log
    2011/03/31 16:17:42 main MESSAGE ProcessInitializer: Properties will be read from C:\CSCOpx\campus\etc\cwsi\ut.properties
    2011/03/31 16:17:45 main MESSAGE DBConnection: Created new Database connection [hashCode = 17007273]
    UTM is shutting down
    2011/03/31 16:17:47 main MESSAGE DBConnection: Closed Database connection [hashCode = 17007273]
    2011/03/31 16:17:47 SnmpSocketManager: Shutting down all SNMP sockets.
    Io error while closing SnmpSocket : Cannot assign requested address: Datagram send failed
    How should I do to re-activate these processes and to allow User Tracking working again ?
    Thank you.
    Regards,
    Stephane.

    sorry, now I understand;
    there have been at least 2 bugs affecting User Tracking  ( CSCtd49439,CSCtg20882)  and the easiest thing would be to just update to LMS 3.2.1 by installing the Service Pack 1 for LMS 3.2
    you can get it here:
    Windows:
    http://www.cisco.com/cisco/software/release.html?mdfid=282635181&flowid=16561&softwareid=280775102&os=Windows&release=3.2.1&relind=AVAILABLE&rellifecycle=&reltype=latest
    Solaris:
    http://www.cisco.com/cisco/software/release.html?mdfid=282635181&flowid=16561&os=Solaris&softwareid=280775102&release=3.2.1&rellifecycle=&relind=AVAILABLE&reltype=latest
    and the ReadMe is here:
    http://www.cisco.com/en/US/partner/docs/net_mgmt/ciscoworks_lan_management_solution/3.2/SP1/Readme/Readme__LMS_3.2_SP1.html

  • Config-Archive Issue on PI 1.3

    Hi Everyone,
          Customer has recently installed PI 1.3 software, and then used it to back up  or restore devices' config. However, when imported all devices into PI 1.3 by csv template and set up some setting about schedule daily job of configuration-archives, we found that the status of the lastest archive still displayed the initial inventory collection on "Configuration Archives", it seems that PI can't automatically get devices' configuration daily, however we can find the schedule jobs display success. That's so weird.
           Most of devices are Cisco 800 series(such as 871、887 etc) and two of them are WLC(5500 and 7500), all version of them satisfy with PI 1.3 Support devices datasheet's requestment.
           All of devices have been added into ACS 5.4 and used TACACS + to authenticate user by AD account. PI just uses local account to login and uses 15-level username and password to telnet devices to get their configuration file. In LMS case , we can try to edit the prompt symbol in tacacs file on lms server. In this case, we have checked the ACS AAA report and found that the PI has normally used some commands to get configuration such as show running-config, copy etc.
           Please give some advices, thx in advance.
    Regards,
    Tira

    Any update?

Maybe you are looking for