SAP Query - Extract part of field

Hi,
I created a query with a local field. I want to extract only the last 3 characters of a field.
Is there a LEFT or RIGHT function I can use like in Excel?
The field I want to extract it from is 12 characters long.
Hope someone can help.
Thanks, Lupe

You can not fetch only 3 characters directly
There are 3 ways you can achieve this
1> Create additional field in the infoset and code the logic. (If this report is used frequently, you should use this)
2> Download the output of query in the excel and perform excel actions (Use this if the report is not frequently required. Does not take much time to fetch 3 characters)
3> if the report format is fixed, you can create ABAP report and code yo fetch only 3 characters

Similar Messages

  • SAP Query Documentation - Defining additional fields

    Hi,
    I need to create a new SAP Query defining a new Functional Area. My problem is that I have created the area and defined the tables I want to use and how to join them, but I want to add additional fields with ABAP coding. I have looked up for documentation on how to do it, and all I find is that I shoud access the menu GOTO/Additional Field, but in my screen I find no such option (I'm using 46B).
    Could anyone explain how to add additional fields and coding, or send me any documentation please??
    Also, is it possible that I can create functional areas and queries, but not edit ABAP coding from functional areas in my productive system? Do I have to create the query in my test system and transport it, or how does that work? I's my first time creating queries.
    Thanks so much in advance!

    Try
    http://www.sappoint.com/abap/ab4query.pdf
    http://www.sap-img.com/basis/transport-of-abap-query.htm
    Pl. award the points if it helps you ...
    Thanks
    Message was edited by: Saquib Khan

  • SAP Query and selection screen fields

    Hi,
    I am currently modifying a Query. I have added a new selection field. The fieldname for this selection field has been autogenerated within the query and I have pasted a bit in here:
    SELECT-OPTIONS SP$00015 FOR ZERROR_FLG LOWER CASE.
    SELECT-OPTIONS SP$00022 FOR KNA1-ERDAT.
    SELECT-OPTIONS SP$00023 FOR KNA1-ERNAM.
    SELECT-OPTIONS SP$00027 FOR ZLOEVM LOWER CASE.
    SELECT-OPTIONS SP$00030 FOR ZPARTNERNO
    NO INTERVALS NO-EXTENSION.
    I relation to this select -option, I want to execute a few lines of code that only is executed if the user has filled in a value in teh ZPARTNERNO field. However, no matter if I use the field name ZPARTNERNO or SP$00030 it has no effect.
    Any good ideas ?

    HI,
    In the AT SELECTIOn-SCREEN event, you can write the code
    IF not <b>SP$00030[]</b> is initial.
    write the code which you want to execute before the output
    ENDIF.
    if you want in START-OF-SELECTION>
    IF not <b>SP$00030[]</b> is initial.
    write the code which you want to execute before the output
    ENDIF
    Regards
    Sudheer

  • Extracting Part of Field

    Hi,
    I want to extract all data to the right where the field contains 'User:' and to include User:
    I am using this formula which works great.
    =Right([Opportunity Description];(Length([Opportunity Description])-Pos([Opportunity Description];"User:")+1))
    However when the field has data in but not 'User:' it brings back the whole field, I just want this to be blank.
    Any ideas?
    Thanks,
    Gwyn

    Hi Gwyn,
    Please use below formula and let me know:
    =If Pos([Opportunity Description];"User:")=0 Then " " Else Right([Opportunity Description];(Length([Opportunity Description])-Pos([Opportunity Description];"User:")+1))
    Thanks
    Arvind Shukla

  • SharePoint Content Query Web Part Title Field

    SharePoint 2013
    I have a custom list on another site within SharePoint. How do I bring in all the columns? I see the title field on the Edit Web Part, but no matter how hard I try, I can't get multiple columns to show up.  Some of the Columns I am looking for from
    the Custom List:
    City
    Vendor
    Circuit ID
    Thanks,
    Chris

    Amit,
    Thanks for the links, but I am still missing something with the coding.  I am following the first link you gave me. 
    These are the instructions from the page
    In ContentQueryMain.xsl
    Locate “ <xsl:template name=”OuterTemplate.CallItemTemplate”> “
    Add:
    <xsl:template name="OuterTemplate.CallItemTemplate">
    <xsl:param name="CurPosition" />
    <xsl:param name="LastRow" />
    and add:
    <xsl:when test="@Style='MyTask'">
    <xsl:apply-templates select="." mode="itemstyle">
    <xsl:with-param name="CurPos" select="$CurPosition" />
    <xsl:with-param name="Last" select="$LastRow" />
    </xsl:apply-templates>
    </xsl:when>
    Search:
    <xsl:template name=”OuterTemplate.Body”>
    And scroll down to add this line:
    <xsl:call-template name="OuterTemplate.CallItemTemplate">
    <xsl:with-param name="CurPosition" select="$CurPosition" />
    <xsl:with-param name="LastRow" select="$LastRow"/>
    </xsl:call-template>
    What I don't know is where exactly to add the middle section in my xsl document.  Here is what I think I should have.  And the Circuit list below is another attempt at this too that has been unsuccessful.
    <xsl:template name="OuterTemplate.CallItemTemplate">
    <xsl:param name="CurPosition" />
    <xsl:param name="LastRow" />
    <xsl:value-of disable-output-escaping="yes" select="$BeginListItem" />
    <xsl:choose>
    <xsl:when test="@Style='NewsRollUpItem'">
    <xsl:apply-templates select="." mode="itemstyle">
    <xsl:with-param name="EditMode" select="$cbq_iseditmode" />
    </xsl:apply-templates>
    </xsl:when>
    <xsl:when test="@Style='NewsBigItem'">
    <xsl:apply-templates select="." mode="itemstyle">
    <xsl:with-param name="CurPos" select="$CurPosition" />
    </xsl:apply-templates>
    </xsl:when>
    <xsl:when test="@Style='NewsCategoryItem'">
    <xsl:apply-templates select="." mode="itemstyle">
    <xsl:with-param name="CurPos" select="$CurPosition" />
    </xsl:apply-templates>
    </xsl:when>
    <xsl:when test="@Style='MyTask'">
    <xsl:apply-templates select="." mode="itemstyle">
    <xsl:with-param name="CurPos" select="$CurPosition" />
    <xsl:with-param name="Last" select="$LastRow" />
    </xsl:apply-templates>
    </xsl:when>
    <xsl:otherwise>
    <xsl:apply-templates select="." mode="itemstyle">
    </xsl:apply-templates>
    <xsl:when test="@Style='CircuitList'">
    <xsl:apply-templates select="." mode="itemstyle">
    <xsl:with-param name="CurPos" select="$CurPosition" />
    <xsl:with-param name="Last" select="$LastRow" />
    <xsl:with-param name="StartNewGrp" select="$StartNewGroup" />
    </xsl:apply-templates>
    </xsl:when>
    </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of disable-output-escaping="yes" select="$EndListItem" />
    </xsl:template>
    I think I am getting close and your help is much appreciated.

  • Sap Query custom field assigned to wrong field group (in extract)

    Hello,
    I want to add an extra field to InfoSet /SAPQUERY/MEBANF at EBAN level. I added a field in a normal way:
    I fill it with a constant value. I adapted Sap Query:
    In result, I got the value in new column but only for certain rows:
    The value is there only for EBAN rows which have EBKN entries related.
    I checked the program, and my new field is added to field group %fg07 with some other fields from table EBKN (not EBAN):
    Fields from field group %fg07 are inserted to extract only in event get EBKN, so if there is no entries in EBKN, my field will not be inserted into extract:
    I tried a lot of things (assigning my field to new field group in InfoSource, adding a field on EBKN level). I can say that every extra field created by me was assigned to field group &fg07.
    Am I doing something wrong?
    The target is to add new field in the document overview panel in ME2xN transaction. I know that there is user-exit EXIT_SAPLMEQUERY_002 where I can specify a Z* query. But this solution requires a copy of InfoSet and query to Z*. Adding a new field to standard Sap query is the fastest way.
    Message was edited by: Rafal Matuszewski
    Now I tried to append EBAN table with my Z* field. I regenerated InfoSet and query but the result is still wrong:
    insert EBAN-GSFRG into %fg06.
    insert EBAN-ZUGBA into %fg06.
    insert EBKN-VBELN into %fg07.
    insert EBKN-AUFNR into %fg07.
    insert EBKN-KOSTL into %fg07.
    insert EBAN-ZZDELIV_DATE_MRP into %fg07.   <-- here again the Z* field is assigned to field group related to EBKN table

    Thanks Sandra

  • Multiple Value in additional fields using SAP Query

    HI All,
    I have a question related additional field in SAP Query. I tried to create report about PR and PO using SAP Query. Since one PR can be converted to multiple PO, I decided to create additional field
    po_1
    to display the value of PO that related to the PR. But I meet problem when I want to show several PO number in additional field
    po_1
    , I couldn't look the way to solve this problem. Can anybody help me? Just for info, I assign value to additional field
    po_1
    in record processing part.
    Thanks....

    HI,
    IN SQ02, IF table is already in JOIN, just click on the PLUS sign to expand the strcture.
    All the field showing Plus sign in the strcture are selected in your query and with MINUS sing are no selected.
    So you have to just click on the MINUS sign for the field you want to use through table field.
    Generate the query and execute thriugh SQ01.
    If you want to add some other field which is not a part of JOIN,
    then click on EXTRAS Button shown in the MENU option.
    Click on Create button and system will ask abt the additional field.
    Regds,
    Anil

  • Bringing in Additional Fields into SAP Query

    Hi,
    I'm new to SAP Query. I had to modify an existing report to bring in an additional field from one of the tables of the query. When i look at the tables in query, i don't even see the field i would like to add under the table. I guess it needs to be first bring into query and later i can add. Can someone help me how to do this?
    Thanks in Advance.

    HI,
    IN SQ02, IF table is already in JOIN, just click on the PLUS sign to expand the strcture.
    All the field showing Plus sign in the strcture are selected in your query and with MINUS sing are no selected.
    So you have to just click on the MINUS sign for the field you want to use through table field.
    Generate the query and execute thriugh SQ01.
    If you want to add some other field which is not a part of JOIN,
    then click on EXTRAS Button shown in the MENU option.
    Click on Create button and system will ask abt the additional field.
    Regds,
    Anil

  • No hide fields or select fields in SAP Query Extractor?

    HI Gurus,
    I want to generate a data source, extraction data from SAP Query.
    Now I want to hide some fields or to mark some fields as relevant for selection.
    But after saving my settings are unavaiable...?
    Does somebody have an idea? Is this standard when extracting from Query or is this maybe an OSS...?
    Thanks

    Hello,
    Just logoff and Login again, then check it.
    Also see
    SAP Note 1014073 DFG: Changes to the DataSource are displayed incorrectly
    SAP Note 1073714 DataSource in RSA6: Unable to display/change customer fields
    SAP Note 925398 RSA6: DataSource enhancement only visible after restart
    Thanks
    Chandran

  • How to display the field name in the tabulated view for a content query web part

    I have added a content query web part changed the web part file to include custom columns imported and reffered itemstyle.xsl
    to include the tabulated view for the content query.
    However the way it is displayed is such that only the content is displayed.
    As i am using a tabular view wto display the data, i want to display their field names as well.

    Hi  ,
    According to your description, my understanding is that you need to display the field in the tabulated view for a content query web part.
    For your issue, please refer to the code as below:
    <xsl:template name="VendorCustomStyle" match="Row[@Style='VendorCustomStyle']" mode="itemstyle">
    <html>
    <table width="100%">
    <xsl:if test="count(preceding-sibling::*)=0">
    <tr>
    <td width="8%" valign="top"><div class="item"><b>Vendor ID</b></div></td>
    <td width="12%" valign="top"><div class="item"><b>Vendor Name</b></div></td>
    <td width="50%" valign="top"><div class="item"><b>Vendor Description</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Vendor Country</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Vendor Date</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Created By</b></div></td>
    </tr>
    </xsl:if>
    <tr>
    <td width="8%" valign="top"><div class="item"><xsl:value-of select="@VendorID" /></div></td>
    <td width="12%" valign="top"><div class="item"><xsl:value-of select="@Title" /></div></td>
    <td width="50%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Description" disable-output-escaping="yes" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Country" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Date" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Author" /></div></td>
    </tr>
    </table>
    </html>
    </xsl:template>
    For more information, please have a look at the blog:
    http://www.codeproject.com/Articles/756834/Customizing-the-Content-Query-Web-Part-and-Item-St
    http://msdn.microsoft.com/en-us/library/ms497457.aspx
    http://clarksteveb.hubpages.com/hub/Customized-Content-Query-Web-Part-CQWP-in-SharePoint-2007-with-results-Tabbed-Grouped-and-in-an-HTML-Table
    http://blog.sharepointexperience.com/customitemstyle/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • SAP Query - Additional field that collects information from table RESB

    Hello gurus. I have a question.
    I want to create a SAP Query that shows me the stock level of a list of materials, and also show me the total quantity of order reservations in an additional field.
    I created an InfoSet with table MARD, which is the one that holds the Stock information in a plant. Then I created an additional field which would read information from table RESB, the table that holds order reservations per material.
    So I wrote this piece of code:
    SELECT * FROM RESB
    WHERE MATNR EQ MARD-MATNR and
           WERKS EQ MARD-WERKS.
    ENDSELECT.
    if ( sy-dbcnt NE '0').
          MOVE RESB-BDMNG to ZQTY.
    ELSE.
          MOVE '' to ZQTY.
    ENDIF.
    This works fine. However, this is currently just catching the first record in table RESB that matches my condition.
    What I would like is to collect every instance of RESB-BDMNG and add them to field "ZQTY", have it loop in RESB until it finishes finding every record that match the MATNR and WERKS. With this I could get the total number of order reservations that this material has in that table.
    Could someone share some coding that would help me achieve this?

    Yes! That did it. That's what I needed to do. Thank you so much.
    While I'm at it, let me ask you a related question.
    When I execute the query, in the first records of the query where there's no value from RESB to transfer, the value of field ZQTY appears empty. Once it finds the first record in RESB and it populates ZQTY with a value, then the rest of the records with no hit get the proper value of 0.
    Do you know why the first records in the query appear empty and not with a 0? Is there anything I should add to the coding to fix this?

  • Additional fields in SAP Query

    Hi ,
    We have a requirement in HR reporting wherein we are providing the late attendance records of the employees. That is the person is scheduled to come at a respective time but he comes in late and this record is created in attendence infotype . Now we need to see the variance in his planned and actual arrival . Majorly all the fields are availabe in the Infosets but the one with the variance is not there . So do we need to create a custom report for the same or it can be handled in the SAP query adding one field for calculation. If it can be handled , how can that be possible .
    Thanks & Regards

    Please check this link:
    Re: query report
    I guess, it can help for your case too...
    Even this:
    Re: sap query infoset and fieldgroup
    Re: Additional field in SAP Query
    Kind Regards
    Eswar

  • Additional field in SAP Query

    This problem is about sap query. I have created an additional field in an infoset. The initial header text of this additional field is english. Then I created a query which use the additional field as an output field. If I use this query in other language, however the additional field header remains english. How can I maintain addtional field header to support mutil-language?
    Thanks in advance!
    --Alex Miao

    Hi Alex
    Please see if below example helps you to understand:
    Supposing, we are displaying material description within our query.
    1. So we define the join with MARA & MAKT while creating infoset in transaction SQ02.
    2. We create feild groups to identify the fiels we use for selection and display.
    3. Here after selecting language key from MAKT, by default this will take SY-LANGU always for the case.
    4. To make it applicable for different languages we can code in INITIALIZATION Event.
    5. To do so we can do it by two options: Use menupath: Goto->Code->Initialization
    i) First option using variable: <b>MAKT-SPRAS = SY-LANGU.</b>.
    ii) Second option using Parameter-Id: <b>SET PARAMETER ID 'SPR' FIELD SY-LANGU</b>.
    6. Save & Generate.
    Now when we execute the query, we are defaulting the language as System Language.
    Hope the above info helps you for better understanding.
    Kind Regards
    Eswar

  • How to Substr field in SAP Query.

    Dear Developer,
    How to substr any field in SAP Query ?
    Regards,
    Ujed.

    Hi Ujed,
    if SUBSTR stands for substring, then possibly your question may be how to get the substr method as konown in languages like php in ABAP.  If SAP Query points to a SAP query as created in transaction SQ01, then you should explain what you want to achieve.
    Note: Better ask a specific question and get am answer you can or which is already generalized.
    If I need a substr function, I'd create a functional method for that:
    method substr
      importing
        anyfield type any
        offset type i
        length type i
      returning substring type string.
      try.
        substring = anyfield+offset(length).
      catch cx_root.
    * handle error
      endtry.
    endmethod.
    Regards,
    Clemens

  • Adding Fields to Custom Infotype Using Custom Infoset in SAP QUERY

    Hi All,
    We have a requirement to add fileds to a custom infotype for querying Custom Infoset in SAP Query.
    We are facing problem as the added field is not getting displayed in the Query set so that we can select and display it in the Basic List along with the other filds.
    Kindly suggest a solution.
    Full points will be rewarded.
    Thanks in Advance
    Kumar

    Hi Salman,
    Thank you for your valuable information. I haven't Configured Dynamic Actions yet. Is it simple to write the Logic for Dynamic Actions. Is this the only way to solve this Issue?
    I tried by adding the standard fields, but they are not populating the values; but just appearing as Input Fields with Input help option.
    Please let me know if you have any suggestion in this direction?
    Regards,
    Hems.

