• Home
  • About me
  • FALV
  • ALV Grid in the nutshell
    • Basic Information
    • Field catalog
  • Articles
    • Tricks
    • FALV (Fast ALV Grid)
    • ALV Grid in the nutshell
    • Tips
    • How to...
    • For beginners
    • Thoughts
  • By Topic
    • ALV
    • ALV OO
    • SALV
    • GOS
    • Selection screen
    • Purchase Requisitions
    • Purchase Orders
    • Attachments
    • Others
    • Characteristics
    • Sample Programs
    • ZIP
    • OLE
    • Mails
    • Routings
    • EWB
    • Excel
  • Keywords
  • RSS
  • Download
  • Home

ALV Grid in the nutshell: Field catalog - currency

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 2171
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , CURRENCY , ALV GRID

When you have a field that contains an amount, for example net value of an sales order, then in order to show it correctly in the grid you should fill or this field with an value of currency key (one of entries from TCURC table). You can leave this field of course empty and in many case you will, especially if you use CFIELDNAME instead. 

In many situations changing the of currency here will not make difference to the output, but there are some exceptions, for example JPY (Japanese Yen) don’t have decimal places. Figure 17 displays value of 42 294 whereas the internal value of field is 422,94. If we use ZDEMO_AIN_CL08 program with USD currency then as you seen in Figure 18, the value shown is equal to 422,94. Both outputs are correct as long as the currency of the corresponding line is the same as in field catalog.

 

Figure 17 ZDEMO_AIN_CL08 Output using JPY


Figure 18 ZDEMO_AIN_CL08 Output using USD

 

That’s why the CFIELDNAME is very handy to use in that situations where you have different currencies for different rows.


Add a comment

ALV Grid in the nutshell: Field catalog - cfieldname

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 1390
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , CFIELDNAME , ALV GRID

CFIELDNAME can be read as currency field name. When you have in your internal table a field that represents the currency for the amount stored in a field kept under FIELDNAME in field catalog, then you should place its name here. The output of the cell will be then based on a currency key kept in the same row of the internal table, in the corresponding field. 

In the sample program ZDEMO_AIN_CL09 you can see that I passed to the filed catalog CFIELDNAME as ‘CURRENCY’ which is one of the columns of table SFLIGHT, that keeps currency key for field PRICE.

 

Figure 19 ZDEMO_AIN_CL09 CFIELDNAME filled

 As data in this table didn’t contained a line with JPY, I’ve changed in SE16 the currency key for one of the rows in order to show you the difference in output.

 

Figure 20 Changed entry of SFLIGHT table in SE16

 

As the output of the PRICE column depends now on the currency key stored in CURRENCY column, then you can see in the first row that the price is without decimal places, as it should be for Japanese Yen, and in the next rows as we have USD then we see two decimal places.

Figure 21 ZDEMO_AIN_CL09 results


Add a comment

ALV Grid in the nutshell: Field catalog - ifieldname

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 497
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , IFIELDNAME , ALV GRID

Although the SAP name of this field says: “Field name of internal table field”, then I haven’t found any usage of this field. It’s also not filled by SAP when you use SALV for creating field-catalogs. It may be that this field is not used at all.

Add a comment

ALV Grid in the nutshell: Field catalog - quantity

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 2302
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , QUANTITY , ALV GRID

QUANTITY field is very similar to CURRENCY. The difference here is that you don’t keep currency key here, but unit of measure, for example M for meters or KG for kilograms. Again to show you the difference in output I’ve modified a bit the table entries, this time field DISTANCE from SPFLI table, where I’ve included decimal places for first row.

 

Figure 22 Changed entries of SPFLI table in SE16

Now to see the differences, please run program ZDEMO_AIN_CL10 using following units: PMR, DEG, M & empty.

Figure 22 displays the values with three decimal places as PMR is setup to be displayed exactly like this.

 

Figure 23 ZDEMO_AIN_CL10 Results using PMR unit

Figure 23 shows the results when I used DEG unit which shows. In default this unit is set to have one decimal place. As you can see there everywhere where DISTANCE field has less or the same number of decimal places then it’s always shown with one decimal place (even, if after comma there is an 0). In case the quantity value contains more decimal places, like on the first row, then the value is displayed fully as written into internal table.

 

