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

Similar Messages

  • 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

  • Text of additional fields on SAP query show blank

    Hi All,
    I'm encountered a problem when text of additional fields on SAP query is not working and it's show blank after HRSP is implemented.
    SAP_ABA : Rel. 701 Lvl. 3
    SAP_BASIS: Rel. 701 Lvl. 3
    SAP_HR: Rel. 604 Lvl. 8
    Below are the config that we have done before HRSP in table: TEXC_FLD_C and it's work perfectly.
    Table Name: P0000_AF
    Field Name: ZZAPPRATING
    Function Module: ZHRGYYFMPA_PDRATING_TEXT
    Exception Priority: 1
    Object Type Name: CL_HR_TEXT_IDENTIFIER
    During debugging, we found that program (Form: %_GET_PERAS) is retrieve text of additional fields based on structure P0000_AF. At this point, text of fields are successfully take place and filled. However, program try to retrieve the text based on structure P0000 again right after that. Due to additional fields are added on P0000_AF not P0000 and no ZZAPPRATING field found in P0000, hence program has cleared the text which filled in previously. This give the result, text is blank.
    Please advise, how should I get this resolved.
    Thank you very much.
    Best 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

  • Order of the selection fields in SAP QUERY

    Hello All,
    How can we set the order of the selection fields in SAP QUERY!
    Regards!
    Ashish

    Hi,
    You can go into infoset and change the order.
    Or you can select 1 by 1 in the same order, you want to display.
    Below is the link which might help you:
    help.sap.com/printdocu/core/Print46c/EN/data/.../BCSRVQUE.pdf
    Please revert, if needed more clarifications
    Regards,
    Yashwin

  • Hi,How to add field to sap Liquidity calculation module tables?

    Hi Experts,
            How to add field to sap Liquidity calculation module tables?
            and how to add a field to a particular transaction code using a customer exits.
    please tell me in detail.
    thanks inadvance,
    Regards,
    Rekha

    Hi Pranab,
    Please follow the below steps to create an extra field and write code for that field through Infoset.
    1-->Change in Infoset
    u2022Go to SQ02 , enter Infoset name and click on Change Button
    u2022Go to Extras (F5) button displayed on application bar.
    u2022In Extras tab, click on 'Create' icon to create additional field E_NAME1, give as type C (character) and give desired length and. Enter header description  as 'ShipToName'
    u2022Select this field i.e E_NAME1 in one of the field group of Infoset.
    u2022Go to Code section  (Shift+F8) of infoset, Select Record Processing Event and write your logic code (condition) in this code section:
    if vbpa-adrnr = space.
    E_NAME1 = kna1-name1.
    else.
    E_NAME1 = adrc-name1.
    endif.
    2-->Generate the Infoset.
    3-->Change in Query
    u2022Go to SQ01(in a new session), give your query name (by selecting your user group) and click on change button.
    u2022Check the field group in which you have added E_NAME1 field, then check E_NAME1 from Fields screen
    u2022Click on 'Basic List' button; give line (row no.) and sequence (column no.) for extra fields.
    u2022Execute/Test the Query, you will get desired result.
    Please let me know, if you need more information.
    Regards,
    Dinesh
    Edited by: Dinesh Tiwari on Oct 29, 2009 7:13 AM

  • 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

  • How show the Extractor's Sap query

    Hi masters,
    I have a custom extractor in R/3 created with SAP Query method.
    By RSA2, if I try to double click on Extractor name it does not succeed nothing!
    How can I see the Sap Query created behind The Extractor?
    Thanks so much!

    Hi Martina,
    if you want see the infoset in the extractor use sq02.
    Bye

  • How to display/create Local field in SAP query

    HI All,
    I'm new to abap query. I have to include a local field in the existing query. I know through SQ01->Edit->Local field we can display the Local fields, but the options under Local Fields menu option are disable even in change mode of Query.
    So, later through SDN found that, I have to Switch On the short names menu option. Even the sub-options in Short Names are disabled.
    Can any body please let me know how can we display the local fields to the change the formula and how can we create the new local fields in the existing qeury.
    Hope I'm able to explain my issue clearly.
    Thanks in advance.

    You can create the local fields in the "Select Field" screen. (Third screen after "Title, Format" and "Select Field Group") This option is disabled on the other screens.<br />
    <br />
    <i>Reference : <a class="jive-link-external" href="http://help.sap.com/saphelp_NW70EHP1/helpdata/en/d2/cb4186455611d189710000e8322d00/frameset.htm" target="_newWindow">Defining Local Fields</a> in <a class="jive-link-external" href="http://help.sap.com/saphelp_NW70EHP1/helpdata/en/d2/cb3efb455611d189710000e8322d00/frameset.htm" target="_newWindow">SAP Query</a>.</i><br />
    <br />
    Regards,<br />
    Raymond

  • Alignment and restriction of Custom field in SAP query report

    Hi Experts,
    I have one custom field in query report(SQ01) called Amount in local currency which is calculated based on Amount in document currecy * exchange rate.
    But this field values are coming in left alignment instead of right alignment so how i should get in right alignment and second issue is how i can restrict field value to only 2 decimals.
    I tried the below link "http://media.techtarget.com/searchSAP/downloads/SAP_Query_C7.pdf" but the steps they mentioned are not appearing in SQ01 for example in that link they mentioned to click Basic List option for advanced steps but when i click i goes directly to field list with field groups on left pane
    Please provide solution for this.
    Thanks&Regards,
    narasimha

    Hello narasimha,
    In the Infoset when you create the additional field, enter an existing SAP table field that has type CURR in the parameter labeled LIKE Reference.  For example you can enter BSAK-DMBTR as a value. When you select the additional field in the query, the currency will also show.
    Kind Regards,
    Rae Ellen Woytowiez
    Edited by: Rae Ellen Woytowiez on Apr 25, 2011 11:27 PM

  • 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 change code in SAP Query

    Hi Experts !!
    In SAP QUERY I am getting the  PO  with  all delivey dates & deliveried Qty  but I have to select only  single PO with latest delivery date  & qty. If there r more than one record for latest delivery date than deliveried QTY must be sum of  all QTY (for the  latest delivery date). for example :
    this is coming
    Po                delivery date                 qty
    10001         30.06.2009                   4
    10001         30.06.2009                   5
    10001         01.05.2009                   4
    we want
    Po                delivery date                 qty
    10001          30.06.2009                   9
    Thanks in advance.
    Thanks & Regards
    Navneet Singhal

    >
    navneet singhal wrote:
    > There is an internal table  %G00 in  query generated program (AQCSZPCWMM======Z_PCW_ORDER_V2) when I use this table in Code section (END-OF-SELECTION ) system thro msg %G00 is not defined . if I define this table in DATA  section than  run the query , It gives the  DUMP  with error %G00 is already decleared.
    >
    > How can I use %G00 internal table  in my code section.
    I have the same problem as the OP. I need to get rid of the duplicates and have all sumarized in just one row. I was thinking about this same solution, but when I add code to the END-OF-SELECTION event, this doesn't appears anywhere (but if I add code to any calculated field, yes).
    And the problem of the quoted message. I tried using field-symbols but I have errors saying that it's nos a valid table, etc...
    Any ideas???
    Thanks!!!

  • SAP Query - Adding new fields to SAP query

    Hi experts,
    I got an issue to work on SAP query.
    I have Transaction code and need to know the infoset to add additional two fields to the existing output.
    Please let me know how to find infoset/ Query for the specfic transaction and how to add fields.
    Regards,
    Venkata

    first check the transaction code given to you.. if it is report transaction (check using SE93), then get the report name for example AQFKTES_SGS_IV==MMIV0003======, then after aQFK,TES_SGS_IV woulbe be your user group and MMIV0003 would be your query. Now go to SQ03 with the user group (you need to check the query areas also which would be Environment---> query areas) because some can be client depended some can be just cross client. and then go to sq01 from user group. It will direct you to the queries of the user group you mentioned in SQ03. Now you should be able to find the query you are looking for. The infoset will also be displayed linked to the query. The infoset can be displayed via SQ02 transaction.
    If it is parameter transaction code, you need to check the parameter values to find the query details. Rest of the approach is same as mentioned above.

  • How to Sum in a SAP Query

    Folks,
    I have given up....Really need some advice....
    I need a report example: Order Number, Order Type, Order Date, Customer number, Net Price, Total order cost
    I can get all I need from file VBAK, EXCEPT total order cost, which is at the line level (VBAP).  Now I need to show one line per order and sum the cost field (VBAP/WAVWR)...
    How can I accomplish this in SAP Query?  IS this even possible?

    Hi,
    I am sure about SAP Query...
    But check this program which might satisfy your requirement..
    Declarations.
    TYPE-POOLS: slis.
    DATA: BEGIN OF wa_data,
            vbeln LIKE vbak-vbeln,
            auart LIKE vbak-auart,
            audat LIKE vbak-audat,
            kunnr LIKE vbak-kunnr,
            netwr LIKE vbak-netwr,
            wavwr LIKE vbap-wavwr,
            waerk LIKE vbak-waerk,
            posnr LIKE vbap-posnr,
          END OF wa_data.
    DATA: itab LIKE wa_data OCCURS 0 WITH HEADER LINE.
    DATA: itab_final LIKE wa_data OCCURS 0 WITH HEADER LINE.
    DATA: v_tabix TYPE sytabix.
    DATA: t_fieldcat TYPE slis_t_fieldcat_alv.
    Selection-screen.
    PARAMETERS: p_erdat LIKE vbak-erdat OBLIGATORY.
    START-OF-SELECTION.
    Get the data
      SELECT avbeln aauart
             aaudat akunnr
             anetwr bwavwr
             awaerk bposnr
             INTO TABLE itab
             FROM vbak AS a INNER JOIN vbap AS b
             ON avbeln = bvbeln
             WHERE a~erdat = p_erdat.
      IF sy-subrc <> 0.
        MESSAGE s208(00) WITH 'No data found'.
        LEAVE LIST-PROCESSING.
      ENDIF.
      SORT itab BY vbeln.
    Sum the cost.
      LOOP AT itab.
    Store the tabix.
        v_tabix = sy-tabix.
        wa_data = itab.
        AT END OF vbeln.
          SUM.
    modify the cost.
          MOVE wa_data TO itab_final.
          MOVE itab-wavwr TO itab_final-wavwr.
          APPEND itab_final.
          CLEAR itab_final.
        ENDAT.
      ENDLOOP.
    SHow the report.
      DATA: v_repid TYPE syrepid.
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name     = v_repid
                i_internal_tabname = 'WA_DATA'
                i_inclname         = v_repid
           CHANGING
                ct_fieldcat        = t_fieldcat.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program = v_repid
                it_fieldcat        = t_fieldcat
           TABLES
                t_outtab           = itab_final.
    Thanks,
    Naren

  • Selection screen fields in SAP Query

    HI friends,
    I have to make the seletion screen field as mandatory in SAP-Query.
    Please let me know the procedure to make field as mandatory or Let me know how to validate the selection-screen field in Query.
    Thanks in Advance,
    Ravi

    Go to SQ02
    Select your Infoset-->Change
    On next Screen.
    Select GoTo->Code->Initialization.
    Write there code
    LOOP AT SCREEN.
      IF screen-name EQ 'SP$00004'.
           screen-required = 1.
           MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

  • Concatenate 2 fields in SAP Query

    Hello,
    We have a requirement where we have developed a report in SAP query, but we require a local field to basically give the concatenation of two fields detailed in the info set (EKPO-EBELP & EKET-ETENR)
    Can you help me with how to learn to do this?
    Many thanks
    Steve

    Hi Rich,
    Yes, I figured the code would be something like that, however, when I generate the infoset, I get the following:
    Global syntax check
    Additional Fields
    Error in code for additional field ITSCH
    The last statement is not complete (period missing)
    I have placed the following code in the Additional fields/structure section
    Concatenate EKET-EBELP EKET-ETENR into ITSCH
    Can you help with what is probably a simple issue?
    Many thanks
    Steve

