Reg: Logic for context change

Dear friends,
I have a scnario where i need to  uploade the sumary of financial entries.
For every one line item i need to create a target side as 2 line item for debit and credit entry.
I achived this by using  duplicatesubtree.
Now the issue is  for all the entries there should only one debit entry by summing all the line item amout and all the credit item entries.
Even this is achived by using the context change at the sum function.
In fico we can uploade only 900 line item not more that. for this i have make use of counter and udf to resolve this.
But now for context change i need to genarate one debit entry for every 899 credit entrries(input line items).
It mean for 899 input item sum to be taken in to one debit line item at target in the duplicatesubtree
For this i have a udf it gives a counter change after 899 line items.
Now on this change how should i change the context..for sum and create the debit item after every 899.
I have refered this thread .
[context change  in message mapping]
Regards
Vijay

Hi Vijay,
To get Sum
Source item (0 .. outbound)
           line1 (0..1)
           line2 (0..1)
           line3 (0..1)
           line4 (0..1)
           line5 (0..1)
           line6 (0..1)
Now map Line6 --> (RemoveContext) u will get all values ===> Write UDF1 ===> Map to first element under Item1
===> Write UDF2 ===> Map to first element under Item1
UDF1
public void CreditSum(String[] a,ResultList result,Container container){
float count = a.length;
float c = count/2;
int d = (int)c;
int sum=0;
String Sum_str = " ";
for(int i=0;i<=d-1;i++)
sum = sum+Integer.parseInt(a<i>);
Sum_str =Integer.toString(sum);
result.addValue(Sum_str);
UDF2
public void Credit2Sum(String[] a,ResultList result,Container container){
   //write your code here
    //write your code here
float count = a.length;
float c = count/2;
int d = (int)c;
int sum=0;
String Sum_str = " ";
for(int i=d;i<=count-1;i++)
sum = sum+Integer.parseInt(a<i>);
Sum_str =Integer.toString(sum);
result.addValue(Sum_str);
Thx
Srini

Similar Messages

  • Reg : Logic for Report

    Hi ,
    I would like to know one logic for preparing functional specification for one MM report. This report should fetch all materials that are below safety stock.
    Please help me.

    HI,
    The logic is you take the current unresticted stock of a material from MARD table, field name is LABST.now you check for the safety stock of the particular in MARC table Field name-EISBE.
    Now compare the current stock with the safety stock,generate a report for the materials whose present stock is less than the safety stock.
    for this requirement safety stock should be maintained in the material master,other wise your report will not work.
    Regards,
    velu

  • Mapping query for context change without UDF

    Hi,
    My requirement is as below:
    Input queues are
    4319, 4319,4320,4321,4321
    M1,M1,M1,M2,M2,M2
    Required output is
    4319,4320,CC,4321
    COntext change is to be inserted when there is a change in value in second queue.
    regards, Anirudh.

    Hi,
    Have you tried using the formatByExample as specified?
    input1-->removeContext--> concat --> splitByValue:ValueChanged --> collapseContext --> substring (2..6) --> formatByExample (1) --> Target
    input2-->removeContext--> /
    input1-->removeContext--> concat --> splitByValue:ValueChanged --> collapseContext --> substring (0..2) --> splitByValue:ValueChanged -->formatByExample (2)
    input2-->removeContext--> /
    code explanation
    input1 and input 2 when concatted outputs M12319,M12319,M12320,M22321,M22321,M22321
    The upper part of the code does this: M12319,M12320,M22321, when you use the substring it outputs now 2319,2320,2321
    The lower part of the code does this: M12319,M12320,M22321, when you use the substring it outputs
    M1,M1,M2, then you use splitByValue. The output is now M1,M1,CC,M2.
    When you input the code from the upper part and lower part into a formatByExample node, the output becomes
    2319,2320,CC,2321
    Hope this helps,

  • Automate Run DM package for Context changes

    Hi BPC Experts,
      When I change the context, automatically run DM package with same context changes
    Please anybody tell how it is possible?

    "When I click macro button" doesn't mean that "When I change the context, automatically run DM package"!
    You want to run DM using macro attached to the button and you want context selection to be passed to DM without user having to select values.
    Simple way - to use default values in the DM advanced script:
    PROMPT(SELECTINPUT,%TIME%,,"Select Time:","TIME",,1)
    1 at the end will result in selection of context member.
    Complex, but fully automated: How to Call a BPC Data Manager Package from VB
    Vadim

  • Reg-Logic for Query!

    Hi All,
    In my application, there is an requirement for generating Autogen Sequence in two ways.
    First Way: Using Autogen button.
    For Ex: If the old symbol: ABCDEF00, the next Autogen sequence should be i.e, new symbol: ABCDEG00 .
    Similarly if the symbol has old symbol:zzzzz00 new symbol should be AAAAA00.
    As of now my logic is working perfectly accordingly to the above scenario.
    Note: We will be changing only first 5 characters and last two digits I am appending as 00.
    Second Way: Manually there can enter the symbol.
    The problem I am facing in second method, since there can enter/ create a symbol using Alphanumeric.
    For Ex: old Symbol: ABCD100, the next will be ABCD200 and soon till ABCD900.. Once the symbol ends with 9 then next sequence is replacing with some special characters as ABCD:00
    Note: Symbol should not accept any special characters. If the symbol ABCD900 then next should be ABCD000. ‘9’ should be replaced with ‘0’ and soon. My logic will not work for alphanumeric.
    Can anyone help me out my logic should accept both characters as well as numeric’s.
    Following is the logic which currently i am using
    DECLARE
    v_symb_code VARCHAR2(7);
    new_sym_code VARCHAR2(7);
    v_count NUMBER;
    v_auto_count NUMBER;
    symb_code_new VARCHAR2(7);
    BEGIN
    SELECT COUNT(*) INTO v_auto_count FROM T_AUTOGEN_SYMBOL;
    IF v_auto_count=0 THEN
    SELECT symb_code INTO v_symb_code FROM t_symbol WHERE SYMB_MODIFIED_DATE=(SELECT MAX(SYMB_MODIFIED_DATE) FROM t_symbol) AND ROWNUM=1;
    ELSE
    SELECT ATGS_SYMB_CODE INTO v_symb_code FROM T_AUTOGEN_SYMBOL;
    END IF;
    LOOP
    SELECT
    -- 1st digit of new value
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),5,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),4,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),3,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),2,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),1,1),'Z','A',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),1,1),'A','B','B','C','C','D','D','E','E','F','F','G','G','H','H','I','I','J','J','K','K','L','L','M','M','N','N','O','O','P','P','Q','Q','R','R','S','S','T','T','U','U','V','V','W','W','X','X','Y','Y','Z',
    CHR(ASCII(SUBSTR(SUBSTR (v_symb_code, 1, 5),1,1))+1))),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),1,1)),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),1,1)),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),1,1)),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),1,1))
    ||
    -- 2nd digit of new value
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),5,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),4,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),3,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),2,1),'Z','A',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),2,1),'A','B','B','C','C','D','D','E','E','F','F','G','G','H','H','I','I','J','J','K','K','L','L','M','M','N','N','O','O','P','P','Q','Q','R','R','S','S','T','T','U','U','V','V','W','W','X','X','Y','Y','Z',
    CHR(ASCII(SUBSTR(SUBSTR (v_symb_code, 1, 5),2,1))+1))),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),2,1)),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),2,1)),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),2,1))
    ||
    -- 3rd digit of new value
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),5,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),4,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),3,1),'Z','A',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),3,1),'A','B','B','C','C','D','D','E','E','F','F','G','G','H','H','I','I','J','J','K','K','L','L','M','M','N','N','O','O','P','P','Q','Q','R','R','S','S','T','T','U','U','V','V','W','W','X','X','Y','Y','Z',
    CHR(ASCII(SUBSTR(SUBSTR (v_symb_code, 1, 5),3,1))+1))),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),3,1)),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),3,1))
    ||
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),5,1),'Z',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),4,1),'Z','A',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),4,1),'A','B','B','C','C','D','D','E','E','F','F','G','G','H','H','I','I','J','J','K','K','L','L','M','M','N','N','O','O','P','P','Q','Q','R','R','S','S','T','T','U','U','V','V','W','W','X','X','Y','Y','Z',
    CHR(ASCII(SUBSTR(SUBSTR (v_symb_code, 1, 5),4,1))+1))),
    SUBSTR(SUBSTR (v_symb_code, 1, 5),4,1))
    ||
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),5,1),'Z','A',
    DECODE(SUBSTR(SUBSTR (v_symb_code, 1, 5),5,1),'A','B','B','C','C','D','D','E','E','F','F','G','G','H','H','I','I','J','J','K','K','L','L','M','M','N','N','O','O','P','P','Q','Q','R','R','S','S','T','T','U','U','V','V','W','W','X','X','Y','Y','Z',
    CHR(ASCII(SUBSTR(SUBSTR (v_symb_code, 1, 5),5,1))+1)))||'00' INTO new_sym_code
    FROM dual;
    symb_code_new := UPPER(new_sym_code);
    SELECT COUNT(*) INTO v_count FROM t_symbol WHERE symb_code=symb_code_new AND ROWNUM<2;
    /*IF v_count<1 THEN
    SELECT COUNT(*) INTO v_count FROM t_symbol_wip WHERE symb_code=symb_code_new AND ROWNUM<2;
    END IF;
    DELETE FROM T_AUTOGEN_SYMBOL;
    INSERT INTO T_AUTOGEN_SYMBOL(ATGS_SYMB_CODE,ATGS_MODIFIED_BY,ATGS_MODIFIED_DATE) VALUES(symb_code_new,v('APP_USER'),SYSDATE); */
    EXIT WHEN v_count <1;
    v_symb_code:=symb_code_new;
    DBMS_OUTPUT.PUT_LINE(v_symb_code);
    END LOOP;
    :P39_SYMBOL := symb_code_new;
    END;

    I'd use a slightly different approach with the same end result: use and store numbers instead of this "Autogen sequence". When you use a number, you can easily add 1 or subtract 1. You probably only need that string for display. So use a function like below:
    SQL> create function number2weirdstring (p_num in number) return varchar2
      2  as
      3    --
      4    -- The string looks like this AAAAA00.
      5    -- Define for each A what the acceptable characters can be
      6    -- For instance I'm defining them to accept [a-z] and [A-Z]
      7    -- And they are mapped to [0-25] and [26-51]. This leads to
      8    -- 52^5 possible combinations.
      9    --
    10    l_character1 varchar2(1);
    11    l_character2 varchar2(1);
    12    l_character3 varchar2(1);
    13    l_character4 varchar2(1);
    14    l_character5 varchar2(1);
    15  begin
    16    l_character5 := chr( case when mod(p_num,52)                    < 26 then 97 else 39 end + mod(p_num,52) );
    17    l_character4 := chr( case when mod(trunc(p_num/52),52)          < 26 then 97 else 39 end + mod(trunc(p_num/52),52) );
    18    l_character3 := chr( case when mod(trunc(p_num/52/52),52)       < 26 then 97 else 39 end + mod(trunc(p_num/52/52),52) );
    19    l_character2 := chr( case when mod(trunc(p_num/52/52/52),52)    < 26 then 97 else 39 end + mod(trunc(p_num/52/52/52),52) );
    20    l_character1 := chr( case when mod(trunc(p_num/52/52/52/52),52) < 26 then 97 else 39 end + mod(trunc(p_num/52/52/52/52),52) );
    21    return l_character1 || l_character2 || l_character3 || l_character4 || l_character5 || '00';
    22  end number2weirdstring;
    23  /
    Functie is aangemaakt.And to show how the function works:
    SQL> select number2weirdstring(0)
      2       , number2weirdstring(25)
      3       , number2weirdstring(26)
      4       , number2weirdstring(51)
      5       , number2weirdstring(52)
      6       , number2weirdstring(52*52-1)
      7       , number2weirdstring(52*52)
      8       , number2weirdstring(12893571)
      9    from dual
    10  /
    NUMBER2WEIRDSTRING(0)
    NUMBER2WEIRDSTRING(25)
    NUMBER2WEIRDSTRING(26)
    NUMBER2WEIRDSTRING(51)
    NUMBER2WEIRDSTRING(52)
    NUMBER2WEIRDSTRING(52*52-1)
    NUMBER2WEIRDSTRING(52*52)
    NUMBER2WEIRDSTRING(12893571)
    aaaaa00
    aaaaz00
    aaaaA00
    aaaaZ00
    aaaba00
    aaaZZ00
    aabaa00
    bNKrp00
    1 rij is geselecteerd.You only need to modify the function to accept the characters you want. But hopefully this example will get you started.
    Regards,
    Rob.

  • Udf for context change

    Hi All,
                I write a UDF to change context but it is not working properly
                can any please guide me. code is ,
      for (int i = 0 ; i<Plant.length ; i ++)
    int b = 0;
          for (int j = 0  ; j<Plant.length ; j++)
                  if (i!=j)
                if (Plant<i>.equals(Plant[j]) )
                           b++;
      if (b > 0 )
                           result.addValue(ResultList.CC);
                 else
                           result.addValue ("true") ;
    In this code it is working for 'result.addValue ("true")' but not for 'result.addValue(ResultList.CC)'
    Can any one tell me where is a problem?
    ---Rohit

    Rohit,
    I've doubt that the condition for true is not satisfied and it always goes to else block.
    Add MappingTrace to your code and check if its going to the If block or always it goes to esle block.
    One more thing what is this operator for (int j = 0 ;<b> j><Plant.length</b> ; j++) ? What r u trying to achieve...
    -raj.

  • Give me an Example for On Change OF

    Hi experts ,
    Im Some Fields which are Frequently changed. if any of the fields values are changed. Then it has to Trigger the Output Type.
    Fields : Matnr ,kwmeng,werks,lgort.
    For this i written a logic like this :
    SELECT matnr  kwmeng  werks  lgort
             UP TO l_index ROWS                  '''l_index contains 2 rows"
             FROM vbap  INTO tp_vbap
             WHERE  vbeln = com_kbv1-vbeln.
      Here i want 2 incude the Logic On Change of conditional  Statement.
      Here it should compare wit com_kbv1-yymatnr, com_kbv1-kwmeng , com_kbv1-    yywerks & com_kbv1-lgort with tp_vbap-matnr, tp_vbap-kwmeng,
      tp_vbap-werks, tp_vbap-lgort.
      if it found any changes then it should give sy-subrc eq o.
      ENDSELECT.

    hi... this is an sample logic for on change....
    ON CHANGE OF WA_ITAB4-IONO.
            FORMAT COLOR col_TOTAL INTENSIFIED OFF.
            ULINE AT /1(119).
            WRITE: /
                    'SUB-TOTAL',
                    SUM_AMT1 UNDER WA_ITAB4-AMT1,
                    SUM_AMT2 UNDER WA_ITAB4-AMT2,
                    SUM_AMT3 UNDER WA_ITAB4-AMT3,
                    SUM_AMT4 UNDER WA_ITAB4-AMT4.
            ULINE AT /1(119).
          ENDON.

  • Adding extra field in extractor and changing Logic for FM for extraction

    Hi,
    We have an extractor that is extracting R/3 data using Function Module.
    Now that i had appended one field in the extractor , i want to change the FM logic for filling up the new field added.
    Is there any sample code for filling up of newly appended field?
    Regards,
    Karan

    Hi Raj,
    From your description, it is clear that you are talking about a FM extractor. If if it a standard FM data source, you are not adviced to change the standard function module. The way to enhance the data source is to append the ES to add the field and write your logic in the User exit (RSAP0001) to populate the added field. Hope this helps.
    Thanks and Regards
    Subray Hegde

  • Want to change logic for  ck40n bom valuation for mixed costing ?

    Dear Gurus,
    In ck40n transaction,material bom valuation is depnding on mixed ratio.
    My requirement is to change the logic,Iam debugging the ck40n transaction for costing,but iam unable to getting the right position to change the logic for mixed costing (average).
    Thanks in advance,
    CR

    In solution 1, I had a procurement alternative and mixing ration in plant 200 and a special procurement type for costing in plant 210.
    Before calculating the mixed costing in plant 200 I had to eliminate the spec.proc.type for costing in plant 210 otherwise, the calculation got into a loop.
    Without the spc.proc.type in plant 210, I got a correct mixed costing in plant 200.
    Then I enter the spec.proc. type for costing again in plant 210 and calculate the cost price. This copies the mixed costing from plant 200. So far, OK.
    But as soon as I save this cost estimate in plant 210, the reports in CK11N or CK13N get incorrect for the first calculation made for plant 0210 while costing in plant 0200 is overwritten by this result. Now the report gets into a loop and you can drill down endlessly.

  • Reg logic required for selection-screen.

    Hi,
    i have one requirement
    on selection screen 2 radio button
    1 for service
    2 for account
    Parameter      FILE     LOCALFILE     Filename
    If the radiobutton ACCOUNT is selected the default name for file will be:
         ‘Rev_acc_com_&system_time_stamp&.dat’
    Elseif the radiobutton SERVICE is selected the default name for file will be:
         ‘Rev_srv_com_&system_time_stamp&.dat’
    some body can give the logic for this.

    take the following solution
    data: tstamp type TZNTSTMPS.
    data: filename type string.
    call function 'CONVERT_INTO_TIMESTAMP'
    exporting
       I_DATLO  = sy-datum
       I_TIMLO   = sy-uzeit
    importing
       E_TIMESTAMP = tstamp.
    if ACCOUNT is selected then
    concatenate 'Rev_srv_com_' tstamp '.dat' into filename.
    else if SERVICE is selected then
    concatenate 'Rev_srv_com_' tstamp '.dat' into filename.
    the filename variable will be containing ur required file name..
    reward points if useful....

  • Context change problem

    Team,
    I have a problem with context change in a peculiar mapping requirement.
    Scenario is IDOC --> XML
    There's an idoc field MRKN1 which carries all shipment unit numbers seperated by spaces.
    MRKN1 : 50325 50326 50329 50321 50215
    This field should be mapped to target XML as below:
    <Package>                                                                                <identifier>50325</identifier>
    </Package>
    <Package>                                                                                <identifier>50326</identifier>                                                           
    </Package>
    <Package>                                                                                <identifier>50329</identifier>                                                           
    </Package>
    <Package>                                                                                <identifier>50321</identifier>                                                           
    </Package>
    <Package>                                                                                <identifier>50215</identifier>                                                           
    </Package>
    I created a USD StringTokenizer to extract the values from MRKN1 & to populate it in the identier field:
    import java.lang.*;
    public void StringTokenizer(String[] input,ResultList result,Container container){
    String x[] = new String[input.length];
    for(int j=0; j<input.length;j++) {
    x = input[j].split(" ");
    for(int i=1;i<x.length;i++) {
         result.addValue(x<i>);
    and mapped liked below:
    MRKN1 --> StringTokeniser --> identifier
    But the output xml looks like this:
    <Package>                                                                                <identifier>50325</identifier>                                                                              <identifier>50326</identifier>                                                                                <identifier>50329</identifier>                                                                                <identifier>50321</identifier>                                                           
    <identifier>50215</identifier>                                                           
    </Package>
    Please help me how to create new Package tag for every new identifier tag.
    I already tried adding result.addContextChange() just by returning empty value to the above code & mapped it to Package node. But it throws error.
    Any immediate help is appreciated.
    Thanks in advance,
    Shanthi

    The above logic works quite different. The complete XML looks like this
    Given 3 items & 2 values in MRKN1
    <GoodsItem..1>
    <Packaging>
        <marksNumber>503124</marksNumber>
            <PackagesCollection>
                <Package>
                    <identifier>50216</identifier>
                </Package>
            </PackagesCollection>
           <packageType>PK</packageType>
    </Packaging>
    </GoodsItem..1>
    <GoodsItem..2>
    <Packaging>
        <marksNumber>503124</marksNumber>
            <PackagesCollection>
                <Package>
                    <identifier>50215</identifier>
                </Package>
            </PackagesCollection>
           <packageType>PK</packageType>
    </Packaging>
    </GoodsItem..2>
    <GoodsItem..3>
    <Packaging>
        <marksNumber>503124</marksNumber>
        <PackagesCollection/>
        <packageType>PK</packageType>
    </Packaging>
    </GoodsItem..3>
    But the customer requirement is quite different

  • Unable to get RequestDispatcher for Context

    Eclipse 3.3.0
    Tomcat 6.0.16
    Java 1.5.0_13
    Mac OS X 10.5.6
    Greetings:
    I'm attempting to retrieve information cross context in my web application. I've attempted to enable cross context access by three means.
    - I've added "crossContext=true" to the <Context> element in the server.xml of the Tomcat configuration under the Servers project of my workspace.
    - I've added "crossContext=true" to the <Context> element in a META-INF/context.xml in the WebContent folder of my project.
    - I've added "crossContext=true" to the <Context> element of the context.xml file in the conf directory of the Tomcat installation directory.
    Yet despite these changes I'm still seeing "Unable to get RequestDispatcher for Context....Verify values and/or enable cross context access" in the console. What do I need to do to enable cross context access using Eclipse? Thanks for any help.
    ETA - I've had this working before. I believe that I upgraded to Tomcat 6 from Tomcat 5.5 and that's when the jstl cross context actions broke.
    ETA - I've got it working in Tomcat 6. The problem arises when I change the name of my webapplication from "foo" to ROOT inside eclipse. I want a jsp page in the ROOT web application to be able to access a servlet in the "bar" web application.
    Edited by: nantucket on May 17, 2009 2:17 PM
    Edited by: nantucket on May 17, 2009 2:26 PM

    Thanks for your reply evnafets.
    How many times do you declare your context???I know, I know... I got frustrated. :o)
    But seriously, since my post I've discovered that it is "working" but not in the manner I had expected within the IDE. That is, if I access the page at
    http://localhost:8080/ROOT/myPage.jspThen I can see the contents retrieved from the context bar. But if I use.
    http://localhost:8080/myPage.jspI can see that the page somehow has been deployed to the root context, but the error code 500 appears in place of where the content from the bar context should be.
    However, if I export war files for these two web applications and run them in Tomcat 6 outside of Eclipse, everything works as it should. So this is an eclipse issue with respect to deploying a web application to the root context. Maybe there is some configuration about that I must make somewhere.
    I hope that makes sense.
    Anyhow, the server.xml file contains the following..
    <Context crossContext="true" docBase="bar" path="/bar" reloadable="true" source="org.eclipse.jst.j2ee.server:bar"/>
       <Context crossContext="true" docBase="ROOT" path="/ROOT" reloadable="true" source="org.eclipse.jst.j2ee.server:ROOT"/>The jstl code in the jsp page accessing the context bar is the following.
    <c:import url='/helloworld?action=view' context='/bar' />

  • How to set reg.cgi for VideoPhoneLabs

    i start with stratus .i try set it to work with my dedicated apache server and sql but have no clue how to do it or where to put this file on my server.
    i realy have probleme with reg.cgi
    for now i did www/cgi-bin/reg.cgi and in the xml i set my websiteurl = "http://88..../cgi-bin/"
    also how to complete reg.cgi for have it to talk with my db ?
    here the reg.cgi file.
    help please ...
    #! /usr/bin/python --
    reg.cgi by Michael Thornburgh.
    This file is in the public domain.
    IMPORTANT: This script is for illustrative purposes only. It does
    not have user authentication or other access control measures that
    a real production service would have.
    This script should be placed in the cgi-bin location according to
    your web server installation. The database is an SQLite3 database.
    Edit the location of the database in variable "dbFile".
    Create it with the following schema:
    .schema
    CREATE TABLE registrations (
        m_username VARCHAR COLLATE NOCASE,
        m_identity VARCHAR,
        m_updatetime DATETIME,
        PRIMARY KEY (m_username)
    CREATE INDEX registrations_updatetime ON registrations (m_updatetime ASC);
    # CHANGE THIS
    dbFile = '.../registrations.db'
    import cgi
    import sqlite3
    import xml.sax.saxutils
    query = cgi.parse()
    db = sqlite3.connect(dbFile)
    user = query.get('username', [None])[0]
    identity = query.get('identity', [None])[0]
    friends = query.get('friends', [])
    print 'Content-type: text/plain\n\n<?xml version="1.0" encoding="utf-8"?>\n<result>'
    if user:
        try:
            c = db.cursor()
            c.execute("insert or replace into registrations values (?, ?, datetime('now'))", (user, identity))
            print '\t<update>true</update>'
        except:
            print '\t<update>false</update>'
    for f in friends:
        print "\t<friend>\n\t\t<user>%s</user>" % (xml.sax.saxutils.escape(f), )
        c = db.cursor()
        c.execute("select m_username, m_identity from registrations where m_username = ? and m_updatetime > datetime('now', '-1 hour')", (f, ))
        for result in c.fetchall():
            eachIdent = result[1]
            if not eachIdent:
                eachIdent = ""
            print "\t\t<identity>%s</identity>" % (xml.sax.saxutils.escape(eachIdent), )
            if f != result[0]:
                print "\t\t<registered>%s</registered>" % (xml.sax.saxutils.escape(result[0]), )
        print "\t</friend>"
    db.commit()
    print "</result>"

    Persistent binding is effectively provided by STMS (MPxIO) - is there anything in particular you're wanting to do that STMS doesn't provide?

  • Need logic for po item

    Hi iam trying to get the po line item latest changedby name to display in my report
    can you give me the logic to get the changed by name for theline item.
    i have written the code but if i change the line item 20 then in the out put the changedby name is being displayed for line itema 10 ,20, 30 i e for all line items .but i want the changeby name to be displayed only for the particular line item which was changed.
    *& Report  ZMR_PO_AUDIT_RPT                                            *
    *&  Purpose - Report on PO release details for auditing.               *
    Program ID  :  ZMR_PO_AUDIT_RPT                                     *
    Title       :  Purchase Release Audit Report                        *
    Create Date :  19.03.2007                                           *
    Author      :  Marina Gosman (JH IT services)                       *
    Tech. Spec  :                                                       *
    Change Req #:                                                       *
    Changed by  |  Description of change                    |  Date     *
    MarinaG     | Change the report Heading to Purchase     |           *
                 | Order Action Audit Report R3DK912376      |23.03.07   *
    MarinaG     | Fix a select bug. R3DK912384              |23.03.07   *
    MarinaG     | Change report heading by removing fields  |27.03.07   *
                 | R3DK912404                                |           *
    MarinaG     | Add exception checkbox which will only    |3.04.07    *
                 | show the same GR, Released and Created    |           *
                 | username R3DK912444.                      |           *
    MarinaG     | Add GR Value and Vendor Name FP#1919      |28.08.07   *
                 | R3DK912809                                |           *
    MarinaG     | Add line item no., display line items for |11.10.07   *
                 | GR period and GR date FP#1919 R3DK912960  |           *
    REPORT ZSAMPLE3 NO STANDARD PAGE HEADING LINE-SIZE 200
    MESSAGE-ID zv.
    Database Tables
    TABLES: ekko,t16fd,cdhdr,cdpos,t000,lfa1,t024,ekbe,mkpf.
    TYPE-POOLS slis.
    Type Declaration
    *TYPE-POOLS: kkblo.
    Structures
    DATA:BEGIN OF st_output,
         ebeln  LIKE ekko-ebeln,
         batxt  LIKE t161t-batxt,
         banfn  LIKE eban-banfn,
         bukrs  LIKE ekko-bukrs,
         frggr  LIKE ekko-frggr,
         frgsx  LIKE ekko-frgsx,
         frgct  LIKE t16fd-frgct,
         udate  LIKE cdhdr-udate,
         utime  like cdhdr-utime,
         username LIKE cdhdr-username,
         lifnr  LIKE ekko-lifnr,        " vendor
         name1  LIKE lfa1-name1,        " vendor name
         ebelp  LIKE ekpo-ebelp,        " line no.
         afnam  LIKE ekpo-afnam,        " requisitioner
         netwr  LIKE ekpo-netwr,
         ekgrp  LIKE ekko-ekgrp,
         eknam  LIKE t024-eknam,
         ernam  LIKE ekko-ernam,
         grnam  LIKE ekbe-ernam,
         bedat  LIKE ekko-bedat,
         budat  LIKE ekbe-budat,
         belnr  LIKE ekbe-belnr,                                "R3DK912960
         dmbtr  LIKE ekbe-dmbtr,                                "R3DK912960
    Indira
         cdate  LIKE cdhdr-username,
    Indira
    END OF st_output.
    Indra
    DATA: l_ponum LIKE ekko-ebeln,
          l_poline LIKE ekpo-ebelp.
    DATA: BEGIN OF t_EKbe OCCURS 0,
          ebeln LIKE EKbe-ebeln,
          belnr LIKE EKbe-Belnr,
          budat LIKE EKbe-Budat,
          cputm LIKE EKbe-cputm,
          END OF T_EKbe.
    DATA: BEGIN OF T_mkpf OCCURS 0,
           mblnr LIKE mkpf-mblnr,
           usnam LIKE mkpf-usnam,
           END OF T_mkpf.
    Internal Tables
    DATA: t_cdhdr LIKE cdhdr OCCURS 0 WITH HEADER LINE,
          t_cdhdr1 LIKE cdhdr OCCURS 0 WITH HEADER LINE,
          po_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
    Indra
    DATA: t_cdpos LIKE cdpos OCCURS 0 WITH HEADER LINE.
    indra
    DATA: BEGIN OF tbl_output OCCURS 0.
            INCLUDE STRUCTURE st_output.
    DATA: END OF tbl_output.
    DATA: BEGIN OF tbl_ekpo OCCURS 0.
            INCLUDE STRUCTURE ekpo.
    DATA: END OF tbl_ekpo.
    DATA: BEGIN OF tbl_ekbe OCCURS 0.
            INCLUDE STRUCTURE ekbe.
    DATA: END OF tbl_ekbe.
    DATA:  BEGIN OF t_ekko OCCURS 0,
              ebeln TYPE ebeln,
              ebelp TYPE ebelp,                                 "R3DK912960
              belnr TYPE MBLNR,                                 "R3DK912960
              bukrs TYPE bukrs,
              bsart TYPE bsart,
              bedat TYPE bedat,
              budat TYPE budat,
              ernam TYPE ernam,
              grnam TYPE ernam,
              dmbtr TYPE dmbtr,                                 "R3DK912960
           END OF t_ekko.
    DATA: c_tcode(25) TYPE c.
    DATA: st_fieldcat    TYPE slis_fieldcat_alv.
    DATA: tbl_fieldcat   TYPE slis_t_fieldcat_alv.
    DATA: st_event       TYPE slis_alv_event.
    DATA: tbl_events     TYPE slis_t_event.
    DATA: fieldname(30)  TYPE c.
    DATA: st_layout      TYPE slis_layout_alv.
    DATA: g_status       TYPE slis_formname VALUE 'STANDARD01'.
    DATA: g_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
    DATA: st_status      TYPE slis_status.
    DATA: tbl_status     TYPE slis_status OCCURS 0 WITH HEADER LINE.
    DATA: f_ebeln        LIKE ekko-ebeln.
    DATA: cursorfield    LIKE ekko-ebeln.
    DATA: ws_ebeln       LIKE ekko-ebeln,
          ws_netwr       LIKE ekpo-netwr,
          ws_ernam       LIKE ekbe-ernam,
          rs_selfield    TYPE slis_selfield,
          ws_dmbtr       LIKE ekbe-dmbtr.                       "R3DK912809
    RANGES: r_kunnr FOR vbak-kunnr OCCURS 0.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK title WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_bukrs  FOR ekko-bukrs OBLIGATORY,
                    s_ekorg  FOR ekko-ekorg OBLIGATORY,
                    s_ebeln  FOR ekko-ebeln,
                    s_groups FOR ekko-ekgrp,
                    s_lifnr  FOR ekko-lifnr,
                    s_bedat  FOR ekko-bedat,
                    s_budat  FOR ekbe-budat,
                    s_bsart  FOR ekko-bsart.
    SELECTION-SCREEN END OF BLOCK title .
    SELECTION-SCREEN BEGIN OF BLOCK title2 WITH FRAME TITLE text-001.
    PARAMETERS: p_gr AS CHECKBOX DEFAULT 'X',
                p_excep AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK title2 .
    *& AT SELECTION SCREEN
    AT SELECTION-SCREEN.
      IF NOT p_gr IS INITIAL.
        IF s_budat IS INITIAL.
          MESSAGE s000 WITH 'Please enter Goods Receipt Date.'.
          STOP.
        ENDIF.
      ELSE.
        IF s_bedat IS INITIAL.
          MESSAGE s000 WITH 'Please enter Purch Doc Date.'.
          STOP.
        ENDIF.
      ENDIF.
                       START-OF-SELECTION.
    START-OF-SELECTION.
      PERFORM select_data.         " Select data
      PERFORM sort_table.
      PERFORM get_events.          " Include header in display
      PERFORM get_eventstatus.     " Set the GUI status
      PERFORM get_layout.          " Define ALV Layout
      PERFORM get_fieldcat.        " Fill report fields
      PERFORM create_report.       " Write ALV format
    AT LINE-SELECTION.
      PERFORM user_command USING sy-ucomm
                                 rs_selfield.
          FORM user_command                                             *
    -->  R_UCOMM                                                       *
    -->  RS_SELFIELD                                                   *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
      DATA: l_ta TYPE sy-tcode VALUE 'SLIS_DUMMY'.
      CLEAR: f_ebeln.
      CASE r_ucomm.
        WHEN 'CF1'.
          READ TABLE tbl_output INDEX rs_selfield-tabindex.
          IF sy-subrc = 0.
            f_ebeln = tbl_output-ebeln.
          ENDIF.
          SET PARAMETER ID 'BES' FIELD f_ebeln.
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    Begin of R3DK912404
        WHEN 'EXIT' OR 'CANC'.
          LEAVE PROGRAM.
    End of R3DK912404
        WHEN 'OTHERS'.
      ENDCASE.
    ENDFORM.                    "user_command
          FORM STANDARD_02                                              *
    -->  EXTAB                                                         *
    FORM standard_01 USING  extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD01' EXCLUDING extab .
    ENDFORM.                    "standard_01
    *&      Form  get_events
          setup report headings
    -->  p1        text
    <--  p2        text
    FORM get_events.
      CLEAR st_event.
      st_event-name = 'TOP_OF_PAGE'.
      st_event-form = 'PROCESS_TOP_OF_PAGE'.
      APPEND st_event TO tbl_events.
    ENDFORM.                    " get_events
          FORM get_eventstatus                                          *
    FORM get_eventstatus.
      CLEAR st_status.
      st_status-callback_pf_status_set = 'STANDARD_01'.
      APPEND st_status TO tbl_status.
    ENDFORM.                    " get_eventstatus
    *&      Form  get_layout
          text
    -->  p1        text
    <--  p2        text
    FORM get_layout.
      CLEAR st_layout.
      st_layout-zebra = 'X'.
    ENDFORM.                    " get_layout
    *&      Form  get_fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM get_fieldcat.
      PERFORM write_fieldcat USING 'EBELN' 'TBL_OUTPUT' 'EKKO' 'X' 1 ' '.
      PERFORM write_fieldcat USING 'BUKRS' 'TBL_OUTPUT' 'EKKO' 'X' 2 ' '.
    Begin of R3DK912960
      PERFORM write_fieldcat USING 'EBELP' 'TBL_OUTPUT' 'EKPO' 'X' 3 ' '.
    End of R3DK912960
      PERFORM write_fieldcat USING 'UDATE' 'TBL_OUTPUT' ' ' ' ' 4
      'Doc. Date'.
      PERFORM write_fieldcat USING 'UTIME' 'TBL_OUTPUT' ' ' ' ' 13
      'Doc. Time'.
    Begin of R3DK912960
      PERFORM write_fieldcat USING 'BUDAT' 'TBL_OUTPUT' ' ' ' ' 5
      'GR Date'.
    End of R3DK912960
      PERFORM write_fieldcat USING 'ERNAM' 'TBL_OUTPUT' ' ' ' ' 6
    'Created By'.
      PERFORM write_fieldcat USING 'USERNAME' 'TBL_OUTPUT' ' ' ' ' 7
    'Released By'.
      PERFORM write_fieldcat USING 'GRNAM' 'TBL_OUTPUT' ' ' ' ' 8
    'Goods Receipted By'.
      PERFORM write_fieldcat USING 'CDATE' 'TBL_OUTPUT' ' ' ' ' 9
      'Changed By'.
      PERFORM write_fieldcat USING 'NETWR' 'TBL_OUTPUT' ' ' ' ' 10
    'Total Value'.
      PERFORM write_fieldcat USING 'EKGRP' 'TBL_OUTPUT' 'EKKO' ' ' 11 ' '.
    Begin of R3DK912809
      PERFORM write_fieldcat USING 'DMBTR' 'TBL_OUTPUT' ' ' ' ' 12
    'GR Value '.
      PERFORM write_fieldcat USING 'NAME1' 'TBL_OUTPUT' ' ' ' ' 13
    'Vendor Name'.
    End of R3DK912809
    ENDFORM.                    " get_fieldcat
          FORM process_top_of_page                                      *
    FORM process_top_of_page.
      SKIP.
      ULINE.
      FORMAT COLOR COL_HEADING INTENSIFIED OFF .
    Begin of R3DK912376
    WRITE:/ 'Report Name     :  PO Release Audit Report',
      WRITE:/ 'Report Name     :  Purchase Order Actions Report',
    End of R3DK912376
           / 'Run Date        : ', sy-datum,
           / 'Run Time        : ', sy-uzeit,
    Begin of R3DK912404
         / 'Document Type   : ', c_tcode,
    End of R3DK912404
           / 'Company code    : ', s_bukrs-low.
      IF NOT s_bukrs-high IS INITIAL.
        WRITE: 'To', s_bukrs-high.
      ENDIF.
      WRITE:/ 'Purch Org       : ', s_ekorg-low.
      IF NOT s_ekorg-high IS INITIAL.
        WRITE: 'To', s_ekorg-high.
      ENDIF.
    Begin of R3DK912404
    WRITE:/ 'Purchase Order  : ', s_ebeln-low.
    IF NOT s_ebeln-high IS INITIAL.
       WRITE: 'To', s_ebeln-high.
    ENDIF.
    WRITE:/ 'Purchasing Grp  : ', s_groups-low.
    IF NOT s_groups-high IS INITIAL.
       WRITE: 'To', s_groups-high.
    ENDIF.
    WRITE:/ 'Vendor          : ', s_lifnr-low.
    IF NOT s_lifnr-high IS INITIAL.
       WRITE: 'To', s_lifnr-high.
    ENDIF.
      WRITE:/ 'Goods Receipt Date:', s_budat-low.
      IF NOT s_budat-high IS INITIAL.
        WRITE: 'To', s_budat-high.
      ENDIF.
    End of R3DK912404
      WRITE:/ 'Purch Doc Date  : ', s_bedat-low.
      IF NOT s_bedat-high IS INITIAL.
        WRITE: 'To', s_bedat-high.
      ENDIF.
    Begin of R3DK912404
    WRITE:/ 'Purch Doc Type  : ', s_bsart-low.
    IF NOT s_bsart-high IS INITIAL.
       WRITE: 'To', s_bsart-high.
    ENDIF.
    End of R3DK912404
      ULINE.
      FORMAT COLOR COL_HEADING INTENSIFIED OFF.
    ENDFORM.                    " process_top_of_page
    *&      Form  create_report
          text
    -->  p1        text
    <--  p2        text
    FORM create_report.
      SORT tbl_output BY ebeln ebelp.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          it_events                = tbl_events
          i_interface_check        = ' '
          i_callback_program       = 'ZSAMPLE3'
          i_callback_pf_status_set = g_status
          i_callback_user_command  = g_user_command
          is_layout                = st_layout
          it_fieldcat              = tbl_fieldcat
          i_default                = 'X'
          i_save                   = 'X'
        TABLES
          t_outtab                 = tbl_output
        EXCEPTIONS
          program_error            = 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.                    " create_report
    *&      Form  select_data
          select records for specified selections
    -->  p1        text
    <--  p2        text
    FORM select_data.
      CLEAR: c_tcode, t_cdhdr, t_ekko, tbl_output.
      REFRESH: t_cdhdr, t_ekko, tbl_output, tbl_fieldcat.
      IF NOT p_gr IS INITIAL.
        SELECT DISTINCT a~ebeln "R3DK912960
        SELECT a~ebeln                                          "R3DK912960
               b~ebelp                                          "R3DK912960
               b~belnr
               a~bukrs
               a~bsart
               a~bedat
               b~budat
               a~ernam
               b~ernam
    INTO TABLE t_ekko
    FROM ekko AS a
    INNER JOIN ekbe AS b
    ON aebeln = bebeln
    Begin of R3DK912384
    AND b~bewtp = 'E'
    AND b~bwart = '101'
    End of R3DK912384
    WHERE a~bukrs IN s_bukrs AND
        a~ebeln IN s_ebeln AND
        a~ekgrp IN s_groups AND
        a~lifnr IN s_lifnr AND
        a~bsart IN s_bsart AND
        a~ekorg IN s_ekorg and
        a~bedat IN s_bedat AND
        b~budat IN s_budat AND
        a~frgke = 'R'
        ORDER BY aebeln bbudat DESCENDING.
    Begin of  R3DK912809 R3DK912960
        DELETE ADJACENT DUPLICATES FROM T_EKKO COMPARING EBELN.
    End of  R3DK912809 R3DK912960
      ELSE.
      SELECT DISTINCT a~ebeln       "R3DK912960
        SELECT a~ebeln                                          "R3DK912960
               b~ebelp                                          "R3DK912960
               b~belnr
               a~bukrs
               a~bsart
               a~bedat
               b~budat
               a~ernam
               b~ernam
            INTO TABLE t_ekko
            FROM ekko AS a
            LEFT JOIN ekbe AS b
            ON aebeln = bebeln
    Begin of R3DK912384
            AND b~bewtp = 'E'
            AND b~bwart = '101'
    End of R3DK912384
            WHERE a~bukrs IN s_bukrs AND
                  a~ebeln IN s_ebeln AND
                  a~ekgrp IN s_groups AND
                  a~lifnr IN s_lifnr AND
                  a~bsart IN s_bsart AND
                  a~ekorg IN s_ekorg AND
                  a~bedat IN s_bedat AND
                  a~frgke = 'R'
                  ORDER BY aebeln bbudat DESCENDING.
    Begin of  R3DK912809 R3DK912960
        DELETE ADJACENT DUPLICATES FROM T_EKKO COMPARING EBELN.
    End of  R3DK912809 R3DK912960
      ENDIF.
      sort t_ekko by ebeln ebelp budat descending.
    sivanew
      delete adjacent  duplicates from t_ekko comparing ebeln ebelp .
    sivanew
    IF sy-subrc EQ 0.            "R3DK912809
      IF NOT t_ekko[] IS INITIAL.                               "R3DK912809
        PERFORM process_data.
    Begin of R3DK912444
        IF NOT p_excep IS INITIAL.
          PERFORM get_exceptions.
        ENDIF.
    End of R3DK912444
      ENDIF.
    ENDFORM.                    " select_data
    *&      Form  write_fieldcat
          text
         -->P_0190   field name, if the SAP name used desc will be
                     automatically get from SAP table
         -->P_0191   Internale structure or table name
         -->P_0192   SAP table for field description
         -->P_0193   format
         -->P_1      Position
         -->P_0195   Custom Description
    FORM write_fieldcat USING name tab st key pos desc.
      st_fieldcat-fieldname = name.
      st_fieldcat-tabname = tab.
      st_fieldcat-ref_tabname = st.
      st_fieldcat-key = key.
      st_fieldcat-col_pos = pos.
      st_fieldcat-seltext_m = desc.
      IF pos = 12.
        st_fieldcat-outputlen = 40.
      ENDIF.
      APPEND st_fieldcat TO tbl_fieldcat.
      CLEAR st_fieldcat.
    ENDFORM.                    " write_fieldcat
    *&      Form  process_record
          text
    -->  p1        text
    <--  p2        text
    FORM process_record.
      DATA:l_ebeln LIKE ekko-ebeln.
      LOOP AT t_cdhdr.
        CLEAR: l_ebeln, ws_ebeln, ws_netwr, ws_ernam.
        MOVE t_cdhdr-objectid TO l_ebeln.
        CALL FUNCTION 'ME_EKKO_SINGLE_READ'
          EXPORTING
            pi_ebeln = l_ebeln
          IMPORTING
            po_ekko  = po_ekko.
    Begin of R3DK912809 R3DK912960
       SELECT SUM( dmbtr ) INTO ws_dmbtr
         FROM ekbe WHERE ebeln = l_ebeln
                     AND vgabe = '1'
                     AND bewtp = 'E'
                     GROUP BY ebeln.
       ENDSELECT.
    End of R3DK912809
        SELECT SINGLE dmbtr INTO t_ekko-dmbtr
           FROM ekbe WHERE ebeln = t_ekko-ebeln
                       AND ebelp = t_ekko-ebelp
                       AND belnr = t_ekko-belnr
                       AND vgabe = '1'
                       AND bewtp = 'E'.
        MODIFY T_EKKO.
    End of R3DK912960
        SELECT SINGLE ernam INTO t_ekko-grnam
             FROM ekbe WHERE ebeln = t_ekko-ebeln
                         AND ebelp = t_ekko-ebelp
                         AND ELIKZ = 'X'.
        MODIFY T_EKKO.
        SELECT ebeln SUM( netwr ) INTO (ws_ebeln, ws_netwr)
         FROM ekpo WHERE ebeln = l_ebeln       R3DK912960
           FROM ekpo WHERE ebeln = t_ekko-ebeln                 "R3DK912960
           GROUP by ebeln.
        ENDSELECT.
        IF sy-subrc EQ 0.
          IF s_groups IS INITIAL.
            PERFORM build_output.
          ELSE.
            IF po_ekko-ekgrp IN s_groups.
              PERFORM build_output.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " process_record
    *&      Form  get_customer
          Get Customers if sales office specified
    -->  p1        text
    <--  p2        text
    *&      Form  build_output
          text
    -->  p1        text
    <--  p2        text
    FORM build_output.
      DATA: l_line   LIKE ekpo-ebelp.
      DATA: l_requisitioner LIKE ekpo-afnam.
      IF po_ekko-frgke = 'R'.
        CLEAR: tbl_output.
        tbl_output-udate = t_cdhdr-udate.
        tbl_output-utime = t_cdhdr-utime.
        tbl_output-username = t_cdhdr-username.
        tbl_output-ebeln = po_ekko-ebeln.
        tbl_output-bukrs = po_ekko-bukrs.
        tbl_output-lifnr = po_ekko-lifnr.
        tbl_output-name1 = ' '.
        tbl_output-lifnr = po_ekko-lifnr.
        tbl_output-ekgrp = po_ekko-ekgrp.
       tbl_output-ernam = po_ekko-ernam.
        tbl_output-ernam = t_ekko-ernam.
        tbl_output-budat = t_ekko-budat.
       tbl_output-grnam = t_ekko-grnam.
        tbl_output-bedat = t_ekko-bedat.
        tbl_output-dmbtr = t_ekko-dmbtr.                        "R3DK912809
        tbl_output-ebelp = t_ekko-ebelp.
        SORT T_CDHDR1.
       sivanew
       read table t_cdhdr1 with key
                      objectid = t_cdhdr-objectid binary search.
       if sy-subrc = 0.
         tbl_output-cdate = t_cdhdr1-username.
       endif.
        read table t_cdhdr1 with key
                       tcode = 'ME22N' binary search.
        if sy-subrc = 0.
          SELECT * FROM cdpos INTO TABLE t_cdpos
                 WHERE objectid = t_cdhdr1-objectid AND
                       objectclas = 'EINKBELEG' AND
                 changenr = t_cdhdr1-changenr.
          IF sy-subrc = 0.
            l_ponum = t_cdpos-tabkey+3(10).
            l_poline = t_cdpos-tabkey+13(6).
          ENDIF.
        ENDIF.
        IF tbl_output-ebeln = l_ponum AND tbl_output-ebelp = l_poline.
          READ TABLE t_cdhdr1 WITH KEY changenr = t_cdpos-changenr
                                      tcode = 'ME22N' BINARY SEARCH.
          IF sy-subrc = 0.
            tbl_output-cdate = t_cdhdr1-username.
          ENDIF.
        ENDIF.
    ENDIF.
      select ebeln belnr budat cputm   from ekbe into table t_ekbe
                        where vgabe = '1' and
                              ebeln = t_cdhdr-objectid.
      sort t_ekbe by   budat descending cputm descending.
      delete adjacent duplicates from t_ekbe comparing ebeln.
      loop at t_ekbe.
        select mblnr usnam from mkpf into table t_mkpf
                                 where mblnr = t_ekbe-belnr.
        if sy-subrc = 0.
          read table t_mkpf with key
                           mblnr = t_ekbe-belnr binary search.
          move t_mkpf-usnam to   tbl_output-grnam.
        endif.
      endloop.
        Indra
    Get the user changed the record
       IF t_cdhdr-tcode = 'ME22N'.
         SELECT * FROM cdpos INTO TABLE t_cdpos
                WHERE objectid = t_cdhdr-objectid AND
                      objectclas = 'EINKBELEG' AND
                changenr = t_cdhdr-changenr.
         IF sy-subrc = 0.
           l_ponum = t_cdpos-tabkey+3(10).
           l_poline = t_cdpos-tabkey+13(6).
         ENDIF.
       ENDIF.
    indra
    Display creator or changer
       IF tbl_output-ebeln = l_ponum AND tbl_output-ebelp = l_poline.
         READ TABLE t_cdhdr WITH KEY changenr = t_cdpos-changenr
                                     tcode = 'ME22N' BINARY SEARCH.
         IF sy-subrc = 0.
           tbl_output-cdate = t_cdhdr-username.
         ENDIF.
       ENDIF.
    Indra
      SELECT SINGLE * FROM t024
             WHERE ekgrp = po_ekko-ekgrp.
      IF sy-subrc EQ 0.
        tbl_output-eknam = t024-eknam.
      ENDIF.
      tbl_output-netwr = ws_netwr.
      SELECT SINGLE name1 FROM lfa1
        INTO tbl_output-name1
        WHERE lifnr = po_ekko-lifnr.
    Get Document descriptions
      SELECT SINGLE batxt FROM t161t
             INTO tbl_output-batxt
             WHERE spras = 'E' AND
                   bsart = po_ekko-bsart AND
                   bstyp = po_ekko-bstyp.
    Get Release code descriptions
      SELECT SINGLE frgct FROM t16fd
                   INTO tbl_output-frgct
                   WHERE spras = 'E' AND
                         frggr = po_ekko-frggr AND
                         frgco = po_ekko-frgsx.
      APPEND tbl_output.
    ENDIF.
    ENDFORM.                    " build_output
    *&      Form  SORT_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM sort_table.
    SORT tbl_output BY ebeln ebelp ascending  udate  utime DESCENDING.
    SORT tbl_output BY ebeln  ascending  udate  utime DESCENDING.
    delete adjacent  duplicates from tbl_output comparing ebeln ebelp .
    ENDFORM.                    " SORT_TABLE
    *&      Form  PROCESS_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM process_data.
      LOOP AT t_ekko.
        c_tcode = 'Purchase Orders'.
       SELECT * FROM cdhdr UP TO 1 ROWS INTO TABLE t_cdhdr "R3DK912960
        SELECT * FROM cdhdr   into table t_cdhdr
                WHERE objectclas = 'EINKBELEG' AND
                     objectid = t_ekko-ebeln AND
                        tcode = 'ME28'.
        SORT T_CDHDR BY UDATE DESCENDING  UTIME DESCENDING.
        delete adjacent duplicates from t_cdhdr  comparing objectid.
         siva
           SELECT * FROM cdhdr UP TO 1 ROWS INTO TABLE t_cdhdr1
    *"R3DK912960
        SELECT * FROM cdhdr  INTO TABLE t_cdhdr1
                WHERE objectclas = 'EINKBELEG' AND
                     objectid = t_ekko-ebeln AND
                        tcode = 'ME22N'.
        SORT T_CDHDR1 BY UDATE descending UTIME DESCENDING.
        delete adjacent duplicates from t_cdhdr1 comparing objectid.
       sivanew
       if c_tcode = 'ME22N'.
         SELECT * FROM cdpos INTO TABLE t_cdpos
                      WHERE objectid = t_cdhdr1-objectid AND
                            objectclas = 'EINKBELEG' AND
                      changenr = t_cdhdr1-changenr.
         IF sy-subrc = 0.
           l_ponum = t_cdpos-tabkey+3(10).
           l_poline = t_cdpos-tabkey+13(6).
         ENDIF.
       ENDIF.
    *sivanew
       IF sy-subrc = 0.
         delete adjacent  duplicates from t_cdhdr comparing objectid.
        PERFORM process_record.   " process each document
       ENDIF.
      ENDLOOP.
    ENDFORM.                    " PROCESS_DATA
    *&      Form  get_exceptions
          text
    -->  p1        text
    <--  p2        text
    form get_exceptions.
    Display a report which shows the same released, goods receipted and
    created by user
      LOOP AT tbl_output.
        IF tbl_output-username <> tbl_output-ernam OR
           tbl_output-ernam <> tbl_output-grnam.
          DELETE tbl_output.
        ENDIF.
      ENDLOOP.
    endform.                    " get_exceptions

    Hi,
    first of all you should read the following thread ABAP Development It is really hard to read code without proper formatting.
    It looks like you use change documents to get user name for last change. For each document you use last change document and hence you have same name for every item. I am not sure if it is possible (it should be) but for each item you need to look for last change document corresponding to this item. 
    Cheers

  • Dynamic Action on tabular form: to auto set value for all changes rows

    Hi All:
    I am using APEX4.2.3 and I am not very familar with JQUERY or Javascript.
    I am having a tabular form to support Update and Delete action. The tabular form has 4 columns:
    Column A: ID                      (Number)     : Read-only column
    column B: Name                 (Varchar2)   : Editable
    Column C: Age                    (Number)     : Editable
    Column D: ChangeFlag      (Varchar2)   : Read-only column                             ==> however, I want this column been automatically upldated by my APEX application
    Here is the requirement: First user update Column B, or C or both for # of rows; then user click "Save Change" button. For ALL updated rows, I need to automatically update Column D with below logic:
    For a given row,
                   IF Column D IS NULL  THEN
                         set value = 'M'                           -- M means modified
                   ELSE --- column D has a value already
                        IF last character of Column D is 'M', THEN
                               don't do anything;
                        ELSE
                              set value of D = existing value + 'M'                       (here + means concatenate
                       END IF;
                END IF;
    I thought this can be done by creating dynamic action on tabular form ... I have researched this on this forum and can't find a good match example ..
    I know I can implement this using a DB trigger; however, I want to learn if this can be achived via Dynamic Action.
    Thanks!
    Kevin

    Hi Expert:
    Anyone can offer any direction or help on this?
    Thanks!
    Kevin

Maybe you are looking for

  • GTS Organization Structure for Plants in foreign countries

    Hello, I want to get an solution for the following task: A German Company, represented with one Company Code in ECC, has about 40 Sales- and/or Productionplants all over the word. These plants do deliveries for german sales orders and projekts. The r

  • Remove pics from trash in iphoto

    Hi i have moved all my pics and albums to an external hard drive to free up some space, but they still remain(over 8000) in the trash in iphoto, not in the trash on applications, how can iremove these as it is still taking time when i click on iphoto

  • MacBook OS X 10.5.8 connect to TV Toshiba

    Okay, so I'm wondering what cords to use? if i can do this. Its a small flat screen TV i have in my room and i would love to connect it to my laptop. If i can do this and get the cord what steps do i take ?

  • Just reinstalled Snow Leopard - where's the "previous system" located?

    I just successfully reinstalled Snow Leopard. I'm satisfied my new system works fine, so I'd like to delete the previous system - as I've done in the past before Snow Leopard. Is there a "Previous System" folder lurking around somewhere on my hard di

  • OpenSPARC T2 package 1.2, linux: problem with simv linking

    Dear all, I'm experiencing a problem with the package OpenSPARC T2 v. 1.2. When running the sims and regressions everything seems to goes fine, but the simv is not created and the regression tests not executed. I'm getting error when link is searchin