Figure 24 ZDEMO_AIN_CL10 Results using DEG unit

The same situation you can see if you use meters. No decimal places are visible in the rows for which the value doesn’t have any decimals, but if it’s the case then the full value is displayed.

 

Figure 25 ZDEMO_AIN_CL10 Results using M unit

At last I have run ZDEMO_AIN_CL10 without using any unit. As expected the internal value is displayed exactly like stored in internal table, so with four decimal places.

 

Figure 26 ZDEMO_AIN_CL10 Results without filling unit


Add a comment

ALV Grid in the nutshell: Field catalog - round

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 1377
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , ROUND , ALV GRID

Round can be used for decimal fields that have no assigned QFIELDNAME or CFIELDNAME fields. Its purpose is to move decimal places left or right. If you want to move decimal places left, then you have to put there positive numbers, if you want to move decimal places right, then use negative numbers.

Example when you use 0 as round, you’ll get the normal full numbers, the display of the field hasn’t changed.

 

  

Figure 29 ZDEMO_AIN_CL12 Results using 0 as P_ROUND value

Now the same program is run with 3 that is inserted into ROUND. You can notice that instead of 2 571,25 you can see 2,5723, so the comma sign was moved left by 3 positions.

 

Figure 30 ZDEMO_AIN_CL12 Results with 3 as P_ROUND value

Also changed output is visible when you use negative values. This time -5 was used. You can see on image below that instead of 2 571,25 you can see 275 225 000.

 

Figure 31 ZDEMO_AIN_CL12 Results with -5 as P_ROUND value

In each case the value in the internal table was the same 2 571,25.


Add a comment

ALV Grid in the nutshell: Field catalog - qfieldname

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 992
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , QFIELDNAME , ALV GRID

QFIELDNAME has the same meaning for quantity fields, like CFIELDNAME for amount fields. This means that we can setup in which column of internal table the information about unit of measure is kept. On the base of that information, data can be displayed differently in each row, as in comparison to QUANTITY the unit is not set for the whole column. In program ZDEMO_AIN_CL11 I’ve setup column DISTID to be used as QFIELDNAME for DISTANCE.

 

Figure 27 ZDEMO_AIN_CL11 FCAT with QFIELDNAME

As you can see in the Figure 27, the quantity is displayed differently on first and second row. This means that our field catalog setting is working correctly.

 

Figure 28 ZDEMO_AIN_CL11 Results using QFIELDNAME


Add a comment

ALV Grid in the nutshell: Field catalog - exponent

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 647
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , EXPONENT , ALV GRID

This field is used to setup exponent number display for floating point decimals (F) fields. Although it’s not that commonly used field type for display, then it’s important to know that you can manipulate how the field is displayed in ALV grid.

For example, the picture below, shows the results of the ALV output when EXPONENT field was set to 2.

 

Figure 32 ZDEMON_AIN_CL13 Results with P_EXP parameter value set to 2

 

On next picture the results of the ALV output when EXPONENT field was set to 3.

 

Figure 33 ZDEMO_AIN_CL13 Results with P_EXP parameter value set to 3

As you have noticed the value 2 572,25 that you can find in the internal table, will be shown differently but it’s showing exact the same number.

 


 

Add a comment

ALV Grid in the nutshell: Field catalog - key

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 479
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , KEY , ALV GRID

If you want to setup current field as a key one, you need to fill KEY with ‘X’. When you’ll do this then the field will have blue background and during horizontal scrolling the column will be fixed.

 

Figure 34 ZDEMO_AIN_CL14 Results with CARRID field set as key one

 


 

Add a comment

ALV Grid in the nutshell: Field catalog - key_sel

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 671
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , KEY_SEL , ALV GRID

The description of this fields claims that if you put ‘X’ inside then current field will became a key field that can be hidden, but in fact it has no effect here, as standard key field can always be hidden. As you can see also in the picture bellow, it doesn’t even mark field as a key one.

 


Figure 35 ZDEMO_AIN_CL15 No effect after setting KEY_SEL to 'X'

 


 

Add a comment

ALV Grid in the nutshell: Field catalog - symbol

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 653
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , SYMBOL , ALV GRID

