Is there any way to view the details in Item Text tab in Purchase Order ME23N in a report form or table form? I have tried to search in many places but I couldn't find the table. Table EKKO/EKPO doesn't seem to help in this.
Asked
Active
Viewed 2.1k times
1 Answers
3
There are tables STXH (for header) and STXL (for lines) but they are not readable out-of-the-box.
Usually reading texts is made by READ_TEXT
FM:
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = 'F01'
language = 'E'
name = %PO_number% + %PO_pos%
object = 'EKPO'
To find out ID/name of necessary text one should enter edit mode and press Goto >> Header where one should check correspondent fields
UPDATE: mass extraction of texts based on the above example
TYPES: BEGIN OF ty_stxl_raw,
clustr TYPE stxl-clustr,
clustd TYPE stxl-clustd,
END OF ty_stxl_raw,
BEGIN OF ty_stxl,
tdname TYPE stxl-tdname,
clustr TYPE stxl-clustr,
clustd TYPE stxl-clustd,
END OF ty_stxl.
DATA: t_stxl_raw TYPE STANDARD TABLE OF ty_stxl_raw,
t_stxl TYPE TABLE OF ty_stxl,
w_stxl_raw TYPE ty_stxl_raw.
DATA: t_tline TYPE STANDARD TABLE OF tline.
FIELD-SYMBOLS: <tline> TYPE tline,
<stxl> LIKE LINE OF t_stxl.
SELECT l~tdname l~clustr l~clustd
INTO CORRESPONDING FIELDS OF TABLE t_stxl
FROM stxl AS l
JOIN stxh AS h
ON h~tdobject = l~tdobject
AND h~tdname = l~tdname
AND h~tdid = l~tdid
WHERE l~relid = 'TX' "standard text
AND h~tdobject = 'EKPO'
AND h~tdname = '450001216400010'
AND h~tdid = 'F01'
AND l~tdspras = sy-langu.
LOOP AT t_stxl ASSIGNING <stxl>.
CLEAR: t_stxl_raw[], t_tline[].
APPEND VALUE ty_stxl_raw( clustr = <stxl>-clustr clustd = <stxl>-clustd ) TO t_stxl_raw.
IMPORT tline = t_tline FROM INTERNAL TABLE t_stxl_raw.
LOOP AT t_tline ASSIGNING <tline>.
"do anything
ENDLOOP.
ENDLOOP.

Suncatcher
- 10,355
- 10
- 52
- 90
-
1Hi Suncatcher, thank you for the suggestion. I have already tried this method. But this one needs to be keyed in one by one. I'm looking for a way to display all the text items one shot in a table. I'm searching for any query that can be created for this. – Anonymous Feb 22 '17 at 04:36
-
1Hi Suncatcher, thank you! This code has to be implemented in SQ02 right? If yes, then I will need to create a new Infoset is it? Sorry, I have no experience in creating SAP queries before. – Anonymous Mar 09 '17 at 09:23
-
1@Anonymous, not mandatory in SQ02. In any [program type](http://www.erpdb.info/sap-abap-program-types/) (type 1, module pool, function module etc.) – Suncatcher Mar 09 '17 at 11:45
-
1Okay, I will try this first @Suncatcher. Thank you! – Anonymous Mar 10 '17 at 09:33
-
1I keep getting error message that 'The field 't_stxl' is unknown'..I tried to insert this code into Infoset under Data section for EKPO table once I have created the Infoset. Any idea why? @Suncatcher – Anonymous May 24 '17 at 06:31
-
1@Anonymous, table declaration was missing. Corrected the code – Suncatcher May 24 '17 at 10:25
-
This is amazing, Could you possibly do a variation for Extracting PO Text from Materials in SAP? (MM03) I would do a bounty but my rep sucks... – DeerSpotter Nov 08 '17 at 15:23
-
@DeerSpotter, the process is the same, just use `MATERIAL` instead of `EKPO` and `BEST` instead `F01` in the above snippet. And of course, proper tdname. – Suncatcher Nov 10 '17 at 07:10