Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem in ALV report

Former Member
0 Likes
824

Hi friends,

I am using the FM REUSE_ALV_FIELDCATALOG_MERGE to create catalog in ALV report.

DATA : BEGIN OF t_sel1 OCCURS 0,

bukrs LIKE lfb1-bukrs, " Company Code

lifnr LIKE lfa1-lifnr, " Vendor Number

name1 LIKE lfa1-name1, " Vendor Name

street LIKE adrc-street, " Street

str_suppl3 LIKE adrc-str_suppl3, " Street 4

city2 LIKE adrc-city2, " District

post_code1 LIKE adrc-post_code1, " Postal Code

city1 LIKE adrc-city1, " City

region LIKE adrc-region, " Region

erdat LIKE lfb1-erdat, " Create Date

ernam LIKE lfb1-ernam, " Created By

stcd1 LIKE lfa1-stcd1, " Tax Number

qsskz LIKE lfb1-qsskz, " With Holding Tax Code

END OF t_sel1.

DATA: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = repname

i_internal_tabname = 'T_SEL1'

i_inclname = repname

CHANGING

ct_fieldcat = fieldcat[]

EXCEPTIONS

OTHERS = 1.

On executing the program it is giving short dump in this FM.I am sending you the information from run time analysis.

You tried to read the program "ZFIRBD04" from the database. The READ REPORT

statement allows you to copy a program's source code into an internal

table.<b>The lines of source code must not be longer than the width of the

internal table. The internal table is 72 characters wide. The source

code line is 95 wide.</b>

Please help me. What is meaning of 'The source code line is 95 wide'.Every line in my code is 73 wide.

Regards,

Mukesh Kumar

Hi friends,

I am using the FM REUSE_ALV_FIELDCATALOG_MERGE to create catalog in ALV report.

DATA : BEGIN OF t_sel1 OCCURS 0,

bukrs LIKE lfb1-bukrs, " Company Code

lifnr LIKE lfa1-lifnr, " Vendor Number

name1 LIKE lfa1-name1, " Vendor Name

street LIKE adrc-street, " Street

str_suppl3 LIKE adrc-str_suppl3, " Street 4

city2 LIKE adrc-city2, " District

post_code1 LIKE adrc-post_code1, " Postal Code

city1 LIKE adrc-city1, " City

region LIKE adrc-region, " Region

erdat LIKE lfb1-erdat, " Create Date

ernam LIKE lfb1-ernam, " Created By

stcd1 LIKE lfa1-stcd1, " Tax Number

qsskz LIKE lfb1-qsskz, " With Holding Tax Code

END OF t_sel1.

DATA: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = repname

i_internal_tabname = 'T_SEL1'

i_inclname = repname

CHANGING

ct_fieldcat = fieldcat[]

EXCEPTIONS

OTHERS = 1.

On executing the program it is giving short dump in this FM.I am sending you the information from run time analysis.

You tried to read the program "ZFIRBD04" from the database. The READ REPORT

statement allows you to copy a program's source code into an internal

table.<b>The lines of source code must not be longer than the width of the

internal table. The internal table is 72 characters wide. The source

code line is 95 wide.</b>

Please help me. What is meaning of 'The source code line is 95 wide'.Every line in my code is 73 wide.

Regards,

Mukesh Kumar

5 REPLIES 5
Read only

Former Member
0 Likes
797

hi ,

its simple

in u r abap editor, check each <b>program line</b> length some line have extended 72 characters check even comment lines

award pts if useful

Read only

Former Member
0 Likes
797

nothing to do just delete coment statement...

DATA : BEGIN OF t_sel1 OCCURS 0,

bukrs LIKE lfb1-bukrs, "<b> -


>delete comment statement.</b>..

lifnr LIKE lfa1-lifnr, " Vendor Number

name1 LIKE lfa1-name1, " Vendor Name

street LIKE adrc-street, " Street

str_suppl3 LIKE adrc-str_suppl3, " Street 4

city2 LIKE adrc-city2, " District

post_code1 LIKE adrc-post_code1, " Postal Code

city1 LIKE adrc-city1, " City

region LIKE adrc-region, " Region

erdat LIKE lfb1-erdat, " Create Date

ernam LIKE lfb1-ernam, " Created By

stcd1 LIKE lfa1-stcd1, " Tax Number

qsskz LIKE lfb1-qsskz, " With Holding Tax Code

END OF t_sel1.

DATA: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = repname

i_internal_tabname = 'T_SEL1'

i_inclname = repname

CHANGING

