Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SQ02 - Ad Hoc Query - Custom additional fields

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

In Mantain InfoSet, go to extras, white page icon (create) and select additional field. I use to populate the field 'LIKE reference' (for instance, LIKE vbrp-sgtxt, ie: a char lengh 50), I set a long text and a text to see it in the header of columns. After, go to the icon for coding (coding for addition) and write the ABAP where you populate the field. Write a coment and search it in the coding for the ABAP report that this tool built. The sequence is a kind of sort of this extras. The purpose is that this assistant knows the order in that it must sort this additional coding. Remember that in the query definition in SQ01 you can change this texts (selection screen, header, etc..)

I hope this helps you

Regards

Eduardo

9 REPLIES 9

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

In Mantain InfoSet, go to extras, white page icon (create) and select additional field. I use to populate the field 'LIKE reference' (for instance, LIKE vbrp-sgtxt, ie: a char lengh 50), I set a long text and a text to see it in the header of columns. After, go to the icon for coding (coding for addition) and write the ABAP where you populate the field. Write a coment and search it in the coding for the ABAP report that this tool built. The sequence is a kind of sort of this extras. The purpose is that this assistant knows the order in that it must sort this additional coding. Remember that in the query definition in SQ01 you can change this texts (selection screen, header, etc..)

I hope this helps you

Regards

Eduardo

0 Kudos

Thanks Eduardo.

What you have explained is to add a new custom field that gets and displays text.

Thanks for that.

Although, what I was looking for is to have both code and text in the same field, just like any standard SAP field.

Personal Sub Area for example, has both code and text, so you could right click on the field and pick up the Code(Value) or Text or Value and Text.

This however is not true for custom additional field.

The only option is to display Value.

Any ideas how to get both Value and Text just like any other standard field?

Many thanks for your reply.

Vaishali

0 Kudos

Hi

The additional field can be defined as a text (for instance, MSEG-SGTXT) or as a value (MSEG-MENGE). When you populate it with your ABAP coding you must remember that you cannot do something, as do sums with texts and so on (and avoid dumps). My doubt is when you talk about customer additional fields ¿do you refer to appends in standard tables, ie: zz-fields?

Regards

Eduardo

0 Kudos

Hi again,

Thanks for the prompt response.

The additional field that I refer to is customer additional field in infoset.

For example, I want to add an additional field called country and want to display both country code and text.

In this case I have had to create two separate fields - one for P0001-LAND1 and other for T005T-LANDX.

But standard fields available have the option of displaying both code and text as query output.

Is it possible to define a field as code here P0001-land1 and specifying text table somewhere, such that text is automatically populated in display? I am trying to achieve the same functionality as any other standard field which has codes and texts attached to it.

Vaishali

0 Kudos

Hi Vishali,

Your requirement is still not clear, can you please mention a standard infoset and field, where you see the value and text being display for only one field, we can check in our system and see.

If you want to display the code(actual country, IND for India or US for USA and text like India or USA. Then we need 2 fields for this.

Please give an example in standard SAP.

Thanks,

Srini

0 Kudos

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

0 Kudos

Hi Vaslhali,

Create an addition field for instance, COUNTRY_KEY_NAME , 'country (key and name)', for instance like BKPF-SGTXT (char, lenght 50). Add the tables T005, T005T in the infoset. In the additional coding write:


  DATA: name_country LIKE t005t-landx50.

  CLEAR name_country.
  country_key_name(3) = p0001-land1.
  SELECT SINGLE landx50 INTO name_country FROM t005t
     WHERE spras = sy-langu
     AND      land1 = p0001-land1.
   country_key_name+4(46) = name_country(46).
  

Check the coding, save, activate and check that you can see it in the query (SQ01)

I hope this helps you

Regards

Eduardo

0 Kudos

Hi Vaishali,

To display the P0001-WERKS, which is personal area in SAP HR, 2 fields are needed.

So to display the personal area code and the description, in standard SAP, there are two fields P0001-WERKS, T500P-NAME1. ( you can check this by going to PA20 and IT 2 or address data).

So to display the actual code, and description, we always need two fields. One fields canu2019t have code and description.

If this is not what need, as I said, please given an example in SAP where I can go and check what you mean.

Thanks,

Srini

0 Kudos

Hello Eduardo

Thank you for your, I tried this method, and I can display both code and text in output.

But the user is not interested in the code but only wants to see the text - the code needs to used for selection.

hence looks like there is no option but to create two separate fields.

Edited by: Vaishali Patwa on Oct 12, 2011 12:21 PM