Need some logic for knowing closest Iternary Number for a Delivery

Hi Guys,
              I have some requirement like below.
Let say for example I have a Delivery with No 8000001 with Iternary(Order) as 5 in workarea.
Let say I have one Internal Table with deliveries and Iternary no as below.
VBELN        ITERN
8000002        2
8000003        4
8000004        3
8000005        1
8000006        6
How to get the value into another ITAB1 for 8000001 with Iternary 5 from the above mentioned workarea has the nearest Iternary value is
8000006        6
OR
8000003        4
from the above ITAB.
Thanks in Advance.
Prasad.
Edited by: Dheeru Prasad on Nov 30, 2009 10:04 PM

modify the code as per your need .
types : begin of ty_order,
         vbeln type vbeln,
       itern type i,
     end of ty_order.
     data : i_order type standard TABLE OF ty_order,
            wa_order type ty_order,
            wa_order_result type ty_order,
            value type i,
            l_value type i,
            l_vbeln type vbeln,
            l_itern type i,
            l_tabix type sy-tabix.
     wa_order-vbeln = '8000002'.
     wa_order-itern = 2.
     append wa_order to i_order.
      wa_order-vbeln = '8000003'.
     wa_order-itern = 4.
     append wa_order to i_order.
      wa_order-vbeln = '8000004'.
     wa_order-itern = 3.
     append wa_order to i_order.
      wa_order-vbeln = '8000005'.
     wa_order-itern = 1.
     append wa_order to i_order.
      wa_order-vbeln = '8000006'.
     wa_order-itern = 6.
     append wa_order to i_order.
     l_vbeln = 8000001.
     l_itern = 5.
     loop at i_order into wa_order.
       l_tabix = sy-tabix.
       value = wa_order-itern - l_itern.
       if value < 0.
         value = value * ( - 1 ).
         endif.
       if l_tabix NE 1.
         if value lt l_value.
            l_value = value.
           wa_order_result = wa_order.
           endif.
         else.
           l_value = value.
           wa_order_result = wa_order.
           endif.
       endloop.
       write / :  wa_order_result-vbeln , wa_order_result-itern .

