11-15-2007 10:15 AM
Hi all,
I have to update price conditions from an XLS file.
I want to use the FM IDOC_INPUT_COND_A, but no IDOC are created. I think that it's due to the control record (table IDOC_CONTRL), I am not sure that all the data needed are filled in.
Here my values :
idoc_contrl-direct = 2,
idoc_contrl-credat = sy-datum
idoc_contrl-cretim = sy-uzeit
idoc_contrl-mestyp = "COND_A"
idoc_contrl-idoctp = "Z_COND_A02" -> Basic type
idoc_contrl-cimtyp = "Z_COND_TEXT" -> Extension
Please, could you tell me how to well use the FM IDOC_INPUT_COND_A, or if there is an another solution ?
Regards.
Harry38
11-19-2007 2:18 PM
Hi,
I finally found the solution.
There is 3 FM to be used :
- EDI_IDOC_SYNTAX_GET : To get the structure of your IDOC and allow you to generate the data table.
- IDOC_CREATE_ON_DATABASE : To create a new IDOC. At this time the IDOC has the status 64 "IDoc ready to be transferred to application".
- APPLICATION_IDOC_POST_IMMEDIAT : To launch your IDOC.
Extract of the specific FM :
...
PERFORM idoc_structure_get.
IF t_idoc_syntax[] IS INITIAL.
m_msg_return sy-msgty sy-msgid sy-msgno
sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
return v_error.
ELSE.
LOOP AT t_data INTO st_data.
REFRESH : t_icontrl, t_idata, t_istatus, t_rvar, t_sinfo.
PERFORM idoc_control_get.
PERFORM idoc_data_get.
*& IDOC creation
CALL FUNCTION 'IDOC_CREATE_ON_DATABASE'
EXPORTING
idoc_status = st_istatus
error_occured = ' '
TABLES
idoc_data = t_idata
CHANGING
idoc_control = st_icontrl
EXCEPTIONS
idoc_input_inconsistent = 1
OTHERS = 2.
REFRESH : t_icontrl.
APPEND st_icontrl TO t_icontrl.
*& IDOC execution
CALL FUNCTION 'APPLICATION_IDOC_POST_IMMEDIAT'
TABLES
idoc_control = t_icontrl
idoc_data = t_idata
EXCEPTIONS
error_opening_idoc = 1
error_writing_idoc_status = 2
no_idocs = 3
OTHERS = 4.
IF sy-subrc <> 0.
m_msg_return sy-msgty sy-msgid sy-msgno
sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
return v_error.
ENDIF.
ENDLOOP. "T_DATA
...
*&---------------------------------------------------------------------*
*& Form idoc_structure_get
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM idoc_structure_get .
REFRESH : t_idoc_syntax.
CALL FUNCTION 'EDI_IDOC_SYNTAX_GET'
EXPORTING
pi_idoctyp = v_basic_type
pi_cimtyp = v_extension
TABLES
pt_syntax_table = t_idoc_syntax
EXCEPTIONS
syntax_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " idoc_structure_get
...
If it's helpfull, please, could you reward the solution ?
Thanks.
Regards.
Harry38