Follow up to How to store multiple bytes

So, instead of using that for loop, the whole loop will be replaced by something like
first [ ] = Util.Arraycopy(byteRead); ???
or should it be Util.Arraycopy(buffer);

assuming the array is nonatomic,
Util.arrayCopyNonAtomic( apduBuffer, ISO7816.OFFSET_CDATA,first, (short)0,bytesRead)
if you are maintaining an atomic array, the arguments are same, method is different Util.arrayCopy(...)

Similar Messages

  • How to store multiple bytes

    Ok, the problem I am currently having that gives me a 6f00 (unknown) error is due to the way I am reading in data and storing it in my loop. My code is as follows:
    byte[] buffer = apdu.getBuffer();
    byte numBytes = buffer[ISO7816.OFFSET_LC];     
    byte byteRead = (byte)(apdu.setIncomingAndReceive());
    if (numBytes != byteRead){
    ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
    byte ind = ISO7816.OFFSET_CDATA;
    for (short index=0x0000; index <numBytes; index=+0x0001)
    first[(short)index] = buffer[(short)(ind)];
         ind = ind ++;
    What I am trying to do is to store the bytes of data from the script file into my first array. I have tried many different variations on this. I know that this is where I'm getting errors because it works if I only use one byte. If anyone knows what could be causing my problem, I'd appreciate your help. Thank you.

    Use the Util.arrayCopy(....) instead of looping like that

  • How to store multiple files from SAp in to Application server?

    Hi Guys,
                 Can anybody tell me how to store multiple files from SAP into Application server.in my application i have to get the data from SAP tables BSEG , BKPF , BSAK and BSIK that to daily i have to do.
                Any Logic  or Code for how to do is welcomed.
                        plz help me urgently.
    Thanks,
    Gopi

    Hi,
      directories creates basis. If you have task to store data in application server you already should have information into which folder you have to do it. If you don't have this information because it is just for example training for next task then you can use your personal folder into which you have access. To get list of all available folders please look at attached code and form get_directories (you get the list of folders you see in transaction AL11). But don't forget: If you are using open dataset you have to have rights to access application folder!
    Here you are code which I use to upload text files from local disc into application folder
    Regards,
      Karol
    *& Report  FILE_PC_TO_SAP
    REPORT  FILE_PC_TO_SAP.
    DATA: BEGIN OF searchpoints OCCURS 100,
            DIRNAME(200)     TYPE c, " name of directory.
            sp_name(100)     TYPE c," name of entry. (may end with *)
          END OF searchpoints.
    DATA: BEGIN OF isearchpoints OCCURS 10,
            dirname(75) TYPE c,            " name of directory.
            aliass(75)  TYPE c,            " alias for directory.
            svrname(75) TYPE c,            " svr where directory is availabl
            sp_name(75) TYPE c,            " name of entry. (may end with *)
            sp_cs(10)   TYPE c,            " ContainsString pattern for name
          END OF isearchpoints.
    data: l_file type filetable.
    data: l_rc   type i.
    data: itab   type TABLE OF string.
    data: g_tmp_file_path type rlgrap-filename.
    data: wa_itab type string.
    data: h_destin(100) type c.
    data: dat      type string.
    INITIALIZATION.
    perform get_directories.
    START-OF-SELECTION.
    parameters: in_file type string OBLIGATORY LOWER CASE.
    parameters: destin(100) type c OBLIGATORY LOWER CASE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
       FILENAME                      = in_file
       "FILETYPE                      = 'BIN'
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = ' '
       HEADER_LENGTH                 = 0
       READ_BY_LINE                  = 'X'
       DAT_MODE                      = ' '
      TABLES
        DATA_TAB                     = itab
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17.
    IF sy-SUBRC <> 0.
      write: / 'Error during loading input file!'.
    ENDIF.
    if h_destin is INITIAL.
      h_destin = in_file.
    endif.
    CONCATENATE destin h_destin into dat SEPARATED BY '/'.
    *TRANSLATE dat TO UPPER CASE.
    OPEN DATASET dat FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-SUBRC = 0.
      loop at itab into wa_itab.
         TRANSFER: wa_itab TO dat.
      endloop.
      CLOSE DATASET dat.
      write: / 'File uploaded!'.
    ELSE.
      write: / 'Not possible to open dataset'.
    ENDIF.
    at selection-screen on value-request for in_file.
      perform select_input_file_name.
      loop at l_file into g_tmp_file_path.
        move g_tmp_file_path to in_file.
        h_destin = ''.
        SPLIT g_tmp_file_path at '\' into table itab.
        loop at itab into g_tmp_file_path.
          h_destin = g_tmp_file_path.
        endloop.
      endloop.
    at selection-screen on value-request for destin.
      DATA: lt_dfies    TYPE TABLE OF dfies.
      DATA: lwa_dfies   TYPE dfies.
      CALL FUNCTION 'DDIF_FIELDINFO_GET'
        EXPORTING
          tabname    = '/BI0/PCO_AREA'
          lfieldname = 'CO_AREA'
        IMPORTING
          dfies_wa   = lwa_dfies.
      lwa_dfies-tabname = 'searchpoints'.
      lwa_dfies-REPTEXT   = 'Destination directory'.
      lwa_dfies-LENG      = 100.
      lwa_dfies-INTLEN    = 100.
      lwa_dfies-OUTPUTLEN = 100.
      lwa_dfies-fieldname = 'SP_NAME'.
      APPEND lwa_dfies TO lt_dfies.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD = 'SP_NAME'
          DYNPPROG = SY-REPID
          DYNPNR = SY-DYNNR
          DYNPROFIELD = 'destin'
          VALUE_ORG = 'S'
        TABLES
          VALUE_TAB = searchpoints
          FIELD_TAB = lt_dfies
        EXCEPTIONS
          PARAMETER_ERROR = 1
          NO_VALUES_FOUND = 2
          OTHERS = 3.
    *&      Form  select_input_file_name
    *       text
    form select_input_file_name.
    *  call function 'F4_FILENAME'
    *       exporting
    *            program_name  = sy-repid
    *            dynpro_number = sy-dynnr
    *            field_name    = 'PATH'
    *       importing
    *            file_name     = g_tmp_file_path.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
      WINDOW_TITLE = 'Please choose a file'
      "default_extension = '*.TXT'
      "default_filename = 'C:\*.txt'
      initial_directory = 'C:\'
      file_filter = '*.*'
      CHANGING
      FILE_TABLE = l_file
      RC = l_RC
      EXCEPTIONS
      FILE_OPEN_DIALOG_FAILED = 1
      CNTL_ERROR = 2
      ERROR_NO_GUI = 3
      NOT_SUPPORTED_BY_GUI = 4
      OTHERS = 5.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    "select_input_file_name
    *&      Form  WRITE_DB_HOME
    *       Write DB home directory
    *       no parameters
    FORM write_db_home.
      CASE sy-dbsys(3).
        WHEN 'ORA'.
          CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_ORAHOME'
                             ID 'VALUE' FIELD searchpoints-dirname.
    *--- C5056155 Start of ALV -------------------------------*
    *      PERFORM flip_flop(rsora000) USING cflag.
    *      WRITE: / 'DIR_ORAHOME',       30 searchpoints-dirname.
          MOVE: 'DIR_ORAHOME'        TO searchpoints-sp_name.
          APPEND searchpoints.
    *--- C5056155 End   of ALV -------------------------------*
        WHEN 'ADA'.
          CALL 'C_GETENV' ID 'NAME'  FIELD 'DBROOT'
                          ID 'VALUE' FIELD searchpoints-dirname.
    *--- C5056155 Start of ALV -------------------------------*
    *      PERFORM flip_flop(rsora000) USING cflag.
    *      WRITE: / 'DIR_ADA_DBROOT',    30 searchpoints-dirname.
          MOVE: 'DIR_ADA_DBROOT'     TO searchpoints-sp_name.
          APPEND searchpoints.
    *--- C5056155 End   of ALV -------------------------------*
        WHEN 'INF'.
          CALL 'C_GETENV' ID 'NAME'  FIELD 'INFORMIXDIR'
                          ID 'VALUE' FIELD searchpoints-dirname.
    *--- C5056155 Start of ALV -------------------------------*
    *      PERFORM flip_flop(rsora000) USING cflag.
    *      WRITE: / 'DIR_INF_INFORMIXDIR', 30 searchpoints-dirname.
          MOVE: 'DIR_INF_INFORMIXDIR' TO searchpoints-sp_name.
          APPEND searchpoints..
    *--- C5056155 End   of ALV -------------------------------*
        WHEN 'DB6'.
          CALL 'C_GETENV' ID 'NAME'  FIELD 'INSTHOME'
                          ID 'VALUE' FIELD searchpoints-dirname.
          IF sy-subrc = 0.
    *--- C5056155 Start of ALV -------------------------------*
    *        PERFORM flip_flop(rsora000) USING cflag.
    *        WRITE: / 'DIR_DB2_HOME',    30 searchpoints-dirname.
            MOVE: 'DIR_DB2_HOME'       TO searchpoints-sp_name.
            APPEND searchpoints.
    *--- C5056155 End   of ALV -------------------------------*
          ELSE.
            EXIT.
          ENDIF.
        WHEN OTHERS.
          EXIT.
      ENDCASE.
    ENDFORM.                    " WRITE_DB_HOME
    FORM get_directories.
    * get the name and aliases of ALL userdefined directories
      SELECT * FROM user_dir INTO isearchpoints
        WHERE svrname = sy-uname.
        MOVE isearchpoints-dirname to searchpoints-dirname.
        MOVE isearchpoints-aliass  to searchpoints-sp_name.
        APPEND searchpoints.
      ENDSELECT.
      SELECT * FROM user_dir INTO isearchpoints
        WHERE svrname = 'all'.
        MOVE isearchpoints-dirname to searchpoints-dirname.
        MOVE isearchpoints-aliass  to searchpoints-sp_name.
        APPEND searchpoints.
      ENDSELECT.
    * Get DB home
      IF sy-dbsys(3) = 'ADA'.
        PERFORM write_db_home.
      ENDIF.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_ATRA'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_ATRA'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_BINARY'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_BINARY'         TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory $DIR_CCMS
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_CCMS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_CCMS'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_CT_LOGGING'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_CT_LOGGING'     TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_CT_RUN'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_CT_RUN'         TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_DATA'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_DATA'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * Get DB home
      IF sy-dbsys(3) = 'DB6'.
        PERFORM write_db_home.
      ENDIF.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_DBMS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_DBMS'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_EXECUTABLE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_EXECUTABLE'     TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_EXE_ROOT'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_EXE_ROOT'       TO searchpoints-sp_name.
      APPEND searchpoints.
    *get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GEN'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GEN'            TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GEN_ROOT'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GEN_ROOT'       TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GLOBAL'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GLOBAL'         TO searchpoints-sp_name.
      APPEND searchpoints.
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GRAPH_EXE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GRAPH_EXE'      TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_GRAPH_LIB'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_GRAPH_LIB'      TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_HOME'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_HOME'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * Get DB home
      IF sy-dbsys(3) = 'INF'.
        PERFORM write_db_home.
      ENDIF.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_INSTALL'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_INSTALL'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_INSTANCE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_INSTANCE'       TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_LIBRARY'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_LIBRARY'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_LOGGING'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_LOGGING'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the files written by the memory inspector
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_MEMORY_INSPECTOR'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_MEMORY_INSPECTOR' TO searchpoints-sp_name.
      APPEND searchpoints.
    * Get DB home
      IF sy-dbsys(3) = 'ORA'.
        PERFORM write_db_home.
      ENDIF.
    *get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PAGING'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PAGING'         TO searchpoints-sp_name.
      APPEND searchpoints.
    *get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PUT'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PUT'            TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PERF'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PERF'           TO searchpoints-sp_name.
      APPEND searchpoints.
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PROFILE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PROFILE'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_PROTOKOLLS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_PROTOKOLLS'     TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_REORG'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_REORG'          TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_ROLL'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_ROLL'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_RSYN'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_RSYN'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * calculate directory for saphostagent (no sapparam available...)
      IF ( sy-opsys(3) = 'WIN' ) OR ( sy-opsys(3) = 'Win' ).
        DATA: windir_path(64),  programfiles_path(64).
    *   hoping that ProgramFiles is set in service user environment
        CALL 'C_GETENV' ID 'NAME'  FIELD 'ProgramFiles'
                        ID 'VALUE' FIELD programfiles_path.
        IF programfiles_path IS INITIAL.
    *     %ProgramFiles% not available. guess from windir
          CALL 'C_GETENV' ID 'NAME'  FIELD 'windir'
                          ID 'VALUE' FIELD windir_path.
    *     e.g. S:\WINDOWS ==> S:\Program Files
          CONCATENATE windir_path(3) 'Program Files' INTO programfiles_path.
        ENDIF.
        CONCATENATE programfiles_path '\SAP\hostctrl'
                                                 INTO searchpoints-dirname.
      ELSE.
    *   on UNIX, the path is hard coded
        searchpoints-dirname = '/usr/sap/hostctrl'.
      ENDIF.
      MOVE: 'DIR_SAPHOSTAGENT' TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_SAPUSERS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      IF searchpoints-dirname = '.'.
        IF sy-opsys = 'Windows NT'.
          searchpoints-dirname = '.\'.
        ELSE.
          searchpoints-dirname = './'.
        ENDIF.
      ENDIF.
      MOVE: 'DIR_SAPUSERS'       TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_SETUPS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_SETUPS'         TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_SORTTMP'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_SORTTMP'        TO searchpoints-sp_name.
      APPEND searchpoints.
    *get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_SOURCE'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_SOURCE'         TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_TEMP'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_TEMP'           TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_TRANS'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_TRANS'          TO searchpoints-sp_name.
      APPEND searchpoints.
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_TRFILES'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_TRFILES'        TO searchpoints-sp_name.
      APPEND searchpoints.
    * get name of directory with the error files
      CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'DIR_TRSUB'
                         ID 'VALUE' FIELD searchpoints-dirname.
      MOVE: 'DIR_TRSUB'          TO searchpoints-sp_name.
      APPEND searchpoints.
    *  get the name of the current server.
      CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'rdisp/myname'
                         ID 'VALUE' FIELD searchpoints-dirname.
      data: h_ind type i.
      LOOP AT searchpoints.
        h_ind = sy-tabix.
        IF searchpoints-sp_name IS INITIAL.
          DELETE searchpoints INDEX h_ind.
        ENDIF.
      ENDLOOP.
    ENDFORM.

  • How to store multiple data in one aray at one go?

    Hi i am creating a Recipe Cooking Book and i have got a recipe class, ingredient class, equipment class and jFORM GUI. the gui form will have a list and it will contain couple of equipments. the user should be able to select more than 1 equipments which would use the pass- by - value to the recipe class and it will be passed to equipment class.
    The problem that encounter is that when i have to select multiple values from list, it should store all selected equipments to array.
    This is where i am stuck as i don't know how to store couple of equipment at one creation.
    This is my recipe constructor in recipe class
    public Recipe(int aRecipeID, String aRecipeName, String aCountryofOrigin,
                      String aType, String aPreparationTime, String aCookingTime,
                      String aRecipeDescription, String aProcedure,
                       ClsEquipment[] aequipment, String aImage1, String aImage2,
                      String aImage3) {
            Create(aRecipeID, aRecipeName, aCountryofOrigin, aType,
                   aPreparationTime, aCookingTime, aRecipeDescription, aProcedure,
                   aequipment, aImage1, aImage2, aImage3);
        public void Create(int aRecipeID, String aRecipeName,
                           String aCountryofOrigin, String aType,
                           String aPreparationTime, String aCookingTime,
                           String aRecipeDescription, String aProcedure,
                            ClsEquipment[] aequipment, String aImage1, String aImage2,
                           String aImage3) {
            RecipeID = aRecipeID;
            RecipeName = aRecipeName;
            CountryofOrigin = aCountryofOrigin;
            Type = aType;
            PreparationTime = aPreparationTime;
            CookingTime = aCookingTime;
            RecipeDescription = aRecipeDescription;
            Procedure = aProcedure;
            *equipment[j] = aequipment[k];*
            Image1 = aImage1;
            Image2 = aImage2;
            Image3 = aImage3;
    this is The command that i have in Jform gui
        public void jRcreateButton_actionPerformed(ActionEvent e) {
            int i=0;
    myRecipe.Create(Integer.parseInt(jRidTextField.getText()),jRnameTextField.getText(),jRcountryTextField.getText(),jRtypeTextField.getText(),jRptimeTextField.getText(),jRctimeTextField.getText(),jRdescriptionTextArea.getText(), jRprocedureTextArea.getText(),new ClsEquipment(jAEequipmentList.getSelectedValues()),jRimage1TextField.getText(),jRimage2TextField.getText(),jRimage3TextField.getText());
    Let me conclude what i am trying to do. Basically i want the user to select more than 1 equipments from the List and the user should also input other recipe data. once this is done, the should click on create.
    when creating one recipe, u need more than 1 equipment so that created recipe should store selected equipments, which i will later on retrieve  and display on screen.
    can u please guide me where i am goin wrong and how i could fix it.
    thank you in advance
    Edited by: JAVABABY on Feb 18, 2008 8:40 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

           *equipment[j] = aequipment[k];*JList's getSelectedValues() method returns an array of Objects, so if you wanted to store it into another Object[] reference, you'd just use
    equipment = aequipment;But, you are storing it as an Equipment array, so you'll need to loop over the Object array and cast each element to an Equipment reference, and store it into the Equipment array. Something like this:
    equipment = new Equipment[aequipment.length];
    for (each element x in aequipment) {
        equipment[x] = (Equipment)aequipment[x];
    }

  • How to store Multiple Attachments in Workflow.

    Hello All,
    I am doing an scenario, in that i need to store multiple attachments in the workflow container.
    Kindly help me, how to store and also, how to retrieve those attachments form worklfow.
    I am using custom workflow.
    Thanks in advance......
    Best Regards,
    Chandran S

    Hi Jubish/Venkat
    1. I iterated this fucntion moudule to store the multiple attachments to the workflow
       SAP_WAPI_ATTACHMENT_ADD
    2. Call this FM to get the attachemnts form the workflow (pass workitem Item id which is used for storing the attchments).  SAP_WAPI_GET_ATTACHMENTS
    from above you will get objkey for each attachment as output in table.
    3. Pass the  objkey to this FM to get the contents
    SO_DOCUMENT_READ_API1'. this will retrun the content of the attachment either in object_content,   contents_hex.
    4. Pass the Obtained content to SCMS_BINARY_TO_XSTRING to get the disired format.
    Best Regards,
    Chandran S

  • How to store Multiple Ec\xcels into Table Using sql loder

    Plese guide me to store Multiple Ec\xcels into Table Using sql loder

    I am not clear with your question. Do you want to load multipel Excel Files into a table. If so you can follow this link.
    http://www.orafaq.com/wiki/SQL*Loader_FAQ#Can_one_load_data_from_multiple_files.2F_into_multiple_tables_at_once.3F
    Thanks,
    Karthick.

  • How to store Multiple values with restriction in Oracle 9i

    Hi,
    I am using oracle 9i R2 and i would like to know that how can i store multiple values and restrict some of values into oracle table?
    ex.
    I need to create table or inserting into existing table like below:
    ID will be Primary/Unique key and each ID has multiple dept but each ID to have only 1 “X” dept, only 1 “Y” dept and only 1 “Z” dept… but, can have multiple “W” dept
    What will be the best option to create/store data like this?
    Like Table level Constraint (Unique or Check), Triggers or pl/sql?
    ID     DEPT
    1     X
    1     Y
    1     Z
    1     W
    2     X
    2     Y
    2     Z
    2     W
    2     W
    2     W

    Hi,
    Other solution:
    Function:
    CREATE OR REPLACE FUNCTION my_unique_function(p_dep IN VARCHAR2) RETURN VARCHAR2
       DETERMINISTIC AS
    BEGIN
       IF (p_dep = 'X' OR p_dep = 'Y' OR p_dep = 'Z') THEN
          RETURN p_dep;
       ELSE
          RETURN NULL;
       END IF;
    END;
    /Test:
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL> create table emp(id number, dept varchar2(30));
    Table created
    SQL>
    Function created
    SQL> CREATE unique index ix_emp on emp(my_unique_function(dept));
    Index created
    SQL> insert into emp(id,dept) values (1, 'X');
    1 row inserted
    SQL> insert into emp(id,dept) values (2, 'X');
    insert into emp(id,dept) values (2, 'X')
    ORA-00001: unique constraint (HR.IX_EMP) violated
    SQL> insert into emp(id,dept) values (3, 'Y');
    1 row inserted
    SQL> insert into emp(id,dept) values (4, 'Y');
    insert into emp(id,dept) values (4, 'Y')
    ORA-00001: unique constraint (HR.IX_EMP) violated
    SQL> insert into emp(id,dept) values (5, 'Z');
    1 row inserted
    SQL> insert into emp(id,dept) values (6, 'Z');
    insert into emp(id,dept) values (6, 'Z')
    ORA-00001: unique constraint (HR.IX_EMP) violated
    SQL> insert into emp(id,dept) values (7, 'W');
    1 row inserted
    SQL> insert into emp(id,dept) values (8, 'W');
    1 row inserted
    SQL> Regards,

  • How to store multiple values associated to one key

    hello all
    In my program I need to store "multiple values associated to one key".
    for example : key would be ="T"
                             Values are    = 2,4,5,1,2Plz tell me which data structure I can use for this purpose.
    I have tried Hashtable for it, unfortunately it does not support duplicate keys in one Hashtable.
    Thanx.
    Rakesh

    The easiest thing to do, is store another data structure as your value for a
    particular key. So "T" being your your key, you would associate the value
    to be an int[] (if you know the number of sub values) or create a new Vector
    for each key, then you don't have to worry about the number of values at
    compile time. All the while still using the Hashtable for constant time
    look up. So like this:
    public void storeMultValues(int[] arr)
      Vector v = new Vector();
      v.add(new Integer(1));
      v.add(new Integer(2));
      v.add(new Integer(3));
      this.hashtable.put("T", v);
    }See if you can work with that.
    -Cludge

  • How to store multiple values in a coloum for a particaular row?

    By mistake i posted this in abap general forum but i think this question should belong to Data Dictionary section
    I want to design a table where we can store a table where we can save multiple values of  column for a particular row. how to achieve this ? thanks in advance.
    Example
    id      name  val1    val2
    001  abc        1          a
                           2          b
                           3          d
                           4          e

    you can use deep structures to achieve this.
    or may be a simpilar approach based on the example that you have mentioned will be to create a table with all the primary keys that you want with an additional key field which will behave as a counter. some standard table do you this technique eg: PLMK where zaehl is a counter field which part of the kley fields.
    cheers, Prabhakaran

  • How to store multiple child nodes using dbms_xmlstore

    Hi,
    I'm using oracle 10g environment. In DBMS_XMLSTORE package I cannot able to insert the multiple child node value into db table.
    Here I have given the xml value
    <DATAPACKET REQUEST-ID="10001094">
      <HEADER>
        <SEARCH-RESULT-LIST>
          <SEARCH-RESULT-ITEM NAME="Ra-Al-Gul" CONFIDENCE-SCORE="750" BUREAU-ID="893991307899440">
            <IDENTIFIERS>
              <IDENTIFIER IDSOURCE="0001" MATCHED="TRUE"/>
            </IDENTIFIERS>
            <SURROGATES>
              <SURROGATE ID="CH0001" MATCHED="TRUE"/>
              <SURROGATE ID="CH0002" MATCHED="TRUE"/>
              <SURROGATE ID="CH0003" MATCHED="TRUE"/>
            </SURROGATES>
          </SEARCH-RESULT-ITEM>
        </SEARCH-RESULT-LIST>
      </HEADER>
    </DATAPACKET>for this xml data I have created the below table structure
    -- Table create script
    CREATE TABLE xml_insert (datapacket t_response );
    /* Type creation  code  */
    CREATE OR REPLACE TYPE t_response AS OBJECT
      "@REQUEST-ID" VARCHAR2(100),
      header        t_resp_header
    CREATE OR REPLACE TYPE t_resp_header AS OBJECT
      "SEARCH-RESULT-LIST"    t_search_item
    CREATE OR REPLACE TYPE t_search_item AS OBJECT
    ("SEARCH-RESULT-ITEM"      t_search_list);
    CREATE OR REPLACE TYPE t_search_list AS OBJECT
    ("@NAME"           VARCHAR2(300),
    "@CONFIDENCE-SCORE"      VARCHAR2(300),
    "@BUREAU-ID"           VARCHAR2(300),
    IDENTIFIERS           t_search_identifiers,
    SURROGATES           t_search_surrogates
    CREATE OR REPLACE TYPE t_search_identifiers AS OBJECT
    (IDENTIFIER           t_search_IDENTIFIER);
    CREATE OR REPLACE TYPE t_search_identifier AS OBJECT
      "@IDSOURCE"           VARCHAR2(20),
      "@MATCHED"           VARCHAR2(20)
    CREATE OR REPLACE TYPE t_search_surrogates AS OBJECT
    (SURROGATE           t_search_SURROGATE);
    CREATE OR REPLACE TYPE t_search_surrogate AS OBJECT
    "@ID"                VARCHAR2(20),
    "@MATCHED"           VARCHAR2(20)
    CREATE OR REPLACE TYPE tb_search_surrogate AS TABLE of t_search_SURROGATE;
    /and run this block
      DECLARE
      insCtx DBMS_XMLStore.ctxType;
      rows NUMBER;
      xmldoc CLOB :=
    <ROWSET>
    <ROW>
    <DATAPACKET REQUEST-ID="Q10001094">
      <HEADER>
        <SEARCH-RESULT-LIST>
          <SEARCH-RESULT-ITEM NAME="Anis kulam" CONFIDENCE-SCORE="750" BUREAU-ID="893991307899440">
            <IDENTIFIERS>
              <IDENTIFIER IDSOURCE="0001" MATCHED="TRUE"/>
            </IDENTIFIERS>
            <SURROGATES>
              <SURROGATE ID="CH0001" MATCHED="TRUE"/>
              <SURROGATE ID="CH0002" MATCHED="TRUE"/>
              <SURROGATE ID="CH0003" MATCHED="TRUE"/>
            </SURROGATES>
          </SEARCH-RESULT-ITEM>
        </SEARCH-RESULT-LIST>
      </HEADER>
    </DATAPACKET>
    </ROW>
    </ROWSET>';
    BEGIN
      insCtx := DBMS_XMLStore.newContext('xml_check');
      rows := DBMS_XMLStore.insertXML(insCtx, xmlDoc);
      DBMS_XMLStore.closeContext(insCtx);
    END;I got the following error
    Error Messgae :
    ORA-19031: XML element or attribute SURROGATE does not match any in type DOHADEV.T_CRB_SEARCH_SURROGATES
    ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
    ORA-06512: at line 28

    Hi,
    A couple of comments to begin with :
    - Your setup script, test case and error message are not consistent with each other.
    - You've not chosen the easiest road with DBMS_XMLSTORE and nested objects. As pointed out in a previous thread of yours, the whole thing would be far more simple with XMLTable.
    Do you really need to store the data in an object-relational structure at the end, or do you intend to further break it down into relational rows and columns?
    Do you have an XML schema?

  • How to store multiple format text file in a oracle table

    Hi,
    I want to store a file which has multiple format for field separation so is it possible in Oracle data integrator if yes then how .....
    Waiting for reply
    regards
    palash

    Hello,
    <p>Read this article.</p>
    Francois

  • How to store multiple records for one master reocrd using sequnce

    dear,
    my question is in one form i have master block f and detail block.
    my question is i created one sequence and assign to master table. but i dont know how to assign that sequence to multiple record in detail table for that particular master record. i got lots of answer previously but i m not getting exactly.pls tell me full procedure otherwise gv me one demo application
    NOTe: the sequnce is created after master record commiting to database.
    PLS pls help me
    Thanks
    damby

    i did not get answer pls help me.

  • How to store multiple edits of the same file

    When I edit photos I typically create several versions of the same photo. The first edit I will end the filename with an "x". The second edit I will end with a "y", etc. For a black and white edit the file name ends with "bw". An edited version scaled down for sharing will typically end with it's long side dim i.e. IMG_2345_960.jpg. I'm new to Lightroom and it looks like only one version is stored in the data base. Can multiple versions be saved in the catelog? How would I set my version system up in Lightroom? Thank You.

    You can also use "snapshots".  Snapshots are saved and when you open a RAW file just select the snapshot you want and output the image. 

  • How to store multiple languages using APEX

    Hi,
    I am asked to develop an Application where I have to store data in multiple languages. If someone enters their info in Chinese, I should be able to store it in Chinese and display it back. Has any one worked on a similar project ? What will it take to implement it ? Are there any documents on this subject ? Can any one help me ? I would really appreciate any suggestions on this.
    Thanks
    Naresh

    Hi,
    A couple of comments to begin with :
    - Your setup script, test case and error message are not consistent with each other.
    - You've not chosen the easiest road with DBMS_XMLSTORE and nested objects. As pointed out in a previous thread of yours, the whole thing would be far more simple with XMLTable.
    Do you really need to store the data in an object-relational structure at the end, or do you intend to further break it down into relational rows and columns?
    Do you have an XML schema?

  • How to store multiple data's in an object

    i am preparing a game, the game has four bet spots. i want to save the user bet details. i like to save the user bet details in an object, so i can access it whenever i need.
    I have done same thing in AS 2.0. my object will look like
    player[0].betSpot1.amount="100"
    player[0].betSpot2.amount="200"
    i am not sure to do this in AS 3.0. any help pls
    Thanks in advance

    What you show has errors even for AS2.  The most significant one being that your buttons are not being named to give you what your code is after.  Tr the following and rename your buttons to fit the intentions of the code...
    var gameDetails:Object = new Object();
    gameDetails.player = new Array(new Object());
    betSpot_0.mouseChildren = true;
    betSpot_0.addEventListener(MouseEvent.CLICK, onBtnClick);
    function onBtnClick(e:MouseEvent){
        var btn = e.currentTarget.name;
        var spot = String(btn).split("_")[0];
        var spotId =String(btn).split("_")[1];
        gameDetails.player[spotId].betSpot = spot;
        gameDetails.player[spotId].betSpotId = spotId;
    edit:  after rethinking what I offered, I believe it is also off the mark, but I also think there is likely a much simpler data structure you can use for whatever purpose this data is going to serve.  If you can explain what the data needs to provide, it might be possible to help you define a simpler structure.  A bit of what you showed originally, an array of objects, would seem much more suitable.

Maybe you are looking for

  • CS6 Error Message When Burning a Blu Ray Project to DVD

    Hi, I'm trying to burn a Blu Ray project to DVD and I'm getting this message when I try to build the project: The project is an excerpt from a larger one and contains only 2 video files and no menus. However it's particularly worrying because the pro

  • I cannot get Messages App to send out messages

    I'm running Yosemite and the Messages app won't send out messages. Trying Again also fails. I did a clean reinstall and now messages can come in but still cannot send.

  • Permission Denied

    Hi Experts I have created a CAF Application. In this application i have one BO, and one Application Services that consume the methods of BO. In my BO i configure Permission Cheks Enable checked. In nwa in create an specific rules to manipulate the BO

  • I have download iOS 6 no more utube and the mapping is not working write ????????

    I Have downloaded iOS 6 no more utube and the maps are wrong ?

  • System errors on N91 8GB

    The warranty on my N91 8GB has recently expired and since it has my phone has started acting wierd, it gives me system errors when frequently, sometimes it drops the network and will not detect any if i do a manual search, the music players acting fu