10-16-2008 7:02 AM
Hi Experts,
My requirement is to find out 6months old purchase orders with uncompleted status and create and idoc for them and distribute them.
Please let me know what Function modules to use for creating PO idocs and distributing the idocs.
Regards,
Sangeeta.
10-16-2008 7:54 AM
Hi Experts,
I am looking for an outbound FM and not for inbound FM.
Please suggest a FM for the same.
Regards,
Sangeeta.
10-16-2008 7:23 AM
hai,
outbound
message type ORDERS.
f.m IDOC_OUTPUT_ORDERS
process code me10
10-16-2008 7:32 AM
Hi Experts,
Sorry...I forgot to write...I have to create the PO idoc and distribute them programatically.
What FMs to use in my program for the same.
Regards,
Sangeeta.
10-16-2008 7:37 AM
Hi
Check these Fms:
IDOC_INPUT_ACC_PURCHASE_REQUI.
IDOC_INPUT_ACC_PURCHASE_ORDER.
Regards,
Vishwa.
10-16-2008 7:54 AM
Hi Experts,
I am looking for an outbound FM and not for inbound FM.
Please suggest a FM for the same.
Regards,
Sangeeta.
10-16-2008 10:25 AM
Hello,
You can follow the below method since you would like to Distribute the PO IDocs programatically.
1. Create a Z-Report in which you'll be querying on Purchasing Tables EKKO, EKPO etc to fetch all the PO Numbers which are 6 Months Old.
2. Secondly, For each Purchase Order (In a LOOP), create an IDoc. For this, you need to have the IDoc Structure ready first. Meaning, you can use the Existing IDoc Type or Create your own Custom IDoc Type in WE30.
Also, you may want to define a Custom Message Type in WE81 or Use the Existing ORDERS message Type.
3. Create the Respective Segments (PO Header , PO Item , PO Texts etc) in the Transaction in WE31.
4. Once the IDoc is Populated for each PO which is not Complete, then Call the FM "MASTER_IDOC_DISTRIBUTE" to generate IDocs.
5. Make sure to populate the IDoc Control Record Information for each PO IDoc that you generate before calling the above FM.
6. Your Selection Screen may contain the PO Number Range & Date Range.
7. Your Report program can be run Online or in Background Job.
8. In this way, you can easily Send your 6 months old PO IDocs with less effort by developing a Standalone Program.
Hope it was helpful.
Thanks and Regards,
Venkat Phani Prasad Konduri
10-16-2008 3:23 PM
Hi Venkat,
Can you please send an example code for creating and distributing an idoc programatically.
Regards,
Sangeeta.
10-16-2008 3:37 PM
Hello,
Find the below Sample Code. What exactly the Subroutine is doing is that it is moving the details which were already populated in an Internal Table to another Internal Table of IDOC_DATA. After that, it is populating the Control Record Information such as Sender, Receiver, Port, Partner etc.
Finally, it calls the FM MASTER_IDOC_DISTRIBUTE.
FORM f0022_fill_data_record_mnp.
REFRESH i_edidc.
CLEAR wa_edidc.
CLEAR wa_edidd1.
wa_edidc-doctyp = 'ZPRDORD05'. "This is for Production Order
wa_edidc-mestyp = 'ZPRODORD'.
wa_edidc-rcvprt = 'YTESTPORT'.
wa_edidc-rcvpor = 'YRCVPRT'.
wa_edidc-rcvprn = 'YPARTNER'.
APPEND wa_edidc TO i_edidc. "This is of Type EDIDC to Store the Control Record Information.
_ Population of Data Record_*
wa_data1-aufnr = wa_output-aufnr.
PERFORM f0054_conv_exit_aufnr
CHANGING
wa_data1-aufnr.
wa_data1-werks = wa_output-werks.
wa_data1-matnr = wa_output-matnr.
PERFORM f0055_conv_exit_matnr
CHANGING
wa_data1-matnr.
wa_data1-lgort = wa_output-lgort.
wa_data1-psmng = wa_output-psmng.
wa_edidd1-segnam = c_seg1.
wa_edidd1-sdata = wa_data1.
APPEND wa_edidd1 TO i_edidd1 .
wa_data2-arbpl = wa_output-arbpl.
wa_edidd1-segnam = c_seg2.
wa_edidd1-sdata = wa_data2.
APPEND wa_edidd1 TO i_edidd1 .
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = wa_edidc
TABLES
communication_idoc_control = i_edidc
master_idoc_data = i_edidd1
EXCEPTIONS
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
OTHERS = 5.
IF sy-subrc EQ 0.
COMMIT WORK.
CALL FUNCTION 'DEQUEUE_ALL'.
CALL FUNCTION 'EDI_DOCUMENT_DEQUEUE_LATER'
EXPORTING
docnum = wa_edidc-docnum
EXCEPTIONS
idoc_is_not_to_dequeue = 1
OTHERS = 2.
IF sy-subrc <> 0.
CLEAR: wa_vbbpitem.
ENDIF.
REFRESH i_edidd1.
CLEAR wa_edidd1.
ENDIF.
ENDFORM. " f0022_fill_data_record_mnp
Hope it would be helpful.
Thanks and Regards,
Venkat Phani Prasad Konduri