This is a test message to test the length of the message box.
Login
ABAP Quick Extract icon from list
Created by Software-Heroes

ABAP Quick - Extract icon from list

371

You want to separate an icon from a printed list or a printed ALV? With us you are in the right place to get this knowledge.



For a technical evaluation of spool jobs or printing of background processing, it is sometimes necessary to separate an icon from a list because it could give further information about a processing status. However, it is not possible to extract the information because the standard function modules of SAP filter the icons from the data.

 

Extract a list

The following scenario shows sample coding that extracts an item from a list. Submit starts a report whose result or list is loaded into the list memory. Then the list is converted internally.


DATA:
  lt_abaplist TYPE STANDARD TABLE OF abaplist,
  lt_list     TYPE STANDARD TABLE OF text255.

CALL FUNCTION 'LIST_FREE_MEMORY'.

SUBMIT 
  ...
 EXPORTING LIST TO MEMORY AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    listobject = lt_abaplist
  EXCEPTIONS
    not_found  = 1
    OTHERS     = 2.
IF sy-subrc <> 0 OR lt_abaplist IS INITIAL.
ENDIF.

CALL FUNCTION 'LIST_TO_ASCI'
  TABLES
    listasci           = lt_list
    listobject         = lt_abaplist
  EXCEPTIONS
    empty_list         = 1
    list_index_invalid = 2
    OTHERS             = 3.
IF sy-subrc <> 0.
ENDIF.

 

LIST_TO_ASCI

The function module LIST_TO_ASCI converts the binary result into a readable format. For example, columns with icons are left blank because they are not converted by the function module. And here is the problem if you want to access these icons when they represent a status.

In this case, the solution is actually quite simple, since only the function module needs to be copied and some minor adjustments are needed so that icons are returned reasonably correct. The adjustments are as follows:

  • Adjust of the Performs to "IN PROGRAM saplslst", so that the routines are called from the standard function module
  • Conversion of the used type t_linenumbers to "TABLE OF i"
  • Exchange of the transfer parameter of the form LIST_LINE_TO_ASCI from space to "abap_true"

 

The final step is the actual magic, and causes the icons to not be converted to space and returned in the list. When converting the list you will now get the icon code without the @ characters (for example: 3A instead of @3A@). Using the ICON table, you can then select the additional information about the icon or compare it directly.

 

Conclusion

With this small practical example, you can evaluate lists even more easily in the future and evaluate different statuses based on the icons used. Of course it is not completely clean to make a copy of a standard object, but very useful for this case.


Included topics:
QuickIconListLIST_TO_ASCI
Comments (0)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


ABAP Tools - Quick Actions und Highlighting (ABAP Unit)

Category - ABAP

With the last release of the ABAP Development Tools, Quick Actions were added for ABAP development in the ABAP Unit area. Here we take a closer look at them.

06/18/2024

ABAP Quick - RFC Error handling

Category - ABAP

How do you actually handle errors when communicating via a destination in the function module? More about this in our tip.

03/05/2024

ABAP Quick - CLEAR right

Category - ABAP

Delete correctly? In this article we want to take a look at when it makes sense to delete and how you can do it effectively.

05/12/2023

ABAP Quick - Performance chained statements

Category - ABAP

Let's take a look at the performance when creating chained statements with DATA and FIELD-SYMBOL. Which variant will be ahead in terms of performance?

04/28/2023

ABAP - ALV still relevant in 2022?

Category - ABAP

Today the joking question, do we still need reports that generate ALV outputs in 2022? In this article, we want to look into this question.

07/01/2022