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

EDI 850 inbound process orders

Former Member
0 Likes
1,670

when an inbound order is getting created i want check if the PO number already exists, if PO is already created i want the idoc to throw a error.

we are using the z process code inside which i am using the  FM : IDOC_INPUT_ORDERS. Now where should i check for duplicate PO an write an error message... please help it very very urgent.

I have pasted the process we are following.please help i will be greatful

FUNCTION zidoc_input_orders.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD

*"     VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC

*"  EXPORTING

*"     VALUE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT

*"     VALUE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-APPL_VAR

*"     VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK

*"     VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS

*"     VALUE(DOCUMENT_NUMBER) LIKE  VBAK-VBELN

*"  TABLES

*"      IDOC_CONTRL STRUCTURE  EDIDC

*"      IDOC_DATA STRUCTURE  EDIDD

*"      IDOC_STATUS STRUCTURE  BDIDOCSTAT

*"      RETURN_VARIABLES STRUCTURE  BDWFRETVAR

*"      SERIALIZATION_INFO STRUCTURE  BDI_SER

*"      EDI_TEXT STRUCTURE  EDIORDTXT1 OPTIONAL

*"      EDI_TEXT_LINES STRUCTURE  EDIORDTXT2 OPTIONAL

*"----------------------------------------------------------------------

  CALL FUNCTION 'IDOC_INPUT_ORDERS'

    EXPORTING

      input_method          = input_method

      mass_processing       = mass_processing

    IMPORTING

      workflow_result       = workflow_result

      application_variable  = application_variable

      in_update_task        = in_update_task

      call_transaction_done = call_transaction_done

      document_number       = document_number

    TABLES

      idoc_contrl           = idoc_contrl

      idoc_data             = idoc_data

      idoc_status           = idoc_status

      return_variables      = return_variables

      serialization_info    = serialization_info

      edi_text              = edi_text

      edi_text_lines        = edi_text_lines.

*Trigger Event

  WAIT UP TO 1 SECONDS.

  DATA : ls_edidc TYPE edidc,

         ls_edids TYPE bdidocstat,

         lv_objkey TYPE sweinstcou-objkey.

  READ TABLE idoc_contrl INTO ls_edidc INDEX 1.

  READ TABLE idoc_status INTO ls_edids WITH KEY docnum = ls_edidc-docnum

                                                status = '51'.

  IF sy-subrc = 0.

    lv_objkey = ls_edids-docnum.

    CALL FUNCTION 'SWE_EVENT_CREATE'

      EXPORTING

        objtype = 'ZIDOCORDER'

        objkey  = lv_objkey

        event   = 'ZINPUTERROROCCURRED'.

    COMMIT WORK.

  ENDIF.

ENDFUNCTION.

when an inbound order is getting created i want check if the PO number already exists, if PO is already created i want the idoc to throw a error.

we are using the z process code inside which i am using the  FM : IDOC_INPUT_ORDERS. Now where should i check for duplicate PO an write an error message... please help it very very urgent.

I have pasted the process we are following.please help i will be greatful

FUNCTION zidoc_input_orders.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD

*"     VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC

*"  EXPORTING

*"     VALUE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT

*"     VALUE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-APPL_VAR

*"     VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK

*"     VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS

*"     VALUE(DOCUMENT_NUMBER) LIKE  VBAK-VBELN

*"  TABLES

*"      IDOC_CONTRL STRUCTURE  EDIDC

*"      IDOC_DATA STRUCTURE  EDIDD

*"      IDOC_STATUS STRUCTURE  BDIDOCSTAT

*"      RETURN_VARIABLES STRUCTURE  BDWFRETVAR

*"      SERIALIZATION_INFO STRUCTURE  BDI_SER

*"      EDI_TEXT STRUCTURE  EDIORDTXT1 OPTIONAL

*"      EDI_TEXT_LINES STRUCTURE  EDIORDTXT2 OPTIONAL

*"----------------------------------------------------------------------

  CALL FUNCTION 'IDOC_INPUT_ORDERS'

    EXPORTING

      input_method          = input_method

      mass_processing       = mass_processing

    IMPORTING

      workflow_result       = workflow_result

      application_variable  = application_variable

      in_update_task        = in_update_task

      call_transaction_done = call_transaction_done

      document_number       = document_number

    TABLES

      idoc_contrl           = idoc_contrl

      idoc_data             = idoc_data

      idoc_status           = idoc_status

      return_variables      = return_variables

      serialization_info    = serialization_info

      edi_text              = edi_text

      edi_text_lines        = edi_text_lines.

*Trigger Event

  WAIT UP TO 1 SECONDS.

  DATA : ls_edidc TYPE edidc,

         ls_edids TYPE bdidocstat,

         lv_objkey TYPE sweinstcou-objkey.

  READ TABLE idoc_contrl INTO ls_edidc INDEX 1.

  READ TABLE idoc_status INTO ls_edids WITH KEY docnum = ls_edidc-docnum

                                                status = '51'.

  IF sy-subrc = 0.

    lv_objkey = ls_edids-docnum.

    CALL FUNCTION 'SWE_EVENT_CREATE'

      EXPORTING

        objtype = 'ZIDOCORDER'

        objkey  = lv_objkey

        event   = 'ZINPUTERROROCCURRED'.

    COMMIT WORK.

  ENDIF.

ENDFUNCTION.

8 REPLIES 8
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,418

Hi

Use EXIT_SAPLVEDA_011 and fill DERRTAB for the same

Nabheet

Read only

0 Likes
1,418

i can use it if i use the standard process code. but will it work for for the above FM it is my doubt...

for me to check the User exit works or not  i need access key so i just wanna confirm whether it will work.

Thanks in advance

Read only

0 Likes
1,418

It will work.. You dont need access key. You just create the Z include inside the Exit and create a project in CMOD for the same...Why do you need an acess key?

Nabheet

Read only

0 Likes
1,418

i was not registered as developer so it was asking me for access key. thanks for the suggestion.. i will put a break point and check.

Read only

0 Likes
1,418

okie:) break point will trigger if project is activated for the same in CMOD

Read only

0 Likes
1,418

I have activated and harcoded the breakpoint when i try to reprocess in we19 the breakpoint i not triggering.pls help

Read only

0 Likes
1,418

In WE19 Please use INBOUND Function Module button and choose call in debugging mode. Please attach a screen shot of the project created in CMOD all green?

Nabheet

Read only

0 Likes
1,418

i have activated in  cmod and checked even in the program, but when it triggers there th sy-subrc=4 and skips the the include, so i tried to manually change it to '0' in debbuging mode but still it skips the include and goes to  end function.

please help.