ct_fieldcat = fieldcat[]

EXCEPTIONS

OTHERS = 1.

Read only

Former Member
0 Likes
797

Refer this code

call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       exporting
            i_program_name         = 'ZDEMO_ALVGRID'
            i_internal_tabname     = 'IT_EKKO'
            i_inclname             =  'ZDEMO_ALVGRID_STRUCTURE'
       changing
            ct_fieldcat            = gd_fieldcat
       exceptions
            inconsistent_interface = 1
            program_error          = 2
            others                 = 3.

inclname should be teh anem in which the FM is called, if there is no include used in the program dont specify that.

Refer

http://www.sapdevelopment.co.uk/reporting/alv/alv_variousfcat.htm

Read only

Former Member
0 Likes
797

Hi

The problem is that the REUSE_ALV_FIELDCATALOG_MERGE uses an internal table with a field long 72 char to upload the abap code.

Now you're using the FRONTEND editor and it allows to write lines longer than 72 char.

In this moment I'm not using a release like yours (I suppose you're working on 4.7), but in the SETTING options you should find the funcitonality to check if the lines you're writing are longer than 72 char.

Max

Read only

Clemenss
Active Contributor
0 Likes
797

Hi Mukesh,

it is not advisable to use REUSE_ALV_FIELDCATALOG_MERGE with parameter i_internal_tabname.

If your table for display is not defined in dictionary, you have the choice of:

- Calling REUSE_ALV_FIELDCATALOG_MERGE repeatedly for structures that contain the fields of your itab and finally delete the fields not used.

- define a DDIC structure for the table and call REUSE_ALV_FIELDCATALOG_MERGE for this structure

- build your own standard fieldcatalog using below routines.


&---------------------------------------------------------------------*
*&      Form  ALV_FIELDCAT_FOR_ITAB
*&---------------------------------------------------------------------*
*       Feldkatalog from (arbitrary) internal Table (c) Clemens Li
*       * build field catalog from        type description
*----------------------------------------------------------------------*
FORM alv_fieldcat_for_itab                                  "#EC *
  TABLES   pt_outtab                      TYPE table        "#EC *
  CHANGING pt_alv_fieldcat                TYPE slis_t_fieldcat_alv."#EC *
  DATA:
    l_desc                                TYPE sydes_desc,
    l_alv_fieldcat                        TYPE slis_fieldcat_alv,
    l_longfield                           TYPE fname.
  FIELD-SYMBOLS:
    <typeinfo>                            TYPE sydes_typeinfo,
    <nameinfo>                            TYPE sydes_nameinfo.
  DESCRIBE FIELD pt_outtab INTO l_desc.                     "#EC *

  LOOP AT l_desc-types
      ASSIGNING <typeinfo>
      WHERE NOT idx_name IS INITIAL
        AND table_kind IS INITIAL "no entries for deep table like color
        AND back                          = 1. "top-level-entries only.
    READ TABLE l_desc-names INDEX <typeinfo>-idx_name
      ASSIGNING <nameinfo>.
    CHECK <nameinfo>-name                 <> 'INCLUDE'.
    l_alv_fieldcat-fieldname              = <nameinfo>-name.
    WHILE NOT <nameinfo>-continue IS INITIAL.
      ADD 1 TO <typeinfo>-idx_name.
      READ TABLE l_desc-names INDEX <typeinfo>-idx_name
        ASSIGNING <nameinfo>.
      CONCATENATE
        l_alv_fieldcat-fieldname
        <nameinfo>-name
        INTO l_alv_fieldcat-fieldname.
    ENDWHILE." not <nameinfo>-continue IS INITIAL.
    READ TABLE l_desc-names INDEX <typeinfo>-idx_help_id
      ASSIGNING <nameinfo>.
    IF sy-subrc                           = 0.

* Caution: Help-ID may be Tablename-Fieldname and thus longer
* than 30 Chars; l_alv_fieldcat-rollname is 30 Chars only
      l_alv_fieldcat-rollname             = <nameinfo>-name.
      l_longfield                         = <nameinfo>-name.
      WHILE NOT <nameinfo>-continue IS INITIAL.
        ADD 1 TO <typeinfo>-idx_help_id.
        READ TABLE l_desc-names INDEX <typeinfo>-idx_help_id
          ASSIGNING <nameinfo>.
        CONCATENATE
          l_longfield
          <nameinfo>-name
          INTO l_longfield.
      ENDWHILE." not l_desc-continue is initial.

* help id may be data element or <table>-<field>
      IF l_longfield CA '-'.