Maybe you are looking for

  • I cannot access Yahoo Mail, gives an error "Bad Request" in the tab? What does this mean and how can I access my mail?

    I downloaded the latest version of Firefox 8.0.1. I have an Intel imac with os 10.6.8. I can log onto the Yahoo website, but not my e-mail, it works fine in Safari but not with FF? I get a message in the tab that reads"Bad Request", never seen this b

  • Handling Exceptions in Custom Tags??

    Hi,           what is the preferred way to handle an exception that is thrown from jsp           code in the body of a custom tag? The code below obviously causes a null           pointer exception inside of the custom tag. When the code executes, a

  • Batch reconnecting from a different disk

    I've moved the scratch location to new hard disk I bought, now I want to edit a old project in which I've to reconnect the media. I don't see an option to do a batch reconnect. reconnecting individual clips is time consuming. Just wondering if anybod

  • Sap fi-sd integration and configuration part

    Hi guru, Please tell me fi-sd integration and configuration part. every one knows the t.code - vkoa, apart from this, is there any other related configurations..? Please tell me any other configurations part. With regards, Manas

  • Can't invoke the Servlet............

    Hi there!! I'm trying to invoke my servlet from inside my simple Java Application.Though it shows me it has connected to the target URL but the servlet doesn't start its exceution,,here's my code... System.out.println("========GOING FOR SERVLET======