This field has similar functionality like ICON but instead of better looking icons, you can choose to display old-style ASCII symbols from type-pool SYM. Like in an example of ICON you have to setup the fieldcatalog value for field SYMBOL to ‘X’ and in the corresponding field of your internal table, you have put the value of the symbol. The corresponding field should be CHAR1 field.

 

Figure 39 ZDEMO_AIN_CL17 ALV with symbols

 

You can check the available symbols on your system, but I doubt they vary between old and new releases.

Figure 40 Possible symbols in ALV Grid

 


 

Add a comment

ALV Grid in the nutshell: Field catalog - icon

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 2796
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , ICON , ALV GRID

If you want to display an icon inside the cell, then you need to setup a value of this field to ‘X’ and additionally you need to put an icon from type-pool ICON into the corresponding field of your internal table. The corresponding field should be an CHAR4 field. You can use of course the domain ICON_D as well. In my example I’ve filled all rows with the same icon (ICON_ABAP) during the selection of data into internal table, but in productive programs, you’ll probably do this during the loop over internal table, as probably you’ll want to setup different icons for a row, depending on the content of other field.

 


Figure 36 ZDEMO_AIN_CL16 Select with ICON_ABAP

 

Figure 37 ZDEMO_AIN_CL16 Results with ICON

To visualize all available icons, it’s enough to go to SE16 or SE16N and display the content of a table ICON. You’ll see then how icons looks in your current SAP GUI theme.

 

Figure 38 Content of ICON table

 


 

Add a comment

ALV Grid in the nutshell: Field catalog - checkbox

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 3408
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , CHECKBOX , ALV GRID

The name of this field says almost everything about it. If you put an ‘X’ in it, then the column will be displayed as checkbox. The type of the field which is used as checkbox should be set to ABAP_BOOL or any other CHAR(1) type.

If you use editable grid then once the checkbox is checked, the cell of the table behind it will be filled with value ‘X’.

 


Figure 41 ZDEMO_AIN_CL18 Checkbox on editable grid

 


 

 

Add a comment

ALV Grid in the nutshell: Field catalog - just

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 439
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , JUST , ALV GRID

With this field, you can setup alignment of the column. You can use one of the following values:

  • R - Right,
  • L - Left,
  • C - Centre,
  • space – default setting for field type

 

 

Figure 42 ZDEMO_AIN_CL19 Fieldcatalog with alignment

As you can see the columns are using the settings from fieldcatalog correctly.

Figure 43 ZDEMO_AIN_CL19 Results

 


 

 

Add a comment

ALV Grid in the nutshell: Field catalog - lzero

Details
Written by Łukasz Pęgiel
Category: ALV Grid in the nutshell
Published: 24 June 2019
Hits: 867
1 1 1 1 1 Rating 0% (0 Votes)
Tags: CL_GUI_ALV_GRID , ALV GRID IN THE NUTSHELL , FIELDCATALOG , LVC_T_FCAT , LZERO , ALV GRID

This field allows manipulation of visibility of leading zeros. One of the most common example is the material number (MATNR), when there is no letter inside the name of material, it is stored in database with leading zeros. For example material 101 would is stored as 000000000000000101 in ECC and 0000000000000000000000000000000000000101 in S/4 HANA. In order to not display this not needed zeros, you can setup LZERO to ‘X’.

 

Figure 44 ZDEMO_AIN_CL20 With leading zeros

 

Figure 45 ZDEMO_AIN_CL20 Without leading zeros

 


 

 

Add a comment

More Articles ...

  1. ALV Grid in the nutshell: Field catalog - no_sign
  2. ALV Grid in the nutshell: Field catalog
  3. ALV Grid in the nutshell
  4. ALV Grid in the nutshell: Basic Information
  5. ZCL_CMD_CUSTOMER -> Wrapper for CMD_EI_API classes
  6. SAP Fiori - HTTP request failed403,,CSRF token validation failed
  7. ABAP Code Retreat Tychy 2019 - Organizer Recap
  8. Selection-Screen Function Key in Form, Function Module or Method
  9. Unlock yourself on the DEV system
  10. Speed-up your Eclipse installation
Page 3 of 11
  • Start
  • Prev
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • Next
  • End
