Function Module for Outbound process code
Hi,
I have a scenario in which i have to send MBGMCR02 Idoc from SAP to XI.
I created a new Outbound process code and now I have to code the function module that populates data into the segments.
Does anyone have sample code for this, i.e code to put in the finction module of an outbound process code?
hi...
please find the below code.
*& Report ZPROGRAM11
REPORT ZPROGRAM11.
tables : likp,vbuk,vbfa,ibin,vbap,vbak,kna1.
types : begin of iy_tab,
vbeln type vbfa-vbeln,
vbelv type vbfa-vbelv,
posnv type vbfa-posnv,
end of iy_tab.
types : begin of iy_tab1,
vbeln type vbuk-vbeln,
wbstk type vbuk-wbstk,
end of iy_tab1.
types : begin of iy_tab2,
vbeln type vbak-vbeln,
kunnr type vbak-kunnr,
vkorg type vbak-vkorg,
vtweg type vbak-vtweg,
spart type vbak-spart,
end of iy_tab2.
data : i_ibase type ib_ibase.
data : i_kunnr type vbak-kunnr.
data : it_tab type table of iy_tab with header line,
it_tab1 type standard table of iy_tab1 ,
wa_tab1 type iy_tab1,
it_tab2 type standard table of iy_tab2 ,
wa_tab2 type iy_tab2.
data : t_edidd type standard table of edidd .
data : t_edidc type edidc.
data : t_edidc1 type standard table of edidc .
data : wa type edidd.
data : wa1 type e1edl20.
data : wa2 type zibase.
data : wa3 type e1edl32.
data : wa4 type e1edl44.
data : wa5 type e1edl37.
data : wa6 type e1edl28.
data : wa7 type e1edl30.
data : wa8 type e1edl24.
data : wa9 type e1adrm1.
data : begin of it_tab3 occurs 10,
vbeln type iy_tab-vbelv,
posnr type iy_tab-posnv,
i_ibase type ib_ibase,
end of it_tab3.
types : begin of iy_tab4 ,
valfr type ibin-valfr,
ibase type ibin-ibase,
amount type ibin-amount,
unit type ibin-unit,
end of iy_tab4.
data : it_tab4 type standard table of iy_tab4,
wa_tab4 type iy_tab4.
data : begin of it_tab5 occurs 10,
vbeln type vbfa-vbelv,
posnr type vbfa-posnv,
ibase type ibib-ibase,
valfr type ibin-valfr,
amount type ibin-amount,
unit type ibin-unit,
matnr type vbap-matnr,
kunnr type vbak-kunnr,
vkorg type vbak-vkorg,
vtweg type vbak-vtweg,
spart type vbak-spart,
name1 type kna1-name1,
end of it_tab5.
types : begin of iy_tab6,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
end of iy_tab6.
data : it_tab6 type standard table of iy_tab6,
wa_tab6 type iy_tab6.
types : begin of iy_tab7,
kunnr type kna1-kunnr,
name1 type kna1-name1,
end of iy_tab7.
data: it_tab7 type standard table of iy_tab7,
wa_tab7 type iy_tab7.
data : wa_table type ytable1.
selection-screen: begin of block b1 with frame title text-t00.
parameters: p_vbeln type vbfa-vbeln.
selection-screen: end of block b1.
start-of-selection.
select vbeln vbelv posnv from vbfa into table it_tab
where vbeln = p_vbeln.
if sy-subrc eq 0.
loop at it_tab.
select vbeln wbstk from vbuk into table it_tab1
for all entries in it_tab
where vbeln = it_tab-vbeln.
endloop.
endif.
loop at it_tab1 into wa_tab1.
if wa_tab1-wbstk = 'C'.
loop at it_tab.
call function 'IBSD_CREATE_IBASE'
exporting
i_vbeln = it_tab-vbelv
i_posnr = it_tab-posnv
i_as_sold = '0'
i_as_build = '0'
i_capid = '0'
I_CHANGE = ' '
i_commit = 'X'
I_COMMIT_WAIT = ' '
importing
e_ibase = i_ibase
exceptions
order_not_found = 1
position_not_found = 2
nothing_to_do = 3
too_much_to_do = 4
missing_authorization = 5
foreign_lock = 6
others = 7
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
move it_tab-vbelv to it_tab3-vbeln.
move it_tab-posnv to it_tab3-posnr.
move i_ibase to it_tab3-i_ibase.
append it_tab3.
if sy-subrc eq 0.
select valfr ibase amount unit from ibin into table it_tab4
for all entries in it_tab3
where ibase = it_tab3-i_ibase.
if sy-subrc eq 0.
select vbeln posnr matnr from vbap into table it_tab6
for all entries in it_tab3
where vbeln = it_tab3-vbeln and posnr = it_tab3-posnr .
if sy-subrc eq 0.
select vbeln kunnr vkorg vtweg spart from vbak into table it_tab2
for all entries in it_tab
where vbeln = it_tab-vbelv.
sort it_tab2 by vbeln.
delete adjacent duplicates from it_tab2 comparing all fields.
if sy-subrc <> 0.
select kunnr name1 from kna1 into table it_tab7
for all ENTRIES IN it_tab2
where kunnr = it_tab2-kunnr.
endif.
endif.
endif.
endif.
endif.
endloop.
else.
exit.
if sy-subrc eq 0.
endif.
endif.
endloop.
loop at it_tab3.
move it_tab3-vbeln to it_tab5-vbeln.
move it_tab3-posnr to it_tab5-posnr.
move it_tab3-i_ibase to it_tab5-ibase.
if sy-subrc eq 0.
read table it_tab4 into wa_tab4 with key ibase = it_tab3-i_ibase.
move wa_tab4-valfr to it_tab5-valfr.
move wa_tab4-amount to it_tab5-amount.
move wa_tab4-unit to it_tab5-unit.
if sy-subrc eq 0.
read table it_tab6 into wa_tab6 with key vbeln = it_tab3-vbeln posnr = it_tab3-posnr.
move wa_tab6-matnr to it_tab5-matnr.
if sy-subrc eq 0.
read table it_tab2 into wa_tab2 with key vbeln = it_tab3-vbeln.
move wa_tab2-kunnr to it_tab5-kunnr.
move wa_tab2-vkorg to it_tab5-vkorg.
move wa_tab2-vtweg to it_tab5-vtweg.
move wa_tab2-spart to it_tab5-spart.
if sy-subrc eq 0.
read table it_tab7 into wa_tab7 with key kunnr = wa_tab2-kunnr.
move wa_tab7-name1 to it_tab5-name1.
append it_tab5.
endif.
endif.
endif.
endif.
append it_tab5.
endloop.
loop at it_tab5.
move it_tab5-vbeln to wa_table-vbeln.
move it_tab5-kunnr to wa_table-kunnr.
move it_tab5-vbeln to wa_table-vbeln.
move it_tab5-ibase to wa_table-ibase.
move it_tab5-matnr to wa_table-matnr.
move it_tab5-valfr to wa_table-valfr.
move it_tab5-unit to wa_table-unit.
move it_tab5-amount to wa_table-amount.
move it_tab5-vkorg to wa_table-vkorg.
move it_tab5-vtweg to wa_table-vtweg.
move it_tab5-spart to wa_table-spart.
move it_tab5-name1 to wa_table-name1.
insert ytable1 from wa_table.
endloop.
*INSERT ytable1 FROM TABLE it_tab5.
loop at it_tab5.
wa1-vbeln = it_tab-vbeln.
wa1-vkorg = it_tab5-vkorg.
wa-segnam = 'E1EDL20'.
wa-sdata = wa1.
wa-hlevel = 2.
append wa to t_edidd.
loop at it_tab3.
wa2-i_ibase = it_tab5-ibase.
wa2-i_qty = it_tab5-amount.
wa2-i_dat = it_tab5-valfr.
wa-segnam = 'ZIBASE'.
wa-sdata = wa2.
wa-hlevel = 3.
append wa to t_edidd.
endloop.
wa9-name1 = it_tab5-name1.
wa-segnam = 'E1ADRM1'.
wa-sdata = wa9.
wa-hlevel = 3.
append wa to t_edidd.
wa-segnam = 'E1EDL28'.
wa-sdata = wa6.
wa-hlevel = 3.
append wa to t_edidd.
wa-segnam = 'E1EDL30'.
wa-sdata = wa7.
wa-hlevel = 4.
append wa to t_edidd.
wa3-kunnr = it_tab5-kunnr.
wa-segnam = 'E1EDL32'.
wa-sdata = wa3.
wa-hlevel = 5.
append wa to t_edidd.
wa8-meins = it_tab5-unit.
wa8-vtweg = it_tab5-vtweg.
wa8-spart = it_tab5-spart.
wa-segnam = 'E1EDL24'.
wa-sdata = wa8.
wa-hlevel = 3.
append wa to t_edidd.
wa-segnam = 'E1EDL37'.
wa-sdata = wa5.
wa-hlevel = 3.
append wa to t_edidd.
wa4-vbeln = it_tab5-vbeln.
wa4-posnr = it_tab5-posnr.
wa4-matnr = it_tab5-matnr.
wa-segnam = 'E1EDL44'.
wa-sdata = wa4.
wa-hlevel = 4.
append wa to t_edidd.
endloop.
t_edidc-mandt = sy-mandt.
t_edidc-direct = '1'.
t_edidc-rcvpor = 'A000000062'.
t_edidc-rcvprt = 'LS'.
t_edidc-rcvprn = 'O2C_ASSET'.
t_edidc-rcvpfc = 'LS'.
t_edidc-sndpor = 'SAPSIT'.
t_edidc-sndprt = 'LS'.
t_edidc-sndprn = 'T90CLNT090'.
t_edidc-sndpfc = 'LS'.
t_edidc-mestyp = 'DELVRY'.
t_edidc-idoctp = 'DELVRY03'.
*t_edidc-rcvpfc = 'LS'.
t_edidc-sndpfc = 'LS'.
t_edidc-cimtyp = 'ZDELVRY03'.
append t_edidc to t_edidc1.
call function 'MASTER_IDOC_DISTRIBUTE'
exporting
master_idoc_control = t_edidc
OBJ_TYPE = ''
CHNUM = ''
tables
communication_idoc_control = t_edidc1
master_idoc_data = t_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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
CALL FUNCTION 'DB_COMMIT'
CALL FUNCTION 'DEQUEUE_ALL'
EXPORTING
_SYNCHRON = ' '
COMMIT WORK.
endif.
endloop.
Similar Messages
-
Function module for OUtbound DESADV01
Hi,
Can anyone tell me which function module to be used for OUtbound DESADV01 which i will be using for ASN. In addition to this, please let me know which procesisng code will be used.
Can anyone please share the code for writting a funciion module in case I have to write custom FM.
Regards
Rinku
Message was edited by:
Rinku MalikHi,
Create a new function group from se37.
From the menu Goto --> Function group --> create group
Copy the function module IDOC_OUTPUT_DESADV01 into ZIDOC_OUTPUT_DESADV01 function module. Add your code in the function module.
create a new Z Process code ZSD05 in we41 tcode and attach the function module
ZIDOC_OUTPUT_DESADV01 to the process code.
In tcode we57 attach the function module to the idoc type and message type.
Regards
Arun -
Transaction code to assign the function module to the process code
Hi,
What is the transaction to assign the function module to the process codeHello Preethi,
Try with these Tcodes:
<b>
WE41 0000 Process codes, outbound
WE42 RSECODIN 1000 Process codes, inbound
WE43 0000 Funct.module: Status record display</b>
If useful reward.
Vasanth -
Function module for Outbound Delivery
Dear ABAPers,
Can anyone tell me the Function module for Out bound Delivery.
Thanks & Regards,
Ashok.Hi,
Check this BAPI:
BAPI_OUTB_DELIVERY_CREATE_SLS.
Hope it is helps.
Regards,
T.D.M. -
Custom Function Module for the New Process Codes
I want to distribute the custom table data . For that i have written the program using MASTER_IDOC_DISTRIBUTE. I have created the custom message & idoc types along with their assignments.
I got struck up at the process code. I have to assign the function module for that process code. Can anyone kindly help me in writting the code at that function module ?Hi Friends,
My requirement is , i need to transfer the table records. For that i have created the Message/Idoc Types and also created the Partner profile and the Distribution model view .....all alll i have done.
My doubt is , in the we20, at the outbound parameters , i can give the Message/Idoc types that i have created. Ok thats fine
But at the inbound parameters, i have to give the inbound process code. So i have created the Inbound process code. As we know that for every process code a function module is attached, now i have to create the function module which posts the records in receiver side.
so 1. Does the Function module need to be RFC Enabled ?
2. Do we need to create Object type in SWO1 once i
create and release the function module ? -
What is outbound process code for quotation
hi
what is outbound process code for quotationProcess code for outbound processing - Code which identifies the type of data which is to be sent via the IDoc interface.
Use - Using the process code, the IDoc interface finds the application selection module which converts the SAP document into an IDoc.
The process code is only used with applications which perform outbound processing via Message Control (NAST).
Check with tcode WE41
Process code SD12 - QUOTES: Quotation
Regards,
maha -
How to Assign a function module for customized IDOC
Hi,
I have created a customized IDOC. Can any body explain how to assign a FM for customized IDOC? Is same IDOC can be used for both Outbound and Inbound Process? In WE41 and WE42 we have to give the outbound and inbound function module name. can we give same function module? Is process code is same for both outbound and inbound process?
Valuable suggetions are appreciated.
Regards,
RamHi ,
Here is the Procedure for the Inbound Idoc Funtion Module
Function Module : SE37
Message : WE81
Assign message : WE82
Assgin FM : we57
Process Code : WE42.
Assign Partner Profile - WE20,
To test the Inbound IDOC.
In WE19, Give the IDOC number & execute ... then put the cursor on the idoc control record . then click on the Standard Inbound push button on the application tool bar.it will show show all the details like partner no,type , message type , process code & function module name ...
now put a break point in the function module .. & debug .
if u r using customised inbound function module , then click on inbound function module .. there u will get a pop screen with FM name & debugging option in both background & foreground mode...
Reward Points if it is Useful.
Thanks,
Manjunath MS -
IDOCs : Not abe to add funciton module to Z Process code.
Hi,
I have created a new Z process code and was trying to add the function module to the process code. I can see the fucntion module in the list but when i select and press enter i get a error message " Application object type is not planned".
I have added the enrty for message type and function module in we57.
am i still missing something?
thanks.Hi,
Maintain the entry in BD51 as well if its inbound.
Also check if you've specified the further details of the function while creating the we42 entry.
i.e logical messages and the IDoc packet and Object type, start event and end event.
regards,
Advait -
How to create the INBOUND Function Module for INBOUND IDOCs
Hi Friends,
Can any Suggest me How to proceed to Create an INBOUND Function Module for Processing the INBOUND IDOCS
which are recieved from XI Server ?
I am working in SAP-ISU
Here i will recieve the INBOUND IDOCs for the Meter Reading Orders.
We have a Standard INBOUND FUNCTION MODULE
IDOC_INPUT_ISU_MR_UPLOAD
which Uploads the Meter Reading Results.
I copied the Same function Module into ZIDOC_INPUT_
and working on it.
Can any one suggest me, whether i am going in correct way or not.
In IDOC_INPUT_ISU_MR_UPLOAD Inbound fun module,
BAPI_MTRREADDOC_UPLOAD is used to Update or Insert the Meter Reading Results,
My requirment is to Insert and Update the Meter Reading Orders which are Inbounded from XI.
Can I Use the Same BAPI
BAPI_MTRREADDOC_UPLOAD
to Update the below fields,
EABL-SERNR
EABL-ZWNUMMER
EABLG-ABLESGR
EABL-V_ZWSTAND
EABL-N_ZWSTAND
EABL-ABLHINW
EABL-ZSKIPC
EABL-ADAT
EABL-ATIMTATS
EABL-ADATTATS
EABL-ATIM
EABL-ZMESSAGE
EABL-ABLESER(Meter reader number)
Kindly Suggest me,
Thanks in Advance,
GaneshHello Ganesh
I think you are going completely astray with you z-function module for IDoc processing.
If you look at TABLES parameter METERREADINGRESULTS (type BAPIEABLU ) of BAPI_MTRREADDOC_UPLOAD you will find many of the requested fields already:
EABL-SERNR => BAPIEABLU-SERIALNO
EABL-ZWNUMMER =>REGISTER
EABLG-ABLESGR
EABL-V_ZWSTAND
EABL-N_ZWSTAND
EABL-ABLHINW
EABL-ZSKIPC
EABL-ADAT
EABL-ATIMTATS => ACTUALMRTIME
EABL-ADATTATS => ACTUALMRDATE
EABL-ATIM
EABL-ZMESSAGE
EABL-ABLESER(Meter reader number)
Field EABL-ZMESSAGE appears to be custom field (at least I cannot find it on ECC 6.0). If this field was added using include CI_EABL then you probably can get these values into the BAPI using the EXTENSIONIN parameter.
Check routine CHECK_UPLOADRECORDS in the BAPI which allows two extension structures:
- BAPI_TE_EABL
- BAPI_TE_EOSB
Not surprisingly BAPI_TE_EABL contains the include CI_EABL.
Regards
Uwe -
Processing code and Function Module for IDOC
hi forum,
i m trying to make a file to IDOC scenario,
the IDOC is being sent to a R/3 system,
for the purpose, in R/3 i need to make a inbound processing code, can u tell me how to make a processing code and link it with a Function Module.......
can u guide me....sudheer,
If you are using standard idoc then you do not need to create new processing code.
There would be standard processing code available. You need to set input partner profile with processing code.
Let us know which idoc type you are using for inbound posting.
Anyway..TC for Creating processing code is : WE41(Outbound) and WE42 (Inbound)
Nilesh -
Function Module for message "MBGMCR" in outbound process
Hi all,
I want to create an IDoc via EDI when I post a material document. I use messgae type MBGMCR and IDoc type MBGMCR02 and I already configured in partner profile and all about output determination in SAP-IM.
And now I need a function module to process outbound IDoc of posting material document but I couldn't find a function module for processing.
Pls let me know about that.
Thanks for your time.Hi,
You need to Code your own Z Function Module for this. Copy any standard outbound FM to create your own Z FM, so as to ensure that Interfaces are correct.
Refer to given below threads:
Re: Standard IDOC for Goods Receipt
Re: Idoc type for Goods Receipt
Goods Receipt MIGO IDOC -
What is outbound function module for IDoc type INFRECMASS01
Hi,
What is outbound function module for IDoc type INFRECMASS01? This is for purchasing info record.
Thanks
KamalHi Kamal,
Have you looked standard program <b>RBDSEINF</b> or transaction code <b>ME18</b>?
This program will call function module <b>MASTERIDOC_CREATE_REQ_INFREC</b> to generate purchasing info record IDoc.
Hope this will help.
Regards,
Ferry Lianto
Please reward points if helpful. -
Outbound function module for IDOC WMMBID02
Hi,
Do we have any outbound function module for basic IDOC type WMMBID02 (Stock movements from ext. systems) which has message type WMMBXY.
I searched with hot keys OUTBOUND_WMMBXY in SE37 but unable to find a standard FM. My task is to extend that FM by a user-exit so as to populate my extended IDOC which is of basic type WMMBID02.
Any help would be greatly appreciated.
Regards,
HarshHi Kamal,
Have you looked standard program <b>RBDSEINF</b> or transaction code <b>ME18</b>?
This program will call function module <b>MASTERIDOC_CREATE_REQ_INFREC</b> to generate purchasing info record IDoc.
Hope this will help.
Regards,
Ferry Lianto
Please reward points if helpful. -
Sample Outbound Function Module for IDocs
Hello All,
Does anyone have sample code for an outbound function module for an IDoc - they created themselves. Custom or extended? Weblogs, sample code will be useful
ty, dd
Message was edited by:
Demi DouglasHi,
Check this program:
REPORT zmatmas_idoc.
INCLUDE zmatmas_idoc_top.
INCLUDE zmatmas_idoc_selscreen.
INCLUDE zmatmas_idoc_formroutine.
START OF SELECTION
START-OF-SELECTION.
PERFORM get_data.
PERFORM create_idoc.
PERFORM distribute_idoc.
TABLES
TABLES: mara.
Structures
*Header
TYPES: BEGIN OF gs_h_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
aenam TYPE mara-aenam,
pstat TYPE mara-pstat,
END OF gs_h_mara.
*Item
TYPES: BEGIN OF gs_i_makt,
spras TYPE makt-spras,
maktx TYPE makt-maktx,
maktg TYPE makt-maktg,
matnr TYPE makt-matnr,
END OF gs_i_makt.
TYPES: BEGIN OF gs_i_mbew,
lvorm TYPE mbew-lvorm,
lbkum TYPE mbew-lbkum,
salk3 TYPE mbew-salk3,
vprsv TYPE mbew-vprsv,
verpr TYPE mbew-verpr,
stprs TYPE mbew-stprs,
peinh TYPE mbew-peinh,
matnr TYPE mbew-matnr,
END OF gs_i_mbew.
TYPES: BEGIN OF gs_i_mvke,
vkorg TYPE mvke-vkorg,
vtweg TYPE mvke-vtweg,
lvorm TYPE mvke-lvorm,
versg TYPE mvke-versg,
bonus TYPE mvke-bonus,
provg TYPE mvke-provg,
matnr TYPE mvke-matnr,
END OF gs_i_mvke.
TYPES: BEGIN OF gs_i_mlan,
aland TYPE mlan-aland,
taxm1 TYPE mlan-taxm1,
taxm2 TYPE mlan-taxm2,
taxm3 TYPE mlan-taxm3,
taxm4 TYPE mlan-taxm4,
matnr TYPE mlan-matnr,
END OF gs_i_mlan.
*Segment & control record
DATA: gs_segment_h LIKE zmara_h,
gs_segment_i1 LIKE zmakt_i,
gs_segment_i2 LIKE zmbew_i,
gs_segment_i3 LIKE zmvke_i,
gs_segment_i4 LIKE zmlan_i,
gs_control_rec LIKE edidc.
Internal Table and work area
*Header & Item
DATA: gt_h_mara TYPE STANDARD TABLE OF gs_h_mara,
gt_i_makt TYPE STANDARD TABLE OF gs_i_makt,
gt_i_mbew TYPE STANDARD TABLE OF gs_i_mbew,
gt_i_mvke TYPE STANDARD TABLE OF gs_i_mvke,
gt_i_mlan TYPE STANDARD TABLE OF gs_i_mlan.
DATA: gw_h_mara TYPE gs_h_mara,
gw_i_makt TYPE gs_i_makt,
gw_i_mbew TYPE gs_i_mbew,
gw_i_mvke TYPE gs_i_mvke,
gw_i_mlan TYPE gs_i_mlan.
*EDIDD & EDIDC
DATA: gt_edidc LIKE TABLE OF edidc WITH HEADER LINE,
gt_edidd LIKE TABLE OF edidd WITH HEADER LINE.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS: s_matnr FOR mara-matnr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
*& Include ZMATMAS_IDOC_FORMROUTINE
*& Form get_data
FORM get_data .
SELECT matnr ersda ernam laeda aenam pstat
FROM mara
INTO TABLE gt_h_mara
WHERE matnr IN s_matnr.
IF sy-subrc <> 0.
MESSAGE e003(zkaren_msgclass).
No data found according to the selection criteria
ENDIF.
IF gt_h_mara IS NOT INITIAL.
SELECT spras maktx maktg matnr
INTO TABLE gt_i_makt
FROM makt
FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
SELECT lvorm lbkum salk3 vprsv verpr stprs peinh matnr
INTO TABLE gt_i_mbew
FROM mbew
FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
SELECT vkorg vtweg lvorm versg bonus provg matnr
INTO TABLE gt_i_mvke
FROM mvke
FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
SELECT aland taxm1 taxm2 taxm3 taxm4 matnr
INTO TABLE gt_i_mlan
FROM mlan
FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
ENDIF.
ENDFORM. " get_data
*& Form create_idoc
FORM create_idoc .
*Control data
gs_control_rec-mestyp = 'ZKAR_MATMAS_MSG_TYPE'. "Message type
gs_control_rec-idoctp = 'ZKAR_MATMAS'. "IDoc
gs_control_rec-rcvprt = 'LS'. "Partner type of receiver
gs_control_rec-rcvprn = 'T90CLNT810'. "Partner number of receiver
LOOP AT gt_h_mara INTO gw_h_mara .
*Header data.
gs_segment_h-matnr = gw_h_mara-matnr.
gs_segment_h-ersda = gw_h_mara-ersda.
gs_segment_h-ernam = gw_h_mara-ernam.
gs_segment_h-laeda = gw_h_mara-laeda.
gs_segment_h-aenam = gw_h_mara-aenam.
gs_segment_h-pstat = gw_h_mara-pstat.
*Header segment
gt_edidd-segnam = 'ZMARA_H'.
gt_edidd-sdata = gs_segment_h.
MOVE gt_edidd-sdata TO gs_segment_h.
APPEND gt_edidd.
WRITE:/ gs_segment_h-matnr, gs_segment_h-ersda, gs_segment_h-ernam,
gs_segment_h-laeda, gs_segment_h-aenam, gs_segment_h-pstat.
*ITEM 1
LOOP AT gt_i_makt INTO gw_i_makt.
IF gw_i_makt-matnr = gw_h_mara-matnr.
*Item data
gs_segment_i1-spras = gw_i_makt-spras.
gs_segment_i1-maktx = gw_i_makt-maktx.
gs_segment_i1-maktg = gw_i_makt-maktg.
*Item segment
gt_edidd-segnam = 'ZMAKT_I'.
gt_edidd-sdata = gs_segment_i1.
APPEND gt_edidd.
ENDIF.
ENDLOOP. "at gt_i_vbak
*ITEM2
LOOP AT gt_i_mbew INTO gw_i_mbew.
IF gw_i_mbew-matnr = gw_h_mara-matnr.
*Item data
gs_segment_i2-lvorm = gw_i_mbew-lvorm.
gs_segment_i2-lbkum = gw_i_mbew-lbkum.
gs_segment_i2-salk3 = gw_i_mbew-salk3.
gs_segment_i2-vprsv = gw_i_mbew-vprsv.
gs_segment_i2-verpr = gw_i_mbew-verpr.
gs_segment_i2-stprs = gw_i_mbew-stprs.
gs_segment_i2-peinh = gw_i_mbew-peinh.
*Item segment
gt_edidd-segnam = 'ZMBEW_I'.
gt_edidd-sdata = gs_segment_i2.
APPEND gt_edidd.
ENDIF.
ENDLOOP.
*ITEM3
LOOP AT gt_i_mvke INTO gw_i_mvke.
IF gw_i_mvke-matnr = gw_h_mara-matnr.
*Item data
gs_segment_i3-vkorg = gw_i_mvke-vkorg.
gs_segment_i3-vtweg = gw_i_mvke-vtweg.
gs_segment_i3-lvorm = gw_i_mvke-lvorm.
gs_segment_i3-versg = gw_i_mvke-versg.
gs_segment_i3-bonus = gw_i_mvke-bonus.
gs_segment_i3-provg = gw_i_mvke-provg.
*Item segment
gt_edidd-segnam = 'ZMVKE_I'.
gt_edidd-sdata = gs_segment_i3.
APPEND gt_edidd.
ENDIF.
ENDLOOP.
*ITEM4
LOOP AT gt_i_mlan INTO gw_i_mlan.
IF gw_i_mlan-matnr = gw_h_mara-matnr.
*Item data
gs_segment_i4-aland = gw_i_mlan-aland.
gs_segment_i4-taxm1 = gw_i_mlan-taxm1.
gs_segment_i4-taxm2 = gw_i_mlan-taxm2.
gs_segment_i4-taxm3 = gw_i_mlan-taxm3.
gs_segment_i4-taxm4 = gw_i_mlan-taxm4.
*Item segment
gt_edidd-segnam = 'ZMLAN_I'.
gt_edidd-sdata = gs_segment_i4.
APPEND gt_edidd.
ENDIF.
ENDLOOP.
ENDLOOP. "at gt_h_kna1
ENDFORM. " create_idoc
*& Form distribute_idoc
FORM distribute_idoc .
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = gs_control_rec
TABLES
communication_idoc_control = gt_edidc
master_idoc_data = gt_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.
WRITE:/ 'Error'.
ELSE.
LOOP AT gt_edidc.
WRITE:/ gt_edidc-docnum.
ENDLOOP. "at gt_edidc
ENDIF.
ENDFORM. " distribute_idoc -
Function Module for splitting(field) in CO02 t-code
Function Module or enhancement for splitting(field) in CO02 t-code Need function module for inserting a value in field(Max No of splits) in Transaction CO02
Message was edited by:
Mohan KumarYou can use this SAP enhancement PPCO0012 to display your own additional
information on a separate tab page in the production order header. You
can also make user fields avaialble for input, change them, and return
the changes to the order header.
Maybe you are looking for
-
Problems saving a DAQ task in Labview and running elsewhere
I am attempting to use DAQmx Save Task.vi in LabView to save a simple signal generation task, so I can open it later / elsewhere. The problem I am having, though, is when I attempt to open the task in MAX. The task is brought into MAX, but when I att
-
Balance Confirmation thru mail
Dear All, Client requirement is to mail the balance confirmation letter directly thru SAP after executing F.17. I want to know, if this is possible and what are the settings that are required to be done. If any there is any document for the same. Ple
-
Sorry for all the questions but if I finally understand then I will stop asking. Here is the html code for my site so far: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd"> <head> <meta http-equiv
-
Error message displayed when adding Wiki entry
When adding a new WIKI entry in Teaming 2, this error message is sometime displayed: class org.kablink.teaming.module.binder.impl.WriteEntryD ataException Frequently, Teaming 2 seems to stop responding and the web page will time out. Any ideas?
-
How do you vary a parameter at a given frequency?
i'd like have parameters in FCP vary at a given frequency, following the beat of the music. i assume i would need to open filter in Motion but how do i modify an external parameter that then lets me assign a frequency and intensity range within FCP o