Capturing line items in the routine-mail order sending problem
Hi
I am sending Sales Order Output to the Email.
I have configured the output type Using Option 'External Send' Option.
But the Problem is Whenever there are blocks for Sales Order Email Should not be send.
1. When there is a block in Sales Order Header, then no email should be sent.
2. Similary when there is a block Sales Order Item , then no email should be sent.
There is some standard routine attached to Outputtype Procedures .
First Condition we can met using routine, in the routine if the block is there , then no output will
be triggered.
But in the same routine we couldn't able to capture item level data to validate the second condition.
If anybody is having the idea to validate second condition, Please help me.
Thanks&Regards
(YUGANDHAR.P)
hi check this simple example which is sending the sales order email........
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver .
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
data: ld_store(50) type c. "Leading zeros
CONSTANTS: con_cret(5) TYPE c VALUE '0D', "OK for non Unicode
con_tab(5) TYPE c VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR' INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
*Modification to retain leading zeros
inserts code for excell REPLACE command into ld_store
=REPLACE("00100",1,5,"00100")
concatenate '=REPLACE("' wa_charekpo-ebelp '",1,5,"'
wa_charekpo-ebelp '")' into ld_store .
concatenate ld_store into .xls file instead of actual value(ebelp)
CONCATENATE wa_charekpo-ebeln ld_store wa_charekpo-aedat wa_charekpo-matnr INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform.
regards,
venkat
Similar Messages
-
Adding some more line items in the unconfirmed Transfer Order
Hi All,
We do kitting activity at our warehouse i.e. several components make up an assembly of a particular final product. The WH creates a production order(BOM) based on which the system creates TO wherever stock of individual components are available for picking. However, the remaining components which are required to make up the product are still awaited in such a case (stock unavailable at present). Under this situation, is it possible that the balance remaining components can be added to the same original TO created earlier (i.e. where only available line items of that TO is confirmed and the TO header is still open).
Alternatively, can we add some more line items in the same unconfirmed Transfer Order to facilitate this kitting process and thereby confirming the TO header finally.
A quick feedback will be appreciated. Thanks.
Regards
JamanHi,
If you know what all the items you will include in one TO, even though you haven't pick the items;
In the TO, you have an option to make the items "Inactive" for which picking hasn't been done.
After making the items "Inactive", if you save the TO, it will allow you to confirm the TO, but then, it will create the new TO with the inactive items.
Hope its clear.
Aktar -
1 line item in the sales order ship to different shipping address
Hi,
Our customer A have 3 different branches (meaning 3 different shipping address).
During the creation of the sales order for 1 material A, I want to ship 50pc to this customer A:
10pc to address A1
20pc to address A2
20pc to address A3
In my sales order, is there a way I just create 1 line item with the order qty 50pc for this material A, but split into 3 schedule line with 3 different ship to address?
I know there is alternate way where I create 3 different line item (with order qty 10, 20 and 20) and change the ship to address in the Item -> Partner tab. But using this method, I have to create 3 times of the same material in 1 sales order, just with the different shipping address.
I want to know is there a way I just need to create 1 line item?
Kindly please advise. Thank you.Hi there,
When you have 3 different ship-to address, system will anyway create 3 different deliveries. This is coz if the header data in shipping (ship-to) is different, system will split the deliveries. Routes are different to 3 ship-to addresses & they cannot be combined in the same delivery.
So as mentioned in above thread, create 3 different line items or create different sales orders all together for different ship-to parties.
Regards,
Sivanand -
How to create an inspection lot for each line item of the Purchase order?
Hi,
How to create an inspection lot for each line item of the Purchase order ?
In detail if possible.Hi
please check this
[thread|Create Inspection Lot; -
Same material can exist on multiple line items for the same order.
Hi
Is there any specific customising setting or web shop setting through which we can restrict user to add same material on multiple line items for the same order ?
RegardsNo.
But if this is a must requirement, you can do an elaborate check during order save in ORDER_SAVE BAdI and return error. So, it will be only during order save.
Eawar Ram
http://www.parxlns.com -
How to delete a line item from the sales order
Hi all,
how to delete a line item from the sales order for which the production is already happened and it has been delivered. the production order status is DLV.
Regards
KumarHi
U can do this in two ways one u can short close the order by entering Reason for rejection in VA02 at header level and if yr order is multiple line item order u can enter the reason for rejection in any of the line item which u don't want to deliver.
This is called short close ( as the qty is not delivered fully).
Thx. -
Sample Material in the 3rd Line item of the Sales Order
Hi,
We have configured the system in the sales order as follows.
1. Commercial Material
2. Bonus Material.(ie Free Material)
Now, i want to add the 3rd line item in the sales order as Sample with different Material number. How go about this. kindly let me.
Regards
RaviHi there,
Enter the material in the sales order & change the item catg manually in VA02.
But free goods & sample materials are dealt differently..
Freegoods is entered as TANN item catg along with nornam TAN item in standard order OR.
But sample materials or free of charge items are processed through different order type FD for eg.
Even thought the item catg proposed in FD is TANN,, the whole process will not have pricing as TANN items arenot relevant for pricing.
Regards,
Sivanand -
Calculate sales tax based on all line items on the order
My users have asked to determin tax on the sales order, based on all the line items on the order. For example, if all the items are for product only, or if all the line items are for labor only, or if there is a mix of product and labor,
Order 1
line 1 product flag as both for vertex
line 2 labor flag as both for vertex
Order 2
line 1 product flag as product only
line 2 product flag as product only
Order 3
line 1 labor flag as labor only
line 2 labor flag as labor only
I do not see away to do this while the order is being created. In the order 1 example above, line one is entered, priced, and taxed as product only (it is the only line on the order at that time and it is product only). Line two is entered, it is marked as both. But I cannot send line item one back through vertex marked as both. Vertex processing is already complete.
I have looked at using both FYTX0001 and FYTX0002. With both of these exits I can only work with a single line item, i.e. once item one is processed it will not go through the exit when item two is added.
Any assistance would be appreciated.
JayHi WCG,
Our business is located in California as well. California is a modified-origin state, where state, county, and city taxes are based on the origin of the sale, while district taxes are based on the destination of the sale. You only need to add Sales tax when your customer's billing address is in California. I do not believe that Catalyst currently supports district based sales tax. You could look into a third party solution like TaxJar and see if it could be integrated into Catalyst. We currently charge our California based customers exactly what we would charge them in our retail store.
So you want to do something like this:
-Ryan -
Custom table Not deleting the line items on the order.
Hi All
I have an issue, In SAP we have created a custom table which is related to ship to party, as and when we delete any line items in the order(VBAP) it should update /delete the custom table but it is not deleting, while when we create any line items in the order (VBAP) it is updating the entries in the custom table which is suppose to happen.
Please let me know your inputs.
Thanks,
RamUPDKZ is not a field name. it is the processing status of a line or order.
If UPDKZ is I , its initial, like adding a new line
If UPDKZ is U, its update. Like changing or modifying an existing line
....so on...
Regards
Sai -
Line item is falling into back order even though the stock is available
Hi Gurus,
I have a sales order with a single line item which fell into back order even though there is material stock available in the plant and thereby is not dropping any delivery note.
Please suggest me what could be the reason behind this issue and let me know how can i figure it out of what is causing this issue.
FYI, it is happening for multiple sales order but not for all the orders.
Please help.
Regards,
Praveen Kambala.Hi,
You should check if there are pending requirements in MD04 coming from another sales orders or STO. If your sales order is not available in MD04, either you have daily requirements or the order is probably blocked by credit check.
If you use credit check control and the credit check fails, the quantity will not be confirmed until the sales order is released in VKM4.
If the above does not help, please provide more details about the issue (schedule line type, MRP type etc), as it is stated quite generic now.
Regards,
Marcin -
Subroutine program its display the text at line item as it's service order
Hi All,
Am looking for subroutine program its display the text at line item as it's service order, I want to view the text in sapscript in the tcode ME9F of the order text.
Ex:- in tcode ME23N, select PO & item details in Account Assignment tab, ORDER field is not displaying for some of the orders, but while debugging I can see the ORDER values.
Can'nt see the ORDER field in print preview, Pls let me know.
Edited by: Nagendra DS on Feb 19, 2008 3:18 AMHi,
If you are retrieving the values in the print program, the values will definetly get populated to the sap script. In case of subroutines in the form, the values you pass it to the structure ITCSY should be characters only.
Hope this helps.
Sudha -
Delivery doc creation for a selected line item of the Sales order
Hi folks,
Can any one help me in how to create a delivery order for a selected line item of the Sales order.My requirement is the request comes from the web browser where a sales document and details of the items are shown the user select one line item and request for delivery create of that particular SO doc.I have used couple of FM to create delivery but the delivery create is depend on the schedule line dates so iam unable to figure out where exactly i can distinguish between the line items.
Example:
SO:- 11193645
Line item -1 has 2 schedule line 06/11
06/13
Line iteam-2 has 1 schedule line 06/12
so if i try to create Delivery doc for date 06/12
it creates partially for line 1 and line 2.
but my requirement is i wanted to create SO for only line item 1 as i wanted to process Del Doc for only line item 1.
If you have any idea please help me.hi ,
You can develop a customised FM to process the Idoc data .
1. Read the Idoc data into internal table for the line items which need to be delivered .
2. Run BDC for transaction 'VL01N' ( delivery creation ) through which eliminate the line items which are not in internal table and save the delivery document
Note : Because in VL01N , you specify the sales document with respect to which you want to perform delivery hence automatically all items are copied to the delivery document .
During BDC recording , select items by " MOVING TO TOP"
and then deleting the selected item
If you face problem in BDC recording , i can help u that too . -
Problem in invoice printout for second line item of the contract.
Hi,
There are two line items in the contract. Both with different material and different plants. 1st line item with plant japan, and 2nd line item with plant singapore. But, when i try to take printout for 2nd line item after invoicing it, the address appearing in printout is of Japan instead of singapore.
Any idea why this happening?
Please revert back asap.Hi Chetan,
If that is a header output, then there are issues at the design level itself. You have an output as header output and you expect the item level details to be printed in two different printouts.How is this handled in the program. Mostly header outputs are used to print the details abotu all the items in the doucment , not for a specific item. If you want to print a specific item only , then it is always advisable to configure the output as item output.
Leaving that aside, the problem lies in the code. You may be selecting the item number when you are printing the details of the second item, but for printing address, you are not coding using the item number.
To prove this test this scenario.
Create an order with first item belonging to Singapore plant and second item Japan plant.
Now create the otuput for item1----it will work fine
Do the same for item2-----Now, the plant address will be of Singapore, while the material belongs to Japan.
If this happens, it can be safely assumed that problem lies in the code. Do this test and then if the problem is in the program, discuss with your developer, he will rectify the bug for you.
You can reward me if this solves your problem. -
To split the payment document value as per the line items of the P O
To split the payment document value as per the line items of the purchase order in the period of payment, so that the payment amounts are measured against the Capex order assigned as account assignment in the purchase order.(Account assignment tab for the individual line item in the PO.
Example:
Inputs:
Purchase Order 3100012345, line item 10 value 6000 line item 20 value 4000
VAT @10% , account assignment for PO line item 10(Internal Order no 10001) & line item 20 Internal Order 10002) G/ R no 5105105101 for Rs10,000.
The I/R doc 501501501 appears as follows: (MIRO)
Line 10: Value Rs 6,000
20: Value Rs 4,000
VAT Rs 600
Rs 400
Total Rs11, 000
Withholding Tax Rs 1,100
The accounting entry for MIRO happens as follows: doc 2102102101
GR/IR Dr Rs 10,000
VAT Dr Rs 1.000
Vendor Cr Rs9, 900
TDS due Cr Rs1, 100
The business expects the payment report as follows:payment doc 2001200101
PO Line item Internal Order MIRO Invoice Payment Payment period Amount
A/c doc number doc number
3400012345 10 10001 5605605601 2102102101 2001200101 001/2009 5940
3400012345 20 10002 5605605601 2102102101 2001200101 001/2009 3960
Currently we are able to show the amounts as Rs 6000 for line item 10 & Rs 4000 for line item 20.
The problems faced.
1. The VAT line items are auto created, hence the reference of purchase order number and line item are not available. So the VAT portion which is part of payment liability does not get reflected against the PO.(not able to show the VAT portion , when we try to show the payment amount per PO line item.)
2. The withholding tax is also a problem; WHT is not calculated and assigned per line item. It is calculated on the total amount of basic and VAT. Because of these reasons, the payment could not be shown properly according to the line item of the purchase order.
3. When part payment is made, against invoices, there is no provision to assign a payment amount against a particular line item. Further, when final payment is made in different period, the clearing document will get generated. That adds to the complexity of differentiating full payments and part payments final clearing.
4. When residual payment is made, a new line item is created. Here assignment of Purchase order line item against payment for residual items become a problem.
5. Many a times advance payments are made. Later the invoice is created and balance payment is made. In those situations, the clearing document creates one more line item and makes payment for the balance item. This adds complexity in bringing balance payment alone and to split as per the purchase order line item. The clearing document number system is multi dimensional. It creates two line items for the same item (one at the time of advance and another the time of clearing.)
6. When full payment is made, the payment document number and clearing document numbers are same. In cases of subsequent or partial or residual payment, the document numbers are different. Because of this, the part payment amounts are shown in the period, where the final payment and clearing are made.
Please suggest a way to split the payment amount in the exact posting period with all the considerations given above.
Regards
Sundararajan
Edited by: Sundarajan Venkatachari on Sep 30, 2009 11:04 AMHi,
See Note 301077 - User exits for the interface to accounting, although I think that there isn't this kind of option. Note 429117 - Collective note advice note SD-FI interface will be useful too.
I think that SAP Note 1085921 - Document split perhaps will help you
Regards
Eduardo -
To make service entry sheet for multiple line items of the service PO.
Hello MM Gurus,
Please help me for the following
I create a service PO with say 10 line items. Then while doing the service entry sheet the system automatically picks the line item 10 by default. When I try to enter the other items it throws an error" unplanned services cannot be entered"
So how to make a service entry sheet which shall include all the line items of the service PO at the same time.
So if I have 100 items in the PO do we make the service entry sheet 100 times against each item? Is there any seeting/solution on this?
Please help.
Regards,
Prasanna.Dear,
I have two solution for u.
1) Create different service entry sheet -ML81N for each line item and create single invoice verification for all service entry sheet - MIRO
2) Create service purchase order - ME21N for only one line item.
And include all services in service tab available at item detail level of service purchase order. Enter it's quantity and rate.
Than create one service entry sheet for purchase order.
So you can create one service entry sheet for all line item of services.
Note: - Use option 2 for easy process.
Regards,
Mahesh Wagh.
Maybe you are looking for
-
Adobe cloud just spins - wont start
adobe cloud wont open - it just spins around
-
Can I use Magic Mouse on a PC with Windows XP?
I have a PC at work with Windpws XP. I would like to use Magic Mouse on it. I s this possible? How?
-
Importing native xml in to semi structured storage
hello, how store the a bibliographic data in the native xml and import or export that data into to the semi structured storage. What are the ways we query the xml database. Eagerly waiting for the reply Cheers Akhil Thank you in advance
-
What causes spinning beach ball upon waking from sleep
I have a 4 year old iMac that has recently developed an intermittent problem. If I put it to sleep, sometimes on waking up, the hard drive access seems to stop. I hear a tap sound as though it was trying to read the disk, but it gets stuck and a spin
-
I am having a problem with my hp pavilion dv7-1135nr with Windows 7 64 bit. I'll start from the point that it started having issues. My wife had been telling me that he laptop had been overheating for some time, but I attributed it to the fact that s