Enterprise Resource Planning Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
aadizarobi
Explorer
3,656

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


 

Hi,


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




 

  • Select Data Definition and then Select Finish.



Write your query and then Activate.


Create class with interface calculation field.



 


 

Long Text working in method



  • Double click on IF_SALV_IDA_CALC_FIELD_HANDLER~CALCULATE_LINE


Program code is given below.


 


 

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( ).

 


 

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.


4 Comments
azubair
Discoverer
0 Kudos
Hi Adnan Khan,

Very well described article. Great going (Y)
shais
Participant
There is already a very similar post:

Display standard text using CDS in ALV with IDA | SAP Blogs

 

As been mentioned there, you may use FM READ_TEXT_TABLE for performance optimization.
aadizarobi
Explorer
0 Kudos
Hi Shai Sinai,

Thanks for you valuable response. I just covered this with T-Code SE24 without inline class method/Implementation and also used with less step which can easy to understand for every beginner too.
Mahesh20
Discoverer
0 Kudos

Is it possible total Functionality for calculated field?