6

ALV IDA Using CDS View Long Text using (Calculation Field)

 1 year ago
source link: https://blogs.sap.com/2023/08/22/alv-ida-using-cds-view-long-text-using-calculation-field/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
August 22, 2023 2 minute read

ALV IDA Using CDS View Long Text using (Calculation Field)

ALV IDA Using CDS View Long Text using (Calculation Field)

Mostly people facing problem to how to use long text using function module, Call class in CDS while creating ALV IDA from CDS View. In this blog I will share my knowledge of ALV IDA Using CDS View and ALV IDA Calculation field (Mostly is used for virial element). Using Calculation Field in this blog I am going to display Long Text and Other Field

In this blog I will focus on below points.

  1. Create CDS View (Generic) with 2 or 3 fields.

  2. Create class with interface calculation field.

  3. Long Text working in method

  4. Creation of ALV IDA Program

Let’s begin with our learning.

Create CDS View (Generic) with 2 or 3 fields.

Mostly of people aware of to create a CDS View. That’s why I am creating as generic.

  • Create Data Definition
Data%20Definition
  • Select Data Definition and then Select Finish.
Data-Defination2.png

Write your query and then Activate.

Data-Defination3.png

Create class with interface calculation field.

Data-Defination4.png
Data-Defination5.png

Long Text working in method

  • Double click on IF_SALV_IDA_CALC_FIELD_HANDLER~CALCULATE_LINE

Program code is given below.

Data-Defination6-2.png
Data-Defination7.png

Code Example

REPORT ZALV_IDA_DEMO_LONG_TEXT.


"Data Declataion for ALV IDA and Class handler
DATA: LO_ADDITIONAL_CONDITION TYPE REF TO IF_SALV_IDA_CONDITION,
      LO_CONDITION_FACTORY    TYPE REF TO IF_SALV_IDA_CONDITION_FACTORY,
      LS_PERSISTENCE_KEY      TYPE IF_SALV_GUI_LAYOUT_PERSISTENCE=>YS_PERSISTENCE_KEY,
      LR_DISP                 TYPE REF TO IF_SALV_GUI_TABLE_DISPLAY_OPT.
*      LO_CALC_FLD             TYPE REF TO ZCL_LONGTEXT.



DATA(LO_CALC_FLD) = NEW ZCL_LONGTEXT( ). 


*Create 'ALV with IDA' for Core Data Services(CDS)
DATA(O_DATA) = CL_SALV_GUI_TABLE_IDA=>CREATE_FOR_CDS_VIEW(
  IV_CDS_VIEW_NAME      = 'ZPURCHASE_ORDER_CDS'
  IO_CALC_FIELD_HANDLER = LO_CALC_FLD
).


*For Layout this is must be user coz it will enable layout button
DATA(L_GLOBAL_SAVE_ALLOWED) = ABAP_TRUE.
DATA(L_USER_SPECIFIC_SAVE_ALLOWED) = ABAP_TRUE.
LS_PERSISTENCE_KEY-REPORT_NAME = SY-REPID.
O_DATA->LAYOUT_PERSISTENCE( )->SET_PERSISTENCE_OPTIONS(
EXPORTING
  IS_PERSISTENCE_KEY           = LS_PERSISTENCE_KEY
  I_GLOBAL_SAVE_ALLOWED        = L_GLOBAL_SAVE_ALLOWED
  I_USER_SPECIFIC_SAVE_ALLOWED = L_USER_SPECIFIC_SAVE_ALLOWED
).


*Display ALV IDA
O_DATA->FULLSCREEN( )->DISPLAY( ).
Data-Defination8.png

Note: Before creating ALV IDA must sure below note is implemented or already implemented. This is for save global layout.

https://me.sap.com/notes/3196994

I have covered all basic thing in above blog. Hopefully its helpful for all of you. Happy Learning.

Your suggestions, feedback, comments on this blog are most welcome.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK