Ad Hoc query Addition Field code

Dear Experts,
I need amend Ad hoc query to be able to report on Expected End MPP Q0088-EEMPP, It is not a standard field in the infotype for SE16 or SAP Query/Ad Hoc. We need to be able to query off this field. Can someone please point me in the right direction about how to get the calculated value from this field added to queries, or what code is needed.
I have created an additional field in SQ02, i probably need code to make it fetch the data
thanks
haji

Hi,
Please take a look at standard function module HR_GBSMP_MPP_DATES. It returns the expected end date.
Hope this helps.
Donnie

Similar Messages

  • Ad hoc query text field reference

    Hi all,
    Faily new to all this and wonder if you have any insight on the following:
    In ad hoc query I'm adding additional fields to a functional area. They subsequently show up in SQ02 in the left hand pane tree structure for that functional area.
    Now, if I double click on one of the additional fields the most central pane shows the details of this field. One of the boxes in there called 'References' contains a field 'Text field' that associates a long text with the code that the field contains.
    As a made-up example: the add. field could be Personnel Area, value "XY01", and it is associated with a field Personnel Area Long Text that contains "Xeta Yoyo Regional Office". This is the association shown in 'References' -> 'Text Field'.
    My problem is that this 'Text field' field seems to be populated automatically, that is there is some kind of automatic link between the field and the foreign field that contains its associated long text. Also it's greyed out so un-editable.
    Does anyone know where this relationship comes from? Does anyone know how to be able to edit this 'Text field' field?
    Grateful for help,
    Richie

    Ok, I'll try to be a bit clearer.
    For infosets in Ad Hoc Query, a field has an option to be related to another, different field that provides the long text version of this. Example: field P1000-OTYPE 'object type' is related to T7770-OTEXT 'object type text'.
    This relationship is displayed for each infoset additional field: right click on the add. field ->  display/change definition, text identification ->  'Determine LIKE reference using text field' in the pop up window.
    Problem is this text field is <b>always</b> greyed out and uneditable. So the question was, how do you set this yourself?
    Hope this clarifies stuff, thanks for any help,
    Richie

  • Sap Query Additional Fields using  Abap Code

    Hi Experts,
    I am relatively new to the world of SAP query (Log Database PNPCE), I have written a number of additional fields to retrieve previous info-type data using the select statement E.G
    prev_endda = p0008-begda - 1.
    SELECT  single bsgrd
          INTO FTE1
          FROM
            pa0008
          WHERE pernr EQ  P0008-pernr
          AND   endda EQ prev_endda
    Although I can retrieve the previous info-type data , I was wondering if there was a easy way where I could take this a step further and show the Previous , Previous record. I.E
    Pernr     FTE Current    FTE1      FTE2
    101              60%          30%       75%
    I guess what I am asking is , is there a way to loop through the HR info-type records, does anybody know if there is a standard function or macro I can use to achieve this.
    Your help is much appreciated.

    Hi ,
    Thanks for our reply.
    I have pasted some example code into my additional field which I have created in SAP Query But im not sure how the loop bit works and how I can populate the additional fields that I have created , could you please explain this
    CALL FUNCTION 'HR_READ_INFOTYPE'
      EXPORTING
        pernr                 = '000000019'
        infty                 = '01'
        BEGDA                 = '18000101'
        ENDDA                 = '99991231'
      tables
        infty_tab             = p0008
      EXCEPTIONS
        INFTY_NOT_FOUND       = 1
        OTHERS                = 2
        LOOP AT p0008.
    NOT SURE WHAT TO PUT IN THIS SECTION *****
      ENDLOOP.
    I have created 3 additional Fields in the infoset Current FTE ,FTE1 FTE2 , and I want to loop through the records and populate the relevant Additional field with the employees FTE  (I only want to populate  where there is a change)
    Sample Data
    Begda              Endda             FTE        Salary
    1/1/2010         31/12/999       60%         19K          (Current  FTE)
    01/08/2009     31/12/2009     100%       27k           (FTE1)
    01/07/2008     31/7/2009         50%       17K          (FTE2)
    Thanks in anticipation
    DM

  • 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?

  • How to make SAP Query additional field as one of the selection field ?

    Hi experts,
    I'm working on a AdHoc query. I added some Additional fields to the infoset. I put Abap code to populate this additional fields as output fields but I want to make these fields as selection fields also.
    How can I accomplish this ?
    I'd appreciate any answer or suggestion.
    Thanks in advance.

    See Extended / Quick Search capability with attributes in the following SAP notes.
    [482338 - Using Extended Search in ISA B2B, ver. 30|https://service.sap.com/sap/support/notes/482338]
    [792556 - Quick search using several attributes|https://service.sap.com/sap/support/notes/792556]
    [888528 - ISA R/3 4.0: Extended catalog search not consistent|https://service.sap.com/sap/support/notes/888258]

  • SQ01 Sap Query - additional fields doesn't appear

    Hi everybody,
    i've created a SAP Query with transaction SQ01 but one of my additional fields doesn't appear when i execute my Query.
    My query shows the G/L account number and the field status Group (table SKB1)
    I just need to display equally the text field of "field status Group" but it doesn't work.
    When i look at the parameters i can see that it makes the link between the table T004G and SKB1 in order to find the textfield but the field stay blank.
    For information T004g is a Pooled table.
    Is someone could help me?
    Thank you

    Hi,
    First you need to create a structure in Data Dictionary - SE11. This structure will contain all the fields that you want to display in the query output.
    Example - Name the Strucutre as zz_infoset01
    fields of the structure( for your requirement )
    BUKRS
    SAKNR
    FSTAG
    FSTTX
    Go to T-code SQ02
    1) Enter the Infoset name - zinfoset01 press create
    2) Enter a Short Description - G/L Infoset - 01
    3) select radio button - "Data retrieval by program"
                   and in "data structure" enter   zz_infoset01
    4) select "Integrated program" radio button
    5) In the next screen click on the "Data reading program" push button(on the application toolbar)
    6) An Editor will open with the following code
    REPORT  rsaqdvp_template .
      declarations
      (insert your declarations in this section)
    DATA:
      zz_infoset01                          TYPE zz_infoset01                          ,
      it_data TYPE STANDARD TABLE OF zz_infoset01 WITH HEADER LINE.
      selection screen statements
      (define your selection-screen here)
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_HEAD>
      read data into IT_DATA
    (select your data here into internal table IT_DATA)
      output of the data
      (this section can be left unchanged)
    LOOP AT it_data.
      zq01  = it_data.                        .
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_BODY>
    ENDLOOP.     
    7) when you insert your code in the sections it will look like this
    REPORT  rsaqdvp_template .
      declarations
      (insert your declarations in this section)
    Tables:SKB1,
              t004g.          
    DATA:
      zz_infoset01                          TYPE zz_infoset01 ,
      it_data TYPE STANDARD TABLE OF zz_infoset01 WITH HEADER LINE.
      selection screen statements
      (define your selection-screen here)
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_HEAD>
    *These will be the input parameters for the query
    parameters: sp_bukrs like skb1-bukrs,
             sp_saknr like skb1-saknr.     
      read data into IT_DATA
    (select your data here into internal table IT_DATA)
    *get all the G/L for com code and G/L in selection screen
    SELECT bukrs saknr fstag
                INTO TABLE it_data
                FROM skb1
                WHERE bukrs = sp_bukrs
                AND   saknr = sp_saknr.
      output of the data
      (this section can be left unchanged)
    *for every G/L get the status text from t004g for lang 'EN'
    LOOP AT it_data.
    SELECT SINGLE fsttx
                    FROM t004g
                    INTO it_data-fsttx
                    WHERE spras = 'EN' "Language
                    AND   bukrs = it_data-bukrs
                    AND   fstag = it_data-fstag.
      zz_infoset01  = it_data.                        .
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_BODY>
    ENDLOOP.     
    8) Save and generate the Infoset.By clicking on the generate button.
    9) Now assign the Infoset to the query in SQ01 and select the output list fields.
    let me know if you need more info. Also award points if helpful.
    Regards,
    Santosh

  • SAP Query : additional field

    Hi,
    in my HR query i need to add a new field in infotype specific 9016 to be calculated by ABAP code.
    I perform the following steps :
    - transaction SQ02, i modify my info-set, in the node of my infotype i add a new field, i give a new name and a LIKE reference, and i generate the info-set, it's ok.
    - transaction SQ01 : i add my new field in my request, i check it and it's ok but when i run it, i have a dump : Function module "RPAQ_GET_AF_9016" not found.
    Can you explain to me how can i resolve this problem ?
    Cheers
    Edited by: CECG on Aug 25, 2009 11:08 AM

    Hi,
    What is the field you have referred to using LIKE statement? If this is infotype 9016, there  would be the corresponding table which holds the data for 9016 infotype(PA table...PA9016(i hope so and not sure of HR tables))....
    If so please refer to a dataelement for the field and then try to regenrate your query in SQ01 after adjusting the infotype in SQ02.
    Hope this helps
    Regards
    Shiva

  • Adding code to additional fields in Ad Hoc Query

    Hello,
    I am trying to add code to existing additional fields available in IT0001 - Field SYHR_A_P0001_AF_PL_CTRY.
    I have added code in the field code section, but the field does not get populated.
    I also tried to add code to Start of selection / Record processing sections, but the values are not populated.
    What am I doing wrong?
    Thanks,
    Vaishali

    Hi Vaishali,,
       Your question is not clear, no probs. you plz check  this code !!
      FUNCTION zhrintf_om_pernr_info_adhocqry .
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(FI_PERNR) TYPE  PA0001-PERNR
    *"     VALUE(FI_BEGDA) TYPE  PA0001-BEGDA
    *"  EXPORTING
    *"     VALUE(L_MC_STEXT) TYPE  HRP1000-MC_STEXT
      DATA: dep_text(40) TYPE c,
            l_plans TYPE pa0001-plans,
            l_sobid TYPE hrp1001-sobid,
            l_mc_short TYPE hrp1000-mc_short.
    Get Employee Position ID
      SELECT SINGLE plans
        FROM pa0001
        INTO l_plans
        WHERE pernr = fi_pernr
              AND begda LE fi_begda
              AND endda GE fi_begda.
      l_sobid = l_plans.
    Check if OU is Department
      IF ( l_sobid NE '00000000' ) AND ( l_sobid NE '99999999' ). " Terminated Employee
        WHILE NOT ( ( l_mc_short(1) EQ '2' ) OR ( l_mc_short(1) EQ '1' ) OR ( l_mc_short(1) EQ 'X' ) ).
          SELECT SINGLE sobid FROM  hrp1001
                 INTO l_sobid
                 WHERE  objid  = l_sobid
                 AND    rsign  = 'A'
                 AND    sclas  = 'O'
                 AND    begda LE fi_begda
                 AND    endda GE fi_begda.
          SELECT SINGLE mc_short mc_stext FROM  hrp1000
                 INTO (l_mc_short, l_mc_stext)
                 WHERE  otype  = 'O'
                 AND    objid  = l_sobid
                 AND    begda LE fi_begda
                 AND    endda GE fi_begda.
    Empty l_mc_stext if OU is not Department
          IF NOT ( ( l_mc_short(1) EQ '2' ) OR ( l_mc_short(1) EQ 'X' ) ).
            l_mc_stext = ''.
          ENDIF.
        ENDWHILE.
      ENDIF.
    ENDFUNCTION.
      Regards
    Zulfikhar Ali

  • Addition of new fields and sub dields in ad hoc query

    hey all,
    hey friends i would like to know how to add additional fields and the sub fields in ad- hoc query.
    i had tried sq02 and went on creating new field but it is nt adng there and no options of sub fields are visible.
    note: i am entirely new to sap hr.. so plz try and help me out in a laymans language.

    At the Date Field, there is 1 node call the Additional fields.
    Then Right click the Additional field and choose create >> additional field.
    Then enter the field name, description, Data type and length.
    After that right click the newly created field name and choose code
    Then enter some simple code.
    E.g.
    For IT2006 the table does not provide the quota balance. If order to display the quota balance we can create an additional field call ZBalance. Then at code section enter the code ZBalance = p2006-anzhl - p2006-kverb.

  • Code for Query Report as additional field

    I need a field in query report which has a simple join of VBUK & LIKP.
    Can't increase join of LIPS as the report changes to item level which I don't want.
    My additional field formula will be VBAP-NETPR X LIPS-LFIMG
    Where
    VBAP-VBELN = LIPS-VBELV   &
    VBAP-POSNR = LIPS-POSNV
    Again where
    LIPS-VBELN = VBUK-VBELN
    Simply to say, my query build to generate Delivery Report which billing not complete. And within that report I want to bring Sales Order Rate * Delivery Qty.

    Dear Sir (Mr.J.R.Kavala),
    I'm really appreciate your effort and thanks for your reply. The report almost done with your coding, but may be it is my fault that I couldn't clearly elaborate what I exactly I wanted.
    According to your code the result brings only 1st lines result ($ 1,500) from LIPS, but the result should be sum up for all the line item instead, that is ($ 25,750). I've tried to make the scenario below for your understand.
    So where should I change the coding if you please advice. Many thanks again in advance.
    Zaied
    ====

  • Problem text additional fields Query ad-hoc

    Dear All,
    We created a query using an additional field in the structure created P0001_AF. The fact is that our field has an associated text, which indicates how the output of our query, but the text always appears empty.
    The field has duly informed the function that is responsible for recovering the text and it works well.
    Running the standard report is generated with the query (AQA0HCM ========= XXX ....) we realized that fields of the table P0001 read well , then read it the text associated with our field of P0001_AF, the problem is that after reading this right will find again our field Z in Table P0001, and as there is, delete the recovered value above.
    This code is standard and can not be changed. We also found no customizing to generate the program otherwise.
    Do you know any solution? Is it a standard problem?
    Thanks & Regards

    hi ,
    this field might not be running in std reports but you can do below
    did you created a local field in sq02  , and add custom coding at that field according to correspondig field text.

  • SQ02 - Ad Hoc Query - Custom additional fields

    HI experts
    I am working additional fields in SQ02 .
    I added a new additional field for an info type in SQ02.
    Issue is when I right click on my additional field I can see options 'Only value' but for other fields I can see ' only value ' , 'only text' and ' value and text' .
    When creating the new field in SQ02, the check box "Determine LIKE reference using text field" is disabled.
    Is there is configuration somewhere or any other way, where I can also get the text for the custom additional field?
    I can see that this question has been asked earlier, but there are no responses.
    Also on SAP documentation, this field is shown as enabled.
    But I cant get the text for a additional field working. Please coyu post your suggestions?
    Thanks,
    Vaishali

    Hello Srini,
    Thank you for your time.
    Consider the additional field SYHR_A_P0001_AF_PL_CTRY (country) in Infotype 0001 in the infoset.
    This field does not populate any country code or text for us, so I need to create a custom additional field that will have the same functionality.
    I have created two new additional fields - Z_Country_Code and Z_country_text in additional fields section of IT0001.
    One field fetches country code and other fetches the text corresponding to this code.
    What I want to achieve is the standard functionality that is available for standard fields - P0001-WERKS for example.
    In the query output, you could select to display text/code/ text and code.
    For the additional field "Country", I have to select two separate fields - Z_Country_Code and Z_country_text  to achieve the same  functionality.
    How can I achieve this?
    When we define a custom additional field, in the field definition section, there is a check-box "Determine LIKE reference using TEXT FIELD" , but this is disabled when I create the additional fields. Perhaps, if this is enabled, then I can define the text table.
    Any ideas how to enable this text box?
    Vaishali

  • Ad-Hoc Query Field using HR_99S_INTERVAL_BETWEEN_DATES function module

    I have created an additional field in Sq02 to calculate years between two dates and am using function module HR_99S_INTERVAL_BETWEEN_DATES.
    There are no syntax erros but when I run a query in Sq01 and output the field it doesn't calculate instead gives "00000" output.
    The field Code in the additional field
    Clear ZHR_SERVICEYRS.
    DATA: V_MONTHS TYPE  i.
    DATA: V_YEARS TYPE  i.
    DATA: V_MONTHS1 TYPE  char20.
    DATA: V_YEARS1 TYPE  char20.
    CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
      EXPORTING
       BEGDA           = P0002-GBDAT
       ENDDA           = Sy-Datum
      TAB_MODE        = ' '
    IMPORTING
      DAYS            =
      C_WEEKS         =
       C_MONTHS        = V_MONTHS
       C_YEARS         = V_YEARS
      WEEKS           =
      MONTHS          =
      YEARS           =
      D_MONTHS        =
      MONTH_TAB       =
    V_MONTHS1 = V_MONTHS.
    V_YEARS1 =  V_YEARS.
    CONCATENATE V_YEARS1  '.'  V_MONTHS1 INTO ZHR_SERVICEYRS.
    condense ZHR_SERVICEYRS.
    has anybody had similar problems! Help Appreciated!

    Hi Anuj,
    Yes, you use Transaction Code SQ02.  Find your infoset on the list - if you want to create a new infoset you can do so.  If it is an existing infoset, select it and Change.  On the next screen you will see all the infotypes in that infoset on the left.  The fields available for Ad Hoc are on the right.  Open the infotype table on the left and the field group on the right.  If the field is not included in the field group all you have to do is drag and drop from the list on the left to the correct field group.  If the infotype is not already in your infoset, select Edit --> Change Infotype Selection from the top menu bar.  Place a check in the new infotype and then return and do the drag and drop if necessary.  You will find the basic fields already moved to the field group. 
    You say you want information from IT0008-Basic Pay and IT1005-Planned Compensation.  Problem is that if you use the standard HR logical data base, there is no link directly between a person and IT1005.  IT1005 is assigned to a Position or a Job.  If it is assigned to a Position, you can select the "Change Infotype Selection" action and ago to the bottom of the list to Related Objects.  Here select Position and open that to find the IT1005.  If the IT1005 is tied to the Job, there is no direct link. Thus, if it does not already exist, you will need to create an infoset based on the PCH logical database and object Position.  Now you can link that Position to "Holder"-Person and "Described by"-Job.  Again, select the infotypes and fields you want and you will be able to obtain your information via Ad Hoc Query based on that infoset.
    Paul

  • Modifying  the Ad-hoc Query Infoset : problem with P9105 fields.

    Hi all,
    Am having problem with Infoset of Ad-hoc Query .
    i need to add the Critical role Field Group to ZHR_PA_01 Infoset of Satandard Area.
    for this i have imported that Infotype 9105 and included the following standard fields by drag and drop.
                    1. Role Category
                    2. Role SubCategory
                    3. Global Identifier 
                    4. Personnel Number
    and then Saved and Generated the infoset succesfully.(No syntax errors)
    But
    While testing, using the T-Code:  S_PH0_48000510
    if i select one of these above fields for the report,
    Am getting the message that "Error when generating the report".
    Error Description:The report cannot be generated because the internal description is invalid or incomplete.
    means what may be the problem.?
    if i select other fields its working fine.
    can any body explain me clearly..??
    Regars,
    Kalam A.

    Hi Manoj,
      yes, i have saved the T-code.and generated the Infoset Succesfully.
    and its showing the those additional fields while testing.
    for remaining fields its working fine.
    but am not getting wats problem with the four fields of P9105 infotype.
    could you please suggest me.?
    Regards,
    Kalam A.

  • Additional field in adhoc query

    Hi all, I need to be able to report on the IT105 subtype 0001 system ID for employees who are withdrawn from the company, however, when someone leaves their IT105 record is delimited so adhoc query will not output anything.  Has anyone coded an additional field that will look at the latest record regardless of the date?
    If you have, please can you share the code with me!?
    Many thanks!

    Hi Tanya ,
    Please find the code below. It is designed for additional structure z105_last which is bassed on P0105 type.
    data l_it_p0105 type standard table of p0105.
    clear: l_it_p0105, z105_last.
    call function 'HR_READ_SUBTYPE'
      exporting
        tclas                 = 'A'
        pernr                 = peras-pernr
        infty                 = '0105'
        subty                 = '0001'   
        begda                 = '18000101'
        endda                 = pn-endda
      tables
        infty_tab             = l_it_p0105
      exceptions
        others                = 1.
    if sy-subrc = 0.
      describe table l_it_p0105.
      read table l_it_p0105 into z105_last index sy-tfill.
    endif.
    Regards,
    Sergey