Similar Messages

  • Need some logic for displaying data from Internal Table

    Hi Guys,
                  I have a Internal Table with multiple entries.
    My ITAB looks like below.
    PN  VBELN  MATNR MATKX
    1     111       P-101    XXX
    2     121       P-102    XYZ
    2     112       P-103    ABC
    3     134       P-104    DEF
    3     124       P-105    EFG
    Now my requirement is I need to display the out put as follows through ALV or normal display.
    <Header>                                                  <Date>
                                                                      <Time>
    PN = 1
    VBELN   MATNR  MATKX
    111         P-101   XXX
    <Footer>
    Some gap (May be a line to differentiate)
    <Header >                                                <Date>
                                                                     <Time>
    PN = 2
    VBELN   MATNR  MATKX
    121         P-102   XYZ
    112         P-102   ABC
    <Footer>
    Some gap (May be a line to differentiate)
    <Header >                                                <Date>
                                                                     <Time>
    PN = 3
    VBELN   MATNR  MATKX
    134         P-104   DEF
    124         P-105   EFG
    <Footer>
    Thanks in Advance.
    Prasad.

    HI,
    Use:
    Data: W_PNlike PN.
    LOOP AT ITAB.
    If Itab-PN ne W_PN.
    <Header> <Date>
    <Time>
    PN = 1.
    VBELN MATNR MATKX   >>>>>>>>>>>>>>>First Line enter
    ELSE.
    VBELN MATNR MATKX  > line Next entry
    ENDIF.
    W_PN = ITAB-PN.
    AT-END PN.
    <Footer>
    ENDAT.
    ENDLOOP.
    Hope this resolve your issue.
    Regards,
    Gurpreet

  • I need some parts for my MuVo V100, can anyone help?

    I need some parts for my MuVo V00, can anyone help I couldn't find any thread this would belong in, but if I've made a mistake, I'm sorry.
    I have a Creative Labs MuVo V00 2 gig player. I love it. The only problem is that the back peice of plastic that holds the battery in somehow has fallen off and has disappeared. I really, really, would like to replace it, but I can't find anywhere where parts like this are sold.
    So, does anyone know where I can buy this part Or does anyone have one they are willing to sell me If I have to get the whole little "docking bay" that holds the batery and the unit, that would be fine too. I'm not going to pay huge money for it, seeing that I can still get a new one at a few places, but if anyone has one that broke, or that they just aren't using, and wouldn't mind making a few bucks + postage, I would really appreciate it.
    Thanks for your time.

    Re: I need some parts for my MuVo V00, can anyone help As far as I'm concerned the subject is closed. I was just irritated that I asked for help, and got some glib little reply, telling me something that anyone who's been on the internet for more than ten seconds should know about. Because to be honest, him replying with those three words, might have made someone overlook the post, thinking, "Someone is handling that, let's move on." Someone who actually might have what I needed.
    But, as it turns out, I could order a reconditioned MuVo from Creative directly for about 6 bucks. (vs. 45+ if I'd gone through ebay) so the problem is resolved. If I could figure out a way to erase this entire post, I would do it. If you can do so, being a mod, I would appreciate it.
    Sorry if I upset you Loi-CL, I understand you're a moderator, but I don't take kindly to being treated like I'm stupid and that's exactly what coachop94 was doing. If he didn't have anything important or useful to tell me, he could have just skipped over my post.

  • I need some help for an explanation. Loop for 1 minute.

              int minute=1;
              long currentTime=System.currentTimeMillis();          
              long stoppingTime = currentTime + (minute * 60 * 1000);
              while (currentTime<stoppingTime) {
                   // do x;
                   currentTime=System.currentTimeMillis();
              }I want to have the loop to run for 1 minute. It does not seem to work.
    What did I miss? I need some help for an explanation.

    Ran:
    class PrintTimeAsProcess {
      public static void main(String[] argv)  throws Exception {
        int minute=1;
        long currentTime=System.currentTimeMillis();
        long stoppingTime = currentTime + (minute * 15 * 1000);
        System.out.println("START Time: "+currentTime);
        while (currentTime<stoppingTime) {
          currentTime=System.currentTimeMillis();
        System.out.println("END Time: "+currentTime);
    }Got:
    START Time: 1149278202718
    END Time: 1149278217718
    1149278217718
    -1149278202718
    15000

  • Need a logic for Internal table processing

    Hi,
    I have a requirement...an internal table contains three fields material no, bin no, and Quantity
    Mat. No    |         Bin No        |              Quantity
    a              |              x1         |                   10
    a              |              x1         |                   10
    a              |              x2         |                   20
    b              |              x3         |                   10 
    c              |              x3         |                   20
    c              |              x4         |                   30
    c              |              x4         |                   40
    In this I need to append the records to new internal table say itab1 where multiple entries exist for some material no like mat no 'a' and 'c'  and
    if the material no. exist only once in the table, it has to be moved to another new internal table say itab2.
    Pls suggest some logic that does not have performance issues.
    Thanks in advance
    Saravana

    Hi there,
    a solution in brief...
    data: wa_itab1_a like itab1,
             wa_itab2_b like itab1,
             lv_tabix       type sytabix.
    sort itab1 by matnr.
    loop at itab1.
      wa_itab1_a = itab1.
      at new matnr.
        lv_tabix = sy-tabix + 1.
        clear wa_itab2_b.
        READ TABLE itab1 into wa_itab2_b
                            INDEX lv_tabix.
        if wa_itab2_b-matnr ne wa_itab1_a-matnr.
          append wa_itab1_a to itab2.
          delete itab1 where matnr = wa_itab1_a-matnr.
        endif.
      endat.
    endloop.
    Regards
    George Zervas
    Edited by: gzervas on Oct 20, 2010 12:08 PM

  • Need some tips for Database Developer Role.

    Dear All,
    Next week, I'm going to face an Interview for Database Developer role.
    For this, I need some more & useful information on these recommended points.
    1. Involve in a designing part of Data warehouse from
    scratch 
    2. Create complex analytic queries on large data sets.
    3. Analyse trends in key metrics.
    4. Monitoring and optimizing the performance of the database.
    Please help get the vital information on these points.
    All help will be highly appreciated.
    Thanks,

    1. Involve in a designing part of Data warehouse from
    scratch
    Design Database...
    This needs lot of information about business and its fonctionnalités, and so many.. Tables,  relationships etc...
    http://technet.microsoft.com/en-us/library/ms187099%28v=sql.105%29.aspx
    Code Design...
    SP's, Funcitions, Views, Sub queries, Joins, Triggers etc...
    DW Design
    DB size and number of reports and historical data details, reduce the normalization and etc....
    http://technet.microsoft.com/en-us/library/aa902672%28v=sql.80%29.aspx
    2. Create complex analytic queries on large data sets.
    Its all based on your current database design, size, required output, data, performance etc..
    4. Monitoring and optimizing the performance of the database.
    Perfmon, Activity monitor, spotlight, custom queries, DMV's sp_whoisactive, execution plans, and many other thirdparty tools.. and may be best experience will give best view and clarity :)
    Note : This is very big topic and its not easy to answer in few words or lines... :) goole it for more details...
    Raju Rasagounder Sr MSSQL DBA

  • Need some Idea for my final year project to increase buffer size

    hi...i need some idea from someone to give some idea, advice or some excersice/toturial about " how to increase buffer size" on my final year project, i have try find the solution..but it's still have problem on my oscilloscope.VI. I was design my final year project using LabVIEW 8.6 and now i state my design for someone to refer my project.
    Thank You  
    Attachments:
    Oscilloscope A.llb ‏166 KB

    Don't know if this is what you're searching for, and I don't know if there is such a function in LV 8.6, but I'm using LV 2010 and under DAQmx Pallete, you go to "Advanced Task Options", there is a function "Configure Output Buffer", in which you can configure the buffer size you want.

  • Need some opinions for K9VGM-V

    hello all, My computer is only to play and i have this Motherboard K9VGM-V,  need some opinions about this. Is necessary to upgrade to another motherboard with my current system? need some pros and contra please about this motherboard. Any response will be appreciate.(im srry, english is not my main lenguage)
    Sytem:
    Amd Athlon X2 Dual-core 5200 AM2
    2GB DDR2 667
    ECS Geforce 9800GT
    PSU 650W Thermaltake
    Windows XP SP3

    Quote from: Sm3K3R on 20-March-09, 22:16:45
    Recheck if the RAM sticks are inserted into the right DIMM-s for dual channel to work
    Also disable in BIOS Cool & Quiet and see if this solves the problem 
    Whats the score in Aquamark 3?
    Edit:Have you installed AMD Dual Core Optimizer ?
    I guess they are insert right.. my motherboard only have 2 slots so i guess its works that way. how i can check if they are actually working as dual channel?.
    K im gonna disable cool and quiet.. anything else i need to know that can improve my fps?
    Aquamark 3?.. gonna check now
    AMD Dual Core Optimizer? No.. i dont have that.. im already downloading it
    thx for the reply  
    EDIT:
    AMD Dual core Optimizer installed.
    K on Aquamark 3 (this test is from 2004 ¬¬) i have 98391.. 18273 on GX and 10658 on CPU.
    cool and quiet was disabled on BIOS.. the only thing i changed on my BIOS was the clock from 200 to 211 everything else is on default, i have to say last week i buyed a new Processor a VideoCard and RAM listed before.
    From Orleans 3800+ Single core to 5200+ Dual core
    From 7300GS to 9800GT
    From 2x 512MB DDR2 800 to 2x 1GB DDR2 667 (both were Dual-channel i guess they were the same)

  • I need some testers for 915resolution-static... [I have them thanks]

    I added another Intel chipset (945GME) to 915resolution-static and in the process I did some refactoring of the patch. The only machine I have to test on here is a GMA500 (Poulsbo -- POS) and that works fine. I'd like to have a few testers on the other chipsets to make sure that the package works correctly before I upload it to AUR. If you're willing to help, just let me know here and I'll e-mail you the PKGBUILD and supporting files.

    brianhanna wrote:I have a 945GM and I'm willing to help but curious why I'd need 915resolution.  For a long time now, the intel drivers auto-detect my screen resolution with no problem.  I haven't needed 915resolution in a couple years now.
    That's a fantastic question. I honestly don't know why anyone that doesn't suffer from a Poulsbo chip (like me) needs this software. I was under the impression that pretty much everything else worked already.
    Anyway, thanks for your offer but I don't think that I'll be needing it. The main thing that I'm trying to do is see if I made a system destroying mess out of my patch refactoring. There are currently a few people trying and I haven't trashed anyone's systems yet.

  • Need a Logic for balance

    Hi Experts,
    I have a table
    SSN          data            balance paid_amount rank
    111111111    1st week date   1000     100         1
    111111111    2nd week date   1000     100         2
    111111111    3rd week date   1000     100         3
    111111122    1st week date   1000     100         1
    111111122    2nd week date   1000     100         2
    111111122    3rd week date   1000     100         3
    I want the output as
    SSN          data            balance New_balance
    111111111    1st week date   1000     1000        
    111111111    2nd week date   1000     900        
    111111111    3rd week date   900      800        
    111111122    1st week date   1000     1000        
    111111122    2nd week date   1000     900        
    111111122    3rd week date   900      800        
    For first New_balance values will be same as balance
    for second week balance = new_balance and new_balance = balance-paid_amount
    for third  week balance = new_balance and new_balance = balance-paid_amount
    I am using data service version 4.1
    Need a Logic to perform above
    Thanks
    Madhu

    Hi Mohd,
    It worked Perfect for the new balance field, thank you so much, Also the balance field should change
    In the above result set the 3rd Week balance should be same as 2nd week new balance
    In other words, 2nd Week Balance should be same as first week new balance as shown below
    Input
    SSN
    DATE
    BALANCE
    PAID_AMOUNT
    111111111
    1ST Week
    1000
    100
    111111111
    2nd Week
    1000
    100
    111111111
    3rd Week
    1000
    100
    111111112
    1ST Week
    1000
    100
    111111112
    2nd Week
    1000
    100
    111111112
    3rd Week
    1000
    100
    111111112
    4TH Week
    1000
    100
    output
    SSN
    DATE
    BALANCE
    NEW_BALANCE
    111111111
    1ST Week
    1000
    1000
    111111111
    2nd Week
    1000
    900
    111111111
    3rd Week
    1000
    800
    111111112
    1ST Week
    1000
    1000
    111111112
    2nd Week
    1000
    900
    111111112
    3rd Week
    1000
    800
    111111112
    4TH Week
    1000
    700
    Thanks for your Effort

  • Need the Logic for this Prg issue Pls

    Hi Friends,
    i have an urgent requirement..
    i am develop the report that is :
    Based on Selction Critirea kunnr(knvv-kunnr)
    i want Delete the
             Internet mail (SMTP) address FROM ADR6-MTP_ADDR
    AND Teletex number FROM ADR4-TTX_NUMBER..
    USING TABLES ARE KNVV , ADR6 AND ADR4.
    please how to Write the LOGIC For this Program .
    help me.. it is an urgent.. anyone.
    regards,

    Hi Alchermi,
    thanks for your reply soon.
    based on selction kunnr .. i want deete the ADR4-TTX_NUMBER..and ADR6-SMTP_ADDR From these 2 tables
    for these 2 fields..
    kunnr from knvv, selection field..
    below fields want be DELETED..
    ttx-number from adr4,
    smtp_addr from adr6.
    it is an urgent. help me .
    regards,

  • Need Some Material For XI.

    Hi all,
    I need some material to prepare XI.
    Apart SAP Help site ...pls help me out in finding good material for XI learning for beginner.
    Thanks in advance.
    Regards,
    Harsha.

    I think it is a good start
    https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FforumID%3D44%26threadID%3D42795
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    /people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario
    /people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter
    https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FforumID%3D44%26threadID%3D41493%26messageID%3D409257%23409257
    https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FthreadID%3D52541%26messageID%3D541927
    https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/2131 [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    https://www.sdn.sap.com/sdn/developerareas/dotnet.sdn?node=linkDnode1-2
    Hope this helps!
    regards
    roberti

  • I need some idea for my last project about Java

    Hi my name is suzanna from Indonesia. I have lots of interest with Java programming and I want make something about it for my last project. It's very important and I need some idea...could u give me some topic? I'm sorry if my english is very bad.thx,bye

    Here's some popular ideas:
    image steganography, chat client/server, spyware, client/server file transfer, forum content management/enforcement, anything with reflection, anything with communicating with an external device such as camera or modem or robot, writing your own replacement for the java.util.Calendar class, anything with custom class loaders, splitting a string into a string[]
    And for an extra challenge:
    dominition-based repetition, implementing a JVM which represents 'null' values internally using some other integer value than 0

  • Need some examples for smartforms and scripts

    hi
    now i am working in scripts and smartforms. so i need some examples and some information for scripts and smartforms. where i can find that information.

    hi jyothsna,
    i have given below a simple example
    this is the report program,
    *& Report  ZSCRIPT1                                                    *
    REPORT  ZSCRIPT1                                .
    TABLES : EKKO,
             EKPO,
             KNA1,
             USR01,
             MARA,
             MAKT.
    DATA : BEGIN OF ZOPTION.
            INCLUDE STRUCTURE ITCPO.
    DATA : END OF ZOPTION.
    PARAMETERS: P_EBELN LIKE EKKO-EBELN,
                P_EBELP LIKE EKPO-EBELP.
    CLEAR EKPO.
    SELECT SINGLE * FROM EKPO
           WHERE EBELN = P_EBELN AND
                 EBELP = P_EBELP.
    CLEAR KNA1.
    SELECT SINGLE NAME1 FROM KNA1
                  INTO KNA1-NAME1
                  WHERE KUNNR = EKPO-KUNNR.
    CLEAR MAKT.
    SELECT SINGLE MAKTX FROM MAKT
                  INTO MAKT-MAKTX
                  WHERE MATNR = EKPO-MATNR AND
                        SPRAS = SY-LANGU.
    CLEAR USR01.
    SELECT SINGLE * FROM USR01 WHERE BNAME = SY-UNAME.
    ZOPTION-TDDEST    = USR01-SPLD.        "Output device (printer)
    ZOPTION-TDIMMED   = 'X'.               "Print immediately
    ZOPTION-TDDELETE  = 'X'.               "Delete after printing
    ZOPTION-TDPROGRAM = 'ZPQRPRNT'.        "Program Name
    CALL FUNCTION 'OPEN_FORM'
         EXPORTING
             APPLICATION        = 'TX'
            ARCHIVE_INDEX      = ' '
            ARCHIVE_PARAMS     = ' '
             DEVICE             = 'PRINTER'
             DIALOG             = ' '
             FORM               = 'ZFORM1'
             LANGUAGE           = SY-LANGU
             OPTIONS            = ZOPTION
         IMPORTING
              LANGUAGE           = SY-LANGU
           EXCEPTIONS
             OTHERS     = 1.
    CALL FUNCTION 'WRITE_FORM'
         EXPORTING
             ELEMENT       = 'HEADER'
            FUNCTION      = 'SET'
            TYPE          = 'BODY'
             WINDOW        = 'HEADER'
         EXCEPTIONS
              ELEMENT       = 1.
    CALL FUNCTION 'WRITE_FORM'
         EXPORTING
             ELEMENT       = 'MAIN'
            FUNCTION      = 'SET'
            TYPE          = 'BODY'
             WINDOW        = 'MAIN'
         EXCEPTIONS
              ELEMENT       = 1.
    CALL FUNCTION 'WRITE_FORM'
         EXPORTING
             ELEMENT       = 'FOOTER'
            FUNCTION      = 'SET'
            TYPE          = 'BODY'
             WINDOW        = 'FOOTER'
         EXCEPTIONS
              ELEMENT       = 1.
    CALL FUNCTION 'CLOSE_FORM'
         EXCEPTIONS
              UNOPENED = 1
              OTHERS   = 2.
    This is the layout Set
    Layout set           Z_TESTSCRIPT
    Description          Test SAP script
    Standard attributes
      First page          FIRST
      Default paragraph   P1
      Tab-stop            1.00 CH
      Page format         DINA4
      Orientation         Landscape
      Lines/inch            6.00
      Characters/inch      10.00
    Font attributes
      Font family         COURIER
      Font size           12.0 Point
      Bold                No
      Italic              No
      Underlined          No
    Characters    Attributes
      B           Character String Bold
                  Standard attributes
                  Marker            No
                  Font attributes
                  Bold              Yes
    Paragraphs    Attributes
      P1          Default Paragraph
                  Standard attributes
                  Line spacing      1.00 LN
                  Left margin       1.00 CM
                  Alignment         Left-aligned
                  Font attributes
                  Font family       TIMES
                  Font size         12.0 Point
      P2          Header Paragraph
                  Standard attributes
                  Line spacing      1.00 LN
                  Left margin       4.50 CM
                  Alignment         Left-aligned
                  Font attributes
                  Font family       TIMES
                  Font size         18.0 Point
                  Bold              Yes
      P3          Undelined paragraph
                  Standard attributes
                  Line spacing      1.00 LN
                  Alignment         Left-aligned
                  Font attributes
                  Font family       TIMES
                  Font size         12.0 Point
                  Underlined        Yes
    Windows       Attributes
      MAIN        Main window
                  Window type       MAIN
      HEADER      Main window
                  Window type       CONSTANT
      FOOTER      Main window
                  Window type       CONSTANT
    Pages         Attributes
      FIRST       First Page
                  Standard attributes
                  Next page         FIRST
                  Page counter
                  Mode              START
                  Numbering type    Arabic numerals
                  Page window
                  HEADER               Left margin          00.00 CM
                                       Upper margin         00.00 CM
                                       Window width         20.00 CM
                                       Window height        04.00 CM
                  MAIN                 Left margin          00.00 CM
                                       Upper margin         05.00 CM
                                       Window width         20.00 CM
                                       Window height        20.00 CM
                  FOOTER               Left margin          00.00 CM
                                       Upper margin         25.00 CM
                                       Window width         20.00 CM
                                       Window height        04.00 CM
    Text elements for following windows:
    HEADER
    Element HEADER
    /: POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'
    /: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10
    P2     ,,<B>TEST PURCHASE ORDER</>
    MAIN
    Element MAIN
    P1  <B>Customer/Supplier:</>,,&KNA1-NAME1&
    P1  <B>PO No:</>,,&EKPO-EBELN&
    P1  <B>Part No:</>,,&MAKT-MATNR&
    P1  <B>Description:</>,,&MAKT-MAKTX&
    P1  <B>Quantity:,,</>&EKPO-MENGE&
    P1  <B>Sign:</>&uline(81)&
    P1  <B>Date:</>&EKKO-AEDAT&
    FOOTER
    Element FOOTER
    /: POSITION XORIGIN 2 CM YORIGIN '-0.5 CM'
    /: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10
    P2     ,,<B>PLEASE SIGN THE PO BEFORE DISPATCH</>
    <b>reward if useful :)</b>

  • I need some help , for create some paper on air

    Hi everyone
    I need some help , i work in a static sequence from Tehran street (1 frame), i paint damages on this frame in Photoshop because i need war atmosphere, then i add some smoke and cloud with particular .
    but i think this sequence is not realistic yet
    now i want add some moving paper in air and on street
    do u have any solution for how can i make this paper and moving those
    Thanks a lot
    and pardon me for bad English
    Ali Molavi

    The best tool to add this kind of particle is After Effects.
    If you have the Creative Cloud then I recommend you download that.
    Slightly annoying voice over, but here is a youtube tutorial you can follow top make floating particals. You can adjust it to make it look exactly as you want.
    http://www.youtube.com/watch?v=dq2op6yqvFk&noredirect=1

Maybe you are looking for