2007 Apr 23 10:34 AM
Hi could u plz tell me how to transfer the file in application server to idoc format?
Hi could u plz tell me how to transfer the file in application server to idoc format?
2007 Apr 23 10:44 AM
Hi Sahil,
This is the posting program.
FUNCTION zidoc_input_btmatmas.
*"----
""Local interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" VALUE(NO_APPLICATION_LOG) LIKE SY-DATAR OPTIONAL
*" VALUE(MASSSAVEINFOS) LIKE MASSSAVINF STRUCTURE MASSSAVINF
*" OPTIONAL
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
*" EXCEPTIONS
*" WRONG_FUNCTION_CALLED
*"----
DATA:wa_mara TYPE z1marm,
wa_makt TYPE e1maktm.
DATA: st_mara TYPE mara,
st_makt TYPE makt.
LOOP AT idoc_contrl.
LOOP AT idoc_data WHERE docnum = idoc_contrl-docnum.
CASE idoc_data-segnam.
WHEN 'Z1MARM'.
wa_mara = idoc_data-sdata.
MOVE-CORRESPONDING wa_mara TO st_mara.
INSERT mara FROM st_mara.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
WHEN 'E1MAKTM'.
wa_makt = idoc_data-sdata.
MOVE-CORRESPONDING wa_makt TO st_makt.
INSERT makt FROM st_makt.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
ENDCASE.
ENDLOOP.
ENDLOOP.
IF sy-subrc = 0.
return_variables-wf_param = 'Processed IDOCs'.
return_variables-doc_number = idoc_contrl-docnum.
return_variables-wf_param = 'Appl_objects'.
return_variables-doc_number = fs_app_empdet-ssn.
APPEND return_variables.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = 53.
idoc_status-msgty = 'I'.
idoc_status-msgid = 'ZE'.
idoc_status-msgno = '006'.
APPEND idoc_status.
ENDIF.
ENDFUNCTION.
Hope this resolves your query.
<b>Reward all the helpful answers.</b>
Regards
2007 Apr 23 11:18 AM
Hi Sahil,
By using the FM we can transfer the data from one system to another system.
FM: Master_Idoc_distribute
&----
*& Report ZBT_SEL_PROGRAM *
*& *
&----
*& *
*& *
&----
REPORT zbt_sel_program .
TABLES: mara.
*----
Data declaration
*----
*--Material number selection.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
PARAMETERS:
*--Rec.Partner
p_rcvprn TYPE edi_rcvprn,
*--Message type
p_msgtyp TYPE edi_mestyp.
*----
Internal table declaration
*----
DATA:
*--MARA data
it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE,
*--To fill the segment Z1MARM
it_temp_mara TYPE STANDARD TABLE OF z1marm WITH HEADER LINE,
*--MAKT data
it_makt TYPE STANDARD TABLE OF makt WITH HEADER LINE,
*--To fill the segment E1MAKTM
it_temp_makt TYPE STANDARD TABLE OF e1maktm WITH HEADER LINE.
DATA: st_edidd TYPE STANDARD TABLE OF edidd WITH HEADER LINE,
st_comm_cont TYPE STANDARD TABLE OF edidc WITH HEADER LINE,
st_mast_cont TYPE edidc.
*--Fetch the data from MARA table
SELECT * FROM mara INTO TABLE it_mara WHERE matnr IN s_matnr.
IF sy-subrc = 0.
SORT it_mara.
ENDIF.
*--Fetch the data from MAKT table
IF NOT it_mara[] IS INITIAL.
SELECT * FROM makt INTO TABLE it_makt FOR ALL ENTRIES IN it_mara
WHERE matnr = it_mara-matnr.
IF sy-subrc = 0.
SORT it_makt.
ENDIF.
ENDIF.
*--Fill the iternal tables which is type the same of Segments
LOOP AT it_mara.
MOVE-CORRESPONDING it_mara TO it_temp_mara.
APPEND it_temp_mara.
CLEAR it_temp_mara.
ENDLOOP.
LOOP AT it_makt.
MOVE-CORRESPONDING it_makt TO it_temp_makt.
APPEND it_temp_makt.
CLEAR it_temp_makt.
ENDLOOP.
*--Fill the segments
LOOP AT it_temp_mara.
st_edidd-segnam = 'Z1MARM'.
st_edidd-sdata = it_temp_mara.
APPEND st_edidd.
CLEAR st_edidd.
ENDLOOP.
LOOP AT it_temp_makt.
st_edidd-segnam = 'E1MAKTM'.
st_edidd-sdata = it_temp_makt.
APPEND st_edidd.
CLEAR st_edidd.
ENDLOOP.
*--Fill Master IDOC
st_mast_cont-rcvprt = 'LS'.
st_mast_cont-rcvprn = p_rcvprn.
st_mast_cont-mestyp = p_msgtyp.
st_mast_cont-idoctp = 'ZMATMAS01'.
*--Create the communication IDOC by passsing master IDOC and control
information.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = st_mast_cont
OBJ_TYPE = ''
CHNUM = ''
TABLES
communication_idoc_control = st_comm_cont
master_idoc_data = st_edidd
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 = 0.
*--Commit work
COMMIT WORK.
ENDIF.
*--Display IDOC Number.
LOOP AT st_comm_cont.
WRITE: 'IDOC Numbers:',st_comm_cont-docnum.
ENDLOOP.
*******Rewards if helpful.
Rgds,
P.Naganjana Reddy
2007 Apr 23 11:52 AM
i think u have to declare a ALE partner with appication server parameters.
and in we20 for the partner which u want to send the idoc to application server u have to maintain the ALE port that u hae defined .....
then when a idoc is created ...u get a file of idoc format on the application server
2007 Apr 23 12:19 PM
Hi Sahil,
In WE21 you need to create a file port. You can specify a logical or physical directory and the Outbound file name.
Make sure you have read/write permission in the path specified above.
Now in the partner profile settings (WE20) use the file port defined above.
When you trigger the IDocs the IDoc file will be written in the specified location.
Regards,
Gajendra.