Skip to Content
author's profile photo Former Member
Former Member

unable to get data into field catalog

Hi,

I am getting data of long text into a character type field and able to print it successfully on the screen, but its not getting printed in ALV of my report.Please help

Here's the code:-

&----


*& Report ZQA33_LTEXT

*&

&----


*&

*&

&----


REPORT zqa33_ltext.

TYPE-POOLS: slis.

TABLES:tj48,qals.

TYPES: BEGIN OF it_tj48,

selid LIKE tj48-selid,

END OF it_tj48.

DATA: it_tj48 TYPE STANDARD TABLE OF it_tj48 INITIAL SIZE 0,

wa_tj48 TYPE it_tj48.

DATA:

BEGIN OF header OCCURS 0,

ld_txt1(163),

END OF header.

DATA: li_lines LIKE STANDARD TABLE OF tline WITH HEADER LINE,

id LIKE thead-tdid,

tname LIKE thead-tdname,

tname1 LIKE thead-tdname,

tdobject LIKE thead-tdobject.

DATA: BEGIN OF it_qals OCCURS 0,

prueflos LIKE qals-prueflos,

werk LIKE qals-werk,

matnr LIKE qals-matnr,

ktextmat LIKE qals-ktextmat,

charg LIKE qals-charg,

losmenge LIKE qals-losmenge,

mengeneinh LIKE qals-mengeneinh,

offen_lzmk LIKE qals-offen_lzmk,

offennlzmk LIKE qals-offennlzmk,

pastrterm LIKE qals-pastrterm,

paendterm LIKE qals-paendterm,

bwart LIKE qals-bwart,

ltextkz LIKE qals-ltextkz,

hld_txt1(75) TYPE c,

ktextlos LIKE qals-ktextlos,

enstehdat LIKE qals-enstehdat,

herkunft LIKE qals-herkunft,

lifnr LIKE qals-lifnr,

hersteller LIKE qals-hersteller,

kunnr LIKE qals-kunnr,

grtxt LIKE t157e-grtxt,

selid LIKE tj48-selid,

stsma LIKE tj48-stsma,

END OF it_qals.

**DATA: IT_QALS TYPE STANDARD TABLE OF IT_QALS INITIAL SIZE 0,

DATA: wa_qals LIKE it_qals.

*variable for Report ID

DATA: v_repid LIKE sy-repid .

*declaration for fieldcatalog

DATA: i_fieldcat TYPE slis_t_fieldcat_alv,

wa_fieldcat TYPE slis_fieldcat_alv.

DATA: it_listheader TYPE slis_t_listheader.

  • declaration for events table where user comand or set PF status will

  • be defined

DATA: v_events TYPE slis_t_event,

wa_event TYPE slis_alv_event.

  • declartion for layout

DATA: alv_layout TYPE slis_layout_alv.

  • declaration for variant(type of display we want)

DATA: i_variant TYPE disvariant,

i_variant1 TYPE disvariant,

i_save(1) TYPE c.

*Title displayed when the alv list is displayed

DATA: i_title_qals TYPE lvc_title VALUE 'Report For Rejection Reason'.

INITIALIZATION.

v_repid = sy-repid.

SELECTION-SCREEN BEGIN OF BLOCK b1.

SELECT-OPTIONS: s_selid FOR tj48-selid.

SELECT-OPTIONS: s_ensdat FOR qals-enstehdat.

SELECT-OPTIONS: s_paserm FOR qals-pastrterm.

SELECT-OPTIONS: s_paeerm FOR qals-paendterm.

SELECT-OPTIONS: s_werk FOR qals-werk.

SELECT-OPTIONS: s_hernft FOR qals-herkunft.

SELECT-OPTIONS: s_matnr FOR qals-matnr.

SELECT-OPTIONS: s_charg FOR qals-charg.

SELECT-OPTIONS: s_lifnr FOR qals-lifnr.

SELECT-OPTIONS: s_herler FOR qals-hersteller.

SELECT-OPTIONS: s_kunnr FOR qals-kunnr.

SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

PERFORM data_retrieval.

PERFORM build_fieldcatlog.

PERFORM event_call.

PERFORM populate_event.

PERFORM build_listheader USING it_listheader.

PERFORM display_alv_report.

&----


*& Form data_retrieval

&----


  • retreiving values from the database table ekko

----


FORM data_retrieval.

SELECT prueflos werk matnr ktextmat charg losmenge mengeneinh offen_lzmk offennlzmk pastrterm paendterm bwart ltextkz FROM qals INTO TABLE it_qals WHERE enstehdat IN s_ensdat AND pastrterm IN s_paserm AND paendterm IN s_paeerm

AND werk IN s_werk AND herkunft IN s_hernft AND matnr IN s_matnr AND charg IN s_charg AND lifnr IN s_lifnr AND hersteller IN s_herler AND kunnr IN s_kunnr.

LOOP AT it_qals.

**if it_qals-ktextlos NE ' '.

IF it_qals-ltextkz = 'X'.

CONCATENATE sy-mandt it_qals-prueflos INTO tname1.

id = 'QALS'.

tname = tname1.

tdobject = 'QPRUEFLOS'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = id

language = sy-langu

name = tname

object = tdobject

TABLES

