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

Similar Messages

  • Adding additional fields to an Infoset Query

    Hi Experts,
    I have added a couple of additional fields to an infoset query using SQ02.
    I have also written code for filling in the fields.
    I have also added them to some Field Groups.
    Despite this, when I run the query, they are not being displayed in the output list.
    What could be the reason for this?
    Kindly help with your inputs.
    Thanks in advance.
    Regards,
    Keerthi

    goto sq01,
    give the query name...
    goto change.. just below output, you have a drop down for field group and field catalog. select field catalog.
    select the fields you want to show in output

  • Display Currency field in Ad Hoc Query

    I done enhancment in Infotype 23 for Last Salary drawn as currency field and ref type as PA0015 WAERS in Ad Hoc Query.  But I am not able to display the same field with value.  Its always shows me blank.  Is there any settings to be done to display currency field in ad hoc query??  Pl. help me as this is very urgent.

    Hi Praveen,
    i have selected both value and text, still i'm not getting it.

  • Add color to an Additional Field inside a SAP Query (Infoset) in ALV

    I made an Infoset (transaction SQ02) out of table MARC. I created an Additional Field called "STATUS" which I coded to get a value of 1 or 2 depending on the value of another field in MARC.
    How can I make this cell in the resulting Query to appear in different colors depending on the value? I found the command "FORMAT" but that doesn't work on SAP List Viewer (ALV) mode.
    This is what I coded in the additional field called STATUS::
    clear: STATUS.
    if MARC-DISPO = 001.
      format intensified color = 6.
      move '1' to STATUS.
    else.
      format intensified color = 7.
      move '2' to STATUS.
    endif.
    The coloring didn't work. What ABAP command should I add to this additional field to make the coloring of the STATUS cell work under ALV mode?

    field catalog and layout are saved into database aqrdb
    just before displaying the results into ALV table, they are retrieved by function RSAQRT_ALV_DISPLAY which does
    concatenate rtmode-act_report sy-langu into l_srtfd_pattern.
      import fieldcat = fieldcatalog
             layout   = layout
             sort     = sort
             from database aqrdb(lv) id l_srtfd_pattern.
    so in order to display some cells with a different color, you have to
    - add an additional field that will contain the color codes of cells
    - set values in this field at record level (field is a table of type LVC_T_SCOL)
    but also adapt the layout in order to set the field as containing the colors
    - put the name of this field into layout (CTAB_FNAME)
    - export layout to corresponding entry of aqrdb
    this part I don't see exactly where to put it, I guess there is some place where it is possible to manage the layout - if not then you have to do it "manually" i.e. with a small report

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

  • 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

  • Adding additional fields in Sql Query (SQ01)

    Hi..
    please tell me all the steps to use additional fields option in  sap query (transaction code: SQ01)? can i use mandt field as additional field?
    Thanks and Regards
    Sri.

    Hi,
    You can add it in infoset using extra button.
    Here you can add the filed and the respective code for this field and add this in SQ01 in oytput list.
    Thanks
    Ajay

  • Additional field in selection screen of a abap query

    Hi,
    I am adding a new additional field in the selection screen through abap query(using transaction SQ02) which is of type VBRK-FKSTO.
    The value entered can be 'X' or empty space.But the value which is entered in the selection screen is not getting reflected in the code.Kindly advice me on what needs to be done to capture the selection screen value in the code.
    Regards,
    S.Subasree

    Hi
    You can add new field in VFX3 selection screen as follow. In the report code we can see various explicit enahcement points provided by SAP.One of them is ENHANCEMENT-POINT sdblbddl_01 SPOTS es_sdblbddl STATIC. Here you can declare your selection screen parameters.  Then in the processing i can see a call customer fucntion happening in VBSK_DISPALY which you can implement to add your logic.
    Thanks
    Nabheet

  • Additional field in infoset as string

    Hi,
    Is it possible to add an additional field in an Infoset with type string?
    When i'm creating it, I need to fill the definition of the field, with a certain type or with reference to some table field, but I'm not finding any suitable to here of type string. I always get an error "you must use a flat structure" or "you cannot use internal tables, strings, references, or structures as components".
    This means I cannot create an additional field as a string?
    Thanks in advance for your help.
    Best regards,
    Sónia Gonçalves

    Thnks for answers ,
    I have just do that but there is no hided field . I haven't see the additional field  there already.
    I think it 'll more clear if  I tell about what am I doing step by step ;
    First , I created infoset in SQ01 with joinig tables LIKP -  LIPS .Then I added some additional field ; I collect different value from another table . Then I create field group called " ADD" in infoset and assigned additional fields that I created to "ADD " . Finally generate and saved infoset .
    Second , in RSO2 I create data source and joined with infoset . Then comes to selection filed screen .  Here was my problem ; there were no field that I added to infoset ,additional fields didn't appear
    Can I  explain it ?
    Thnks for help ..

  • BW - additional field in infoset

    Hi all ,
    I used data source with infoset and I added additional field into infoset . But additional fields did not come to the data source selection screen ( Field list screen ).  Is there a way to do this ?
    Can anyone help me ?
    Thnks a lot ..

    Thnks for answers ,
    I have just do that but there is no hided field . I haven't see the additional field  there already.
    I think it 'll more clear if  I tell about what am I doing step by step ;
    First , I created infoset in SQ01 with joinig tables LIKP -  LIPS .Then I added some additional field ; I collect different value from another table . Then I create field group called " ADD" in infoset and assigned additional fields that I created to "ADD " . Finally generate and saved infoset .
    Second , in RSO2 I create data source and joined with infoset . Then comes to selection filed screen .  Here was my problem ; there were no field that I added to infoset ,additional fields didn't appear
    Can I  explain it ?
    Thnks for help ..

  • Additional Fields in Custom in HR Infotype

    Hi All,
    I have added Benefit Salary field to already existing infotype . I have assigned it to field group Insurance Plan and added code in the field at END OF SELECTION (After List ) event . I can see Benefit Salary in Debug mode in  the Technical Name of created field . However this value is not being passed to the Output .
    Please let me know if I am missing out any configuration.
    Regards,
    Sachin

    Thnx Andreas,
    i have following doubts again..
    I have to add sales organisation field to the selection screen...(this is given in the req.)
    now if i will say GET KNKK...it would not keep account of this 'sales organisation' field...so how should i fetch the data with these input data( i.e. 'compny code' and 'customer' are the fields given by LDB and 'sales oraganisation' is the field i put it on the selection screen)
    And what about the KNVV-VKORG ,because the KNVV is not present in the LDB.

  • Add additional field on query

    Dear ,
    I have created a quick viewer.
    I need to add an additional field on a SAP query.
    This new field must be calculated as a multiplication of two fields displayed in the query.
    How can I do that ?
    Thanks

    Hello,
    In Quick Viewer, you cannot define local fields. You may convert (In SQ01->Query->Convert Quickview) SQVI Query into an SQ01 Query and then define local field.
    Thanks,
    Venu

  • Statistics indicator option in Ad hoc query for IT0033

    Hi,
    My client is trying to run the ad hoc query for IT0033 and not able to see the "Statistics indicator"  fields in the selection so is there a way to add this field to ad hoc query so it will facilitate to query on this field ? please advice.
    Thanks,
    Lisa

    Hello Lisa,
    If you need to have there the statistics indicator, you would need to create there additional fields for that, selecting from
    table T543A, with the employee molga and infotype 0033 subtype
    Best Regards,
    Deepak.

  • 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

  • How to create code for an additional field in an info set

    Hello,
    I have an info set in tra SQ02 and the area is HCM with version ERP2004.
    I need to create an additional field to show "Work permit" in ad hoc queries. I know that the infotype 0016 has a standard field P0016-ARBER which contains a date if that person has a work permit. System should select the latest record or the one which is valid during reporting period.
    The requirement for this new field is that it should just has X if the field P0016-ARBER contains a date (i.e. that person has a work permit). If the field  P0016-ARBER is empty, then the new field "Work permit" is also empty. So, the date itself is not enough.
    I am not an abaper. I have tried to create a code for my field but there is always problems with the code. I have tried without the line<i>into</i> but checker says I need to. I have tried different places for statement ENDSELECT but without success. How should I do this?
    What I have so far is (TYOLUPA = Work permit) is shown below:
    select SINGLE ARBER
    into TYOLUPA
    from PA0016
    where pernr = P0016-pernr
    and ENDDA = '31129999'.
    clear TYOLUPA.
    if ARBER ne ''.
    then TYOLUPA = 'X'.
    endif.
    Thanks for your advice!
    Regards,
    Pipsa

    pia,
    In extras tab  create column "workpermit" in infoset and add that column to Field groups.
    Then under record processing event...
    DATA : TYOLUPA like PA0016-ARBER.
    Under Record processing event.
    select SINGLE ARBER
    into TYOLUPA
    from PA0016
    where pernr = P0016-pernr
    and ENDDA = '31129999'.
    if  TYOLUPA  ne ' '.
      WORKPERMIT = 'X'.
    endif.
    Don't forget to reward if useful...

