Me41(Ekko entry) BDC loop Problem

Dear Experts.
I am creating a BDC for Me41(ekko entry).(4.6C Version)
in the item screen I am able to enter 17 records(by default 17 items in the screen).after that I am trying to
click on Page down option(P+ in recording) ,then it is not going to the next page.
I tried in normal creation of rfq by me41 and through  recording also.
but this page down is not working.
I want to enter 100 recordsin one RFQ.
Please sujject a solution.
Thank & Regards,
venkat

Hi,
    What you do is click on insert row for every new record entry, so with that way you can do any no of entries.
I had done for 5000 line items, so after an item entry click on insert row.
watch out for Enter lines(CntrlShiftF1), that creates a new line, with this way you can avoid screen resolution problem also, as some system have 17 rows and other system has 20 rows.
Regards
Bala Krishna
Edited by: Bala Krishna on Jul 27, 2009 3:58 PM

Similar Messages

  • Bdc loop problem

    hai friends,
    Message was edited by: Roby

    Could you frame your question once again? I didn't get what's really the problem is.

  • Not the usual 'login loop' problem, help.

    The login loop problem I'm facing is not the usual login loop problem when starting up mac; it's when I'm trying to log into websites or applications (most of them, eg. facebook, instagram).
    I have tried:
    using other browsers: Safari, Firefox, Maxthon, Chrome
    clearing all cookies / caches / keychains / passwords
    repairing disk
    deleting launchservices cache
    using other userid to login
    All to no avail.
    How do I solve this without having to reformat/install mac?
    Thank you.

    Hi, are you using Parental contrils or a managed account, or an admin account?
    Using any Anit-Vrus software?

  • Trying SSH CLI ,  reading command line method is infinte loop problem!

    I am trying excute command and reading result. but reading result part has problem.
    below source is a part of my method.
    try{
                   SessionChannelClient sessionChannel = ssh.openSessionChannel();
                   sessionChannel.startShell();
                   OutputStream out = sessionChannel.getOutputStream();
                   String cmd = s + "\n";
                   out.write(cmd.getBytes());
                   out.flush();
                   InputStream in = sessionChannel.getInputStream();
                   BufferedReader br = new BufferedReader(new InputStreamReader(in));
                   byte buffer[] = new byte[255];
                   String read= "";
                   while (true) {
                        String line = br.readLine();
                        if (line == null)
                             break;
                        str += line;
                        str += "\n";
                   System.out.print(str); //print result
                   sessionChannel.close();
                   in.close();
                   out.close();
              }catch(IOException ee){
                   System.out.println(ee);
              }finally{
                   System.out.println("=============end cmd=============");
    while loop has problem. While statement has infinite loop problem.
    why has this problem?
    anybody, help me please. Thanks for reading .
    Edited by: BreathAir on Aug 5, 2008 12:16 AM

    That loop will loop until readLine() returns null, which will only happen when the other end closes its end of the connection, and it will block while no data is available.

  • Sony D-50 "boot-up loop" problem

    I have a Sony D-50 portable recorder barely three months old that did something totally strange. Has anyone else had this problem?
    During a shoot yesterday, I noticed that the Sony D50 I bought back in August would not turn OFF.
    When I moved the power switch to the OFF position, the machine went into a "boot up loop," that is:
    I'd turn it OFF after recording.
    Screen goes black.
    I get the "See you!" message.
    Screen lights up again.
    The word "SONY" appears as though it's gonna boot up,
    Then the whole process starts over again
    Screen goes black.
    I get the "See you!" message.
    Screen lights up.
    The word "SONY" appears as though it's gonna boot up....
    So, same thing late last night.
    I get up this morning and turn it ON; it works fine until I turn it off, then it goes back into the "boot loop" thing again.
    I tried everything I could think of, even searching for a "RESET" on the machine and in the Menu. I finally had to take the batteries out of it to shut it down.
    Then, I did something that apparently---so far---fixed it.
    This is so strange---right out of the Twilight Zone:
    I put the batteries back in it, then it starts the loop again.
    Since it won't turn OFF, I take the batteries out of it in the OFF position. I wait five minutes and put the batteries back in it with it in the OFF position.
    Same problem---the "boot up loop" thing.
    I take the batteries back out of it again in the OFF position and wait fifteen minutes. I put the batteries back in it while it's still in the OFF position. Guess what?
    Problem solved: It's doesn't start the "boot up loop" thing.
    So, I turn it back ON. Machine boots up fine and is ready to record.
    OK, I turn it OFF.
    Back to the exact same problem---It shuts down and goes into the "boot up loop" again.
    I go back through the same process of removing and installing the batteries with the machine in the OFF position.
    Nothing changes.
    Then, I have an idea.
    With the machine in the OFF position and going through the "boot up loop" thing, I remove the batteries.
    I then move the power switch to the ON position before I put the batteries back in it---had not tried that before: reinstalling the batteries with it in the ON position. I install the batteries with the machine in the ON position.
    Machine boots up fine and is ready for recording.
    Now, I turn it OFF.
    The machine shuts down fine with no "boot up loop" problem.
    Putting the batteries back in the machine with it in the ON position instead of the OFF position apparently solved the problem.
    So, I turn it back ON and then OFF several times.
    Same thing: No "boot up loop" problem.
    Do-do-Do-do....
    The machine now works fine.
    Anyone ever had this happen to a Sony D-50?
    I'm wondering if I should send it to back to Sony before it does this again. For God's sake, it's only three months old!
    I bought it after rave reviews in the "recorder" community, and I haven't found anyone else who has had this problem with one..

    Sorry to see that you were having this issue with your PCM-D50 Linear PCM Recorder - if you continue having the issue the unit may need service - give Sony Business and Professional team a call and they will be happy to assist:
    http://pro.sony.com/bbsc/ssr/services.s ... port.shtml

  • Possible solution to "Looping" problem

    Hello all, I've read several threads here dealing with a "looping" problem, I'm not sure what the ins-and-outs of this issue is but it seems to affect many different config and different manufacturers are blaming each other... check out the link below (mind the wrapping) for what might be a real solution at the Via forums. I happened upon this because I could not get a stable system out of my MSI via-km266 mobo with dual display.
    http://forums.viaarena.com/messageview.cfm?catid=25&threadid=9263&highlight_key=y&keyword1=dual%20display
    Alpay Eno

    What is the problem? Let the filters return a List instead of an array. Am I missing something?
    Kaj

  • Bdc transaction problem

    hi,
    i am create a programm for f-27 type DG by bdc session method
    when i execute it on 3rd screen of execution it ask for the values for PAYMENT TERMS but in manual entry OF F-27 it does not TAKE ANY PAYMENT TERMS. plz check my code and tell me where is the problem in coding.
    CODES:
    REPORT zcrdtdgupld
           NO STANDARD PAGE HEADING LINE-SIZE 255.
    *INCLUDE zdata_declarations.
              I N T E R N A L  T A B L E                           *
    DATA: BEGIN OF wa_data,
           bldat     TYPE  BDC_FVAL, "Document Date10
           blart     TYPE  BDC_FVAL, "Document Type
           bukrs     TYPE  BDC_FVAL, "Company Code
           budat     TYPE  BDC_FVAL, "Posting Date10
           monat     TYPE  BDC_FVAL, "Period
           waers     TYPE  BDC_FVAL, "Currency
           xblnr     TYPE  BDC_FVAL, "Reference Field
           docid     TYPE  BDC_FVAL, "Document ID
           newbs     TYPE  BDC_FVAL, "Posting  Key
           newko     TYPE  BDC_FVAL, "Account Code
           wrbtr     TYPE  BDC_FVAL, "Amount in Documentcurrency
           zfbdt     TYPE  BDC_FVAL, "Baseline Date10
           newbs2    TYPE  BDC_FVAL, "Account Key2
           newko2    TYPE  BDC_FVAL, "Account code2
           wrbtr2    TYPE  BDC_FVAL, "bseg-wrbtr,"Amount2
           kostl     TYPE  BDC_FVAL, " cost center
           prctr     TYPE  BDC_FVAL, " profit center
           END OF wa_data.
                          D A T A                                     *
    DATA: it_data    LIKE TABLE OF wa_data.
    DATA: it_bdcdata TYPE TABLE OF bdcdata.
    DATA: wa_bdcdata LIKE LINE OF it_bdcdata.
    DATA: v_file     TYPE string.
                 S E L E C T I O N  S C R E E N                       *
    SELECTION-SCREEN BEGIN OF BLOCK b.
    PARAMETERS : pa_file LIKE fc03tab-pl00_file OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b.
                    AT SELECTION-SCREEN                               *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_file.
      PERFORM get_file USING pa_file.
               S T A R T  O F  S E L E C T I O N                      *
    START-OF-SELECTION.
      v_file = pa_file.
    *uploading flat file into internal table
      PERFORM upload_file USING v_file CHANGING it_data.
    *open the session
      PERFORM open_session.
    *POPULATING THE BDCDATA
      LOOP AT it_data INTO wa_data.
        REFRESH it_bdcdata.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0100' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'RF05A-NEWKO'.
        PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
        PERFORM bdc_field       USING 'BKPF-BLDAT'  wa_data-bldat.
        PERFORM bdc_field       USING 'BKPF-BLART'  wa_data-blart.
        PERFORM bdc_field       USING 'BKPF-BUKRS'  wa_data-bukrs.
        PERFORM bdc_field       USING 'BKPF-BUDAT'  wa_data-budat.
        PERFORM bdc_field       USING 'BKPF-MONAT'  wa_data-monat.
        PERFORM bdc_field       USING 'BKPF-WAERS'  wa_data-waers.
        PERFORM bdc_field       USING 'BKPF-XBLNR'  wa_data-xblnr.
        PERFORM bdc_field       USING 'FS006-DOCID' wa_data-docid.
        PERFORM bdc_field       USING 'RF05A-NEWBS' wa_data-newbs.
        PERFORM bdc_field       USING 'RF05A-NEWKO' wa_data-newko.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0301' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'BSEG-WRBTR'.
        PERFORM bdc_field       USING 'BDC_OKCODE' '/00'.
        PERFORM bdc_field       USING 'BSEG-WRBTR'  wa_data-wrbtr.
        PERFORM bdc_field       USING 'BSEG-ZFBDT'  wa_data-zfbdt.
        PERFORM bdc_field       USING 'RF05A-NEWBS' wa_data-newbs2.
        PERFORM bdc_field       USING 'RF05A-NEWKO' wa_data-newko2.
        PERFORM bdc_dynpro      USING 'SAPMF05A' '0300' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'BSEG-WRBTR'.
        PERFORM bdc_field       USING 'BDC_OKCODE' '=BU'.
        PERFORM bdc_field       USING 'BSEG-WRBTR' wa_data-wrbtr2.
        PERFORM bdc_dynpro      USING 'SAPLKACB' '0002' 'X'.
        PERFORM bdc_field       USING 'BDC_CURSOR' 'COBL-PRCTR'.
        PERFORM bdc_field       USING 'BDC_OKCODE' '=ENTE'.
       PERFORM bdc_field       USING 'COBL-KOSTL' wa_data-kostl. "'101902'
        PERFORM bdc_field       USING 'COBL-PRCTR' wa_data-prctr.
        PERFORM bdc_insert USING 'F-27' it_bdcdata.
      ENDLOOP.
    *close the session
      PERFORM close_session.
    *&      Form  get_file
          text
         -->P_PA_FILE  text
    FORM get_file  USING    p_pa_file.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name = syst-repid
          field_name   = 'PA_FILE'
        CHANGING
          file_name    = pa_file.
      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.                    " get_file
    *&      Form  upload_file
          text
         -->P_V_FILE  text
         <--P_IT_DATA  text
    FORM upload_file  USING    p_v_file
                      CHANGING p_it_data LIKE it_data.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = p_v_file
       filetype                      = 'DAT'
        has_field_separator           = '#'
        TABLES
          data_tab                      = p_it_data.
      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.                    " upload_file
    *&      Form  open_session
          text
    -->  p1        text
    <--  p2        text
    FORM open_session .
      CALL FUNCTION 'BDC_OPEN_GROUP'
       EXPORTING
         client                    = sy-mandt
      DEST                      = FILLER8
         group                     = 'JAYANT'
      HOLDDATE                  = FILLER8
         keep                      = 'X'
         user                      = sy-uname.
      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.                    " open_session
    *&      Form  bdc_dynpro
          text
         -->P_0043   text
         -->P_0044   text
    FORM bdc_dynpro  USING  program TYPE BDC_PROG
                            dynpro  TYPE BDC_DYNR
                            dynbegin TYPE BDC_START.
      wa_bdcdata-program  = program.
      wa_bdcdata-dynpro   = dynpro.
      wa_bdcdata-dynbegin = dynbegin.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
    ENDFORM.                    " bdc_dynpro
    *&      Form  bdc_field
          text
         -->P_0048   text
         -->P_0049   text
    FORM bdc_field  USING  fnam TYPE FNAM_____4
                           fval TYPE BDC_FVAL.
      wa_bdcdata-fnam = fnam.
      wa_bdcdata-fval = fval.
      APPEND wa_bdcdata TO it_bdcdata.
      CLEAR wa_bdcdata.
    ENDFORM.                    " bdc_field
    *&      Form  bdc_insert
          text
         -->P_0183   text
         -->P_IT_BDCDATA  text
    FORM bdc_insert  USING    p_tcode TYPE sytcode
                              p_it_bdcdata LIKE it_bdcdata.
      CALL FUNCTION 'BDC_INSERT'
        EXPORTING
          tcode     = p_tcode
        TABLES
          dynprotab = p_it_bdcdata.
    ENDFORM.                    " bdc_insert
    *&      Form  close_session
          text
    -->  p1        text
    <--  p2        text
    FORM close_session .
      CALL FUNCTION 'BDC_CLOSE_GROUP'.
    ENDFORM.                    "close_session
    plz help me in this programm
    thanks
    jayant.

    why not post this in the ABAP forum?
    You expect Basis people to help you on this one?

  • Do while loop problem

    I have a problem with do while loop. I am displaying a dialogue box where a person should enter the type of quiz he had performed. The problem is that the user should enter only the following 3 words, either "Earthquakes" or "Place" or "Animals". If the user enters any other word, he/she should be displayed wwith another message saying "Invalid". This should keep repeatinf (i.e. displaying invalid) until the user enters either of those 3 words. When a user enters one of those words it will stop diplaying "Invalid". I tried doing this, but altough it displays "Invalid" when a user enters an invalid word, it will display invalid also when a user neters the correct word. I think i have something wrong with the loop.
    This is the code:
         String player = JOptionPane.showInputDialog(null, "Enter name");
                 String type = JOptionPane.showInputDialog(null, "Enter your quiz type");
                do
                    type = JOptionPane.showInputDialog(null, "Invalid entry. Try again." );
                 while (type != "Earthquakes"  || type != "Place" || type != "Animals" );

    Yeah thats a good idea, but i'm still a beginner and i'm still new to some things. I got a problem, because altough the while loop is working correctly, however the first time i enter a word even if its correct its still displays invalid. I think that thats a property of the while loop. So can someone pls tell me how can i change this loop and use another loop that wouldn't do this. Can i use perhaps a for loop instead here? Thanks a lot.
    String player = JOptionPane.showInputDialog(null, "Enter name");
              String type = JOptionPane.showInputDialog(null, "Enter your quiz type");
                  do {
                      type = JOptionPane.showInputDialog(null, "Invalid entry. Try again." );
                   } while(!type.equals("Earthquakes") && !type.equals("Places") && !type.equals("Animals"));
                Edited by: datax on Feb 21, 2008 10:46 AM

  • BDC OUPUT PROBLEM

    Hi All,
               i have created a bdc which is working well but mine problem is that if some item is not updated by BDC then it should show in my program or save on desktop.
    thanx

    Hello Mr. Suneel,
    i am using call by transaction method.plz check the below:--
    LOOP AT ITAB.
    perform bdc_dynpro      using 'SAPMF02K' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-D0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-LIFNR'
                                  ITAB-LIFNR.
    perform bdc_field       using 'RF02K-BUKRS'
                                  'NILR'.
    perform bdc_field       using 'RF02K-D0110'
                                  'X'.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  ITAB-TELF1.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPDA'.
    *perform bdc_field       using 'LFA1-NAME1'
                                 record-NAME1_004.
    *perform bdc_field       using 'LFA1-SORTL'
                                 record-SORTL_005.
    *perform bdc_field       using 'LFA1-STRAS'
                                 record-STRAS_006.
    *perform bdc_field       using 'LFA1-ORT01'
                                 record-ORT01_007.
    *perform bdc_field       using 'LFA1-PSTLZ'
                                 record-PSTLZ_008.
    *perform bdc_field       using 'LFA1-LAND1'
                                 record-LAND1_009.
    *perform bdc_field       using 'LFA1-REGIO'
                                 record-REGIO_010.
    *perform bdc_field       using 'LFA1-SPRAS'
                                 record-SPRAS_011.
    perform bdc_field       using 'LFA1-TELF1'
                                  ITAB-TELF1.
    *ALL TRANSACTION 'XK02' USING BDCDATA MODE 'A'.
    call transaction 'XK02' USING BDCDATA MODE 'A'.
    ENDLOOP.
    thanx

  • I am having BDC upload problem . 2 transaction upload in one pgm.

    Hi ,
    I am having problems .In one BDC program that i have written. The data is plopulating the first tcode screens i.e of T Code KL01  but its not populating screen of  TCode  KP26.
    Please can you let me the reason why the screen of t code KP26 is not getting populated correctly .
    please help  me with directions of where i am going wrong
    The code is below .
    report ZPM_ACTIVITY_UPLOAD
           no standard page heading line-size 255.
    *include bdcrecx1.
    ***************DATA DECLARATION**************************
    DATA : message like  bdcmsgcoll occurs 0.
    DATA : bdcdata type standard table of bdcdata with header line .
    data : file type string,
            v_msg(255).
    DATA:Begin of itab_main occurs 0,
      LSTAR      type  CSLAZ-LSTAR,
      DATAB_ANFO(10),
    DATAB_ANFO type CSLAZ-DATAB_ANFO,
      KTEXT      type CSLAZ-KTEXT,
      LTEXT      type CSLAZ-LTEXT,
      LEINH_CHAR type CSLAZ-LEINH_CHAR,
      KSTTY      type CSLAZ-KSTTY,
      LATYP      type CSLAZ-LATYP,
      VKSTA      type CSLAZ-VKSTA,
      VERSN      type CCSS-VERSN,
      PERBL      type RKPLN-PERBL,
      PERBL1      type RKPLN-PERBL,
      GJAHR      type CCSS-GJAHR,
      KOSTL      type CCSS-KOSTL,
      LSTAR1      type CCSS-LSTAR,
      TKV        type RKPLN-TKV,
    End of itab_main.
    Data :v_file type string.
    Data :Begin of itab_KL01 occurs 0,
                KL01_LSTAR      type  CSLAZ-LSTAR,
                KL01_DATAB_ANFO(10),             " type CSLAZ-DATAB_ANFO,
               KL01_DATAB_ANFO type CSLAZ-DATAB_ANFO,
                KL01_KTEXT      type CSLAZ-KTEXT,
                KL01_LTEXT      type CSLAZ-LTEXT,
                KL01_LEINH_CHAR type CSLAZ-LEINH_CHAR,
                KL01_KSTTY      type CSLAZ-KSTTY,
                KL01_LATYP      type CSLAZ-LATYP,
                KL01_VKSTA      type CSLAZ-VKSTA,
           End of itab_KL01.
    Data : Begin of error_itab occurs 0,
            msg(255),
           End of error_itab.
    Data :wa_error_itab like line of error_itab.
    Data : Begin of itab_KP26 occurs 0,
               KP26_VERSN      type CCSS-VERSN,
               KP26_PERBL      type RKPLN-PERBL,
               KP26_PERBL1     type RKPLN-PERBL,
               KP26_GJAHR      type CCSS-GJAHR,
               KP26_KOSTL      type CCSS-KOSTL,
               KP26_LSTAR      type CCSS-LSTAR,
               KP26_TKV        type RKPLN-TKV,
           End of itab_KP26.
    data : l_v_tab type abap_char1
                     value cl_abap_char_utilities=>horizontal_tab.
    data : counter type c value 0,
           countere type c value 0,
           counters type c value 0.
    PARAMETER: p_file TYPE ibipparms-path obligatory." Needed to upload the file
    At selection-screen on value-request  for p_file.
      Perform get_file.
    start-of-selection.
      perform file_upload.
      Perform split_itab.
    ****************************************KL01
    loop at itab_KL01.
    refresh  bdcdata.
      perform bdc_dynpro      using 'SAPLKMA6' '0200'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'CSLAZ-LSTAR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'CSLAZ-KOKRS'
                                    '1000'.
      perform bdc_field       using 'CSLAZ-LSTAR'
                                     itab_KL01-KL01_LSTAR .
      perform bdc_field       using 'CSLAZ-DATAB_ANFO'
                                     itab_KL01-KL01_DATAB_ANFO.
      perform bdc_field       using 'CSLAZ-DATBI_ANFO'
                                    '31.12.9999'.
      perform bdc_dynpro      using 'SAPLKMA6' '0299'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BU'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'CSLAZ-TARKZ'.
      perform bdc_field       using 'CSLAZ-KTEXT'
                                    itab_KL01-KL01_KTEXT.
      perform bdc_field       using 'CSLAZ-LTEXT'
                                    itab_KL01-KL01_LTEXT.
      perform bdc_field       using 'CSLAZ-LEINH_CHAR'
                                     itab_KL01-KL01_LEINH_CHAR.
      perform bdc_field       using 'CSLAZ-KSTTY'
                                     itab_KL01-KL01_KSTTY.
      perform bdc_field       using 'CSLAZ-LATYP'
                                     itab_KL01-KL01_LATYP.
      perform bdc_field       using 'CSLAZ-VKSTA'
                                     itab_KL01-KL01_VKSTA .
    call transaction 'KL01' using BDCDATA MODE 'A' update 's' messages into message .
    If sy-subrc eq 0.
    counters = counters + 1.
    else.
    countere = countere + 1 .
          perform error_msg.
          wa_error_itab-msg = v_msg.
          append  wa_error_itab-msg to error_itab.
          clear  wa_error_itab-msg.
    endif.
    Endloop.
    Loop at itab_KP26.
    refresh  bdcdata.
      perform bdc_dynpro      using 'SAPLSPO4' '0300'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'SVALD-VALUE(01)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=FURT'.
      perform bdc_field       using 'SVALD-VALUE(01)'
                                    '1000'.
      perform bdc_dynpro      using 'SAPLKPP0' '1000'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'KPP0B-VALUE(09)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=CSUB'.
      perform bdc_field       using 'KPP1B-ONLY'
                                    'X'.
      perform bdc_field       using 'KPP0B-VALUE(01)'
                                     itab_KP26-KP26_VERSN .
      perform bdc_field       using 'KPP0B-VALUE(02)'
                                    itab_KP26-KP26_PERBL.
      perform bdc_field       using 'KPP0B-VALUE(03)'
                                     itab_KP26-KP26_PERBL1 .
      perform bdc_field       using 'KPP0B-VALUE(04)'
                                    itab_KP26-KP26_GJAHR  .
      perform bdc_field       using 'KPP0B-VALUE(06)'
                                     itab_KP26-KP26_KOSTL .
      perform bdc_field       using 'KPP0B-VALUE(09)'
                                     itab_KP26-KP26_LSTAR.
      perform bdc_dynpro      using 'SAPLKPP2' '0112'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'K-BK_0403'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=CBUC'.
      perform bdc_field       using 'Z-BDC08(01)'
                                    itab_KP26-KP26_TKV  .
    call transaction 'KP26' using BDCDATA MODE 'A' update 'S' messages into message .
    If sy-subrc eq 0.
    counters = counters + 1.
    else.
    countere = countere + 1 .
          perform error_msg.
          wa_error_itab-msg = v_msg.
          append  wa_error_itab-msg to error_itab.
          clear  wa_error_itab-msg.
    endif.
    Endloop.
    counter = countere + counters.
      write /: 'Total Number of Records is',counter .
      Write /: 'Total Number of Successfull records',counters.
      Write /: 'Total Number of error records',countere.
      If countere GT 0.
        Write :/'The error out record message are'.
        Loop at error_itab.
          write:/ error_itab-msg.
        Endloop.
    Endif.
    *&      Form  file_upload
          text
    -->  p1        text
    <--  p2        text
    FORM file_upload .
      v_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = v_file
          FILETYPE                = 'ASC'
          HAS_FIELD_SEPARATOR     = l_v_tab
        TABLES
          DATA_TAB                = itab_main
        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.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " file_upload
    *&      Form  split_itab
          text
    -->  p1        text
    <--  p2        text
    FORM split_itab .
      loop at itab_main.
    MOVE     itab_main-LSTAR       TO  itab_KL01-KL01_LSTAR.
    MOVE     itab_main-DATAB_ANFO  TO itab_KL01-KL01_DATAB_ANFO.
    MOVE     itab_main-KTEXT       TO itab_KL01-KL01_KTEXT.
    MOVE     itab_main-LTEXT       TO itab_KL01-KL01_LTEXT.
    MOVE     itab_main-LEINH_CHAR  TO itab_KL01-KL01_LEINH_CHAR.
    MOVE     itab_main-KSTTY       TO itab_KL01-KL01_KSTTY.
    MOVE     itab_main-LATYP       TO itab_KL01-KL01_LATYP.
    MOVE     itab_main-VKSTA       TO itab_KL01-KL01_VKSTA.
    MOVE     itab_main-VERSN       TO itab_KP26-KP26_VERSN.
    MOVE     itab_main-PERBL       TO itab_KP26-KP26_PERBL.
    MOVE     itab_main-PERBL1      TO itab_KP26-KP26_PERBL1.
    MOVE     itab_main-GJAHR       TO itab_KP26-KP26_GJAHR.
    MOVE     itab_main-KOSTL       TO itab_KP26-KP26_KOSTL.
    MOVE     itab_main-LSTAR1      TO itab_KP26-KP26_LSTAR.
    MOVE     itab_main-TKV         TO itab_KP26-KP26_TKV.
    APPEND itab_KL01.
    APPEND itab_KP26.
    CLEAR itab_KL01.
    CLEAR itab_KP26.
      endloop.
    ENDFORM.                    " split_itab
    *&      Form  get_file
          text
    -->  p1        text
    <--  p2        text
    FORM get_file .
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = SYST-CPROG
       DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = p_file.
    ENDFORM.                    " get_file
           Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      append bdcdata.
    endform.                    "bdc_dynpro
           Insert field                                                  *
    form bdc_field using fnam fval.
      if fval <> space.
        clear bdcdata.
        bdcdata-fnam = fnam.
        bdcdata-fval = fval.
        append bdcdata.
      endif.
    endform.                    "bdc_field
    *&      Form  error_msg
          text
    -->  p1        text
    <--  p2        text
    FORM error_msg .
      call function 'FORMAT_MESSAGE'
        EXPORTING
          id        = sy-msgid
          lang      = 'E'
        IMPORTING
          msg       = v_msg
        EXCEPTIONS
          not_found = 1
          others    = 2.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    ENDFORM.                    " error_msg

    Hi ,
    I am having problems .In one BDC program that i have written. The data is plopulating the first tcode screens i.e of T Code KL01  but its not populating screen of  TCode  KP26.
    Please can you let me the reason why the screen of t code KP26 is not getting populated correctly .
    please help  me with directions of where i am going wrong
    The code is below .
    report ZPM_ACTIVITY_UPLOAD
           no standard page heading line-size 255.
    *include bdcrecx1.
    ***************DATA DECLARATION**************************
    DATA : message like  bdcmsgcoll occurs 0.
    DATA : bdcdata type standard table of bdcdata with header line .
    data : file type string,
            v_msg(255).
    DATA:Begin of itab_main occurs 0,
      LSTAR      type  CSLAZ-LSTAR,
      DATAB_ANFO(10),
    DATAB_ANFO type CSLAZ-DATAB_ANFO,
      KTEXT      type CSLAZ-KTEXT,
      LTEXT      type CSLAZ-LTEXT,
      LEINH_CHAR type CSLAZ-LEINH_CHAR,
      KSTTY      type CSLAZ-KSTTY,
      LATYP      type CSLAZ-LATYP,
      VKSTA      type CSLAZ-VKSTA,
      VERSN      type CCSS-VERSN,
      PERBL      type RKPLN-PERBL,
      PERBL1      type RKPLN-PERBL,
      GJAHR      type CCSS-GJAHR,
      KOSTL      type CCSS-KOSTL,
      LSTAR1      type CCSS-LSTAR,
      TKV        type RKPLN-TKV,
    End of itab_main.
    Data :v_file type string.
    Data :Begin of itab_KL01 occurs 0,
                KL01_LSTAR      type  CSLAZ-LSTAR,
                KL01_DATAB_ANFO(10),             " type CSLAZ-DATAB_ANFO,
               KL01_DATAB_ANFO type CSLAZ-DATAB_ANFO,
                KL01_KTEXT      type CSLAZ-KTEXT,
                KL01_LTEXT      type CSLAZ-LTEXT,
                KL01_LEINH_CHAR type CSLAZ-LEINH_CHAR,
                KL01_KSTTY      type CSLAZ-KSTTY,
                KL01_LATYP      type CSLAZ-LATYP,
                KL01_VKSTA      type CSLAZ-VKSTA,
           End of itab_KL01.
    Data : Begin of error_itab occurs 0,
            msg(255),
           End of error_itab.
    Data :wa_error_itab like line of error_itab.
    Data : Begin of itab_KP26 occurs 0,
               KP26_VERSN      type CCSS-VERSN,
               KP26_PERBL      type RKPLN-PERBL,
               KP26_PERBL1     type RKPLN-PERBL,
               KP26_GJAHR      type CCSS-GJAHR,
               KP26_KOSTL      type CCSS-KOSTL,
               KP26_LSTAR      type CCSS-LSTAR,
               KP26_TKV        type RKPLN-TKV,
           End of itab_KP26.
    data : l_v_tab type abap_char1
                     value cl_abap_char_utilities=>horizontal_tab.
    data : counter type c value 0,
           countere type c value 0,
           counters type c value 0.
    PARAMETER: p_file TYPE ibipparms-path obligatory." Needed to upload the file
    At selection-screen on value-request  for p_file.
      Perform get_file.
    start-of-selection.
      perform file_upload.
      Perform split_itab.
    ****************************************KL01
    loop at itab_KL01.
    refresh  bdcdata.
      perform bdc_dynpro      using 'SAPLKMA6' '0200'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'CSLAZ-LSTAR'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
      perform bdc_field       using 'CSLAZ-KOKRS'
                                    '1000'.
      perform bdc_field       using 'CSLAZ-LSTAR'
                                     itab_KL01-KL01_LSTAR .
      perform bdc_field       using 'CSLAZ-DATAB_ANFO'
                                     itab_KL01-KL01_DATAB_ANFO.
      perform bdc_field       using 'CSLAZ-DATBI_ANFO'
                                    '31.12.9999'.
      perform bdc_dynpro      using 'SAPLKMA6' '0299'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=BU'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'CSLAZ-TARKZ'.
      perform bdc_field       using 'CSLAZ-KTEXT'
                                    itab_KL01-KL01_KTEXT.
      perform bdc_field       using 'CSLAZ-LTEXT'
                                    itab_KL01-KL01_LTEXT.
      perform bdc_field       using 'CSLAZ-LEINH_CHAR'
                                     itab_KL01-KL01_LEINH_CHAR.
      perform bdc_field       using 'CSLAZ-KSTTY'
                                     itab_KL01-KL01_KSTTY.
      perform bdc_field       using 'CSLAZ-LATYP'
                                     itab_KL01-KL01_LATYP.
      perform bdc_field       using 'CSLAZ-VKSTA'
                                     itab_KL01-KL01_VKSTA .
    call transaction 'KL01' using BDCDATA MODE 'A' update 's' messages into message .
    If sy-subrc eq 0.
    counters = counters + 1.
    else.
    countere = countere + 1 .
          perform error_msg.
          wa_error_itab-msg = v_msg.
          append  wa_error_itab-msg to error_itab.
          clear  wa_error_itab-msg.
    endif.
    Endloop.
    Loop at itab_KP26.
    refresh  bdcdata.
      perform bdc_dynpro      using 'SAPLSPO4' '0300'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'SVALD-VALUE(01)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=FURT'.
      perform bdc_field       using 'SVALD-VALUE(01)'
                                    '1000'.
      perform bdc_dynpro      using 'SAPLKPP0' '1000'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'KPP0B-VALUE(09)'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=CSUB'.
      perform bdc_field       using 'KPP1B-ONLY'
                                    'X'.
      perform bdc_field       using 'KPP0B-VALUE(01)'
                                     itab_KP26-KP26_VERSN .
      perform bdc_field       using 'KPP0B-VALUE(02)'
                                    itab_KP26-KP26_PERBL.
      perform bdc_field       using 'KPP0B-VALUE(03)'
                                     itab_KP26-KP26_PERBL1 .
      perform bdc_field       using 'KPP0B-VALUE(04)'
                                    itab_KP26-KP26_GJAHR  .
      perform bdc_field       using 'KPP0B-VALUE(06)'
                                     itab_KP26-KP26_KOSTL .
      perform bdc_field       using 'KPP0B-VALUE(09)'
                                     itab_KP26-KP26_LSTAR.
      perform bdc_dynpro      using 'SAPLKPP2' '0112'.
      perform bdc_field       using 'BDC_CURSOR'
                                    'K-BK_0403'.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=CBUC'.
      perform bdc_field       using 'Z-BDC08(01)'
                                    itab_KP26-KP26_TKV  .
    call transaction 'KP26' using BDCDATA MODE 'A' update 'S' messages into message .
    If sy-subrc eq 0.
    counters = counters + 1.
    else.
    countere = countere + 1 .
          perform error_msg.
          wa_error_itab-msg = v_msg.
          append  wa_error_itab-msg to error_itab.
          clear  wa_error_itab-msg.
    endif.
    Endloop.
    counter = countere + counters.
      write /: 'Total Number of Records is',counter .
      Write /: 'Total Number of Successfull records',counters.
      Write /: 'Total Number of error records',countere.
      If countere GT 0.
        Write :/'The error out record message are'.
        Loop at error_itab.
          write:/ error_itab-msg.
        Endloop.
    Endif.
    *&      Form  file_upload
          text
    -->  p1        text
    <--  p2        text
    FORM file_upload .
      v_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = v_file
          FILETYPE                = 'ASC'
          HAS_FIELD_SEPARATOR     = l_v_tab
        TABLES
          DATA_TAB                = itab_main
        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.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " file_upload
    *&      Form  split_itab
          text
    -->  p1        text
    <--  p2        text
    FORM split_itab .
      loop at itab_main.
    MOVE     itab_main-LSTAR       TO  itab_KL01-KL01_LSTAR.
    MOVE     itab_main-DATAB_ANFO  TO itab_KL01-KL01_DATAB_ANFO.
    MOVE     itab_main-KTEXT       TO itab_KL01-KL01_KTEXT.
    MOVE     itab_main-LTEXT       TO itab_KL01-KL01_LTEXT.
    MOVE     itab_main-LEINH_CHAR  TO itab_KL01-KL01_LEINH_CHAR.
    MOVE     itab_main-KSTTY       TO itab_KL01-KL01_KSTTY.
    MOVE     itab_main-LATYP       TO itab_KL01-KL01_LATYP.
    MOVE     itab_main-VKSTA       TO itab_KL01-KL01_VKSTA.
    MOVE     itab_main-VERSN       TO itab_KP26-KP26_VERSN.
    MOVE     itab_main-PERBL       TO itab_KP26-KP26_PERBL.
    MOVE     itab_main-PERBL1      TO itab_KP26-KP26_PERBL1.
    MOVE     itab_main-GJAHR       TO itab_KP26-KP26_GJAHR.
    MOVE     itab_main-KOSTL       TO itab_KP26-KP26_KOSTL.
    MOVE     itab_main-LSTAR1      TO itab_KP26-KP26_LSTAR.
    MOVE     itab_main-TKV         TO itab_KP26-KP26_TKV.
    APPEND itab_KL01.
    APPEND itab_KP26.
    CLEAR itab_KL01.
    CLEAR itab_KP26.
      endloop.
    ENDFORM.                    " split_itab
    *&      Form  get_file
          text
    -->  p1        text
    <--  p2        text
    FORM get_file .
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = SYST-CPROG
       DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = p_file.
    ENDFORM.                    " get_file
           Start new screen                                              *
    form bdc_dynpro using program dynpro.
      clear bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      append bdcdata.
    endform.                    "bdc_dynpro
           Insert field                                                  *
    form bdc_field using fnam fval.
      if fval <> space.
        clear bdcdata.
        bdcdata-fnam = fnam.
        bdcdata-fval = fval.
        append bdcdata.
      endif.
    endform.                    "bdc_field
    *&      Form  error_msg
          text
    -->  p1        text
    <--  p2        text
    FORM error_msg .
      call function 'FORMAT_MESSAGE'
        EXPORTING
          id        = sy-msgid
          lang      = 'E'
        IMPORTING
          msg       = v_msg
        EXCEPTIONS
          not_found = 1
          others    = 2.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    ENDFORM.                    " error_msg

  • Regarding bdc(views problem in mm01 while uploading the data)

    hi experts,
    i have coded a bdc in which i m using mm01 and extending the material to the different plant ,but here in some cases depending upon the material the views get changed for solving this i have to deselect and again select the views which i want and also i have to provide the valuation type for this material, so plz suggest me how to rectifie the views problem.......

    Ravi,
      Do one thing.Develop some temporary BDC programs for different material  with required views.
    Finally develop a final program.In that internal table loop ,put case statement on material
    when 'mat1'  .
        take the relevant code from above temporary progarms and copy here.
    when '2'.
    endcase.
    At last delete all temporary programs.
    Hope your problem will get solved
    Don't forget to reward if useful.

  • To eliminate the duplicate entries while looping into final internal table

    Hi friends,
    IAam facing the follwoing problem.
    Get Shipment for the Delivery number
          SELECT tknum
                 vbeln
                 INTO TABLE lt_vttp
                 FROM vttp
                 FOR ALL ENTRIES IN lt_vbfa
                 WHERE vbeln = lt_vbfa-vbelv.
        IF sy-subrc EQ 0.
          SELECT vbeln kunnr
                 FROM likp
                 INTO TABLE lt_likp
                 FOR ALL ENTRIES IN lt_vttp
                 WHERE vbeln = lt_vttp-vbeln.
      endif.
    now iam my internal table lt_vttp i have following values
       shipment             delivery
          1000                  2000
          1000                 2001
    in my internal table lt_likp i have the follwoing values
          delivery              shipto
           2000                  ABC
           2001                  ABC
    now iam looping those values in a final internal table.
      LOOP AT lt_likp INTO ls_likp.
        CHECK sy-subrc EQ 0.
         READ TABLE lt_vttp INTO ls_vttp WITH KEY vbeln = ls_likp-vbeln BINARY SEARCH.
        CHECK sy-subrc EQ 0.
             SELECT SINGLE * FROM vttk INTO ls_vttk
                    WHERE tknum = ls_vttp-tknum.
                  CHECK sy-subrc EQ 0.
                APPEND ls_vttk TO lt_vttk.
       endloop.
    Now my problem is if the shipment is same and the shipto is same then need to eliminate the duplicate records.
            in internal table iam getting 2records with same shipment and shipto combination.
           but instead if both the shipment and shipto are same then i should elimate the duplicate entries.
    and for the same shipment if i have differnt shipto then i neeed those 2 value.
    can any body tell me how can i get that.
    Regards
    Priyanka.

    Hi Priyanka,
    In your code you are using seelct statement inside the loop which will affect the performance.
    So, declare a another internal table which contains your both shipment and shipto elements with other required fields, say the name is lt_new.
    sort lt_new by shipment shipto.
    delete adjacent duplicates from lt_new comparing shipment shipto.
    "then use for all entries to choose values from VTTK.
    Hope this helps you.
    Regards,
    Manoj Kumar P

  • Game center registration loop problem

    I have tried to reigister for the game center with my Apple ID and the message that the Apple ID has not been used in Game center... I tap continue. I enter my location, then my date of Birth.
    After this I get the same message again. "This Aplle ID has not yet been used in Game center" and i'm asked to enter my location again and then DOB and then I go back to the same message. I can't get past this loop.
    (I have tried turing up phone off and on again, and it still does not work)
    can any one help me ?

    I had exactly the same problem on my sons ipod 4th gen.
    I tried logging on using my phone and it worked fine.

  • Infinite loop problem

    Hi there,
    This is the second time I have posted this problem, as the last solution I was offered did not seem to work. Here is the problem:
    I have written a method to search through a text file for a word and replace it with another word. That word can either be on its own in the document or as part of another word. So, if the search word was "foot" and the replace word was "dog", the word "football" in the document would become "dogball".
    This method works fine, except for when the replace word is the same as the search word. Basically, if someone searched for "dog" and wanted to replace it with "dog dog" or even just "dog", the program goes into an infinite loop. I understand why it is doing this, but I don't know how to prevent it from happening.
    Now, to make it worse I have to stick to this array style structure and method of solving the problem. I know there is a way to do this by building temporary strings and then concatenating them at the end and returning them to their previous position in the array. The reason I know this is because a friend of mine has managed it. She also happens to be a girl.
    So, I am asking you all to assist in defending men's intelligence by helping me see where I am going wrong in this method. Please.
    Here is the method:
    // Search the document for a string and replace it with another string        
         public String [] SearchReplace() {
              // Declare variables to be used in the method
              String SecondSubstring;
              String FirstSubstring;
              int ReplaceNumber = 0;
              // Loop through the lines of text stored as strings contained in the array
              for (int i = 0; i < NumberOfLines; i++) {
                        // As long as the string contains an instance of the search string, run the method                    
                        while (StrArray.indexOf(SearchW) >= 0) {
                             // Make a string of all the characters after the search word
                             SecondSubstring = StrArray[i].substring(StrArray[i].indexOf(SearchW) + SearchW.length());
                             // Make a string of all the characters before the search word
                             FirstSubstring = StrArray[i].substring(0, StrArray[i].indexOf(SearchW));
                             // Concatenate FirstSubstring with the replace word to make a new string
                             String FirstHalf = FirstSubstring.concat(ReplaceW);
                             // Concatenate the new string with SecondSubstring to make the whole replaced string
                             String FullString = FirstHalf.concat(SecondSubstring);
                             // Put this altered string back to its original place in the array
                             StrArray[i] = FullString;
                             // Increment ReplaceNumber to count the replacements made
                             ReplaceNumber++;
              // Print the numbers of replacements made
              System.out.println("\nA total of " + ReplaceNumber + " changes made.\n");
              // Display the searched and replaced contents of the file
              return StrArray;
    Any suggestions, pointers or solutions would be much appreciated.
    Thanks very much.

    Doing it the "old fashioned" way:
    You need to keep track of a "from index" so you don't search through parts of the string you've already replaced:
           public static void main(String args[]) {          
              try {     
                   String[] lines = new String[] {
                        "the dog went up the dog hill",
                        "all dogs go to dog heaven",
                        "the dogball takes place on 3rd april"
                   lines = replace(lines, "dog", "dog dog");
                   for (int i = 0; i < lines.length; i++) {
                        System.out.println(lines);
              } catch (Exception e) {
                   e.printStackTrace();
         private static String[] replace(String[] lines, String searchWord, String replaceWord) {
              if (searchWord.equals(replaceWord)) return lines; // nothing to do          
              for (int i = 0; i < lines.length; i++) {
                   int fromIndex = 0; // from index to do indexOf
                   String line = lines[i];
                   while (line.indexOf(searchWord, fromIndex) != -1) {
                        final int index = line.indexOf(searchWord, fromIndex);
                        line = line.substring(0, index) + replaceWord + line.substring(index + searchWord.length());
                        fromIndex = (line.substring(0, index) + replaceWord).length();
                   lines[i] = line; // replace
              return lines;

  • While loop problem

    I have a problem with a while loop in this code and it is really holding me up doing my degree. I can see nothing wrong with it but perhaps someone here can help. I would be really greatful if someone could. I have commented the line where the while loop starts about a third of the way down the code.
    Thanks
    Michael
    if (ae.getSource()==client_open)
    int row=0;
    check=true;
    row=client_listing.getSelectedRow();
    try
    System.out.println("information[row][1] is "+information[row][1]);
    if(information[row][1]!=null) //if the index is not null. Comment out this if statement to troubleshoot
    try
    InetAddress inet=InetAddress.getByName(information[row][1]);
    //Create a client socket on the listeners machone on port 7070
    client_socket=new Socket(inet,7070);
    System.out.println("Client port open on 7070 ");
    //Get the output as well as the input streams on that socket
    BufferedOutputStream out=new BufferedOutputStream(client_socket.getOutputStream());
    BufferedInputStream br_socket=new BufferedInputStream(client_socket.getInputStream());
    XMLWriter writer=new XMLWriter();
    writer.requestFString("SHOWFILES"," ");
    String file_data=writer.returnRequest();
    byte file_bytes[]=file_data.getBytes();
    int file_size=file_bytes.length;
    byte b[]=new byte[1024];
    // The methos takes a byte array and it's length as parameters and return
    // a byte array of length 1024 bytes....
    add_on upload=new add_on();
    System.out.println("Class of add_on created sucessfully");
    b=upload.appropriatelength(file_bytes,file_size);
    out.write(b,0,1024);
    /*An output stream is also initialised. This is used to store all the response
    from the listener */
    BufferedOutputStream out_file=new BufferedOutputStream(new FileOutputStream("response.xml"));
    int y=0;
    byte f[]=new byte[32];
    System.out.println("Entering while loop");
    //This while loop is not working. Any ideas. It just hangs here
    while((y=br_socket.read(f,0,32))>0) //the socket input stream is read
    out_file.write(f,0,y); //written on to the file output stream, y bytes from f start @ ofset 0
    out.close();
    br_socket.close();
    out_file.close();
    System.out.println("Exited while loop and closed streams");
    catch(Exception e)
    client_socket=null;
    check=false;
    System.out.println("Didnt enter try");
    try
    client_socket.close();
    catch(Exception e)
    System.out.println("Error occuered "+e.getMessage());
    row=0;
    if(check) //If the exception occurs then do not come here
    Vector parameters=new Vector();
    // A class SParser is also used here this class has a function/method of
    // the name perform which calls the xml parser to parse the xml file
    // generated by the response from the client soket...
    // the function perform returns a Vector which has the files/directories,
    // along with their flag information and size in case of files....
    SParser sp=new SParser();
    System.out.println("SParser object created sucessfully");
    parameters=sp.perform("response.xml");
    System.out.println("Parsing finished ");
    // The vector value returned by the xml parseris then passed as one of
    // the parameters to a class named file_gui this class is responsible for
    // displaying GUI consisting of a table and some buttons along with the
    // root information and flag..
    // Initially since the class is called for the first time the parameter
    // for the root is given the name "ROOT" and the Flag is set to "0"..
    file_gui showfiles=new file_gui(parameters,information[row][1],"Root","0");
    showfiles.show();
    check=false;
    } //end if
    } // end if
    } //end try
    catch(Exception e)
    row=0;
    } //end of ae.getSource()

    Why do you think it hangs at the while loop, eh? You need to put in additional printlns to justify your assertion. It takes alot less time to diagnose if you put in specific try/catch blocks with their own printlns - even if it is not as much fun. When you get into these kinds of troubles, there is no shame in putting in prints at each statement or logical point to track down the actual fault.
    ~Bill

Maybe you are looking for

  • Can you seriously not use IE on a Mac??

    I tried to apply online for an important job today. The website said that I could not access the page since the browser wasn't supported (I use Safari, obviously). They said the webpage required IE 6. I researched how one must download IE for an Appl

  • Can I download / create a gallery template in PE7

    Hello, I am export my albums to my website (via FTP) but was wondering whether you could download or create any new gallery templates which can be uploaded. I actually want a basic thumbnail view? Any help would be appreciated. Regards, Alvin Deen

  • How do I change the default site for a new tab?

    I want to change the page that opens when I open a new tab. I followed the answer that was given for the "how do I change which website that opens when I open a new tab?" question (4/5/14, given by ideato to emmafrom), without success. (The steps adv

  • AT new in ALV

    Hello every one, got an issue with at new in ALV. I need to get  individial sum for each employee. So what ever the amount sub total is for emploee 8361 it should be displayed first b4 it proceeds for next employee 8375. How to go about it. Employe 

  • Can't enable 3d in Photoshop anymore.

    I was able to do it yesterday, but for some reason the option is greyed out in the menu. Everything is turned on and my settings have been reset. I don't know what's going on.