Łukasz Pęgiel
Custom selection-screen fields for MD07 MS07 ALV Grid in the nutshell Field catalog - col id - ALV control Column ID GOS - Link Business Documents from PR to PO DDSHIFACE DELETE USER OBJECTS LOAD COMPLEX BOM SET READY FOR INPUT ADT MEREQ GET FACTORY SCMS XSTRING BINARY RELEASABLE TVCPL SBCS SEND UPDATE COMPONENTS PREPARE Field catalog - no sign CSRF Token SAPGUI FUNCTIONCODE MB51 FLAG Field catalog - edit mask FILL MDLB FROM EBAN Dynamic GUI STATUS TITLE with ABAP code ALV GRID IN THE NUTSHELL FIELDCATALOG TOOL ACCESS ALV GRID The SIN of progress indicator ABAP ZIP ROLLNAME DFIELDNANE CLASS EXTEND PROGRAM RUNTIME IXML OSTREAM BAPI EXCHANGERATE CREATE Field catalog - round LVC FCAT REFRESH ABAP Extensions - Automatic Logon GUI ALV GRID ESRUO ABAP IN ECLIPSE CURRENCY MB51 ENHANCEMENT EXTENSION MESSAGE HANDLER MEPO DOCUMENT GUI HTML EDITOR ALINK CONNECTION GTINSERT PARSER BOM COPY COC1 FEATURE CHECK Selection Screen - Part1 - Parameters Field catalog - sp group - Group key TSK TOTLINE SALV CONTROLLER METADATA GTGET SLIS
  • Laserowe usuwanie blizn Tychy
  • Laserowe usuwanie zmarszczek Tychy
  • Paznokcie hybrydowe Tychy
  • Paznokcie tytanowe Tychy
  • Salon Kosmetyczny Tychy
  • Trycholog Tychy
  • Wypadanie włosów Tychy
Tweets by abapblog

Eclipse Plugins for ABAP

ABAP Favorites

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

ABAP ADT Extensions

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

ABAP Quick Fixes

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

 

Latest Articles

  • ALV Grid in the nutshell: Field catalog - col_id - ALV control: Column ID
  • ALV Grid in the nutshell: Field catalog - dfieldname – Fieldname for column group
  • ALV Grid in the nutshell: Field catalog - Hotspot - ALV control: SingleClick-sensitive
  • ALV Grid in the nutshell: Field catalog - sp_group - Group key
  • ALV Grid in the nutshell: Field catalog - domname - Domain name
  • ALV Grid in the nutshell: Field catalog - reprep - ALV control: Value is selection criterion for rep./rep.intf.
  • ALV Grid in the nutshell: Field catalog - reptext – Heading
  • ALV Grid in the nutshell: Field catalog - lowercase - Lowercase letters allowed/not allowed
  • ALV Grid in the nutshell: Field catalog - intlen - Internal Length in Bytes
  • Downloading Exchange Rates from NBP (National Bank of Poland)
  • Downloading Exchange Rates from Central Bank of Turkey
  • ABAP Extensions - Automatic Logon
  • ALV Grid in the nutshell: Field catalog - inttype - ABAP data type (C,D,N,...)
  • ALV Grid in the nutshell: Field catalog - datatype
  • ALV Grid in the nutshell: Field catalog - rollname

Most Read

  • Create XLSX/MHTML file from internal table in background
  • Refresh ALV GRID and keep position and current cell
  • Call standard F4 search help with customized parameters
  • FALV (Fast ALV Grid)
  • Dynamic GUI STATUS & TITLE with ABAP code
  • Create a nice looking chart with CL_GUI_CHART_ENGINE - Part 3 - Chart Data and render
  • Link Attachments of Purchase Requisition to Purchase Order
  • GOS - How to add business documents at creation of object
  • Subtotal lines of ALV GRID OO as content separator
  • Create fieldcatalog from internal table
  • Endless loop in BADI ME_PROCESS_PO_CUST
  • EWB Components allocation to routing operation (multilevel BOM)
  • How to access private or protected data and methods of CL_GUI_ALV_GRID
  • Popup with multi-select ALV
  • Save message with attachment in Outlook's Drafts
feed-image Feed Entries

Latest Comments

ABAP code and articles provided on http://abapblog.com, if it is not statet otherwise, were created by Łukasz Pęgiel. You can use the code in your SAP instance for commercial and non-commercial use without any warranty from side of the author. You cannot sell the code as a full program or a part of it.
Replicating of the articles and code is prohibited unless the agreement of the author is given to you.