We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

Re: [sap-dev] ESI: Publishing Long Text More Than 132 Characters Failed

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from R. N. Wilhite on Dec 27 at 8:11 AM
A single long text could be, say, 1,000,000,000 characters. ALV is based
on fixed format fields. Therefore it has a limited field width. If you
search, you can find out what that max is. In a week or two I'll be back
from vacation and I could then tell you.

Therefore, AFAICS, you have two options.

1. Display your text in multiple fields across.
2. Have multiple rows down of the same record, each having the next
piece of the long text. If you do this, you will want to clear everything
else in the record that is not a key field. Also, if you do this the user
should never try to resort the alv...

When I get back in a couple of weeks, I can show you some code. Please let
me know if you want this.


Neal

---------------Original Message---------------
From: divyaaagnihotri
Sent: Wednesday, December 26, 2012 10:49 PM
Subject: ESI: Publishing Long Text More Than 132 Characters Failed

Ok sir,
Please consider this simple code for fetching long desp from mm02 by using FM READ_TEXT.

*REPORT ZMM02_DESP1.
TYPE-POOLS: SLIS.
TYPES: BEGIN OF TY_FINAL,
MATNR TYPE MATNR , "J_1IRDOC1,
MAKTX TYPE MAKTX,
ARKTX TYPE STRING,
END OF TY_FINAL.

DATA : GT_MAKT TYPE STANDARD TABLE OF MAKT,
GT_FINAL TYPE STANDARD TABLE OF TY_FINAL,
LINES TYPE STANDARD TABLE OF TLINE WITH HEADER LINE,
GS_FINAL TYPE TY_FINAL,
GS_MAKT TYPE MAKT.
DATA : LV_TEXT(62000) TYPE C,
NAME TYPE THEAD-TDNAME,
ID TYPE THEAD-TDID,
LANG TYPE THEAD-TDSPRAS,
OBJECT TYPE THEAD-TDOBJECT.
DATA : G_MATNR TYPE MATNR.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_MATNR FOR G_MATNR .
" s_AUBEL FOR G_AUBEL.
SELECTION-SCREEN: END OF BLOCK B1.

DATA: GT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV,
GS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_SORTINFO TYPE SLIS_T_SORTINFO_ALV,
WA_SORTINFO TYPE SLIS_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_SORT TYPE LINE OF SLIS_T_SORTINFO_ALV,
T_EVT TYPE SLIS_T_EVENT.

FIELD-SYMBOLS : <LS_FINAL> TYPE TY_FINAL.

DATA: GV_REPID TYPE SY-REPID.

INITIALIZATION.

GV_REPID = SY-REPID.

START-OF-SELECTION.

PERFORM FETCH_DATA.
PERFORM LONG_TEXT.

END-OF-SELECTION.

PERFORM DISPLAY_DATA.


*&------------- -*
*& Form FETCH_DATA
*&--------- ------*
* text
*-------- -----*
FORM FETCH_DATA .

SELECT MATNR MAKTX FROM MAKT INTO CORRESPONDING FIELDS OF TABLE GT_FINAL WHERE MATNR IN S_MATNR.
ENDFORM. "FETCH_DATA

*&------------ --*
*& Form DISPLAY_DATA
*&--------- -----*
* text
*---------- -------*
FORM DISPLAY_DATA .

IF NOT GT_FINAL[] IS INITIAL.
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_LAYOUT.
* PERFORM SUB_ALV_EVENTS.
PERFORM DISPLAY_ALV_REPORT.


ELSE.
MESSAGE 'NO DATA FOUND.' TYPE 'S'.
ENDIF.

ENDFORM. "DISPLAY_DATA

*&------------ --*
*& Form BUILD_FIELDCATALOG
*&-------- -------*
* text
*--------- ---------*
FORM BUILD_FIELDCATALOG .

REFRESH GT_FIELDCAT.

CLEAR GS_FIELDCAT.
GS_FIELDCAT-COL_POS = 1.
GS_FIELDCAT-FIELDNAME = 'MATNR'.
GS_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.

CLEAR GS_FIELDCAT.
GS_FIELDCAT-COL_POS = 2.
GS_FIELDCAT-FIELDNAME = 'MAKTX'.
GS_FIELDCAT-SELTEXT_L = 'SHORT DESP'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.

