Tuesday, February 19, 2008
Function Modules Create Text and Read Text
Function Modules Create Text and Read Text
Many a times it is required to Read text from SAP Objects like Sales Order or Purchase Order from an ABAP program. Similarly it may also be required to write text in Sales Order or other SAP objects through ABAP Code.
The following Function Modules can be used to do the needful.
1) Create_Text
2) Read-Text
To read text from sales order Header Text we first need to create some text. Open an existing Sales order using transaction VA02 as shown in the figure below.
In the header text type some text for example 'This is Header Text' and double click in the text area.
Once this is done the text gets saved and the following screen appears. Here you can type some more text.
Go back to the previous screen
See the change in the Icon as shown in the figure below. It now has some lines.
Now we need to run execute the function module to read the text that we have just typed. But before that we need to find the following
1) Text Object to read
2) Text ID to read.
Hence click on the Icon shown below.
Then the following screen appears. From here we can pick up the Text Object (VBBK) and Text ID (0001). For header text.
This can also be achieved using transaction SE75. As shown below.
Select Text Objects and IDs as shown below and click on display.
We now need to search for Sales. Click on the search tool as shown below.
Type Sales as shown below.
Select Sales Header. From the figure we can see the object as VBBK. Then click on Text IDs.
Select 0001 for header note.
We now have the following information with us.
1) Text Object ------- 'VBBK'
2) Text ID -----------'0001'
3) Sales order number ----'0000005473'
4) Language 'EN'
The above info should be obtained as shown in the above screen shots. Now run transaction SE37 and execute the function module 'READ_TEXT'
Enter the above mention data. Please note that this data will vary from system to system.
Name is the Sales Order Number.
Run the function module. As shown below the table has one record. Click on that entry.
The text is displayed as shown below.
The test data that has been entered can be saved and by clicking on the save button.
Give appropriate name.
Once saved it can be retrieved from the Test Data Directory.
Similarly Text can also be written in Sales Order/Purchase Order or any other SAP object using the function module 'CREATE DATA'.
We will insert text in the 'COMPLETION NOTE'. The following figure shows the Object name and Object ID.
Enter the data in the function module parameters as shown below. And run the function module.
Open the sale order. Goto---Header Text. See the text in COMPLETION NOTE.
Similarly text can be read or written in the Item text. The above mentioned steps can be followed to get the Object and ID.
Note: For Item text the 'NAME' parameter in the function module needs to be filled with
Sales Order number + item number.
Many a times it is required to Read text from SAP Objects like Sales Order or Purchase Order from an ABAP program. Similarly it may also be required to write text in Sales Order or other SAP objects through ABAP Code.
The following Function Modules can be used to do the needful.
1) Create_Text
2) Read-Text
To read text from sales order Header Text we first need to create some text. Open an existing Sales order using transaction VA02 as shown in the figure below.
In the header text type some text for example 'This is Header Text' and double click in the text area.
Once this is done the text gets saved and the following screen appears. Here you can type some more text.
Go back to the previous screen
See the change in the Icon as shown in the figure below. It now has some lines.
Now we need to run execute the function module to read the text that we have just typed. But before that we need to find the following
1) Text Object to read
2) Text ID to read.
Hence click on the Icon shown below.
Then the following screen appears. From here we can pick up the Text Object (VBBK) and Text ID (0001). For header text.
This can also be achieved using transaction SE75. As shown below.
Select Text Objects and IDs as shown below and click on display.
We now need to search for Sales. Click on the search tool as shown below.
Type Sales as shown below.
Select Sales Header. From the figure we can see the object as VBBK. Then click on Text IDs.
Select 0001 for header note.
We now have the following information with us.
1) Text Object ------- 'VBBK'
2) Text ID -----------'0001'
3) Sales order number ----'0000005473'
4) Language 'EN'
The above info should be obtained as shown in the above screen shots. Now run transaction SE37 and execute the function module 'READ_TEXT'
Enter the above mention data. Please note that this data will vary from system to system.
Name is the Sales Order Number.
Run the function module. As shown below the table has one record. Click on that entry.
The text is displayed as shown below.
The test data that has been entered can be saved and by clicking on the save button.
Give appropriate name.
Once saved it can be retrieved from the Test Data Directory.
Similarly Text can also be written in Sales Order/Purchase Order or any other SAP object using the function module 'CREATE DATA'.
We will insert text in the 'COMPLETION NOTE'. The following figure shows the Object name and Object ID.
Enter the data in the function module parameters as shown below. And run the function module.
Open the sale order. Goto---Header Text. See the text in COMPLETION NOTE.
Similarly text can be read or written in the Item text. The above mentioned steps can be followed to get the Object and ID.
Note: For Item text the 'NAME' parameter in the function module needs to be filled with
Sales Order number + item number.
Subscribe to:
Posts (Atom)
ABAP TIPS
|
Always use Pretty Printer and Extended Program Check before releasing the code. Do not leave unused code in the program. Comment the code thoroughly. Align the comments and the Code. Follow the SAP Standards and SAP Best Practices guidelines. It’s a good practice to take a dump of the code on your local drive. |