Reply from divyaaagnihotri on Dec 26 at 10:48 PM 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
| | | ---------------Original Message--------------- From: vijay Sent: Friday, December 21, 2012 7:54 AM Subject: ESI: Publishing Long Text More Than 132 Characters Failed I have mapped Longtext in Material Longtext Procuder: Step1: I have entered Long text More than 132 characters in material. Step2: I have add Distributiontarget(DT) Step3: I am publishing material,But it is failed Error message "Input data Invalid". Regards, Vijay | | Reply to this email to post your response. __.____._ | In the Spotlight Become a blogger at Toolbox.com and share your expertise with the community. Start today. _.____.__ |