CLEAR GS_FIELDCAT.
GS_FIELDCAT-COL_POS = 3.
GS_FIELDCAT-FIELDNAME = 'ARKTX'.
GS_FIELDCAT-SELTEXT_L = 'LONG DESP'.
APPEND GS_FIELDCAT TO GT_FIELDCAT.
CLEAR GS_FIELDCAT.
* GS_FIELDCAT-COL_POS = 4.
* GS_FIELDCAT-FIELDNAME = 'ARKTX1'.
* GS_FIELDCAT-SELTEXT_L = 'LONG DESP'.
* APPEND GS_FIELDCAT TO GT_FIELDCAT.
* CLEAR GS_FIELDCAT.
* GS_FIELDCAT-COL_POS = 5.
* GS_FIELDCAT-FIELDNAME = 'ARKTX2'.
* GS_FIELDCAT-SELTEXT_L = 'LONG DESP'.
* APPEND GS_FIELDCAT TO GT_FIELDCAT.
* CLEAR GS_FIELDCAT.
* GS_FIELDCAT-COL_POS = 6.
* GS_FIELDCAT-FIELDNAME = 'ARKTX3'.
* GS_FIELDCAT-SELTEXT_L = 'LONG DESP'.
* APPEND GS_FIELDCAT TO GT_FIELDCAT.

ENDFORM. "BUILD_FIELDCATALOG

*&------- ---------*
*& Form DISPLAY_ALV_REPORT
*&--------- --------*
* text
*-------- --------*
FORM DISPLAY_ALV_REPORT .

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GV_REPID
IT_SORT = IT_SORTINFO
IS_LAYOUT = GS_LAYOUT
* I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = GT_FIELDCAT
I_SAVE = 'A'
* IT_EVENTS = T_EVT
TABLES
T_OUTTAB = GT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.

ENDIF.


ENDFORM. "DISPLAY_ALV_REPORT


*&--------- -----*
*& Form LONG_TEXT
*&---------- -------*
* text
*---------- ------*
FORM LONG_TEXT.
BREAK-POINT.
LOOP AT GT_FINAL ASSIGNING <LS_FINAL>.
* CONCATENATE '00000000' <LS_FINAL>-MATNR INTO NAME.
MOVE <LS_FINAL>-MATNR TO NAME.
ID = 'GRUN'.
LANG = 'E'.
OBJECT = 'MATERIAL'.

CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = ID
LANGUAGE = LANG
NAME = NAME
OBJECT = OBJECT
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = LINES .

CONCATENATE LINES OF LINES INTO LV_TEXT SEPARATED BY SPACE.

REPLACE ALL OCCURRENCES OF '*' IN LV_TEXT WITH ''.
REPLACE ALL OCCURRENCES OF '/' IN LV_TEXT WITH ''.
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

IF SY-SUBRC = 0.
<LS_FINAL>-ARKTX = LV_TEXT.

ENDIF.
REFRESH LINES.
CLEAR: LV_TEXT ,
ENDLOOP.
ENDFORM. "LONG_TEXT

*&--------- ------*
*& Form BUILD_LAYOUT
*&--------- --------*
* text
*------------ -------*
FORM BUILD_LAYOUT .

CLEAR GS_LAYOUT.
GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GS_LAYOUT-ZEBRA = 'X'.
GS_LAYOUT-CELL_MERGE = 'Y'.

CLEAR WA_SORTINFO.
WA_SORTINFO-SPOS = 1.
WA_SORTINFO-FIELDNAME = 'MATNR'.
WA_SORTINFO-UP = 'X'.
APPEND WA_SORTINFO TO IT_SORTINFO.
ENDFORM. "BUILD_LAYOUT


NOW -:

1) When I was using RESUSE_ALV_GRID_DISPLAY to display the report then at the time of debugging in gt_final it fetches whole text but at the time of display on the screen it cuts the text becoz in debugging we can scroll the particular field but at the screen we cant.

2)Now when I used RESUSE_ALV_LIST_DISPLAY it solved some of problem when text written in the box is limited. BUT NOW problem is that after fetching lines ( type tdline) into LV_TEXT ( CONCATENATE LINES OF LINES INTO LV_TEXT SEPARATED BY SPACE.
REPLACE ALL OCCURRENCES OF '*' IN LV_TEXT WITH ''. REPLACE ALL OCCURRENCES OF '/' IN LV_TEXT WITH ''. ) In LV_TEXT whole text not converted in the single line then it creates problem to display on the screen doesnt matter whats the length given to it . it restricts after taking particular charcters length .

3) Yesterday I used a logic to print whole text by looping in lines and append every time with the corrosponding material and then short the material. Now it comes proper by displaying in ALV but after converting it into .XLS long text appears in multiple lines not act as a single then it creates problem in uploading.

Thank You

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Ziff Davis, Inc. and message author.
Ziff Davis, Inc. 28 E 28th Street New York, NY 10016
R. N. Wilhite  

Senior Project Manager
32 achievements
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Community Achievements

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language