How to look up the first line item value based on several line items

Hi Expert,
I have one start routine in my transformation. But, I want to optimize it and only extract the first required line item. Can anyone help? thanks
SELECT
number
item
char3
char4
char5
char6
FROM
/bi0/adsoa00
t_dsoa into table t_itab
FOR ALL ENTRIES IN
source_package
WHERE
number EQ source_package-number
AND item between '1' and '99'. -> question, if there are more than one value and I always want to fill the first item, could I use any ABAP syntax like exit or up to row 1 in the code.

you can sort the table after the select and use delete adjacent duplicates to keep only the first or last item

Similar Messages

  • How do I prevent the first line of text in a link from becoming indented?

    Hello.  In a div are two sentences.  They look fine until I change the second sentence into a link.  I tried adding a <span> tag, but doing so changed the class.  I tried placing the text of the second sentence into a separate div tag, but that didn't work either.  I tried applying a negative value in the text indent field but that moved that first sentence instead of the second sentence.  I am having trouble getting the div containing the second sentence to move into location beneath the first sentence, so I decided to work with all of the text inside of one div tag.  I would appreciate it if someone would let me know how to have both sentences be in a flush left position.  Thank you.

    The indent comes from the padding-left: 7px; in the CSS rule for the <a> tag
    a:link {
              color: #FFF;
              background-color: #000;
              text-align: center;
              padding-top: 8px;
              padding-right: 8px;
              padding-bottom: 8px;
              padding-left: 7px; /* CREATES UNWANTED LEFT INDENT IN FOOTER LINKS */
              text-decoration: none;
    That rule is good for your menu but not your footer links so create a new set of rules for links in the footer.
    .footer_cc_license a:link { 
              color: #FFF;
              background-color: #000;
    .footer_cc_license a:visited {
      color: #FFF;
      background-color: #000;
    .footer_cc_license a:hover {
      color: #FFF;
      background-color: #000;
       text-decoration: underline;
    .footer_cc_license a:active {
      color: #FFF;
      background-color: #000;
      text-decoration: underline;

  • How do I delete the first seven items that come standard at the top of my favorites list, so that all it includes is my personal favorites?

    My favorites list contains seven unwanted items at the top that I want to remove. I just want it to include the sites I've tagged. I would also like to know the keyboard shortcut that opens the list. I had previously used Alt C, but that doesn't seem to work.
    Thank you for your help,
    a happy new user

    You can only create new folders in one of the three root folders.
    * The Bookmarks Toolbar folder stores the bookmarks that you see on the (View > Toolbars >) Bookmarks Toolbar.
    * The Bookmarks Menu folder stores bookmarks that you see in the Bookmarks menu and create via "Bookmarks > Bookmark This Page" or "Bookmark This Link" in the right click context menu.
    * The Unsorted Bookmarks folder stores the bookmarks that are created by clicking the star at the right end of the location bar.

  • How to pick up the CDHDR-CHANGE ID value, based on EBELN at where condition

    TYPES: BEGIN OF TY_CDHDR,
           OBJECTID TYPE CDHDR-OBJECTID,
           USERNAME TYPE CDHDR-USERNAME,
           UDATE TYPE CDHDR-UDATE,
           END OF TY_CDHDR.   
      SELECT ebeln bukrs bsart aedat ernam lifnr ekorg
             FROM ekko
             INTO TABLE gt_ekko
             WHERE ebeln IN s_ebeln
               AND bsart IN s_bsart
               AND bedat IN s_bedat
               AND ernam IN s_ernam.
      IF sy-subrc EQ 0.
        SELECT ebeln ebelp matnr
          FROM ekpo
          INTO TABLE gt_ekpo
          FOR ALL ENTRIES IN gt_ekko
          WHERE ebeln EQ gt_ekko-ebeln
            AND matnr IN s_matnr.
        IF gt_ekpo[] IS NOT INITIAL.
          SELECT ebeln ebelp etenr eindt menge
           FROM eket
           INTO TABLE gt_eket
           FOR ALL ENTRIES IN gt_ekpo
           WHERE ebeln EQ gt_ekpo-ebeln
             AND ebelp EQ gt_ekpo-ebelp.
          IF sy-subrc EQ 0.
        SELECT objectid username udate
              FROM cdhdr
              INTO TABLE gt_cdhdr
              WHERE changeid EQ gt_ekpo-ebeln.
    This is the exsisting code where i am getting a dump. Can you guys help me in this.

    Hi super3013,
    Modifiy as below :
    TYPES: BEGIN OF TY_CDHDR,
    OBJECTID TYPE CDHDR-OBJECTID,
    USERNAME TYPE CDHDR-USERNAME,
    UDATE TYPE CDHDR-UDATE,
    END OF TY_CDHDR.
    SELECT ebeln bukrs bsart aedat ernam lifnr ekorg
    FROM ekko INTO TABLE gt_ekko
      WHERE ebeln IN s_ebeln
        AND bsart IN s_bsart
        AND bedat IN s_bedat
        AND ernam IN s_ernam.
    IF NOT gt_ekko[] IS INITIAL.
    SELECT ebeln ebelp matnr
    FROM ekpo INTO TABLE gt_ekpo
    FOR ALL ENTRIES IN gt_ekko
      WHERE ebeln EQ gt_ekko-ebeln
        AND matnr IN s_matnr.
    ENDIF. 
    IF gt_ekpo[] IS NOT INITIAL.
    SELECT ebeln ebelp etenr eindt menge
    FROM eket INTO TABLE gt_eket
    FOR ALL ENTRIES IN gt_ekpo
      WHERE ebeln EQ gt_ekpo-ebeln
        AND ebelp EQ gt_ekpo-ebelp.
    SELECT objectid username udate
    FROM cdhdr
    INTO TABLE gt_cdhdr
    FOR ALL ENTRIES IN gt_ekpo 
    *  WHERE changeid EQ gt_ekpo-ebeln. 
      WHERE CHANGENR EQ gt_ekpo-ebeln.   
    ENDIF.
    There is no changeid Field of 90 chars in table CDHDR (but we have OBJECTID - 90 Char)
    There is a field CHANGENR which is of 10 chars make use of it (Document change number).

  • Need help with java File IO ( Removing the first line from a file )

    Hi guys ,
    I am currently doing a project in which I need to extract out the values from the second line of a file to the end. The question is how do I ignore the first line ??
    I thought of two possible answers myself. One is to use randomaccessfile to read and rewrite. But the file may be HUGE so storing the whole file in memory is not a very good idea.
    Second is to jump to second line before doing while ((str = in.readLine()) != EOL) ... or just delete the first line from the file. Can anyone suggest a better solution or show me some sample codes ? Thanks.
    regards
    billyam

    Just skip the first line (bufferedReader.readLine()), add a comment, and then handle the rest of your file

  • When printing a highlighted (selected) print range from an internet item pulled up through Firefox, the first line of the selected range is not printing or is partially cut off.

    When printing a highlighted (selected) print range from an internet item pulled up through Firefox, the first line of the selected range is not printing or is partially cut off. This is not an issue with my printer, as printer prints the whole selected print range when using Internet Explorer or Word Doc applications. The problem only happens when using Firefox. Please advise on how to fix this. Is this a settings issue or do I need to download and update? Thx

    * [[Printing a web page]]
    * [[Firefox prints incorrectly]]
    Check and tell if its working.

  • I modified the first business card in a template. Does anyone know how to get the other cards on the template to look like the first one without doing each individually? please and thanks!

    I modified the first business card in a template. Does anyone know how to get the other cards on the template to look like the first one without doing each individually? please and thanks!

    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=182&mforum=iworktips ntrick
    Peter

  • How to echo the first line???

    Hi everybody,
    I need to know how to echo the first line of an XML document with a SAX parser, for example :
    <?xml version="1.0"?>I've already tried :
    public void processingInstruction(String target, String data) throws SAXException {
            System.out.println("Target = (" + target + ")");
            System.out.println("Data = (" + data + ")");
        }but it doesn't work.
    Please, help me...
    Thanks.
    Maxime.

    http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPSAX4.html

  • How can i show the first item in the list as selected item

    Aslam o Alikum (Hi)
    Dear All
    How can i show the first item in the list as selected item when user click on the list. Right now when user click the list the list shows the last item in the list as selected or highlighted. Furthermore if the list item have large no of value and a scroll bar along with it then the list scroll to last item when user click it with mouse. I want that when user click the list item with mouse list should show the first item as highlighted.
    Take Care
    Allah Hafiz

    Hi!
    You can set list "initial value" using When-Create-Record trigger.
    I.g.
    :<Block_name>.<list_item_name> := Get_List_Element_Value('<Block_name>.<list_item_name>', 1);

  • I need to change the "from" address (the "add to addressbook" address) in the first line of emails that I send. How do I do this?

    I need to change the "from" address (the "add to addressbook" address) in the first line of emails that I send so that people reply to my email alias not the address where my emails originate. How do I do this?

    So you have added a new 'Identity' to your existing email address.
    If someone sends an email using that 'other identity'
    you have a choice of where those received emails can go. they can be received into the original mail account, like a collect all in the one Inbox or perhaps sent to Local Folders, so you can see them as separate. Or you can filter on that identity to put those emails in a specific folder.
    When you REply to any incoming mail that has used that new identity email address, it will use the new identity in the Email address in FROM assuming the received email in the main mail account of which the new identity email is applied.
    This should also now offer the added identity email address as an option in the FROM drop down list. So you can easily swap when sending an email if required.
    If you want to send using your default email address to people, but want their reply to use the identity email address:
    Tools > Account Settings
    select the original email address mail account name
    Where it says: 'Reply to addresses: enter the reply to identity email address.
    click on OK
    This means when they click on 'Reply' it will auto insert the Reply-to option.
    This will work providing it is a 'Reply' to an email you sent which contains the Reply-to email address.
    If someone is not actually replying by using the Reply-to new identity email address:
    In other words they are sending you a new email using the original email address because perhaps that is the one in their address book or the one they located on a webpage etc.
    Then, when you select to Reply to that email, it will use the email address to which it was sent to in the FROM field - the original email address. Hence why you would need to select the new identity FROM in the drop down list.
    One way to get around this is set out below.
    If you do not use an identity - instead you create another existing mail account for the 'identity' email address, so you have two mail accounts for the two email addresses.
    You can move selected emails manually or perhaps using a filter to screen them from the original mail account into the newly created mail account.
    Then when you click on Reply, it will use the new mail account email address instead of the original email address.

  • Help with how to count the number of tokens from the first line

    Hi
    I want to count the number of tokens from the first line of text, from my incoming file and print it out.
    For example i have 12 tokens in the first line, so i want it to print out the number 12
    my code is below
    thanks
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.util.StringTokenizer.*;
    import java.sql.*;
    public class Data {
         public static void main(String[] args) {
                        String token = null;          
                        String currentToken = "";
                        Hashtable hh = new Hashtable();     
              try {
                   Vector v2 = new Vector(100);
                   Vector v = new Vector(100);
                   FileReader file = new FileReader("words.txt");
                   BufferedReader buff = new BufferedReader(file);
                   String line = buff.readLine();
                   StringTokenizer s = null;
                   boolean eof = false;
                   while  (!eof){
                        s = new StringTokenizer(line.trim(),",",true);
                        boolean lastToken = true;
                   while (s.hasMoreTokens()) {
                              token = s.nextToken();
                                  if (lastToken){
                                   if (token.equals(",")) {
                                        v.add("");
                                               lastToken = false;
                                      if (! token.equals(",")) {
                                   v.add(token);
                                  else { if (currentToken.equals(",")) {
                                        v.add("");
                                  currentToken = token;
                        if (token.equals(",")) {
                               v.add("");
                   line = buff.readLine();
                        if (line == null){     
                             eof = true;}
                   buff.close();
              }catch (FileNotFoundException fe) {     
                        System.out.println("Error - - " + fe.toString());
              }catch (NumberFormatException ne) {
                        System.out.println("Error - - " + ne.toString());
              } catch (IOException e) {
                   System.out.println("Error - - " + e.toString());
    }     2.

    I can print out the amount of tokens from each line,
    But i only want the first line to be counted, And i
    also do not want the delimeters to be counted.
    could you please give me some ideas?
    Thanks
    try
       BufferedReader br = new BufferedReader(new FileReader("item.kr"));
       while((str=br.readLine())!= null)
          itemslist.add(str);
    catch(IOException ioe)
       System.out.println("Exception Occurred!!!");
    }This snippet gets one Line from the item.kr file.
    Then i would count (By useing a diffrent String Tokenizer) to count only this line!!!

  • How to set cursor at the first line in a table control?

    Hi,
           I have a customized infotype screen where a table control is being used to input new values.The tab control has 30 lines.Now, the problem is that when the screen is displayed, the cursor always starts at 8th or 4th line.The behaviour is not very consistent.I tried the following statement in the PBO, but no effect.
    SET CURSOR FIELD P9417-ZCOUNTRY LINE 1.  ( P9417-ZCOUNTRY is the name of the tab control field where i want to set the cursor ).This is the last statement in the PBO.
    Can someone please tell me why still I am not able to set the cursor at the first line? I have infact noticed that , in the debugging mode , sometimes the cursor starts at the first line.Please help. Thanks

    I have got a new requirement on this now. If the table control does not have any records , then the cursor position should be on the first row.Otherwise, if it already has some records, then the cursor should be at the first empty row.I wrote the code like below.
    if sy-ucomm = 'INSERT'.
    set cursor 'P9714-ZCOUNTRY'  line 1.
    else if sy-ucomm eq 'CHANGE'.
    describe table itab lines fill.
    fill = fill + 1.
    set cursor 'P9714-ZCOUNTRY'  line fill.
    endif.
    I am facing a strange problem now.The table control has some 10 rows when you see the screen for the first time.If the number of records already present is less than 10, I am able to position the cursor on the first empty row.But if the number is say 15, then the cursor position goes to eighth or fourth line or sometimes the first line.
    Is there any way to display the last few records , ie, if there are 15 records , is there any way to display the last five rows when I see the screen for the first time, rather than showing the first 10 records?How can I position the cursor at the first empty row, when there are more records?
    Thanks in advance..good answers will be rewarded.
    Mahesh

  • Discount for the first line item

    Hi Folks,
    As i have a requirement from my client to give the discuont for the first line item from two .Pls help me in finding the sol for this following requirement
    My client has two materials Material X and Material y .Client wants to  give 5% discuount on Material X when the the customer buys Material Y also along with material x .So the end customer will recieve the discount of 5% on Material X only when he order material Y along with X.
    Pls contribute your valuable tips in finding the sol for this .

    Hi Avinash,
    As you know already this is not standard functionality and is difficult to implement in SAP ERP.
    IMHO this kind of Business Rules should be managed in a separate CRM, which does not have to be SAP CRM.
    It could be an customer CRM application developed in .Net (Visual Studio) or Java technology, much easier to maintain that in ABAP and that could be used "on the road" by pre-sellers.
    The application would generate the manual discounts when needed and then create the Sales Order in SAP ERP when syncronizing using the standard Sales Order BAPI.
    I am sure that is not the answer you were waiting for ....
    Best Regards,
    Franck

  • D110 only prints the first line.

    If I send an item to the printer, it only prints the title. I have tried to copy to notepad and pasted to an email. Then sent it to the printer thru an email. It only prints the first line. How do I get it to print the whole item?

    You can use one of our diagnostic tool and can this can help you resolve the issue automatically and you can use it in future as well.
    http://h10025.www1.hp.com/ewfrf/wc/softwareCategory?os=4132&lc=en&cc=sg&dlc=en&sw_lang=&product=5169...
    Check if the issue gets resolved.
    Say "Thanks" by clicking the Kudos Star in the post that helped you.
    Please mark the post that solves your problem as "Accepted Solution"
    (Although I am employed by HP, I am speaking for myself and not for HP)

  • ME22N - How to scroll down the purchase order items

    Hi,
    I have to make a function with call transaction (ME22N) and when I use the SHDB transaction to build the script, I can´t find the scroll down command for the items list. I have to use because we will have many items to edit / exclude / finalize in a purchase order. How can I solve this problem?
    Thanks.

    Hi,
    It is not suggested to make a recording for a BDC in tx: ME22N, ( EnjoySAP transactions are not suitable for SHDB recording ) instead use ME22 and on the table control scrolling, you find an "ITEM" field where you enter the item which should be positioned in first line of the table control where you could double click the first line in table control to view the details.
    Also you could achieve the change of a PO by BAPI: BAPI_PO_CHANGE.
    Hope this helps.
    Best Regards, Murugesh

Maybe you are looking for