Maybe you are looking for

  • Tethering stopped working on windows 7 after itunes 10.7 update

    This problem seems to have been addressed many times in the forums for Apple OS, but not for Windows. Most reponses refer to the kext files which as I understand do not apply to Windows? I have an iphone 3G that I updated to IOS 6.0.1, and this also

  • Problem with current position (UMI-7764)

    Good afternoon, I'm using servomotors PSKF321 (SEW) and servodrives MDX61B (SEW). I'm using the PCI-7344/UMI-7764 to control the motors. When I was performing some tests in MAX, I realized that I don't have feedback from axis 2, 3 and 4. Axis 1 is wo

  • How do I get my music from previously copied CDs back from itunes

    I have copied a lot of my old CDs on my PC. I had synced them with my iPhone and my ipad.  Then I got a new iPhone, updated itunes, synced the new phone with itunes lost everything that wasn't purchased through itunes.  I still had them on the iPad,

  • After Installing ML on the second Mac

    After downloading and installing OS X Mountain Lion on a second macbook pro at home which belongs to my brother and earlier he had been using another apple ID for it. After he installed the OS X ML, I'm unable to find the ML in my purchases at the ap

  • Canvas problem FCP4.5

    I can't figure out why the picture fills up the viewer (setting is automatically 77%) and is a small picture in the canvas (setting is 50%). The canvas view's next step up is 100% and that is too much which distorts the picture. In the Pro Training t