Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module to Generate Outbound IDOC for Sales Documents

Former Member
0 Likes
1,937

Hello Experts,

Can someone please help me, I need to know which function module to use in order to generate the outbound IDOC for sales documents. Some of the fm's I have come across are the following:

IDOC_OUTPUT_ORDERS, but actually for Purchase Orders

IDOC_OUTPUT_ORDRSP, but did not generate any IDocs for my sample Sales Order.

Points will be given for any help provided.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

former_member404244
Active Contributor
0 Likes
1,261

Hi,

The same function module is used for both sales and purchase orders.

IDOC_OUTPUT_ORDERS

Regards,

Nagaraj

Hi,

The same function module is used for both sales and purchase orders.

IDOC_OUTPUT_ORDERS

Regards,

Nagaraj

3 REPLIES 3
Read only

former_member404244
Active Contributor
0 Likes
1,262

Hi,

The same function module is used for both sales and purchase orders.

IDOC_OUTPUT_ORDERS

Regards,

Nagaraj

Read only

0 Likes
1,261

Hi Nagaraj,

I tried using the IDOC_OUTPUT_ORDERS but I keep getting an error that the Purchase Order <xxx> does not exist, even though the document I tried is a sales order. For everyone's reference here is the code:

form process_data.
  DATA v_idoc       TYPE edidc-docnum.
  DATA i_edidd      TYPE TABLE OF edidd.
  DATA wa_idoc_ctrl TYPE edidc.

  LOOP AT i_nast INTO wa_nast.
    CLEAR i_msgs[].
    CALL FUNCTION 'WFMC_PROTOCOL_GET'
      EXPORTING
        cps_nast        = wa_nast
      tables
        messages        = i_msgs
     EXCEPTIONS
       NOT_FOUND       = 1
       OTHERS          = 2.

    LOOP AT i_msgs INTO wa_msgs WHERE arbgb EQ 'E0'.
*--- Check first if there is an IDOC
      IF wa_msgs-msgv1 IS INITIAL.
        CONTINUE.
      ENDIF.

      v_idoc = wa_msgs-msgv1.

      CLEAR i_edidd[].
      CLEAR wa_idoc_ctrl.

      CALL FUNCTION 'IDOC_READ_COMPLETELY'
        EXPORTING
          document_number                = v_idoc
        IMPORTING
          IDOC_CONTROL                   = wa_idoc_ctrl
*         NUMBER_OF_DATA_RECORDS         =
*         NUMBER_OF_STATUS_RECORDS       =
        TABLES
*         INT_EDIDS                      =
          INT_EDIDD                      = i_edidd
        EXCEPTIONS
*         DOCUMENT_NOT_EXIST             = 1
*         DOCUMENT_NUMBER_INVALID        = 2
          OTHERS                         = 3.


      CALL FUNCTION 'IDOC_OUTPUT_ORDERS'
        EXPORTING
          object                              = wa_nast
          control_record_in                   = wa_idoc_ctrl
*       IMPORTING
*         OBJECT_TYPE                         =
*         CONTROL_RECORD_OUT                  =
        tables
          int_edidd                           = i_edidd
*       EXCEPTIONS
*         ERROR_MESSAGE_RECEIVED              = 1
*         DATA_NOT_RELEVANT_FOR_SENDING       = 2
*         OTHERS                              = 3
                .
      IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      COMMIT WORK.

    ENDLOOP.
  ENDLOOP.

Read only

former_member404244
Active Contributor
0 Likes
1,261

Hi,

what i feel is u have to give

LOOP AT i_msgs INTO wa_msgs WHERE arbgb EQ 'V1'. instead of 'E0'.Because V1 is the application area for sales.try to change and see.

Regards,

Nagaraj