‎2009 May 08 9:56 AM
hi abapers,
i have on req my req is iam sending material master from one server to other server..
in inbound side i want to do mapping for materials,
like matetial type 'FERT' in sending system ,in receving side this material type should be 'HAWA'.
like this kind of mapping i need to do., for this i found one badi 'badi_matmas_alv_in'.
In this badi there are 'idoc_control' and 'idoc_data' exporting parameters and in changing parametes 'material tables' are there, now i did mapping passed values to different tables .
upto now is fine but probelms what i face is
1. The changed records are not updating in database.
so how the cding should should be done in inbound side ,,
any other exits or any sol's plaese let me know..
‎2009 May 08 10:06 AM
Hi Ajay,
for inbound Material master the FM is 'IDOC_INPUT_MATMAS01
check the user exit in this Function module and check the Segment that has Material type ..
and read the segment and check if the segment has matetial type 'FERT' modify the segment to matetial type 'FERT' and append to edidd.
regards,
Prabhudas
‎2009 May 08 10:06 AM
Hi Ajay,
for inbound Material master the FM is 'IDOC_INPUT_MATMAS01
check the user exit in this Function module and check the Segment that has Material type ..
and read the segment and check if the segment has matetial type 'FERT' modify the segment to matetial type 'FERT' and append to edidd.
regards,
Prabhudas
‎2009 May 08 10:55 AM
thanks prabhu,
here i found one exit 'MGV00001'
in that there two fm's 'EXIT_SAPLMV02_002' Enhancements in Material Master: IDoc - Post
here i want testing this by putting break point init .and going to we19 giving the idoc no executing in begguing mode in foreground,
but here this exit is not triggering, see below code of idoc_input_matmas01.
PERFORM CHECK_USER_EXIT TABLES T_EDIDD " zu 3.1H
USER_SEGMENTS
USING CURRENT_TABIX.
LOOP AT USER_SEGMENTS.
REFRESH T_RES_FIELDS.
SY-SUBRC = 0.
CALL CUSTOMER-FUNCTION '002'
EXPORTING
MESSAGE_TYPE = IDOC_CONTRL-MESTYP
F_CUST_SEGMENT = USER_SEGMENTS
TABLES
RES_FIELDS = T_RES_FIELDS
CHANGING
F_MARA_UEB = I_MARA_UEB
EXCEPTIONS
APPLICATION_ERROR = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
APPLICATION_SUBRC = SY-SUBRC.
PERFORM HANDLE_ERROR
TABLES
IDOC_CONTRL
IDOC_STATUS
RETURN_VARIABLES
T_MERRDAT
T_IDOC_MATNR "JH/4.0C/KPr100004993
USING
APPLICATION_SUBRC
CHANGING
WORKFLOW_RESULT.
EXIT.
ENDIF.
APPEND_RESFIELDS COUNTER-TRANC.
ENDLOOP.
here it is checking user segments table ,and when i exexuted this code it show empty,for this reason it is not going to the exit.
just see it and help me..
‎2009 May 09 4:39 AM
Hi,
I guess that userexit you mentioned above will work only for user segments or Z-Segments and not for the standard segments. BADI should work correctly. Do you receive any exception after execution of function module MATERIAL_MAINTAIN_DARK. Also, I can see that parameter NO_DATABASE_UPDATE is not passed which means that database should be updated after the call of function module. Also, try to create the material in dialog using MM01 and your material type. As per the documentation of MATERIAL_MAINTAIN_DARK if you can't make a material using MM01 then you can't do so using this function module as well. No matter whether you change material type in exit or badi the function module MATERIAL_MAINTAIN_DARK is responsible for creation of material in SAP.
Please debug and check it.
KR Jaideep,
‎2009 May 09 10:34 AM
Thanks for ur reply,
after executing material_maintain_dark fm
the idoc _status is empty,
‎2009 May 10 9:39 AM
Hi,
Then I guess the only option is to debug the function module and check why the changes are not been saved in database.
KR Jaideep,
‎2009 May 11 10:17 AM
thanks for u r hint..
i got the sol..
the probelm is when we are passing values to material_maintain_dark.
there for table:
mara_ueb,
makt_ueb,
marc_ueb.
.
.
for these tables in last there are some fields just see below.
mara-tcode = 'MAL1'. " Creating materials in inbound side use tcode MAL1
mara-tranc = '3'. " Transaction for data transfer
mara-d_ind = '1'.
maktm control information
makt-tranc = '3'. " Transaction for data transfer
makt-d_ind = '2'. " Data indicator.
maktm control information
marm-tranc = '3'. " Transaction for data transfer
marm-d_ind = '3'. " Data indicator.
when we pass this information to tables,of fm material_maintain_dark ,it will create material..
if u r not clear just read fm documentation