cancel
Showing results for 
Search instead for 
Did you mean: 

SUBMIT EXPORTING LIST TO MEMORY AND RETURN for query generated program maximum character limit

former_member300754
Participant
0 Kudos

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

FredericGirod
Active Contributor
0 Kudos

did you try to specify LINE-SIZE in the SUBMIT statement ?

Sandra_Rossi
Active Contributor
0 Kudos

You may edit your question to put additional information.

Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.

Sandra_Rossi
Active Contributor

Be careful, your code is badly formatted due to <BR>. Correctly formatted:

  DATA  t_listout LIKE abaplist OCCURS 0 WITH HEADER LINE.
  DATA  t_txtlines(1024) TYPE c OCCURS 0 WITH HEADER LINE.

  SUBMIT (assigned_report)
    WITH SELECTION-TABLE im_rsparams
    EXPORTING LIST TO MEMORY AND RETURN.

  CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
      listobject = t_listout
    EXCEPTIONS
      not_found  = 1.

  IF sy-subrc EQ 1.
    return_status = 'NO_DATA_FOUND'.
    EXIT.
  ENDIF.

  CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
      listobject         = t_listout
      listasci           = t_txtlines
    EXCEPTIONS
      empty_list         = 1
      list_index_invalid = 2
      OTHERS             = 3.

  IF sy-subrc EQ 0.
    return_status = 'OK'.

    LOOP AT t_txtlines.
      IF t_txtlines+0(2) EQ '| '.
        APPEND t_txtlines TO data.
      ENDIF.
    ENDLOOP.

  ELSE.
    return_status = 'FOUND_DATA_ERROR_PREPARE_LIST'.
    EXIT.
  ENDIF.

  CALL FUNCTION 'LIST_FREE_MEMORY'.

Accepted Solutions (0)

Answers (1)

Answers (1)

Sandra_Rossi
Active Contributor
0 Kudos

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)