Maybe you are looking for

  • Report S_ALR_87012341Duplicate invoices have started to appear on the repor

    There is a Report S_ALR_87012341 for Duplicate invoices verification. The Report S_ALR_87012341 is not working correctly.  Duplicate invoices have started to appear on the report for the first time. These documents are however 2 years old and have no

  • Help me please ,I dont can solve this problem

    please How I can solve this problem?(SQL) Display each employee's last name, hire date, and salary review date, which is the first Monday after six months of service. Label the column REVIEW. Format the dates to appear similar to "Monday, the Thirty-

  • Update operation times in routing

    hello all, I need to do a mass change on routing in order to update operation times. I'm trying to find a BAPI/function to do this but without any success. It's not possible to do it with call transaction CA02 because depending on the material I can

  • Swipe movie controls?

    Okay I really need some help. I am working with Air for Android (CS6) and have built out a motion comic as a movie, with stops on Key Frames. The movie is fine, but I am havng trouble with the swipe controls. I need it to right swipe, go to next fram

  • Problem with Quiz created in Captivate 4 imported to Captivate 5

    Good day, I finally got upgraded to the eLearning Suite so I am now using Captivate 5.  I have a course that has a quiz built in Captivate 4.  It is designed that if the user scores less than 80%, they are returned to the start of the quiz. If they p