07-29-2005 3:12 AM
Hi,
I have to extract a text data regarding bill of lading. I have already used the following code for extracting basic data text from material master.
TABLES:
STXH.
DATA:
TDNAME LIKE STXH-TDNAME,
MYLINE LIKE TLINE-TDLINE,
ZE13_LINE(1200) TYPE C.
DATA:BEGIN OF LINES OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA:END OF LINES.
DATA:BEGIN OF MYHEADER.
INCLUDE STRUCTURE THEAD.
DATA:END OF MYHEADER.
CLEAR ZBASICTEXT.
CLEAR TDNAME.
*CONCATENATE '000000000000'
*MARA-MATNR
MOVE MVKE-MVGR4
TO TDNAME.
*MOVE 'AF'
*TO SY-LANGU.
*MOVE TDNAME TO ZZTDNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'YBOL'
LANGUAGE = SY-LANGU
NAME = TDNAME
OBJECT = 'TEXT'
IMPORTING
HEADER = MYHEADER
TABLES
LINES = LINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF SY-SUBRC = 0.
LOOP AT LINES.
MOVE LINES-TDLINE(132) TO ZBASICTEXT."myline.
EXIT.
ENDLOOP.
End If.
Here the last line extracts only 132 characters, but however the Bill of Lading text is 10 line paragraph.So can somebody explain how to extract that data. Also I am using this code in ABAP Query for a field.
I appreciate your help.
07-29-2005 3:23 AM
Hi Shiva,
Not sure I understand you question, but I assume you trying to get all the contents of the table LINES into ZBASICTEXT? If so try the following:
loop at lines.
concatenate zbasictext lines-tdline into zbasictext separated by spcae.
endloop.
Let me know if I have misinterperated your question.
Cheers,
Pat.
07-29-2005 1:56 PM
Hi Patrick,
Thanks for your response. The following are the text lines stored in the table. The code you have given is not completely extracting the texts. I prefer in the output the same format as below;
X KEROSENE DISTILLATES N.O.S,
(STORRARD SOLVENT) 3, UN 1268, PG III
(FLAMMABLE LIQUID LABEL REQUIRED.
MARINE POLLUTANT MARKS NOT REQUIRED ON
PACKAGES WITH INNER PACKAGINGS LESS THAN 5L
MARINE POLLUTANT MARK IS REQUIRED ON
OUTSIDE OF TRANSPORT UNIT (CONTAINER)
SCHEDULE B # 2710.00.5060
FLASHPOINT= 38-55 DEG C/100-131 DEG F (TCC)
IN CASE OF CHEMICAL EMERGENCY BY:
ROAD: REFER TO ERG #555
VESSEL: ABC NO. F-E, S-E
Once again thanks for your help.
07-29-2005 2:03 PM
07-29-2005 2:29 PM
Hi,
I have changed as per your suggestions like the following;
IF SY-SUBRC = 0.
LOOP AT LINES.
*MOVE LINES-TDLINE(132) TO ZBASICTEXT. "myline.
*concatenate lines-tdline into zbasictext separated by SPACE
EXIT.
WRITE:/ LINES-TDLINE.
ENDLOOP.
ENDIF.
But however the output comes like this now;
SCHEDULE B# 2914.22.1000
X FLAMMABLE LIQUID, N.O.S., (1-CARBON 2-
LIQUID ACETATE, PROPANE),
3, UN 9999, PG II
ERG# 901
SCHEDULE B# 0000.90.0000
Material MG
Basic data text
800001 ZZ
******DO NOT SHIP CALL 480-987-7177******
800002 ZZ
******DO NOT SHIP CALL 480-987-7177******
800003 IRE
SCHEDULE B# 3707.90.0000
800004 ZZ
******DO NOT SHIP CALL 480-987-7177******
800005 ZZ
******DO NOT SHIP CALL 480-987-7177******
800006 ZZ
That means I need the material number and parallely the description instead of the text description first and material number second.
How to format this? I am a SD functional guy and hence not able to play around properly in the ABAP codes.
Thanks a million.
07-29-2005 2:33 PM
07-31-2005 11:58 PM
Hi Shiva,
Do you know which Text Objects you are trying to extract?
It seems that when you implement Rich's suggestion, you are getting the wrong data out. Maybe you should be looking for a different Text Object.
Eg, when you are in Material Master, go to the Sales Text Tab. At the bottom of the Screen, you should see an icon that looks like a page with a pencil in it. It should have "Editor" as it's tooltip. If you click on it, you should see your Material Sales Text in a different window. You should notice that on the left hand side, it has an asterisk (*) followed by each text line. The READ_TEXT FM pulls this data out. In order to find the parameters to pass into the READ_TEXT FM, use the following Menu Path: Goto->Header.
This will give you the values to pass into the FM. The Text Name is usually a concatenation of the Material Number (with it's leading zeros) and other additional data such as Sales Org, Dist. Channel, etc.
Now you must find which Text Object has the output you are looking for and apply the steps I have described above to extract the data out. However, if you are looking for a combinaion of Text Objects, eg, first 2 lines of the Material Sales Text, 3 lines from the Delivery Instructions, etc then you must identify all these Text Objects.
If this is so, please let us know which Text Objects you require and the relevant rules to apply and maybe I can assist you further.
If this does not make sense please let me know.
Cheers,
Pat.