Alv Demo Program Sap

Alv Demo Program Sap

Posted by admin- in Home -05/10/17
Alv Demo Program Sap Rating: 5,0/5 1896reviews

Conversion Exit to format Amounts for Currency in ALVConversion Exit to Format the Amount with using the respective currency in ALV created by SALV Model. Preface. In the last article Conversion Exit to format Amounts in ALV, I have demonstrated on how you can achieve the Amount formatting. That formatting was only for one currency dollars. I didnt consider the Currency along with the Amount. So, I knew one of you might ask how, you can achieve it for multiple currencies. Vijay Dudla asked that question on last article. How this can be done for different currency, suppose if i have a report with different currency and i want different functionality based on currency, how can you find which currency you are doing the conversion in the routine. Challenges. Conversion Exit accepts the value and convert it to the desired format. Since we can only pass a single Value to the conversion routine, it posed a first challenge to make the solution work. There is no easy way to identify the currency only from the Amount. I thought of using the DESCRIBE on amount to find out if I can get the associated currency. Alv Demo Program Sap 2000' title='Alv Demo Program Sap 2000' />I also checked the system fields, I can leverage to get the Currency from. You might think that Pass the currency to a memory before ALV is generated, access that in the Conversion routine and use it to formulate. But this doesnt work as you need the currency from corresponding row. Workable solution. So here is how I kind of solved this Create a Dummy Conversion routine. Assign it to Currency Column. The dummy conversion routine FM needs to be created in the Same FG where the Amount conversion FM is created. In this Dummy Conversion FM, save the currency value to Global Variable. Access this global variable in the Amount Conversion Exit to derive the symbol. These are the SAP 4. C PDFs available for download. SAP no longer does PDF downloads after this version, as their SAP help is now available in HTML format. ABAP Conversion Exit to Format the Amount for specific Currency in ALV created using SALV Model. Handling SALV events to renumber columns. Admin/uploads/gpd-pace-object-compare.jpg' alt='Alv Demo Program Sap' title='Alv Demo Program Sap' />Alv Demo Program SapUse the Symbol to concatenate and make the output. Sounds great, huh Not that simple. There are few more things to consider. The Conversion Routine for Currency needs to be executed before the Amount Conversion routine in order to save currency in the global variable. That means the Currency column needs to be before the Amount currency always. Hello everyone, in this SAP Netweaver Gateway tutorial, we will learn how to consume external OData services in SAP Gateway. External OData services means the service. So, I moved the ALV logic in the INITALIZATION event. After this try, I got the Docking container with the empty ALV ALV with the field catalog but no Data. Moved Permanently. The document has moved here. To make sure, the currency column stays in front of Amount column, I need to implement the event AFTERSALVFUNCTION of SALV model. In the event handler, I added logic to renumber the currency and Amount Column. You also cant make the Currency column as currency column for the amount. Alv Demo Program Sap RomaniaDoing this, doesnt trigger the Amount conversion routine at all. For Fullscreen, the function Hide doesnt trigger the After SALV event. Thus it renders the ALV incorrect Currency when you hide the Currency column. Conversion Exit for Currency. I created the ZCURR conversion exit for currency. Here is the dummy Conversion for Currency. CONVERSIONEXITZCURROUTPUT. FUNCTION CONVERSIONEXITZCURROUTPUT. Local Interface IMPORTING REFERENCEINPUT TYPE CLIKE EXPORTING REFERENCEOUTPUT TYPE CLIKE utput input. Global variableNDFUNCTION. Redefined Amount Conversion Exit After adding this new conversion exit FM, here is the redefined version of CONVERSIONEXITZSIGNOUTPUTI have hardcoded the currency and Symbols here for demo. But you can create a custom table to store the currency and symbol as suggested by Mohinder in his comment. CONVERSIONEXITZSIGNOUTPUT with Currency. FUNCTION conversionexitzsignoutput. Local Interface IMPORTING REFERENCEINPUT TYPE DMBTR EXPORTING REFERENCEOUTPUT TYPE CLIKE . DATA lvdmbtr TYPE bseg dmbtr. DATA lvoutput TYPE char. DATA lvdmbtrc TYPE char. DATA lvsymbol TYPE char. WRITE lvdmbtr TO lvdmbtrc NO SIGN. CONDENSE lvdmbtrc. IF lvdmbtr LT 0. CONCATENATE lvdmbtrc INTO lvdmbtrc. WRITE lvdmbtrc TO lvoutput RIGHT JUSTIFIED. This can be saved in Config. CASE vwaersbuffer. WHENEUR. lvsymbol. WHENUSD. lvsymbol. WHENOTHERS. lvsymbol. CONCATENATE lvdmbtrc lvsymbol INTO lvoutput SEPARATED BY. CATCHcxroot. Demo Program. Program needs to be adjusted to include the event to reset the Currency and Amount columns. Here is the code lines with Event handler. Format Amount in ALV for specific Currency. REPORT ZTESTNPSALVFORMATAMOUNT2. CLASS lclmain DEFINITION. PUBLIC SECTION. DATA osalv TYPEREF TO clsalvtable. BEGIN OF tyoutput. TYPE char. 10. waers TYPE bkpf waers. Voip Integration Phone Remote Serial Switcher. TYPE bseg dmbtr. END OF tyoutput. DATA toutput TYPESTANDARD TABLE OF tyoutput. PRIVATE SECTION. setafterevents After Event. FOR EVENT aftersalvfunction OF clsalveventstable. IMPORTING. esalvfunction. ENDCLASS. lclmain DEFINITIONTART OF SELECTION. DATA omain TYPEREF TO lclmain. CREATE OBJECT omain. CLASS lclmain IMPLEMENTATION. METHOD selectdata. INCLUDE lt icon. DATA lsoutput LIKELINE OF toutput. USD. lsoutput dmbtr 1. APPEND lsoutput TO toutput. USD. lsoutput dmbtr 2. APPEND lsoutput TO toutput. EUR. lsoutput dmbtr 2. APPEND lsoutput TO toutput. ENDMETHOD. selectData. METHOD generatealv. DATA lofunctions TYPEREF TO clsalvfunctionslist. DATA lofunctionalsettings TYPEREF TO clsalvfunctionalsettings. DATA lotooltips TYPEREF TO clsalvtooltips. TYPE lvcvalue. DATA locolumns TYPEREF TO clsalvcolumns. DATA locolumn TYPEREF TO clsalvcolumntable. INCLUDE lt icon. ALV Object. TRY. clsalvtable factoryIMPORTING. CHANGING. ttable toutput. CATCH cxsalvmsg. EC NOHANDLERENDTRY. STATUS. locolumn seticon ifsalvcboolsap true. CATCH cxsalvnotfound. EC NOHANDLERENDTRY. DMBTR. locolumn SETCURRENCYCOLUMN WAERS. ZSIGN. CATCH cxsalvnotfound. EC NOHANDLERENDTRY. WAERS. locolumn seteditmaskZCURR. CATCH cxsalvnotfound. EC NOHANDLERENDTRY. Events. DATA loevents TYPEREF TO clsalveventstable. SET HANDLER me setafterevents. FOR loevents. ENDMETHOD. ETHOD setafterevents. DATA locolumns TYPEREF TO clsalvcolumns. DATA locolumn TYPEREF TO clsalvcolumntable. DATA lvamtcolpos TYPE i. IF locolumns getcolumnDMBTR isvisible X. WAERS. locolumn SETVISIBLEX. CATCH cxsalvnotfound. EC NOHANDLERENDTRY. DMBTR. locolumns setcolumnposition. WAERSposition lvamtcolpos. DMBTRposition lvamtcolpos 1. ENDMETHOD. setafterevents. ENDCLASS. lclmain IMPLEMENTATION.