Maybe you are looking for

  • ITunes Match and iPhone

    I have iTunes Match activated on both my devices, macbookpro and iPhone 5. I have noticed many diffences between the 2 library. I have an album that If I don't set the artist album tag, the artist don't work on iPhone. Also, I have an artist that all

  • Need help with installation

    I recently received a laptop from school to access my online classes.  When I tried to use Adobe Reader I received the following message:  Adobe Reader 9.1 has encountered a problem and needs to close.  Sorry for the inconvenience.  I tried tech supp

  • Preview and links since 10.4.4 ?

    Good morning, When reading in Preview a PDF file created with Word or Pages (either through PDF Maker or print/save as PDF) with links thereafter activated in Acrobat, those links are dead, they do not work anymore when they worked fine before 10.4.4

  • How to save web links with photoshop CS4

    Hi everyone, I need to create an image in .png or .jpg with many links in. For this, i used the slide select tool and i used the dialog box to enter the http://..... Then, i saved my work by "save for web and devices", choose the type of file and ok.

  • Installed Flash Player 12 ActiveX not recognised - Windows 7 & Internet Explorer

    On 2/5/2014 I downloaded Adobe Flash Player 12 ActiveX for the 4th time and yet the system is giving me an error message saying "You're mission the video converter tool."  I have a HP Windows 7 system.  Back in October, I was able to use the Internet