lines = li_lines.

READ TABLE li_lines INDEX 1.

IF sy-subrc = 0.

header-ld_txt1 = li_lines-tdline.

**it_qals-hld_txt1 = header-ld_txt1.

MOVE header-ld_txt1 TO it_qals-hld_txt1.

ENDIF.

SHIFT tname1 BY 3 PLACES LEFT.

MODIFY it_qals TRANSPORTING hld_txt1 where prueflos = tname1.

**clear TNAME1.

IF sy-subrc = 0.

WRITE:/ it_qals-prueflos.

WRITE:/ it_qals-matnr.

WRITE:/ it_qals-ltextkz.

WRITE:/ it_qals-hld_txt1.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. "data_retrieval

&----


*& Form BUILD_FIELDCATLOG

&----


  • Fieldcatalog has all the field details from ekko

----


FORM build_fieldcatlog.

**WRITE:/ it_qals-hld_txt1.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'PRUEFLOS'.

wa_fieldcat-seltext_m = 'Inspection Lot'.

wa_fieldcat-col_pos = 1.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'WERK'.

wa_fieldcat-seltext_m = 'Plant'.

wa_fieldcat-col_pos = 2.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'MATNR'.

wa_fieldcat-seltext_m = 'Material'.

wa_fieldcat-col_pos = 3.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'KTEXTMAT'.

wa_fieldcat-seltext_m = 'MaterialName'.

wa_fieldcat-col_pos = 4.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'CHARG'.

wa_fieldcat-seltext_m = 'Batch'.

wa_fieldcat-col_pos = 5.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'LOSMENGE'.

wa_fieldcat-seltext_m = 'Lot Qty'.

wa_fieldcat-col_pos = 6.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'MENGENEINH'.

wa_fieldcat-seltext_m = 'Base Unit'.

wa_fieldcat-col_pos = 7.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'OFFEN_LZMK'.

wa_fieldcat-seltext_m = 'Lt Char'.

wa_fieldcat-col_pos = 8.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'OFFENNLZMK'.

wa_fieldcat-seltext_m = 'St Char'.

wa_fieldcat-col_pos = 9.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'PASTRTERM'.

wa_fieldcat-seltext_m = 'Start Date'.

wa_fieldcat-col_pos = 10.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'PAENDTERM'.

wa_fieldcat-seltext_m = 'End Date'.

wa_fieldcat-col_pos = 11.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'BWART'.

wa_fieldcat-seltext_m = 'MovementType'.

wa_fieldcat-col_pos = 12.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

  • wa_fieldcat-tabname = 'IT_QALS'.

  • wa_fieldcat-fieldname = 'KTEXTLOS'.

  • wa_fieldcat-seltext_m = 'RejectionReason'.

  • wa_fieldcat-col_pos = 13.

  • APPEND wa_fieldcat TO i_fieldcat.

  • CLEAR wa_fieldcat.

wa_fieldcat-tabname = 'IT_QALS'.

wa_fieldcat-fieldname = 'hld_txt1'.

wa_fieldcat-seltext_m = 'RejectionReason2'.

wa_fieldcat-col_pos = 13.

wa_fieldcat-outputlen = 75.

  • wa_fieldcat-datatype = 'CHAR'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

ENDFORM. "BUILD_FIELDCATLOG

&----


*& Form EVENT_CALL

&----


  • we get all events - TOP OF PAGE or USER COMMAND in table v_events

----


FORM event_call.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = v_events.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. "EVENT_CALL

&----


*& Form POPULATE_EVENT

&----


  • Events populated for TOP OF PAGE & USER COMAND

----


FORM populate_event.

READ TABLE v_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.

IF sy-subrc EQ 0.

wa_event-form = 'TOP_OF_PAGE'.

MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =

wa_event-form.

ENDIF.

READ TABLE v_events INTO wa_event WITH KEY name = 'USER_COMMAND'.

IF sy-subrc EQ 0.

wa_event-form = 'USER_COMMAND'.

MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =

wa_event-name.

ENDIF.

ENDFORM. "POPULATE_EVENT

&----


*& Form bUild_listheader

&----


  • text

----


  • -->I_LISTHEADEtext

----


FORM build_listheader USING i_listheader TYPE slis_t_listheader.

DATA hline TYPE slis_listheader.

hline-info = 'QA33 Report'.

hline-typ = 'H'.

ENDFORM. "build_listheader

&----


*& Form display_alv_report

&----


  • text

----


FORM display_alv_report.

v_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

i_callback_user_command = 'USER_COMMAND'

i_callback_top_of_page = 'top_of_page'

i_grid_title = i_title_qals

it_fieldcat = i_fieldcat[]

i_save = 'A'

it_events = v_events

TABLES

t_outtab = it_qals.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. "display_alv_report

&----


*& Form TOP_OF_PAGE

&----


  • text

----


FORM top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_listheader.

ENDFORM. "TOP_OF_PAGE

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 18, 2011 at 05:55 AM

    Hi Nishant,

    I could find one Probable bug:

    I could not make out from code whether it is commented or not.

    wa_fieldcat-fieldname = 'hld_txt1'

    replace with:

    wa_fieldcat-fieldname = 'HLD_TXT1'.

    BR

    Dep

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.