on 03-29-2023 2:30 PM
Hello experts,
I'm developing a BAPI to call SUBMIT prog EXPORTING LIST TO MEMORY AND TURN however not all report columns are return.
Code as follows:
DATA t_listout LIKE abaplist OCCURS 0 WITH HEADER LINE.<br> DATA t_txtlines(1024) TYPE c OCCURS 0 WITH HEADER LINE.<br><br> SUBMIT (assigned_report)<br> WITH SELECTION-TABLE im_rsparams<br> EXPORTING LIST TO MEMORY AND RETURN.<br><br> CALL FUNCTION 'LIST_FROM_MEMORY'<br> TABLES<br> listobject = t_listout<br> EXCEPTIONS<br> not_found = 1.<br><br> IF sy-subrc EQ 1.<br> return_status = 'NO_DATA_FOUND'.<br> EXIT.<br> ENDIF.<br><br> CALL FUNCTION 'LIST_TO_ASCI'<br> TABLES<br> listobject = t_listout<br> listasci = t_txtlines<br> EXCEPTIONS<br> empty_list = 1<br> list_index_invalid = 2<br> OTHERS = 3.<br><br> IF sy-subrc EQ 0.<br> return_status = 'OK'.<br><br> LOOP AT t_txtlines.<br> IF t_txtlines+0(2) EQ '| '.<br> APPEND t_txtlines TO data.<br> ENDIF.<br> ENDLOOP.<br><br> ELSE.<br> return_status = 'FOUND_DATA_ERROR_PREPARE_LIST'.<br> EXIT.<br> ENDIF.<br><br> CALL FUNCTION 'LIST_FREE_MEMORY'.<br>
import/export parameters:
Import - assigned_report
Export - return_status
Table - data
I'd tried Gain Programmatic Access to Data of SAPGUI ALV Reports | SAP Blogs however I got an runtime error. I then converted code back to , LIST_FROM_MEMORY, LIST_TO_ASCI and LIST_FREE_MEMORY
Category ABAP Programming Error
Runtime Errors UNCAUGHT_EXCEPTION
Except. CX_SY_STRUCT_COMP_NAME
ABAP Program CL_SALV_BS_DDIC===============CP
Application Component BC-WD-CMP-ALV
Short text
An exception occurred that was not caught.
What happened?
The exception 'CX_SY_STRUCT_COMP_NAME' was raised, but it was not caught
anywhere along
the call hierarchy.
Since exceptions represent error situations and this error was not
adequately responded to, the running ABAP program
'CL_ABAP_STRUCTDESCR===========CP' has to be
terminated.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_STRUCT_COMP_NAME', was not
caught in
procedure "CREATE_DATA_FOR_COMPONENT" "(METHOD)", nor was it propagated by a
RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
Component Name '%ALVCOUNT' of the Component 49 Contains an Invalid Character
Missing RAISING Clause in Interface
Program CL_SALV_BS_DDIC===============CP
Include CL_SALV_BS_DDIC===============CM00G
Row 1
Module type (METHOD)
Module Name CREATE_DATA_FOR_COMPONENT
Trigger Location of Exception
Program CL_ABAP_STRUCTDESCR===========CP
Include CL_ABAP_STRUCTDESCR===========CM00E
Row 71
Module type (METHOD)
Module Name CHECK_COMPONENT_TABLE
Please would you help me on this? Thanks in advance for your support.
Cheers,
Peerasit
One solution/workaround is to continue using CL_SALV_BS_RUNTIME_INFO (Gain Programmatic Access to Data of SAPGUI ALV Reports | SAP Blogs ) but you need to correct the standard so that it calls the method create or get of cl_abap_structdescr with the parameter P_STRICT = ABAP_FALSE (so that to not fail due to the reserved name %ALVCOUNT). Method CREATE_DATA_FOR_COMPONENT of class CL_SALV_BS_DDIC:
if ls_comp-name ca '-'. " <========= here change '-' into '-%'
l_strict = abap_false.
endif.
endloop.
r_datadescr = cl_abap_structdescr=>get(
p_components = lt_comp
p_strict = l_strict ).
The modification is probably harmless.
(also discussed here: How to retrieve ALV output into an internal table? | SAP Community)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
11 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.