* get data                                type for table field
        PERFORM get_rollname_4_tabfield
          USING l_longfield CHANGING l_alv_fieldcat.
      ENDIF." l_longfield ca '-'.
    ELSE.

* No Help-ID: Use Fieldname as text
      l_alv_fieldcat-seltext_s            =
      l_alv_fieldcat-seltext_m            =
      l_alv_fieldcat-seltext_l            =
      l_alv_fieldcat-reptext_ddic         =
      <nameinfo>-name.
    ENDIF." sy-subrc                      = 0.

* Starting 4.7: get edit mask
    IF NOT <typeinfo>-idx_edit_mask IS INITIAL.
      READ TABLE l_desc-names INDEX <typeinfo>-idx_edit_mask
        ASSIGNING <nameinfo>.
      l_alv_fieldcat-edit_mask            = <nameinfo>-name.
      IF NOT <nameinfo>-continue IS INITIAL.
        ADD 1 TO <typeinfo>-idx_edit_mask.
        READ TABLE l_desc-names INDEX <typeinfo>-idx_edit_mask
          ASSIGNING <nameinfo>.
        CONCATENATE
          l_alv_fieldcat-edit_mask
          <nameinfo>-name
          INTO l_alv_fieldcat-edit_mask.
      ENDIF." not <nameinfo>-continue IS INITIAL.
    ENDIF." not <typeinfo>-IDX_EDIT_MASK is initial.

* assign length, output length and decimals
    l_alv_fieldcat-intlen                 = <typeinfo>-length.
    l_alv_fieldcat-outputlen              = <typeinfo>-output_length.
    l_alv_fieldcat-decimals_out           = <typeinfo>-decimals.
    l_alv_fieldcat-inttype                = <typeinfo>-type.
    APPEND l_alv_fieldcat TO pt_alv_fieldcat.
    CLEAR:  "prevent anything 2 B  taken for subsequent fields
      l_alv_fieldcat.
  ENDLOOP." at l_desc-types where not IDX_NAME is in initial.
ENDFORM.                    " ALV_FIELDCAT_FOR_ITAB
*&---------------------------------------------------------------------
*&      Form  get_rollname_4_tabfield
*&---------------------------------------------------------------------
*       Get Data                          type for Table field
*----------------------------------------------------------------------
FORM get_rollname_4_tabfield
  USING    p_fname                        TYPE fname
  CHANGING p_alv_fieldcat                 TYPE slis_fieldcat_alv.
  FIELD-SYMBOLS:
    <dfies>                               TYPE dfies.
  DATA:
    l_tabname                             TYPE tabname,
     lt_dfies                             TYPE TABLE OF dfies,
    l_fieldname                           TYPE fieldname.
  SPLIT p_fname AT '-'
    INTO l_tabname l_fieldname.
  CLEAR p_alv_fieldcat-rollname.
  CALL FUNCTION 'DDIF_FIELDINFO_GET'
    EXPORTING
      tabname                             = l_tabname
      fieldname                           = l_fieldname
*   LANGU                                 = SY-LANGU
*   LFIELDNAME                            = ' '
*   ALL_TYPES                             = ' '
* IMPORTING
*   X030L_WA                              =
*   DDOBJTYPE                             =
*   DFIES_WA                              =
*   LINES_DESCR                           =
   TABLES
     dfies_tab                            =  lt_dfies
*   FIXED_VALUES                          =
   EXCEPTIONS
     not_found                            = 1
     internal_error                       = 2
     OTHERS                               = 3
            .
  IF sy-subrc                             <> 0.
    MESSAGE ID sy-msgid                   TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    READ TABLE   lt_dfies ASSIGNING <dfies> INDEX 1.
    p_alv_fieldcat-rollname               = <dfies>-rollname.
* Und wenn keinerlei Twexte gepflegt sind?
    IF <dfies>-reptext IS INITIAL AND
       <dfies>-scrtext_s IS INITIAL AND
       <dfies>-scrtext_m IS INITIAL AND
       <dfies>-scrtext_l IS INITIAL.
* No Text: Use Fieldname as text
      p_alv_fieldcat-seltext_s            =
      p_alv_fieldcat-seltext_m            =
      p_alv_fieldcat-seltext_l            =
      p_alv_fieldcat-reptext_ddic         =
      p_alv_fieldcat-fieldname.
    ENDIF." <dfies>-reptext IS INITIAL AND
  ENDIF.
ENDFORM.                    " get_rollname_4_tabfield

Regards,

Clemens