ShowInputDialog as condition in a loop

Hi,
I'm trying to do a loop that pops out showInputDialog
The loop should stop when user presses Cancel or the "X" button on the dialog ;[
Any idea how this could be done ?
something like
String input = "";
while((input = JOptionPane.showInputDialog("some text: ")) != ???)
what should I compare it to ?
non of the JOptionPane.CANCEL_OPTION or JOptionPane.CLOSE_OPTION work as InputDialog returns a String not an Integer ;(
So my question is how can I break the loop using the 'cancel' or 'x' button on the dialog ???
Help !
Edited by: pimpcane on Nov 15, 2007 12:12 PM

Would something like this work?
import javax.swing.JOptionPane;
public class Fubar
    public static void main(String[] args)
        String input = "";
        boolean inputDone = false;
        while (!inputDone)
            input = JOptionPane.showInputDialog("This is some text");
            if (input != null)
                // do what you want to do with the input
                System.out.println(input);
            else
                // tell the while loop: "OK, I'm done"
                inputDone = true;
}Also, when posting your code, please use code tags so that your code will be well-formatted and readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag [code] at the top of your block of code and the tag [/code] at the bottom, like so:
[code]
  // your code block goes here.
[/code]good luck, pete

Similar Messages

  • Should the condition in the loop step

    Should the condition in the loop step in the integration process(BPM) be = or not= ?I need to do the following>>perform certain operation only when the container value is less than 3 Else then get out of the loop.
    Regards,
    Mansi

    The loop step in ccBPM implements a while loop.
    So, while count not = 3, it will be executed.
    Once the counter reachs 3, the loop will be terminated.
    Regards,
    Henrique.

  • How do I make something happen only once on a true condition in a loop

    So I have a way of doing this, but it uses a dreaded local variable, and seems to me that it might be unreliable.
    What I want to happen is to have something happen only once on a condition that will remain true. What I need is to set something after a given amount of time, but I only want to set it once after that time has been reached. Problem is, if I use a range, it could be true more than once, if I use a greater than, it'll be true every time after the set time, and if I use an equal, there's no way to know that the particular millisecond value will even appear in the loop.
    Maybe I'm wrong in even using those comparison functions... Any ideas would be greatly appreciated. See the attached vi for a better look at what I'm trying to do... (v7.0)
    Thanks,
    Geoff
    Attachments:
    Question.vi ‏16 KB

    The "Idle" state that the help file refers to is the "non-running"
    state. The Top Level VI must end execution before any "First Time" VIs will
    return TRUE after being called initially.
    Therefore, if your application calls a subVI at the beginning of the
    Test portion, on the next iteration of the loop it will return FALSE
    from that subVI, since your main VI never stopped running, and received
    a TRUE from the "First Time" on the initial test loop.
    If you have code that you want to execute only on the first run of your
    entire program, "First Time" should work fine. If you have code that
    you only want to execute on the first iteration of just the Test loop,
    the "First Time" VI is not ideal.
    I think that shift registers are going to provide the best solution,
    however you mentioned that for your particular application that is not
    ideal. Could you describe a little bit more why shift registers are
    problematic?
    Thanks Geoff, let us know.
    DWeiland
    Applications Engineer
    National Instruments
    www.ni.com/support
    Dan Weiland

  • About exit condition in a loop

    I have this loop,
    loop
       exit when months_between(sysdate,cur_st)<0;
    end loop;is it possible i can modify the exit condition by adding a OR keyword into it?:
    e.g.exit when months_between(sysdate,cur_st)<0 OR dbms_random.value(0,1)=0thanks in advance

    Moreover, you can use LOOP ... IF... THEN exit; END IF; ... END LOOP or WHILE... LOOP...END LOOP
    A try has never been wrong indeed.
    Nicolas.
    Message was edited by:
    N. Gasparotto

  • Condition WHERE in LOOP

    Good afternoon,
    I have the following issue,
    I  have that do a LOOP to a table Internal, ie.
    Loop at it_tabla where lgart = '0100' or lgart = '0200' or lgart = '0300' or lgart = '0400' or lgart = '0500' or  lgart = '0600' or lgart = '0700' or lgart = '0800' .
    Endloop.
    The question is, Is there any way , in the which not have that do many or  in the sentence LOOP?
    Kind regards.

    I think Rob means that it will go through the table once.
    It's true for Standard tables.  But as it says in the help on the WHERE clause.
    While with standard tables all rows of the internal table are checked for the logical expression of the WHERE- addition, with sorted tables and hash tables (as of Release 7.0) you can achieve optimized access by checking that at least the beginning part of the table key in sorted tables and the entire table key in hash tables is equal in the logical expression through queries linked with AND. Optimization also takes effect if the logical expression contains other queries linked with AND with arbitrary operators
    In this case though, the queries are linked with OR - so you still get all rows checked! 
    Now, if it_tabla is a sorted table with key lgart, then you could do the following:
    PERFORM read_the_table USING: '0100', '0200',...
    FORM read_the_table USING i_lgart TYPE ...
      data: l_tabix TYPE sytabix.
      READ TABLE it_table WITH TABLE KEY lgart =i_lgart TRANSPORTING NO FIELDS.
      l_tabix = sy-tabix.
      LOOP AT it_table FROM l_tabix INTO ls_wa.
        IF ls_wa-lgart NE i_lgart.
          EXIT.
        ENDIF.
        " Do stuff
      ENDLOOP.
    ENDFORM.
    matt

  • How do terminate a wait condition in a loop?

    I have a while loop that uses a Wait.vi to set the timing. When I terminate the loop, it waits for the next iteration of the "wait" to complete. How can I terminate the wait in the middle of an iteration?

    There is no way to stop a wait function. In order to get the behavior you want you need to make your own wait function, that uses the tick count VI and just checks to see if the total time has passed, or if you have asked it to stop.
    Take a look at the attached VI.
    Attachments:
    lv7_Wait_with_Stop.vi ‏21 KB

  • How to use i for if condition in a for i in loop?

    Hi friends,
    I have a question on how to use i for IF condition in a loop, in order to get an efficient programming and results. Here is outlined SQL:
    cursor is
    select c1,c2,c3 from table1; -- 100 rows returned.
    open cursor
    loop
    fetch c1,c2,c3 into v1,v2,v3;
    for i in 1..3 loop
    if 'v'||i between 90 and 100 then
    v_grade := 'Excellent';
    elsif 'v'||i between 80 and 89 then
    elsif 'v'||i between 50 and 59 then
    end if;
    end loop;
    close cursor;
    This way, I don't need to use a lot of if..then for hard code v1,v2,v3,.... actually I have more v..
    But Oracle gave an error of this usage of 'if 'v'||i' or 'v'||to_char(i).
    Thanks for any advice in advance!

    user508774 wrote:
    Thanks for comments and advices. But I didn't get your inputs clearly. Are you saying I don't need to use PL/SQL to achieve this?Correct. Ronel and John showed you the basic approaches. SQL is not a mere I/O language for making read and write calls. It is a very capable, flexible and powerful language. One can solve a problem with a few lines of SQL code, that will take 100's of lines of PL/SQL or Java code.
    So do not underestimate what can be done in SQL.
    v_cmd := 'UPDATE parts_categ_counts SET w1='||v1||', w2='||v2||...||v9||' WHERE seq='||vseq||';
    EXECUTE IMMEDIATE v_cmd;This code is also wrong. Besides the fact that there is no need for dynamic SQL, this approach creates a brand new SQL statement each loop iteration.
    SQL is source code. It needs to be parsed (compiled). The end result is an executable program that is called a cursor. This cursor needs to be stored in server memory (the SQL Shared Pool in the SGA).
    The problem with your code is that it is slow and expensive - it generates lots of unique SQL statements that need CPU for parsing and server memory for storage.
    These add up to a very significant performance overhead. That is the wrong approach. The correct approach is the same one that you would use in any other programming language.
    Let's say you need to use Java to process a bunch of CSV files - exact same CSV layout used by each file. A file needs to be read, processed, and a log file created.
    Will you write a Java program that loops through the files, for each file found, write a Java program for processing that file, compile it, then execute it?
    Or would you write a Java program that takes the name of the file as input, and then process that file and writes the log file?
    The 2nd approach provides a program that can process any of those CSV files - one simply needs to pass the filename as an input parameter.
    Your code and approach use the 1st method. Not the 2nd. And that is why it is wrong.
    To create a SQL program with parameters is done by using bind variables. Instead of
    v_cmd := 'UPDATE parts_categ_counts SET w1='||v1||', w2='||v2||...||v9||' WHERE seq='||vseq||';
    The following SQL source code should be created:
    v_cmd := 'UPDATE parts_categ_counts SET w1=:v1, w2=:v2 ..., w9=:v9 WHERE seq= :vseq';
    The tokens with the colon prefix (such as :v1), are bind variables. Think of these as the parameters to the SQL cursor.
    The server parses this SQL into a cursor. You can now execute the same cursor over and over again, using different bind variables. (just like the 2nd approach above that one would use in Java)
    In PL/SQL, this is made even easier as you can code native SQL code with PL/SQL code and use PL/SQL variables in it. The PL/SQL compiler is clever enough to do the SQL parsing, variable binding, and cursor execution for you. So in PL/SQL, you would use:
    UPDATE parts_categ_counts SET w1=v1, w2=v2 ..., w9=v9 WHERE seq= vseq;
    Where v1 and the others are PL/SQL variables.
    That all said - PL/SQL is only used for data crunching, when the processing of data is too complex for the SQL language to deal with. And this is very seldom the case.
    The main reason for using PL/SQL it to provide processing flow control, conditional processing and error handling, for SQL code. As the SQL language does not have these features.

  • About condition for loop in BPM

    I design a loop, condition is counter<>3.
    It seems only receives 3 messages when I send more than 3.
    for example, I send 105 messages, for every 10 messages it will generate a file. and I totally have 11 files.
    What is the best way to end the loop?

    Hey,
           you need to have two loops in this.
           Have your send step(for the file) in the inner loop.
            The condition for this loop will be te number of messages that you need per file.
          The outer loop should terminate when all the messages are recieved.(recieve step will be in the outer loop)
       This is not possible with the no. of messages
    You can do one thing, provide a stop message as an input along with the other messages.
    And set the condition for the outer loop for the stop message.
    This will terminate the outer loop.
    regards,
            Milan

  • Help with a while loop condition

    I'm trying to write to a File. I ask the user for input, then I enter a while loop and test the condition. The loop works, but it won't stop. I've tried everything. Here is my code please help!!
    thanks
    inputline = keyboard.readLine();//read the keyboard
    try{
    while( inputline != null ){
    DiskOut.println( inputline );
    DiskOut.flush();
    inputline = keyboard.readLine();//read the keyboard again
    }//end while
    }//end try
    catch (IOException e) { 
    e.printStackTrace();
    }//end catch
    also i've tried these while loop conditions:
    while(inputline != "\n" || inputline != "\r") and the sort

    while(inputline != "\n" || inputline != "\r")The condition
    X!=Y OR X!=Z (given Y != Z)
    is always true. X will always not be equal to at least one of the values. So you'll want to use:
    while(!inputline.equals("\n") && !inputline.equals("\r"))In other words, "while inputline is not equal to either of them". Note the use of && instead of ||.
    If "keyboard" is simply a BufferedReader on top of System.in (and not your own class), the trailing line feeds and carriage returns won't even be in the string returned by readLine(). Your best bet is this:
    while(null != inputline && 0 != inputline.length())Make sure you type the two parts of that AND condition in the order above. If for whatever reason there are trailing \r and \n on the strings, you'll want to accomodate for platforms that may include both characters.
    // trim the trailing newline characters
    while(inputline.endsWith("\r") ||
          inputline.endsWith("\n")) {
       inputline = inputline.substring(0,inputline.length()-1);
    // or maybe this will work if you don't mind losing
    //  the whitespace at the beginning of the string:
    inputline = inputline.trim();Hope that helps somewhat.

  • Why does a loop go faster if you add condition in it ?

    The other day I 've added a condition within a loop and I expected the code to go slower but it actually went faster !
    You add a condition and the loop goes faster ... that's not logical for me and I'd like to understand it so if you have an explanation please post it below.
    I've also discovered that this anomality happens only when the code is within a try-catch block.
    I've reproduced the phenomenon with this little example class.
    Try to comment and uncomment the only condition within the loop and to do the same for the exception. If you use the java 5 you should see similar results (haven't try with other JVM)
    public class Test {
        public Test() {}
        public static void main(String[] args) {
            Test t = new Test();
            t.execute();
         * With try-catch :
         *    with condition           ms = 2641  (faster)
         *    without condition        ms = 3047 
         * Without try-catch :
         *    with condition           ms = 2625 
         *    without condition        ms = 2515  (faster)
        public void execute() {
            try {
                int c = 0;
                long t1 = System.currentTimeMillis();
                for (int i = 0; i < 1000000000; i++) {
                    c++;
                    if (c == 0) {
                        c--;
                System.out.println(" ms = " + (System.currentTimeMillis() - t1) + "  " + c);
            } catch (Exception e) {
                e.printStackTrace();
    }

    The other day I 've added a condition within a loop
    and I expected the code to go slower but it actually
    went faster ! The try block has absolutely nothing to do with method speed (unless of course you throw exceptions.)
    Excluding that you ran one test with a condition where it was faster and one where it was slower.
    And what exactly else was running on your computer when you did this? A virus checker? Scheduled tasks? Editor? IDE? Database? Services (like network stacks?) All of those take time from the cpu. And if even one of them did anything at all when your test was running then it will change the results.

  • Conditional Loop Terminal and Autogrow

    When changing a for loop terminal from indexing to conditional, the for loop and any containing structures expand even when they are not set to Auto Grow.
    When selecting multiple conditional tunnels and and choosing Vertical Compress from the Distribute Objects menu, the tunnels are compressed as if they don't have condititonal terminals.
    Are either of these bugs known or corrected in LabVIEW 2013?  I could not find anything on NI.com when searching for "conditional tunnel autogrow".
    Thanks,
    Matt
    Attachments:
    Conditional Terminal Auto Grow bug.vi ‏6 KB

    Matt,
    A Very nice example of unexpected behaviour!
    Steps to reproduce:
    Open Matt's attachment in LabVIEW 2012  (12.0f3 Windows 32 on Win 7 64)
    Right-click the loop and verify Autogrow is not checked
    Right-click the top output tunnel and select Tunnel mode>>Conditional.   Loop does not respect the autogrow setting! 
    Lasso both output tunnels and Ctrl+D (or optionally, click Distribute items>>Vertical Compress)  Conditional glyphs are not respected in allignment
    Select the "Top" tunnel and Ctrl+Shift+J (Move to back)  What kind of tunnel is that now? I'd really hate to debug that one.
    Really Really hate to debug that one! Run VI Analizer! No overlapping objects!
    Sounds like a small oversight-- but a deadly potential for breaking code that is impossible to find without a divining rod!
    BOLO (Be on the lookout) for this type of bug.
    Jeff

  • Getting data from a while loop while running.

    Hello,
    I did a program that call a sub-VI which is doing experiment and have its own timer.
    The sub-VI is a while loop and the stop condition of this loop is the elapsed time of my timer.
    What I want to do is to be able to get the elapsed time in my main program during the execution of the sub-VI (every second of its execution).
    First I assign the elapsed time in the sub-VI as an output of it. But of course the elapsed time is only updated in the main VI only when the while loop has finished. So I tried several solution: property nodes, local variable, global variable.
    When I am using global variable, I can see the elapsed time being updated during the while loop when I open the global variable VI. But the result is always the same: in the main VI the elapsed time is only updated at the end of the while loop.
    I think that is the global variable is updated every time, I could be able to get its data to my main VI?
    Does anyone have an idea?
    Thank you,
    Meach

    I tried using shared variable and reference without succes.
    I will keep searching.
    I enclose my VI that I simplify the most but with still keeping the shape of my real program. If you can take a look I will really appreciate.
    The goal is on the top-level VI to be able to see the updating data time in real time.
    Thanks,
    Meach
    Message Edited by Meach on 07-23-2008 04:13 PM
    Message Edited by Meach on 07-23-2008 04:14 PM
    Attachments:
    Elapsed Time.zip ‏25 KB

  • Values in loops

    Hi. I have a while loop, that runs for some condition
    in this loop, i'm adding as many buttons as the condition holds.
    for each loop, i adds an action listener.
    the problem is when i want to use the action listener. it, of corse, respond to the last button in the loop. how can i make all the buttons work? i dont know ho many loops there will be, ergo i don't know how many buttons there will be... I mean, i have to store each of the values for later use, but how?
    read from file
    while (file is not empty)
    ImageButton = new ImageIcon (name from file);
    theButton = new JButton(imageButton);
    myPanel.add(theButton);
    theButton.addActionListener(this);
    buttonId = i++;
    in the action listener
    if (listener = theButton)
    //do something

    Hi. I have a while loop, that runs for some
    condition
    in this loop, i'm adding as many buttons as the
    condition holds.
    for each loop, i adds an action listener.
    the problem is when i want to use the action
    listener. it, of corse, respond to the last button in
    the loop. how can i make all the buttons work? i dont
    know ho many loops there will be, ergo i don't know
    how many buttons there will be... I mean, i have to
    store each of the values for later use, but how?[snip]
    in the action listener
    if (listener = theButton)
    //do somethingWhat is "listener" and "theButton" here? If you are only doing something for one particular button then that's the only button that will produce any action. You need to do something more like:// Determine which button was pressed
    // Do something (apologies if that's what you're doing already)
    Good Luck
    Lee

  • Action listeners and while loops

    Hi. I have a while loop, that runs for some condition
    in this loop, i'm adding as many buttons as the condition holds.
    for each loop, i adds an action listener.
    the problem is when i want to use the action listener. it, of corse, respond to the last button in the loop. how can i make all the buttons work? i dont know ho many loops there will be, ergo i don't know how many buttons there will be...
    read from file
    while (file is not empty)
    ImageButton = new ImageIcon (name from file);
    theButton = new JButton(imageButton);
    myPanel.add(theButton);
    theButton.addActionListener(this);
    buttonId = i++;
    in the action listener
    if (listener = theButton)
    //do something

    of corse it would only respond to the last button added, thats what you told it to do. In your while loop you assign the variable "theButton" to be a new JButton. Since "theButton" in reassigned with each iteration of your loop, it will always point to the last button you created. So, in your actionListener when you check if (listener = theButton) it will only know about the last button you added. You will need to find some other way of determining which button was pressed. One possible solution would be to have a unique actionListener for each button. Another option might be to cast the source of the action to a JButton. i.e.
    public void actionPerformed(ActionEvent e)  {
         if (e.getSource() instanceof JButton) {
              //do something
    }

  • Change Pricing Condition for an item with CRM_ORDER_MAINTAIN

    Hi community,
    I try to change an existing condition with the function module crm_order_maintain.
    Everything looks fine, no error no dump, but no success
    The condition stays the same!
    Can anybody find a solution for this?
    Heres my report so far:
    *& Report  ZTEST_PRICING2
    REPORT  ztest_pricing2.
    DATA: lt_guid      TYPE crmt_object_guid_tab,
          lt_item      TYPE crmt_object_guid_tab,
          lt_saved     TYPE crmt_return_objects,
          lt_pridoc    TYPE crmt_pric_cond_t,
          ls_pridoc    TYPE crmt_pric_cond,
          lt_pricom    TYPE crmt_pridoc_comt,
          ls_pricom    TYPE crmt_pridoc_com,
          lt_header    TYPE crmt_orderadm_h_comt,
          lt_input     TYPE crmt_input_field_tab,
          ls_input     TYPE crmt_input_field,
          ls_input_fn  TYPE CRMT_INPUT_FIELD_NAMES,
          ls_cond_chg  TYPE prct_cond_external_change,
          ls_cond      TYPE PRCT_COND_DU,
          lt_pricing_i TYPE CRMT_PRICING_I_WRKT.
    PARAMETERS: lv_head TYPE crmt_object_guid DEFAULT 'C4C61C4E35DDF306E10000000A024089'.
    PARAMETERS: lv_item TYPE crmt_object_guid DEFAULT '09C71C4E35DDF306E10000000A024089'.
    PARAMETERS: lv_kbetr TYPE prct_cond_rate DEFAULT '100'.
    INSERT lv_head INTO TABLE lt_guid.
    INSERT lv_item INTO TABLE lt_item.
    CALL FUNCTION 'CRM_ORDER_READ'
      EXPORTING
        it_header_guid                    = lt_guid
        it_item_guid                      = lt_item
    *   IV_MODE                           =
    *   IV_ONLY_SPEC_ITEMS                =
    *   IT_REQUESTED_OBJECTS              =
    *   IV_NO_AUTH_CHECK                  =
    *   IT_ITEM_USAGE_RANGE               =
    *   IV_SUBITEM_DEPTH                  = -1
    *   IT_OBJECT_FILTER                  =
    *   IV_ONLY_CHANGED_OBJ               = FALSE
    *   IV_STATUS_H_CHECK_RELEVANCE       = FALSE
      IMPORTING
        et_pridoc                         = lt_pridoc
        et_pricing_i                      = lt_pricing_i
    * CHANGING
    *   CV_LOG_HANDLE                     =
    EXCEPTIONS
       document_not_found                = 1
       error_occurred                    = 2
       document_locked                   = 3
       no_change_authority               = 4
       no_display_authority              = 5
       no_change_allowed                 = 6
       OTHERS                            = 7.
    IF sy-subrc <> 0 AND lt_pridoc IS NOT INITIAL.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    READ TABLE lt_pridoc INDEX 1 INTO ls_pridoc.
    IF sy-subrc <> 0.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    READ TABLE ls_pridoc-pric_cond INTO ls_cond WITH KEY kschl = 'PB00'.
    IF sy-subrc <> 0.
      WRITE: / 'ERROR'.
      EXIT.
    ENDIF.
    ls_input-ref_guid   = lv_head.
    ls_input-ref_kind   = 'A'.
    ls_input-objectname = 'PRIDOC'.
    ls_input_fn-fieldname = 'WAERS'.
    INSERT ls_input_fn INTO TABLE ls_input-field_names.
    ls_input_fn-fieldname = 'KBETR'.
    INSERT ls_input_fn INTO TABLE ls_input-field_names.
    INSERT ls_input INTO TABLE lt_input.
    ls_pricom-ref_guid   = lv_head.
    ls_pricom-ref_kind   = 'A'.
    *ls_pricom-PRICING_TYPE  = 'B'.
    *ls_pricom-pricing_procedure = 'ZZMTA'.
    ls_pricom-pric_cond[] = ls_pridoc-pric_cond[].
    MOVE-CORRESPONDING ls_cond TO ls_cond_chg.
    ls_cond_chg-waers = 'EUR'.
    ls_cond_chg-kbetr = lv_kbetr.
    INSERT ls_cond_chg INTO TABLE ls_pricom-cond_change.
    APPEND ls_pricom TO lt_pricom.
    CALL FUNCTION 'CRM_ORDER_MAINTAIN'
      EXPORTING
        it_pridoc         = lt_pricom
      CHANGING
    *    ct_orderadm_h     = lt_header
        ct_input_fields   = lt_input
      EXCEPTIONS
        error_occurred    = 1
        document_locked   = 2
        no_change_allowed = 3
        no_authority      = 4
        OTHERS            = 5.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.
    CALL FUNCTION 'CRM_ORDER_SAVE'
      EXPORTING
        it_objects_to_save         = lt_guid
      IMPORTING
        et_saved_objects           = lt_saved
    *   ET_EXCEPTION               =
    *   ET_OBJECTS_NOT_SAVED       =
    EXCEPTIONS
       document_not_saved         = 1
       OTHERS                     = 2.
    IF sy-subrc EQ 0.
      COMMIT WORK AND WAIT.
    ELSE.
      ROLLBACK WORK.
    ENDIF.
    regards
    Markus

    Hello Jordi,
    The example below is whereby i was trying to copy all the pricing condition on one document to another and deleting what's not present on the source document.
    You can used this piece of code to adapt your requirement.
    CALL FUNCTION 'ZCRC_FM_COPY_PRICE_COND_ALL'
              EXPORTING
    id_object_guid_src    = <fs_el_con_guid>
    id_object_guid_dest = <fs_el_so_guid>
    id_commit                  = abap_false
              EXCEPTIONS
    not_allowed         = 1
    error_occured     = 2
    OTHERS                 = 3.
      PERFORM f_recup_donnees USING     id_object_guid_src
                                                              id_object_guid_dest.
    PERFORM f_modif_condition_prix USING id_object_guid_src
                                                                                      id_object_guid_dest.
    PERFORM f_header_copy_pricing using id_object_guid_src
                                                                            id_object_guid_dest.
    FORM f_recup_donnees   USING      pd_object_guid_src TYPE crmt_object_guid
                                                                           pd_object_guid_dest TYPE crmt_object_guid.
      DATA:
         lt_header_guid        TYPE crmt_object_guid_tab.
      INSERT pd_object_guid_src  INTO TABLE lt_header_guid.
      INSERT pd_object_guid_dest INTO TABLE  lt_header_guid.
      CLEAR: gt_orderadm_i, gt_doc_flow.
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid       = lt_header_guid
        IMPORTING
          et_doc_flow          = gt_doc_flow            
          et_orderadm_i        = gt_orderadm_i
        EXCEPTIONS
          document_not_found   = 1
          error_occurred       = 2
          document_locked      = 3
          no_change_authority  = 4
          no_display_authority = 5
          no_change_allowed    = 6
          OTHERS               = 7.
      IF sy-subrc NE 0.
        RAISE error_occured.
      ENDIF.
    " F_RECUP_DONNEES
    FORM f_modif_condition_prix USING pd_guid_src TYPE crmt_object_guid
                                      pd_guid_dest TYPE crmt_object_guid.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              lt_cond_chg_insert   TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_cond_chg_tmp      TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_item_ret     TYPE prct_item_ret_t,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm,
             ld_lines        TYPE i,
             ld_ajout_cond   TYPE abap_bool.
      FIELD-SYMBOLS : <fs_orderadm_i_dest>  TYPE crmt_orderadm_i_wrk,
    <fs_orderadm_i_src>   TYPE crmt_orderadm_i_wrk,
                      <fs_cond_chg>         TYPE prct_cond_print,
    <fs_cond_chg_insert>  TYPE prct_cond_print.
    * Début Ajout CD1K904313-001.
      DATA: ld_guid_src  TYPE crmt_object_guid.
      FIELD-SYMBOLS: <fs_doc_flow>  TYPE crmt_doc_flow_wrk.
    * Début Ajout CD1K904313-001.
    * Verrouillage des documents source et destinataire
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
    iv_header_guid             = pd_guid_src
        IMPORTING
    ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
    error_occurred             = 1
    handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * A ne pas traiter les postes de type ZPDF
      DELETE  gt_orderadm_i WHERE itm_type = 'ZPDF'.
      LOOP AT gt_orderadm_i ASSIGNING <fs_orderadm_i_dest> WHERE header = pd_guid_dest.
        REFRESH : lt_komv_print_src,
                  lt_komv_print_dest,
    lt_cond_chg,
    lt_cond_chg_insert.
    * Début Modif CD1K904313-001.
    * Récupérer le guid de l'item liée au item destinataire.
        READ TABLE gt_doc_flow ASSIGNING <fs_doc_flow> WITH KEY objkey_b = <fs_orderadm_i_dest>-guid.
        CHECK sy-subrc EQ 0.
        ld_guid_src = <fs_doc_flow>-objkey_a.
    *    READ TABLE gt_orderadm_i ASSIGNING <fs_orderadm_i_src> WITH KEY header = pd_guid_src
    * number_int = <fs_orderadm_i_dest>-number_int.
    * Fin Modif CD1K904313-001.
    * Récupérer les pricing document
        IF sy-subrc EQ 0.
    *     Document source
          CALL FUNCTION 'PRC_PD_ITEM_SHOW'
            EXPORTING
              iv_pd_handle        = ld_pd_handle_src
    *         iv_item_no          = <fs_orderadm_i_src>-guid    "Supression CD1K904313-001
              iv_item_no          = ld_guid_src                 "Addition CD1K904313-001
            IMPORTING
              et_komv_print       = lt_komv_print_src
            EXCEPTIONS
              non_existing_handle = 1
              non_existing_item   = 2
              ipc_error           = 3
              OTHERS              = 4.
        ENDIF.
    *   Document destinataire
        CALL FUNCTION 'PRC_PD_ITEM_SHOW'
          EXPORTING
            iv_pd_handle        = ld_pd_handle_dest
            iv_item_no          = <fs_orderadm_i_dest>-guid
          IMPORTING
    et_komv_print       = lt_komv_print_dest
          EXCEPTIONS
            non_existing_handle = 1
            non_existing_item   = 2
            ipc_error           = 3
            OTHERS              = 4.
    * Modification et Suppression des conditions de prix
        LOOP AT lt_komv_print_dest INTO ls_komv_print_dest .
          CLEAR: ls_cond_chg,
                 ls_komv_print_src.
          MOVE-CORRESPONDING ls_komv_print_dest TO ls_cond_chg.
    * Rechercher la condition sur le document source
          READ TABLE lt_komv_print_src INTO ls_komv_print_src WITH KEY kschl = ls_komv_print_dest-kschl
    zaehk = ls_komv_print_dest-zaehk. "CD1K904313
          IF sy-subrc EQ 0.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
          ELSEIF ls_cond_chg-kschl IS NOT INITIAL.
            CLEAR ls_cond_chg.
            CONTINUE.
          ENDIF.
    *     Format décimal
          CASE gv_decimal.
            WHEN space.       "format N.NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            WHEN 'Y'.         "format N NNN NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
          ENDCASE.
          INSERT ls_cond_chg INTO TABLE lt_cond_chg.
          CLEAR ls_cond_chg.
        ENDLOOP.
    * Ajout des conditions de prix
        LOOP AT lt_komv_print_src INTO ls_komv_print_src WHERE kschl IS NOT INITIAL.
          CLEAR: ls_cond_chg, ld_lines, ls_komv_print_dest, ls_cond_chg_tmp, ld_ajout_cond.
    * Vérifier la présence de la condition sur le document destinataire
          READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk. "CD1K904313.
          IF sy-subrc EQ 0.
            CLEAR: ls_cond_chg, ls_komv_print_dest.
            CONTINUE.
          ELSE.
            DESCRIBE TABLE lt_cond_chg LINES ld_lines.
            READ TABLE lt_cond_chg INTO ls_cond_chg_tmp INDEX ld_lines.
            IF sy-subrc EQ 0.
              ld_ajout_cond = abap_true.
              MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
              ls_cond_chg-knumv     = ls_cond_chg_tmp-knumv.
              ls_cond_chg-kposn     = ls_cond_chg_tmp-kposn.
              ls_cond_chg-stunr     = ls_cond_chg_tmp-stunr + 10.
            ELSE.
              CLEAR: ls_cond_chg, ld_lines, ls_komv_print_dest, ls_cond_chg_tmp.
              CONTINUE.
            ENDIF.
          ENDIF.
    *     Format décimal
          CASE gv_decimal.
            WHEN space.             "format N.NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            WHEN 'Y'.               "format N NNN NNN,NN
              REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
          ENDCASE.
    * Récupérer les nouvelles conditions qui seront ajouté au document destinataire
          IF ld_ajout_cond EQ abap_true.
            INSERT ls_cond_chg INTO TABLE lt_cond_chg_insert.
          ENDIF.
          INSERT ls_cond_chg INTO TABLE lt_cond_chg.
          CLEAR ls_cond_chg.
        ENDLOOP.
        CALL FUNCTION 'PRC_INT_ITEM_INPUT'
          EXPORTING
            iv_pd_handle        = ld_pd_handle_dest
            iv_item_no          = <fs_orderadm_i_dest>-guid
            it_cond_prt         = lt_cond_chg
            iv_bal_log          = bal_log
            iv_req_ret          = abap_true
            iv_req_cond_prt     = abap_true
          IMPORTING
            et_item_ret         = lt_item_ret
            et_cond_prt         = lt_cond_ret
            ev_data_changed     = ld_data_changed
          EXCEPTIONS
            non_existing_handle = 1
            non_existing_item   = 2
            ipc_error           = 3.
        IF sy-subrc = 0.
    *     En cas d'ajout de nouvelles conditions de prix, appeler le MF PRC_INT_ITEM_INPUT
    *     avec les montants
          IF lt_cond_chg_insert IS NOT INITIAL.
            REFRESH lt_cond_chg[].
            lt_cond_chg[] = lt_cond_ret[].
            LOOP AT lt_cond_chg_insert ASSIGNING <fs_cond_chg_insert>.
              READ TABLE lt_cond_chg ASSIGNING <fs_cond_chg> WITH KEY kschl = <fs_cond_chg_insert>-kschl.
              IF sy-subrc EQ 0.
                <fs_cond_chg>-kwert     = <fs_cond_chg_insert>-kwert.
                <fs_cond_chg>-kbetr_prt = <fs_cond_chg_insert>-kbetr_prt.
              ENDIF.
            ENDLOOP.
            REFRESH lt_cond_ret[].
            CALL FUNCTION 'PRC_INT_ITEM_INPUT'
              EXPORTING
                iv_pd_handle        = ld_pd_handle_dest
                iv_item_no          = <fs_orderadm_i_dest>-guid
                it_cond_prt         = lt_cond_chg
                iv_bal_log          = bal_log
                iv_req_ret          = abap_true
                iv_req_cond_prt     = abap_true
              IMPORTING
                et_item_ret         = lt_item_ret
                et_cond_prt         = lt_cond_ret
                ev_data_changed     = ld_data_changed
              EXCEPTIONS
                non_existing_handle = 1
                non_existing_item   = 2
                ipc_error           = 3.
          ENDIF.
    *   Publish event afin de sauvegarder les conditions de prix
          CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
            EXPORTING
              iv_obj_name = 'PRIDOC'
              iv_guid_hi  = pd_guid_dest
              iv_kind_hi  = 'A'
              iv_event    = 'SAVE'
            EXCEPTIONS
              OTHERS      = 1.
    *   As no order_maintain will follow implicitly and therefore no
    *   exec times for the events will be set, call CRM_ORDER_MAINTAIN
    *   without any parameters
    *   Then the exec time 'end of document' will be set and with the
    *   group logic also all exec times before
    *   But at least one object is needed in input_fields
    *   --> use PRIDOC
          ls_input_fields-ref_guid   = <fs_orderadm_i_dest>-guid.
          ls_input_fields-ref_kind   = 'B'.
          ls_input_fields-objectname = 'PRIDOC'.
          INSERT ls_input_fields INTO TABLE lt_input_fields.
          CLEAR ls_input_fields.
          CALL FUNCTION 'CRM_ORDER_MAINTAIN'
            CHANGING
              ct_input_fields   = lt_input_fields
            EXCEPTIONS
              error_occurred    = 1
              document_locked   = 2
              no_change_allowed = 3
              no_authority      = 4
              OTHERS            = 5.
        ENDIF.
      ENDLOOP.
    " F_MODIF_CONDITION_PRIX
    *& Form  F_LOCK_DOCUMENT
    * Verrouillage d'un document
    FORM f_lock_document  USING pd_guid TYPE crmt_object_guid.
      CONSTANTS : lc_orderadm_h TYPE  crmt_object_name  VALUE 'ORDERADM_H',
                  lc_orderadm_i TYPE  crmt_object_name  VALUE 'ORDERADM_I'.
      DATA: lv_process_mode      TYPE crmt_mode,
            lv_order_initialized TYPE crmt_boolean,
            lv_process_type      TYPE crmt_process_type,
            lv_already_locked    TYPE abap_bool.
      DATA: ls_admin_ui_status  TYPE crmt_admin_ui_status,
            ls_item_usage_range TYPE crmt_item_usage_range.
      DATA: lt_objects_to_read   TYPE crmt_object_guid_tab,
            lt_requested_objects TYPE crmt_object_name_tab,
            lt_item_usage_range  TYPE crmt_item_usage_range_tab,
            lt_locked_contract   TYPE crmt_object_guid_tab.
      INSERT pd_guid INTO TABLE lt_objects_to_read.
      INSERT lc_orderadm_h INTO TABLE lt_requested_objects.
      INSERT lc_orderadm_i INTO TABLE lt_requested_objects.
      ls_item_usage_range-sign  = 'E'.
      ls_item_usage_range-value = '02'.
      INSERT ls_item_usage_range INTO TABLE lt_item_usage_range.
    * LAM: Financing Options should be viewed in a separate screen:
      ls_item_usage_range-sign  = 'E'.
      ls_item_usage_range-value = '05'.   "Financing options
      INSERT ls_item_usage_range INTO TABLE lt_item_usage_range.
    *-> read document in change mode
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid       = lt_objects_to_read
          iv_mode              = 'B'
          it_requested_objects = lt_requested_objects
          it_item_usage_range  = lt_item_usage_range
        EXCEPTIONS
          document_not_found   = 1
          error_occurred       = 2
          document_locked      = 3
          no_change_authority  = 4
          no_display_authority = 5
          OTHERS               = 6.
      PERFORM enqueue_order IN PROGRAM saplcrm_order_ow IF FOUND
        USING pd_guid
              abap_false
              abap_false
              abap_false
    CHANGING sy-subrc
              lv_already_locked
              lt_locked_contract.
    " F_LOCK_DOCUMENT
    * Fin Ajout CD1K904074-001
    FORM f_header_copy_pricing  USING   pd_guid_src
    pd_guid_dest.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm.
    * Verrouillage des documents source et destinataire
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *  Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_src
        IMPORTING
          ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    *  * Récupérer les pricing document
    *  Document Source
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_src
        IMPORTING
          et_komv_print       = lt_komv_print_src
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  Document Destinataire
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
        IMPORTING
    et_komv_print       = lt_komv_print_dest
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  * Modification et Suppression des conditions de prix
      LOOP AT lt_komv_print_src INTO ls_komv_print_src .
        CLEAR: ls_cond_chg,
               ls_komv_print_dest.
        MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
    * Rechercher la condition sur le document source
        READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk.
        IF sy-subrc EQ 0.
          IF ls_komv_print_src-kbetr NE ls_komv_print_dest-kbetr.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
            CASE gv_decimal.
              WHEN space.       "format N.NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
              WHEN 'Y'.         "format N NNN NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            ENDCASE.
          ENDIF.
        ENDIF.
        CLEAR ls_cond_chg-krech.
        INSERT ls_cond_chg INTO TABLE lt_cond_chg.
        CLEAR ls_cond_chg.
      ENDLOOP.
      CALL FUNCTION 'PRC_INT_HEAD_INPUT'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
          iv_bal_log          = bal_log
          it_cond_prt         = lt_cond_chg
          iv_req_ret          = abap_true
          iv_req_cond_prt     = abap_true
        IMPORTING
          et_cond_prt         = lt_cond_ret
          ev_data_changed     = ld_data_changed
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          not_allowed         = 3
          OTHERS              = 4.
      CHECK sy-subrc EQ 0.
    *    *   Publish event afin de sauvegarder les conditions de prix
      CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
        EXPORTING
          iv_obj_name = 'PRIDOC'
          iv_guid_hi  = pd_guid_dest
          iv_kind_hi  = 'A'
          iv_event    = 'SAVE'
        EXCEPTIONS
          OTHERS      = 1.
    *   As no order_maintain will follow implicitly and therefore no
    *   exec times for the events will be set, call CRM_ORDER_MAINTAIN
    *   without any parameters
    *   Then the exec time 'end of document' will be set and with the
    *   group logic also all exec times before
    *   But at least one object is needed in input_fields
    *   --> use PRIDOC
      ls_input_fields-ref_guid   = pd_guid_dest.
      ls_input_fields-ref_kind   = 'A'.
      ls_input_fields-objectname = 'PRIDOC'.
      INSERT ls_input_fields INTO TABLE lt_input_fields.
      CLEAR ls_input_fields.
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        CHANGING
          ct_input_fields   = lt_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.
    ENDFORM.
    FORM f_header_copy_pricing  USING   pd_guid_src
    pd_guid_dest.
      DATA : ld_pd_handle_src     TYPE prct_handle,
              ld_pd_handle_dest    TYPE prct_handle,
              lt_komv_print_src    TYPE prct_cond_print_t,
    lt_komv_print_dest   TYPE prct_cond_print_t,
              ls_komv_print_dest   LIKE LINE OF lt_komv_print_dest,
              ls_komv_print_src    LIKE LINE OF lt_komv_print_src,
              lt_cond_chg          TYPE prct_cond_print_t,
              ls_cond_chg          TYPE prct_cond_print,
              ls_input_fields      TYPE crmt_input_field,
              lt_input_fields      TYPE crmt_input_field_tab.
      DATA : bal_log         TYPE balloghndl,
             lt_cond_ret     TYPE prct_cond_print_t,
             ld_data_changed TYPE xfeld,
             gv_decimal      TYPE usdefaults-dcpfm.
      PERFORM f_lock_document USING pd_guid_src.
      PERFORM f_lock_document USING pd_guid_dest.
    *  Récupérer le pricing handle des documents
    * Document source
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_src
        IMPORTING
          ev_pd_handle               = ld_pd_handle_src
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    * Document destinataire
      CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
        EXPORTING
          iv_header_guid             = pd_guid_dest
        IMPORTING
          ev_pd_handle               = ld_pd_handle_dest
        EXCEPTIONS
          error_occurred             = 1
          handle_determination_error = 2
          orgdata_error              = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        RETURN.
      ENDIF.
    *  * Récupérer les pricing document
    *  Document Source
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_src
        IMPORTING
          et_komv_print       = lt_komv_print_src
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  Document Destinataire
      CALL FUNCTION 'PRC_PD_HEAD_SHOW'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
        IMPORTING
    et_komv_print       = lt_komv_print_dest
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          OTHERS              = 3.
      CHECK sy-subrc EQ 0.
    *  * Modification et Suppression des conditions de prix
      LOOP AT lt_komv_print_src INTO ls_komv_print_src .
        CLEAR: ls_cond_chg,
               ls_komv_print_dest.
        MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
    * Rechercher la condition sur le document source
        READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
    zaehk = ls_komv_print_src-zaehk.
        IF sy-subrc EQ 0.
          IF ls_komv_print_src-kbetr NE ls_komv_print_dest-kbetr.
            ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
            ls_cond_chg-kwert     = ls_komv_print_src-kwert.
            ls_cond_chg-kinak     = ls_komv_print_src-kinak.
            CASE gv_decimal.
              WHEN space.       "format N.NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
              WHEN 'Y'.         "format N NNN NNN,NN
                REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
            ENDCASE.
          ENDIF.
        ENDIF.
        CLEAR ls_cond_chg-krech.
        INSERT ls_cond_chg INTO TABLE lt_cond_chg.
        CLEAR ls_cond_chg.
      ENDLOOP.
      CALL FUNCTION 'PRC_INT_HEAD_INPUT'
        EXPORTING
          iv_pd_handle        = ld_pd_handle_dest
          iv_bal_log          = bal_log
          it_cond_prt         = lt_cond_chg
          iv_req_ret          = abap_true
          iv_req_cond_prt     = abap_true
        IMPORTING
          et_cond_prt         = lt_cond_ret
          ev_data_changed     = ld_data_changed
        EXCEPTIONS
          non_existing_handle = 1
          ipc_error           = 2
          not_allowed         = 3
          OTHERS              = 4.
      CHECK sy-subrc EQ 0.
      CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
        EXPORTING
          iv_obj_name = 'PRIDOC'
          iv_guid_hi  = pd_guid_dest
          iv_kind_hi  = 'A'
          iv_event    = 'SAVE'
        EXCEPTIONS
          OTHERS      = 1.
      ls_input_fields-ref_guid   = pd_guid_dest.
      ls_input_fields-ref_kind   = 'A'.
      ls_input_fields-objectname = 'PRIDOC'.
      INSERT ls_input_fields INTO TABLE lt_input_fields.
      CLEAR ls_input_fields.
      CALL FUNCTION 'CRM_ORDER_MAINTAIN'
        CHANGING
          ct_input_fields   = lt_input_fields
        EXCEPTIONS
          error_occurred    = 1
          document_locked   = 2
          no_change_allowed = 3
          no_authority      = 4
          OTHERS            = 5.

Maybe you are looking for

  • HOW TO RESTORE A DISABLED PHONE

    i recently locked my iphone and forgot password. I have disabled my phone and am away from home and can only access itunes from a different computer. Does anyone know how to restore iphone 4 from a new computer? When i plug in it gives me error messa

  • ITunes 7 is unusable

    Maybe the title is an exaggeration, but the Command+1 shortcut no longer opens up the iTunes window. Is there any particular reason for this? I can't think of any conceivable reason as to why they remove this useful shortcut. It's incredibly annoying

  • Transfer Bridge images and data to new pc

    I am using CS5.1 on Windows 7 pc.  Just purchased windows 8.1 pc.  CS5.1 PS and Bridge installed on new pc.  How do I get images over and keep Bridge collections and metadata?  Thanks for your help.

  • Who wants a black Audigy Platinum faceplate

    Ok, as far as I could tell, Creative teased us with the promise of a black faceplate that we could purchase separately, but then never actually made it available. They just had their next generation products include them, hoping we'd fork out some ex

  • Creative Cloudアプリが見つかりません インストール方法を教えてください Lr Ps がアップデートできません

    Creative Cloudアプリが見つかりません インストール方法を教えてください Lr がアップデートできません