How to swap two primitive dataelements using swap function??

How to write a swap function that can swap two integer..??

Now we are getting somewhere. Next time you post code, use the code tags!! See Formatting Tips or just select the code and click the Code button.
you cant swap i,j using the above code...You're right. You can't do that.
so how to do that??The ints must be within some object, like I showed you
You cannot swap the values of two arguments to a method and expect the caller's variables be swapped because Java passes arguments by value not reference. There is no such thing as a pointer to a variable in Java as there is in C/C++.

Similar Messages

  • How to set two parameter value using one f4 help of 'F4IF_INT_TABLE_VALUE_REQUEST'

    I have two parameters on selection screen .
    P_QTR and P_YEAR
    I have concatenated the Quarter and Year Value to give same f4 on both paramatersto give f4 using 'F4IF_INT_TABLE_VALUE_REQUEST'
    for example Q1 2014
    now when user selects one value i want to set Q1 to P_QTR and 2014 to P_YEAR.
    but it is setting only one value for P_QTR correctly and the value for P_year is not coming on screen although the value is thier inside code in P_year
    i am using same f4 for both events
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_qtr.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_year.
    here is the code i am using
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            retfield        = 'CHAR20'
            window_title    = text-026
            value_org       = 'S'
          TABLES
            value_tab       = mt_input_f4
            return_tab      = mt_return
          EXCEPTIONS
            parameter_error = 1
            no_values_found = 2
            OTHERS          = 3.
        IF sy-subrc <> 0.
          CLEAR mt_input_f4[].
        ENDIF.
        READ TABLE mt_return INTO ms_return INDEX 1.
        IF sy-subrc EQ 0.
          p_qtr = ms_return-fieldval+0(2).
          p_year = ms_return-fieldval+3(4) .
        ENDIF.
    plz chk  attached pics

    i am sorry for delayed update but i fixed it using following approach.
        READ TABLE mt_return INTO ms_return INDEX 1.
        IF sy-subrc EQ 0.
          ls_dynpread-fieldname = 'P_QTR'.
          ls_dynpread-fieldvalue = ms_return-fieldval+0(2).
          APPEND ls_dynpread TO lt_dynpread.
          ls_dynpread-fieldname = 'P_YEAR'.
          ls_dynpread-fieldvalue = ms_return-fieldval+3(4).
          APPEND ls_dynpread TO lt_dynpread.
    **setting the selection screen values
          CALL FUNCTION 'DYNP_VALUES_UPDATE'
            EXPORTING
              dyname               = sy-repid
              dynumb               = '1000'
            TABLES
              dynpfields           = lt_dynpread
            EXCEPTIONS
              invalid_abapworkarea = 1
              invalid_dynprofield  = 2
              invalid_dynproname   = 3
              invalid_dynpronummer = 4
              invalid_request      = 5
              no_fielddescription  = 6
              undefind_error       = 7
              OTHERS               = 8.
          IF sy-subrc <> 0.
            CLEAR lt_dynpread[].
          ENDIF.

  • How to read two text files using the Read from spreadsheet.vi and then plot it

    I need to read two text files using the read from spreadsheet function and then plot these files over time.
    The file with the .res extention is the RMS values (dt and df) and the second file contains the amplitude of a frequency spectrum.
    I really appreciate any help..thanks
    Attachments:
    RMS.txt ‏1 KB
    FREQUENCY.txt ‏1 KB

    From NI Example Finder:
    Write to Text File.vi
    Read from Text File.vi
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp

  • How can I execute program after using F4_Filename function?

    Hi all,
    I'm a new user on the forum. I've been working with ABAP and SAP for a few weeks. I wrote a program for importing data from excel file to SAP using BDC. During searching this forum I found information about F4_Filename function which allows users to browse the disc for a file. I'd like to add this function to my program. I have a parameter for a file name but this is an ordinary static string field. When I added the code which I found in the message on this forum the rest of program doesn't execute.
    This is simple program for example:
    REPORT  Z_TEST8_AB.
    DATA f_name TYPE STRING.
    PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
    f_name = p_file.
    write:/ f_name.
    This program works correctly. There is a field for parameter. I can change the default name for a file.
    After all, I can run the program (F8) and rest of the code is executed. The field for parameter dissapears from the screen and the file name is displayed. ( command write)
    Now I added a function F4_Filename
    REPORT  Z_TEST8_AB.
    DATA f_name TYPE STRING.
    PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
    at selection-screen on value-request for p_file.
      call function 'F4_FILENAME'
           exporting
                program_name  = syst-repid
                dynpro_number = syst-dynnr
                field_name    = 'p_file'
           importing
                file_name     = p_file.
    f_name = p_file.
    write:/ f_name.
    I can browse a computer for a file now but after selecting the file I can't run the rest of the code. When I click on the icon or press key F8 the field for parameter doesn't dissapier and the command write is not executed.
    What do I do wrong?
    Could anyone suggest me a solution? How can I executed the code after using this function?
    Thanks in advance.
    Regards,
    Arek.

    Hi arkadiusz,
    1. simple
    2.
    <b>start-of-selection.</b>
    f_name = p_file.
    write:/ f_name.
    regards,
    amit m.

  • How to add warning message while using 'print' function in Adobe LiveCycle Designer

    I am trying to make pdf document for my company which requires adding a warning message while anyone use 'print' function from the page...
    Does anyone know how to add warning message on LiveCycle Designer
    Also my supervisor mentioned something using 'nag' if that rings any bell

    No you shoudl never go into the XML source unless uinstricted to do so.
    You can open the script editor (under the window menu). It will appear above the drawing area but below the toolbars. You can resize it if there is not enough room. When you click on an object in the form you can choose an event to script against in the Show dropdown. In your case you will want to choose the prePrint event. A line will show up that indicates the object that is associated with the script as well as the event and other information. Add your script below this line. Once that is done you are finished and your form is ready for testing.
    Paul

  • How to find exception occured while using LOGON function in oracle 10g

    Hi,
    I am using LOGON function to login with a different user name in oracle 10g forms.
    LOGON ( User, Pass@tns, FALSE)
    The third parameter is passed as 'FALSE' to avoid the login screen to be opened. If any of the other parameter ( User Name, Password, TNS) is passed wrong, connection is not established but no exception is occurred. The value for 'FORM_FAILURE' is set to 'TRUE'.
    What i need is the ORA error for connection failure. The error message related to user name/password (ORA-01017) or connection identifier (ORA-12155).
    How i can get this error code if connection is failed. Is there any other way to login in oracle forms other than 'LOGON'.
    Habib

    Habib Ahmad wrote:
    Hi,
    I am using LOGON function to login with a different user name in oracle 10g forms.
    LOGON ( User, Pass@tns, FALSE)
    The third parameter is passed as 'FALSE' to avoid the login screen to be opened. If any of the other parameter ( User Name, Password, TNS) is passed wrong, connection is not established but no exception is occurred. The value for 'FORM_FAILURE' is set to 'TRUE'.
    What i need is the ORA error for connection failure. The error message related to user name/password (ORA-01017) or connection identifier (ORA-12155).
    How i can get this error code if connection is failed. Is there any other way to login in oracle forms other than 'LOGON'.As salamu alikum, Habib
    If you pass FALSE in login you can't catch anything. Want to catch the error ?
    Then change
    LOGON ( User, Pass@tns, FALSE)
    to
    LOGON ( User, Pass@tns, TRUE) Now Create On-Error trigger at form level
    and try the following code
    if error_code=01017 then
         message('invalid user name or password');
         message('invalid user name or password');
         raise form_trigger_failure;
    elsif error_code=12154 or error_code=1215 then
         message('invalid connection string');
         message('invalid connection string');
         raise form_trigger_failure;
    end if;Hopes this helps
    If someone's response is helpful or correct, please mark it accordingly.

  • How can HANA Server Side JavaScript use "Eval" function?

    Hi HANA Experts,
      I use EVAL function to create an object by classname in xsjs file, but it has an Error "Eval is evil". In Client javascript, we can use the Eval function. How can we use "EVAL" function in HANA server side javaScript?  Thanks a lot.

    That looks like the client side JSLint check to me.  Those can be customized or even turned off. If you truly want to use eval.
    >XSJS inherits most of the features of javascript but do not expect all of its features
    Actually that's not exactly accurate.  XSJS is standard ECMA JavaScript (Mozilla SpiderMonkey VM).  It does run in strict mode, however. This isn't a limitation of XSJS but a conscious decision to force the VM into the strict mode - which is really the recommendation for JavaScript anyway.  We also apply JSLint checks as above. Sometimes they are quite restrictive. However they can be customized or even completely turned off at the project level:
    To the point of Eval, there are some excellent articles online.
    http://javascriptweblog.wordpress.com/2010/04/19/how-evil-is-eval/
    coding style - When is JavaScript&amp;#39;s eval() not evil? - Stack Overflow
    JSLint Error Explanations - eval is evil

  • How to convert columns into rows using  transpose function

    Hi
    anybody tell me how to convert columns values into rows using transpose function.

    Since BluShadow went to all the trouble to put it together, someone should use it.
    See the post titled How do I convert rows to columns? here SQL and PL/SQL FAQ
    John

  • Canon MP560. How to override U043 message for using scan function?

    Hi, I've no ink cartridge on my Canon MP560, at the moment.
    How can I override U043 error message for using scan function?
    I tried to push and hold stop button for at least 10 seconds but it didn't work.
    (OS: Windows 7)

    Hello Coz,
    It's been a while since you've posted, I hope you have not given up.  I was having grief with my MF4150 as well, but got it working.  There is a more current driver - search for Mac_UFRII_V230_uk_EN and install it.
    Then, when you go to add your printer through System Preferences > Print & Fax, make sure you click the "default" icon in the top of the dialog.  It should show your Canon MF 4100 series , then use the bottom drop down menu to choose your driver and select Canno MF410 Series UFRII LT (UK) from the list.

  • How to get two header colums using alv?

    Hi,
    experts,
    I want to display alv output with two header columns like shows below:
    Subjects
    |   English       |         Maths       |     Science     |    Social   |         Politics                   |                
    100
    56
    89
    12
    85
    25
    85
    36
    78
    100
    75
    55
    65
    74
    100
    How to acheive this by using ALV Grid dispaly. please end me any document on this .
    Thanks in advance,
    Shabeer Ahmed.

    Hi,
    Please check the link given below :
    Two column header in ALV Report
    hope it will help you.
    Thanks & Regards,
    Sarita Singh Rathour

  • How to Export two web items using one export button in WAD (3.X) ?

    Hello Friends,
    I am trying to export two reports using one export button which are in two columns of the table in a web template created in WAD 3.X. but not able to do it. i also tried to doing the same thing in BI 7 copied that code and pasted in 3.X but that doesn't work.
    can anyone help me on that?
    Thanks,
    Nayan Joshi

    hi,
    SPS 14 for NW 7.0 is installed. I found out, that the filter pane has should have the property "Affected Data Providers (LINKED_DATA_PROVIDER_REF_LIST)" and the navigation pane not. Look at:
    - http://help.sap.com/saphelp_nw70/helpdata/en/16/3ee2416149c717e10000000a155106/content.htm
    - http://help.sap.com/saphelp_nw70/helpdata/en/85/08e241aa8e9d39e10000000a155106/content.htm
    But in my WDA both items don't have this property. The latest SPS for Front-End-Tools is installed.
    Any further ideas?

  • How to concatinate two clob objects using JDBC...good brain excercise!!!

    Hi,
    I am using MYSQL server ver. 4.0 and J/Connector version 3.0.6
    I have two columns of LONGTEXT type and i have to concatenate them and store it in a third column.I have thought of the following strategy:
    1. Retrieve the columns as CLOB using getClob()
    2.Concatinate the CLOB values and then insert it in the corr. database column.
    My problem is this that i don't know what strategy should i use to concatenate the two values in the clob objects without bringing the whole clob values in the memeory.If i use this strategy..it gives me outofmemory error.
    My Clob columns may go upto 10MB in size.
    Pl. help.....Any suggestions from the whizkids out there will be extremely appreciated!!!
    Thanks....

    sorry for replying so late...but neway....
    Ok...i will paste a snapshot of my code here....May be that will clarify a few things....
    I am opening this in the main function body....To get the first column cell value....
    /////////////////Reading the Clob value of the main outer row which will be copmpared with the other rows under it//
    BufferedInputStream anInputStream = new BufferedInputStream( rs.getAsciiStream("row_interaction")); //row_intrctn
    int aByte = anInputStream.read();
    File aFile = File.createTempFile( "tempfile", "txt");
    FileOutputStream anOutput = new FileOutputStream(aFile);
    while (aByte != -1)
    anOutput.flush();
              anOutput.write(aByte);
    aByte = anInputStream.read();
    Then I depending on some condition i concatenate it with some other cell value from the database ...here i am just concatenating it with another rows column cell clob value..shown below as:
    if(loop==0)
    String col_string= null;
    col_string= convert_bitset_string(temp_b);
    //////Getting the other string value///////////////////////////////////////
    anInputStream = new BufferedInputStream( rs.getAsciiStream("row_interaction"));
    aByte = anInputStream.read();
    while (aByte != -1)
    anOutput.write(aByte);
    aByte = anInputStream.read();
    anOutput.flush();
    System.out.println("Loop0,2:The "+row_index+"st row being inserted");
    ////////////////////////Inserting through the prepared statement////////////
    String insertion= "Insert into bv"+next_tbl_nm_cntr+" Values(?,?,"+col_string+")";
    PreparedStatement pstmt= con.prepareStatement(insertion);
    pstmt.setInt(1,row_index);
    try{
    FileInputStream fis = new FileInputStream(aFile);
    pstmt.setAsciiStream(2,fis,(int)aFile.length());
    pstmt.execute();
    fis.close();
    }catch(IOException e)
    System.out.println("Error in setting the stream"+e);
    System.out.println("Loop0,2:Row inserted");
    row_index++;
    loop++;
    }     //End if: loop=0 i.e the row being inserted is the first row
                                  //in the store bitset
    Tell me if there is any error because when it concatenates i get some unwanted values too..which i took before in the iteration.....
    Any help will be greatly appreciated

  • How to merging two audio stream using jmf?

    I have received two rtp audio stream,i want to merging this to one but createMergingDataSource dou work well。please help 。

    You might use an alternative approach: Run exec task and use a external tool to do the encoding.
    You can for example use "The Swiss army knive of Sound" :) SoX: http://sox.sourceforge.net/
    I think from a performance point of view or to handle large files it would be even recommended in using such tools rather then encoding inside your application ... that might be different if you need to do the encoding in real-time ...
    Sebastian

  • How to call two smartforms with using a single print program

    Hi,
       I have a requirement wherein I need to call two smartforms using a single print program.
       The interface parameters are different in two smartforms.
       I presently solved the issue using the smartform names as the reference.
       Can anyone let me know if there is any other way to solve it.
       I heard something about global params. But not sure.
       Please let me know the best possible way to solve this issue.
    Thanks and Regards,
       Debabrata

    Hi Debabrata,
    Based on the condition in your print program you can call the below code
    fname1 TYPE rs38l_fnam.
    IF -
    call function 'SSF_FUNCTION_MODULE_NAME'
      exporting
        formname                 = 'ZSMARTFORMS'
    importing
       fm_name                  = fname1
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.*
    CALL FUNCTION FNAME
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB      =
      ARCHIVE_PARAMETERS =
      CONTROL_PARAMETERS=
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT              =
      MAIL_SENDER                 =
      OUTPUT_OPTIONS           =
      USER_SETTINGS             = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO =
      JOB_OUTPUT_INFO             =
      JOB_OUTPUT_OPTIONS      =
    EXCEPTIONS
      FORMATTING_ERROR         = 1
      INTERNAL_ERROR              = 2
      SEND_ERROR                    = 3
      USER_CANCELED              = 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.
    ELSE.
    fname2 TYPE rs38l_fnam.
    call function 'SSF_FUNCTION_MODULE_NAME'
      exporting
        formname                 = 'ZSMARTFORMS'
    importing
       fm_name                  = fname2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.*
    CALL FUNCTION FNAME
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB      =
      ARCHIVE_PARAMETERS =
      CONTROL_PARAMETERS=
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT              =
      MAIL_SENDER                 =
      OUTPUT_OPTIONS           =
      USER_SETTINGS             = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO =
      JOB_OUTPUT_INFO             =
      JOB_OUTPUT_OPTIONS      =
    EXCEPTIONS
      FORMATTING_ERROR         = 1
      INTERNAL_ERROR              = 2
      SEND_ERROR                    = 3
      USER_CANCELED              = 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.
    ENDIF.

  • How to append two CSV files using ftp

    Hi
    Please let me know the FTP command to append the two .CSV files into one .CSV file.
    e.g.
    Let me explain:
    one CSV file has the fields F1 , F2, F3 , F4 and has 5 records
    another CSV file has the same sequence of fields F1, F2, F3, F4 and has 10 records
    after appending both the files , I must get 15 records.
    Thanks
    Alok

    Ok I will try out.
    I am illustrating my requirement as follow
    File#1 (type .CSV)
    F1     F2     F3     F4
    100   566    89     86   
    235   256    56     12
    File#2 (type .CSV)
    F1     F2     F3     F4
    56     56     98     102
    12     23     36      523
    23      56     56    89
    Now we want to Append File#1 to File#2 as follow: 
    F1    F2    F3     F4
    100   566    89     86   
    235   256    56     12   
    56     56     98     102
    12     23     36      523
    23      56     56    89
    Please suggest now that which command would be appropiate.
    Alok

Maybe you are looking for