ALE-manual configuration of the customer distribution model
DEAR EXPERTS
how do i manually configure the customer distribution model
hi ,
to maintain or configure the customer distribution model (CDM)
go to tcode BD64.
give the sender address -
you have to mention the logical system name of the sender system. if u r sending one version to other then you have to specify the sender system address,
give the receiver address--- same as above but mention the details of receiver system.
meaintain the message type--- depends upon the type of applicaiton using like MATMAS or ........
do the same procedure again in the reverse way to transer the information from one system to other system and vice versa.
next step is to generate partner profiles.
BD82 is the tcode for it
next distribute CDM.
thats it.
If u find it useful mark the points
Regards,
GNK.
Similar Messages
-
RE:manual configuration of the customer distribution model
i hae entered tcode bd64 for manual configuration of the customer distribution model but now i dont know where to go to to put the sende and receiver addresses. i am stuck guys, please helb
Please refer this blog.
/people/kevin.wilson2/blog/2006/11/13/ale-scenario-development-guide
http://searchsap.techtarget.com/general/0,295582,sid21_gci1130337,00.html
Regards,
Ramki. -
How to maintain Customer distribution model in ALE
hi FRIENDS..
i wish to know what will be the transaction code of maintaining the customer distribution model, and how we maintain it. and also distribute custome model in IMG sreen... please reply me...i will surely award you nice points....
bye...
naimU can create/maitain distribution model using BD64.
Or else u can create it using SALE transaction code.
U need to give sender/reciver/msg type.
==============================================
procedure:
click on Create Distribution model button-->give the technical name
select the DModel Technical name>add msgtype>
it will ask sender/reciver/msgtype.
pass those parameters and generate partner profiles through environment menu
=================================
to distribute a model view to partner syste,:
Select mview
edit>modelview>distribute
Message was edited by: Eswar Kanakanti -
How to enter AWTYP manually while posting the customer invoice in F-22 or any other t code
Hi Experts, I am trying to enter AWTYP manually in t code F-22. I tried to customize it by changing field status varien in OBC4. But i couldnot do that. Is it possible to make the Field AWTYP manually inputable?
Elaboration: when I post a debit invoice in F-22, the awtyp is always bkpf. It is given by system but because of testing purpose, i want to enter it manually as WBRK. Please suggest, if possible.Execute SHDB and execute a record of F-22 execution, the fields will now be input allowed.
Regards,
Raymond -
ALE/IDOC configurations?
Hi Experts,
Suppose i've two R/3 systems let say R1(Source system) and R2 (Target System). Now i want to send MATMAS05 IDOC from R1 to R2. Can anyone tell wht are ALE configuration's need to b done on both systems......plz give all Tcodes which are required at both systems with descriptions....
Pts will b rewarded to approraite answers
Regards
FaisalHi Friend ,
Please the process in steps .
MASTER DATA TRANSFERMATION BETWEEN 2 DIFF CLIENTS
For this scenario Client 800 is the Sender and 810 is the receiving system
1. Creating Logical Systems
o Login using 800 client
o Go to T. Code SALE
o Expand Sending and Receiving Systems
o Expand Logical Systems
o Click on Define Logical System
o Click on New Entries
o Create STUD_S, STUD_R Logical Systems
o Save and come back
o Assign the STUD_S Logical System to client 800
o Assign the STUD_R Logical System to client 810
2. Creating the RFCs
o Go to T. Code SM59
o Expand R/3 Connections
o Enter RFC Name as STUD_S
o Connection Type as 3
o Language as EN
o Client as 800
o User as SAPUSER
o PWD as abap
o Target host as sap
o Click on Remote logon button to test the RFC
o Enter RFC Name as STUD_R
o Connection Type as 3
o Language as EN
o Client as 800
o User as SATISH
o PWD as abap
o Target host as sap
o Click on Remote logon button to test the RFC
3. Creating the Message Type
o Go to T. Code WE81
o Click on change, continue
o Click on New Entries button
o Give message type as ZBAPI_STUD_MAS and description
o Save and back
4. Creating the Segment
o Go to T. Code WE31
o Give segment name as ZBAPI_STUD_SEG
o Enter Short Text
o Enter the Field Name and Data Element in the text boxes
o Save, continue,
o Click on Edit -> Set Release.
5. Creating the Basic IDOC Object
o Go to T. code WE30
o Give obj. name as ZBAPI_STUD_IDOC
o Click on create
o Select create new radio button, give description and continue
o Select the IDOC obj name and click on create button
o Enter the segment name which is create earlier
o Select the check box if you want to make the segment mandatory
o Enter 1 in minimum number 99999 in maximum number, continue
o Save and back
o Click on Edit -> Set Release
6. Creating Customer Distribution Model
o Go to T. Code BD64
o Click on change and Create model view button
o Enter the short text and Technical name as ZSTUDENT
o Select the model and click on Add Message Type Button
o Give the Sender as STUD_S,
o Receiver as STUD_R,
o Message Type as ZBAPI_STUD_MAS
o Select the model view & click on Environment -> Generate Partner Profiles
o Select Transfer IDOC Immediately and Trigger Immediately radio buttons
o Click on Execute
o You should get a list in green color which means it executed successfully.
o Back to main screen, select the model view
o Click Edit->Model view->Distribute
o Click on continue
o You should get a list saying model view is distributed successfully.
7. Checking the Port
o Go to T. Code WE21
o Expand Transactional RFC
o Find the port from the list which is created using BD64 for STUD_R (Receiving system) RFC Destination.
8. Checking the Partner Profiles.
o Go to T. Code WE20
o Expand Partner Type LS
o Select the Partner profile STUD_R
o Double click on Message Type ZBAPI_STUD_MAS in Outbound parmtrs.
o Check Receiver Port is assigned correctly
o Check the Basic type as your Basic IDOC object.
9. Assigning the Message Type to Basic IDOC Object
o Go to T. Code WE82
o Click on Change & continue, New Entries button
o Give the Message type as ZBAPI_STUD_MAS
o Give Basic Type as ZBAPI_STUD_IDOC
o Release as 46C
o Save and back
10. Creating Inbound Function Module (Posting Program)
o Go to T. Code SE37
o Create a function Module IDOC_INPUT_ZBAPI_STUD_MAS
o Set the Processing type as Remote Enabled Module and mode as start immed, in Attributes Tab.
o Import Parameters
INPUT_METHOD LIKE BDWFAP_PAR-INPUTMETHD
MASS_PROCESSING LIKE BDWFAP_PAR-MASS_PROC
NO_APPLICATION_LOG LIKE SY-DATAR
MASSSAVEINFOS LIKE MASSSAVINF
o Export Parameters
WORKFLOW_RESULT LIKE BDWF_PARAM-RESULT
APPLICATION_VARIABLE LIKE BDWF_PARAM-APPL_VAR
IN_UPDATE_TASK LIKE BDWFAP_PAR-UPDATETASK
CALL_TRANSACTION_DONE LIKE BDWFAP_PAR-CALLTRANS
o Tables
IDOC_CONTRL LIKE EDIDC
IDOC_DATA LIKE EDIDD
IDOC_STATUS LIKE BDIDOCSTAT
RETURN_VARIABLES LIKE BDWFRETVAR
SERIALIZATION_INFO LIKE BDI_SER
o Exceptions
WRONG_FUNCTION_CALLED
o Source Code
DATA: FIRST_TRANC LIKE MARA_UEB-TRANC,
ZBAPI_STUD_SEG like zbapi_stud.
DATA: ZBAPI_STUD LIKE ZBAPI_STUD.
DATA: I_ZBAPI_STUD LIKE ZBAPI_STUD.
DATA: C_TRUE VALUE 'X'.
DATA: C_FALSE VALUE ' '.
DATA: BEGIN OF T_IDOC_ROLLNO OCCURS 0,
DOCNUM LIKE EDIDC-DOCNUM,
ROLLNO LIKE ZBAPI_STUD-ROLLNO,
END OF T_IDOC_ROLLNO.
DEFINE APPEND_RESFIELDS.
PERFORM APPEND_RES_FIELDS TABLES T_MFIELDRES
T_RES_FIELDS
USING &1
COUNTER-D_IND.
END-OF-DEFINITION.
DATA: I_MARA_UEB LIKE MARA_UEB.
DATA: I_ZSTUD_UEB LIKE ZBAPI_STUD.
DATA: I_MAKT_UEB LIKE MAKT_UEB.
DATA: I_MARC_UEB LIKE MARC_UEB.
DATA: I_MARD_UEB LIKE MARD_UEB.
DATA: I_MFHM_UEB LIKE MFHM_UEB.
DATA: I_MARM_UEB LIKE MARM_UEB.
DATA: I_MEAN_UEB LIKE MEA1_UEB.
DATA: I_MBEW_UEB LIKE MBEW_UEB.
DATA: I_STEU_UEB LIKE STEU_UEB.
DATA: I_STEUMM_UEB LIKE STEUMM_UEB.
DATA: I_MLGN_UEB LIKE MLGN_UEB.
DATA: I_MLGT_UEB LIKE MLGT_UEB. " //br010797 neu zu 4.0
DATA: I_MPGD_UEB LIKE MPGD_UEB.
DATA: I_MPOP_UEB LIKE MPOP_UEB.
DATA: I_MVEG_UEB LIKE MVEG_UEB.
DATA: I_MVEU_UEB LIKE MVEU_UEB.
DATA: I_MVKE_UEB LIKE MVKE_UEB.
DATA: I_MPRW_UEB LIKE MPRW_UEB.
DATA: I_LTX1_UEB LIKE LTX1_UEB.
DATA: HELP_MARC_UEB LIKE MARC_UEB.
DATA: T_MARA_UEB LIKE MARA_UEB OCCURS 0.
DATA: T_MAKT_UEB LIKE MAKT_UEB OCCURS 0.
DATA: T_MARC_UEB LIKE MARC_UEB OCCURS 0.
DATA: T_MARD_UEB LIKE MARD_UEB OCCURS 0.
DATA: T_MFHM_UEB LIKE MFHM_UEB OCCURS 0.
DATA: T_MARM_UEB LIKE MARM_UEB OCCURS 0.
DATA: T_MEAN_UEB LIKE MEA1_UEB OCCURS 0.
DATA: T_MBEW_UEB LIKE MBEW_UEB OCCURS 0.
DATA: T_STEU_UEB LIKE STEU_UEB OCCURS 0.
DATA: T_STEUMM_UEB LIKE STEUMM_UEB OCCURS 0.
DATA: T_MLGN_UEB LIKE MLGN_UEB OCCURS 0.
DATA: T_MLGT_UEB LIKE MLGT_UEB OCCURS 0. " //br010797 neu zu 4.0
DATA: T_MPGD_UEB LIKE MPGD_UEB OCCURS 0.
DATA: T_MPOP_UEB LIKE MPOP_UEB OCCURS 0.
DATA: T_MVEG_UEB LIKE MVEG_UEB OCCURS 0.
DATA: T_MVEU_UEB LIKE MVEU_UEB OCCURS 0.
DATA: T_MVKE_UEB LIKE MVKE_UEB OCCURS 0.
DATA: T_MPRW_UEB LIKE MPRW_UEB OCCURS 0.
DATA: T_LTX1_UEB LIKE LTX1_UEB OCCURS 0.
Internal fields/ tables
DATA: FLAG_ERROR_HAPPENED.
DATA: flag_material_exists. "//br210397 zu 4.0 keine Verwendung mehr
DATA: FLAG_EXIT_TO_BE_DONE.
DATA: HELP_TABIX LIKE SY-TABIX.
DATA: HELP_TRANC LIKE MARA_UEB-TRANC.
DATA: HELP_ALAND LIKE STEU_UEB-ALAND.
DATA: HELP_VKORG LIKE MVKE-VKORG.
DATA: HELP_WERKS LIKE T001W-WERKS.
DATA: HELP_LFDNR LIKE STEU_UEB-LFDNR.
DATA: LAST_MARC_TRANC LIKE MARA_UEB-TRANC.
DATA: LAST_MLGN_TRANC LIKE MARA_UEB-TRANC. " //br010797 neu zu 4.0
DATA: LAST_TEXT_TRANC LIKE MARA_UEB-TRANC.
DATA: CURRENT_TABIX LIKE SY-TABIX.
DATA: GENERAL_SUBRC LIKE SY-SUBRC.
DATA: HELP_FACTOR TYPE P DECIMALS 3.
DATA: USER_SEGMENTS LIKE EDIDD OCCURS 0 WITH HEADER LINE. " insert
DATA: CUST_SEGMENT LIKE EDIDD.
DATA: I_MFIELDRES LIKE MFIELDRES.
DATA: I_MERRDAT LIKE MERRDAT.
DATA: I_EDIDD LIKE EDIDD.
" //br neu zu 3.1g
DATA: T_RES_FIELDS LIKE DELFIELDS OCCURS 0 WITH HEADER LINE.
DATA: T_MFIELDRES LIKE MFIELDRES OCCURS 0.
DATA: T_MERRDAT LIKE MERRDAT OCCURS 0.
DATA: T_EDIDD LIKE EDIDD OCCURS 0.
DATA: BEGIN OF t_matnr OCCURS 0, "//br210397 zu 4.0
matnr LIKE mara-matnr, " wird nicht mehr verwendet
END OF t_matnr. "
DATA: BEGIN OF COUNTER,
TRANC LIKE MARA_UEB-TRANC,
D_IND LIKE MARA_UEB-D_IND,
END OF COUNTER.
DATA: BEGIN OF t_idoc_tranc OCCURS 0, " 4.0
docnum LIKE edidc-docnum, "
tranc LIKE mara_ueb-tranc, "
END OF t_idoc_tranc. "
DATA T_IDOC_TRANC LIKE MATIDOCTRANC OCCURS 0 WITH HEADER LINE."
DATA: FLAG_FITS.
DATA: APPLICATION_SUBRC LIKE SY-SUBRC.
DATA FLAG_MUSS_PRUEFEN LIKE SY-DATAR.
DATA MAX_ERRORS LIKE T130S-ANZUM. " 4.0
note 419281
DATA : FLG_MASS.
CLEAR : FLG_MASS.
FIELD-SYMBOLS: . " 4.0
ALE-distribution unity : IDOC status set by locking "note0361838
data: "note0361838
it_dsp_idocstat like bdidocstat "note0361838
occurs 0 with header line. "note0361838
Initialize data - general
REFRESH T_MFIELDRES.
REFRESH T_IDOC_TRANC.
REFRESH T_IDOC_TRANC. "JH/02.02.98/4.0C KPr100004993
REFRESH t_idoc_tranc_segment. " //br 40 : unnötig
REFRESH matnr_tranc. " -"-
REFRESH t_matnr.
COUNTER-TRANC = 1.
COUNTER-D_IND = 1.
REFRESH T_MARA_UEB.
REFRESH T_MAKT_UEB.
REFRESH T_MARC_UEB.
REFRESH T_MARD_UEB.
REFRESH T_MFHM_UEB.
REFRESH T_MARM_UEB.
REFRESH T_MEAN_UEB.
REFRESH T_MBEW_UEB.
REFRESH T_STEU_UEB.
REFRESH T_STEUMM_UEB.
REFRESH T_MLGN_UEB.
REFRESH T_MLGT_UEB. " //br010797 neu zu 4.0
REFRESH T_MPGD_UEB.
REFRESH T_MPOP_UEB.
REFRESH T_MVEG_UEB.
REFRESH T_MVEU_UEB.
REFRESH T_MVKE_UEB.
REFRESH T_MPRW_UEB.
REFRESH VKORG_ALAND.
REFRESH WERKS_ALAND.
CLEAR APPLICATION_SUBRC.
REFRESH T_MERRDAT.
Check if right function is called
READ TABLE IDOC_CONTRL INDEX 1.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
IF IDOC_CONTRL-IDOCTP <> 'ZBAPI_STUD_IDOC'.
RAISE WRONG_FUNCTION_CALLED.
ENDIF.
ENDIF.
LOOP AT IDOC_CONTRL.
Initialize data - per IDOC
t_idoc_tranc-docnum = counter-tranc.
T_IDOC_TRANC-DOCNUM = IDOC_CONTRL-DOCNUM.
T_IDOC_TRANC-FIRST_TRANC_IDOC = COUNTER-TRANC + 2.
APPEND T_IDOC_TRANC.
Select segments which belong to IDOC
REFRESH T_EDIDD.
LOOP AT IDOC_DATA WHERE DOCNUM = IDOC_CONTRL-DOCNUM.
APPEND IDOC_DATA TO T_EDIDD.
ENDLOOP.
BUSINESS TRANSACTION EVENT (header / data) "note0388000
call function 'OPEN_FI_PERFORM_MGV00200_E' "note0388000
exporting "note0388000
idoc_header = idoc_contrl "note0388000
FLG_APPEND_STATUS = 'X' "note0388000
tables "note0388000
(DEL) idoc_data = idoc_data "note0388000 note0418561
idoc_data = t_edidd "note0418561
idoc_status = idoc_status "note0388000
exceptions "note0388000
others = 1. "note0388000
if sy-subrc = 1. "note0388000
continue. "note0388000
endif. "note0388000
Within one IDOC: loop through data segments:
Prepare internal tables for the current material
LOOP AT T_EDIDD INTO IDOC_DATA.
Transform from CoreData to Normal Data if necesary
CASE IDOC_DATA-SEGNAM.
WHEN 'E1MARAC'.
*--COMMENTED BY SATISH
PERFORM MOVE_E1MARAC_TO_E1MARAM USING IDOC_DATA.
WHEN 'E1MAKTC'.
PERFORM MOVE_E1MAKTC_TO_E1MAKTM USING IDOC_DATA.
*--COMMENTES ENDED BY SATISH
WHEN 'ZBAPI_STUD_SEG'.
PERFORM MOVE_E1MARAC_TO_E1MARAM USING IDOC_DATA.
CLEAR I_ZBAPI_STUD.
Second: Move E1MARAC into E1MARAM
I_ZBAPI_STUD = IDOC_DATA-SDATA.
Third: Move E1MARAM back into IDOC-line
IDOC_DATA-SDATA = I_ZBAPI_STUD.
IDOC_DATA-SEGNAM = 'ZBAPI_STUD_SEG'.
ENDCASE.
CURRENT_TABIX = SY-TABIX.
COUNTER-D_IND = COUNTER-D_IND + 1.
COUNTER-TRANC = COUNTER-TRANC + 2.
CASE IDOC_DATA-SEGNAM.
WHEN 'ZBAPI_STUD_SEG'.
Initialize data - per material
COUNTER-D_IND = 1.
FIRST_TRANC = COUNTER-TRANC.
interpret segment
ZBAPI_STUD_SEG = IDOC_DATA-SDATA.
MOVE-CORRESPONDING ZBAPI_STUD TO I_ZSTUD_UEB.
T_IDOC_ROLLNO-DOCNUM = IDOC_CONTRL-DOCNUM.
T_IDOC_ROLLNO-ROLLNO = I_ZSTUD_UEB-ROLLNO.
APPEND T_IDOC_ROLLNO.
ENDCASE.
if not ZBAPI_STUD_SEG is initial.
ZBAPI_STUD-MANDT = ZBAPI_STUD_SEG-MANDT.
ZBAPI_STUD-ROLLNO = ZBAPI_STUD_SEG-ROLLNO.
ZBAPI_STUD-FNAME = ZBAPI_STUD_SEG-FNAME.
ZBAPI_STUD-LNAME = ZBAPI_STUD_SEG-LNAME.
INSERT ZBAPI_STUD FROM ZBAPI_STUD_SEG.
COMMIT WORK.
ENDIF.
*-- ALE ditribution unity : update IDOC status "note03618
LOOP AT it_dsp_idocstat. "note036
LOOP AT IDOC_STATUS WHERE DOCNUM = it_dsp_idocstat. "note036
DELETE idoc_status INDEX sy-tabix. "note036
ENDLOOP. "note036
APPEND it_dsp_idocstat TO idoc_status. "note036
ENDLOOP. "note036
*--GENERATING THE IDOC STATUS
PERFORM HANDLE_ERROR_EXT " //br40
TABLES "
IDOC_CONTRL "
IDOC_STATUS "
RETURN_VARIABLES "
T_MERRDAT "
T_IDOC_TRANC "
T_IDOC_ROLLNO "JH/4.0C/KPr100004993
USING "
GENERAL_SUBRC "
NO_APPLICATION_LOG "
MASSSAVEINFOS "wk/40c
CHANGING "
WORKFLOW_RESULT. "
PERFORM HANDLE_ERROR
TABLES
IDOC_CONTRL
IDOC_STATUS
RETURN_VARIABLES
T_MERRDAT
T_IDOC_ROLLNO "JH/4.0C/KPr100004993
USING
APPLICATION_SUBRC
CHANGING
WORKFLOW_RESULT.
SORT T_IDOC_ROLLNO BY ROLLNO. "note 315124
React on general error
DATA: I_MERRDAT LIKE MERRDAT.
IF GENERAL_SUBRC <> 0.
I_MERRDAT-MSGTY = 'E'.
I_MERRDAT-MSGID = SY-MSGID.
I_MERRDAT-MSGNO = SY-MSGNO.
I_MERRDAT-MSGV1 = SY-MSGV1.
I_MERRDAT-MSGV2 = SY-MSGV2.
I_MERRDAT-MSGV3 = SY-MSGV3.
I_MERRDAT-MSGV4 = SY-MSGV4.
APPEND I_MERRDAT TO T_MERRDAT.
ENDIF.
LOOP AT T_MERRDAT INTO I_MERRDAT
WHERE MSGTY = 'S' "success
OR MSGTY = 'D' "dummy
OR MSGTY = 'I' "Information " //br011097 zu 3.1I
OR MSGTY = 'H' "dummy " 4.0
OR MSGTY = 'W'. "warning
DELETE T_MERRDAT.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDFUNCTION.
*& Form handle_error_ext
FORM HANDLE_ERROR_EXT
TABLES
IDOC_CONTRL STRUCTURE EDIDC
IDOC_STATUS STRUCTURE BDIDOCSTAT
RETURN_VARIABLES STRUCTURE BDWFRETVAR
T_MERRDAT STRUCTURE MERRDAT
IDOC_TRANC STRUCTURE MATIDOCTRANC
JH/02.02.98/4.0C KPr100004993 (Anfang)
T_IDOC_ROLLNO STRUCTURE T_IDOC_ROLLNO
JH/02.02.98/4.0C KPr100004993 (Ende)
USING
GENERAL_SUBRC LIKE SY-SUBRC
NO_APPLICATION_LOG LIKE SY-DATAR
MASSSAVEINFOS LIKE MASSSAVINF
CHANGING
WORKFLOW_RESULT LIKE BDWF_PARAM-RESULT.
DATA FLAG_ERROR_HAPPENED.
DATA I_MERRDAT LIKE MERRDAT.
DATA IDOC_INDEX_2_SUBRC LIKE SY-SUBRC.
DATA AL_HANDLES TYPE BAL_T_LOGH. "//br99
SORT T_IDOC_ROLLNO BY ROLLNO. "note 315124
React on general error
IF GENERAL_SUBRC <> 0.
REFRESH T_MERRDAT.
i_merrdat-tranc = 0. " //br261197
READ TABLE IDOC_TRANC INDEX 1. " zu 40b
I_MERRDAT-TRANC = IDOC_TRANC-FIRST_TRANC_IDOC. "
I_MERRDAT-MSGTY = 'E'.
I_MERRDAT-MSGID = SY-MSGID.
I_MERRDAT-MSGNO = SY-MSGNO.
I_MERRDAT-MSGV1 = SY-MSGV1. I_MERRDAT-MSGV2 = SY-MSGV2.
I_MERRDAT-MSGV3 = SY-MSGV3. I_MERRDAT-MSGV4 = SY-MSGV4.
APPEND I_MERRDAT TO T_MERRDAT.
ENDIF.
DATA: C_TRUE,
C_FALSE VALUE 'X'.
If error happened ==> Rollback whole work....
LOOP AT T_MERRDAT INTO I_MERRDAT WHERE MSGTY NA 'SDHWI'.
EXIT.
ENDLOOP.
IF SY-SUBRC = 0.
FLAG_ERROR_HAPPENED = C_TRUE.
ROLLBACK WORK.
ELSE.
FLAG_ERROR_HAPPENED = C_FALSE.
ENDIF.
Set IDOC status
two cases:
single IDOC-processing: ==> error can be written in IDOC status
package processing ==> anononymous "package error" for all IDOCs
READ TABLE IDOC_CONTRL INDEX 2.
IDOC_INDEX_2_SUBRC = SY-SUBRC.
IF SY-SUBRC = 0.
IF 1 = 2. "//br40
MESSAGE E051(B1). "
ENDIF. "
CLEAR I_MERRDAT.
I_MERRDAT-MSGID = 'B1'.
I_MERRDAT-MSGTY = 'E'.
I_MERRDAT-MSGNO = '051'.
ENDIF.
IF IDOC_INDEX_2_SUBRC NE 0 OR FLAG_ERROR_HAPPENED = C_FALSE.
Nur in diesen Fällen wird Application Log geschrieben
Delete all Successes and Dummy records from t_merrdat
DELETE t_merrdat WHERE msgty = 'S' "success " testweise
OR msgty = 'D'. "dummy "
LOOP AT T_MERRDAT INTO I_MERRDAT WHERE MSGTY = 'D'. "
I_MERRDAT-MSGTY = 'S'. "
MODIFY T_MERRDAT FROM I_MERRDAT. "
ENDLOOP. "
ENDIF.
WORKFLOW_RESULT = 0.
LOOP AT IDOC_CONTRL.
Set IDOC status
CLEAR IDOC_STATUS.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IF FLAG_ERROR_HAPPENED = C_FALSE.
Application log
PERFORM WRITE_APPL_LOG TABLES IDOC_TRANC
T_MERRDAT
IDOC_STATUS
USING IDOC_CONTRL
FLAG_ERROR_HAPPENED
NO_APPLICATION_LOG
MASSSAVEINFOS
AL_HANDLES.
idoc_status-status = '53'. "OK!
APPEND idoc_status.
JH/02.02.98/4.0C KPr100004993 (Anfang)
Fill Return variables
CLEAR RETURN_VARIABLES.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
RETURN_VARIABLES-WF_PARAM = 'Processed_IDOCs'.
APPEND RETURN_VARIABLES.
Verknüpfungseintrag anlegen
READ TABLE T_IDOC_ROLLNO WITH KEY ROLLNO = IDOC_CONTRL-DOCNUM
BINARY SEARCH.
IF SY-SUBRC = 0.
RETURN_VARIABLES-DOC_NUMBER = T_IDOC_ROLLNO-ROLLNO.
RETURN_VARIABLES-WF_PARAM = 'Appl_Objects'.
APPEND RETURN_VARIABLES.
ENDIF.
JH/02.02.98/4.0C KPr100004993 (Ende)
ELSE.
IF IDOC_INDEX_2_SUBRC NE 0.
Application Log
PERFORM WRITE_APPL_LOG TABLES IDOC_TRANC
T_MERRDAT
IDOC_STATUS
USING IDOC_CONTRL
FLAG_ERROR_HAPPENED
NO_APPLICATION_LOG
MASSSAVEINFOS
AL_HANDLES.
ELSE.
IDOC_STATUS-MSGID = I_MERRDAT-MSGID.
IDOC_STATUS-MSGTY = I_MERRDAT-MSGTY.
IDOC_STATUS-MSGNO = I_MERRDAT-MSGNO.
IDOC_STATUS-MSGV1 = I_MERRDAT-MSGV1.
IDOC_STATUS-MSGV2 = I_MERRDAT-MSGV2.
IDOC_STATUS-MSGV3 = I_MERRDAT-MSGV3.
IDOC_STATUS-MSGV4 = I_MERRDAT-MSGV4.
IDOC_STATUS-STATUS = '51'. "ERROR!
APPEND IDOC_STATUS.
ENDIF.
Fill Return variables
CLEAR RETURN_VARIABLES.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
return_variables-wf_param = c_wf_par_processed_idocs.
RETURN_VARIABLES-WF_PARAM = 'Error_IDOCs'.
APPEND RETURN_VARIABLES.
WORKFLOW_RESULT = 99999.
ENDIF.
APPEND idoc_status.
ENDLOOP.
IF NO_APPLICATION_LOG IS INITIAL.
CALL FUNCTION 'BAL_DB_SAVE' "//br99
EXPORTING
I_IN_UPDATE_TASK = ' '
I_SAVE_ALL = ' '
I_T_LOG_HANDLE = AL_HANDLES.
EXCEPTIONS
LOG_NOT_FOUND = 1
SAVE_NOT_ALLOWED = 2
NUMBERING_ERROR = 3
OTHERS = 4.
CALL FUNCTION 'BAL_GLB_MEMORY_REFRESH' "//br99
EXPORTING
I_AUTHORIZATION =
I_REFRESH_ALL = ' '
I_T_LOGS_TO_BE_REFRESHED = AL_HANDLES.
EXCEPTIONS
NOT_AUTHORIZED = 1
OTHERS = 2
ENDIF.
ENDFORM. " handle_error
Save, check and activate
11. Assigning the Inbound Function Module to Basic Type & Message Type
o Go to T. Code WE57
o Click on change, continue, continue and New Entries Button
o Enter the Module as IDOC_INPUT_ZBAPI_STUD_MAS
o Type as F
o Basic Type as ZBAPI_STUD_IDOC
o Message Type as ZBAPI_STUD_MAS.
o Direction as 2
o Save and back
Now Login in 810 client
12. Assigning the Inbound Function Module in ALE Table
o Go to T. Code BD51
o Click on continue, New Entries button
o Give the Inbound Function Module IDOC_INPUT_ZBAPI_STUD_MAS
o Give Input t. as 0 (zero)
o Save and back
13. Creating Process Code
o Go to T. Code WE42
o Click on Change, New Entries Button
o Give Process Code name as ZSTUD, give Description & Save
o Select Processing with ALE Services Radio button
o Select Processing by Function Module Radio button
o Click the ALE Table (arrow Icon) in Identification
o Give the Function Module Name ZIDOC_INPUT_ZBAPI_STUD_MAS
o Give maximum number of repeats 0
o Save and back, back
o Select the process code from the list & click on Logical Messages Icon
o Give the Message Type as ZBAPI_STUD_MAS
o Save & Back, Save & Back, Save & Back
14. Changing the Customer Distribution model in Receiving system
o Go to T. Code BD64
o Click on change and Create model view button
o Select the model view & click on Environment -> Generate Partner Profiles
o Select Transfer IDOC Immediately and Trigger Immediately radio buttons
o Click on Execute
o You should get a list in green color which means it executed successfully.
15. Assigning the Process Code to Message Type in Receiving System
o Go to T. Code WE20
o Expand Partner Type LS
o Select the Partner Profile STUD_S
o Double click on Message Type ZBAPI_STUD_MAS in Inbound parmtrs.
o Give the Process Code as ZSTUD
o Click on Trigger Immediately Radio button
o Save & Back
o Save & Back
16. Creating the Selection Program (Outbound Program)
Login in client 800.
Go to T. Code SE38
Create a Report Program as ZSTUD_SEND with the following code
REPORT ZSTUD_SEND
NO STANDARD PAGE HEADING.
TABLES: ZBAPI_STUD.
DATA: IT_STUD LIKE ZBAPI_STUD OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-H01.
SELECT-OPTIONS: S_ROLLNO FOR ZBAPI_STUD-ROLLNO.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN:BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-H02.
PARAMETERS: P_MESTYP LIKE EDIDC-MESTYP,
P_RCVPRN LIKE TBDLST-LOGSYS.
SELECTION-SCREEN:END OF BLOCK B2.
SELECTION-SCREEN:END OF BLOCK B1.
START-OF-SELECTION.
PERFORM CREATE_STUDENT.
PERFORM CREATE_IDOC.
*& Form CREATE_STUDENT
sending student
FORM CREATE_STUDENT.
SELECT * FROM ZBAPI_STUD
INTO TABLE IT_STUD
WHERE ROLLNO IN S_ROLLNO.
ENDFORM. " CREATE_STUDENT
*& Form CREATE_IDOC
IDOC Creation
FORM CREATE_IDOC.
DATA : IMAS_DATA LIKE EDIDD OCCURS 10 WITH HEADER LINE,
IMAS_CON LIKE EDIDC OCCURS 10 WITH HEADER LINE,
ICOM_CON LIKE EDIDC OCCURS 10 WITH HEADER LINE.
IMAS_CON-RCVPRT = 'LS'.
IMAS_CON-RCVPRN = P_RCVPRN.
IMAS_CON-IDOCTP = 'ZBAPI_STUD_IDOC'.
IMAS_CON-MESTYP = P_MESTYP.
IMAS_CON-DIRECT = 1.
APPEND IMAS_CON.
LOOP AT IT_STUD.
IMAS_DATA-SEGNAM = 'ZBAPI_STUD_SEG'.
IMAS_DATA-SDATA = IT_STUD.
APPEND IMAS_DATA.
ENDLOOP.
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
MASTER_IDOC_CONTROL = IMAS_CON
OBJ_TYPE = ''
CHNUM = ''
TABLES
COMMUNICATION_IDOC_CONTROL = ICOM_CON
MASTER_IDOC_DATA = IMAS_DATA
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.
ENDIF.
COMMIT WORK.
LOOP AT ICOM_CON.
WRITE :/ 'IDOC: ', ICOM_CON-DOCNUM, 'CREATED SUCCESSFULLY'.
ENDLOOP.
ENDFORM. " CREATE_IDOC
17. Transferring the student records from 800 to 810 client
Execute Report Program ZSTUD_SEND
Give the Range of Roll Nos to Transfer
Give Message Type as ZBAPI_STUD_MAS
Give Receiver Logical system as STUD_R
Execute
You should get the IDOC Number
Take the IDOC Number and go to T. Code WE05 & Execute
In Outbox you can see the IDOC Status
Select the status record in left side window
Double click on the Status record in right side window
You can see the Control Record, Data Record and Status Records for that IDOC
If the ICON is green and the status code is 3, it means the IDOC is passed to PORT Successfully.
Now Login in 810 client
Go to T. Code WE05 & Execute
You can see the status record in left side window
If the status no is 53 and color is green, it means the IDOC is Posted to Application successfully.
You can see the Log Information by double clicking on the status record in right side window.
Now in left side window, you can see the Control Record, Data Record & Status Record of the IDOC
Now go to T. Code SE16
Give the table name ZBAPI_STUD & press F7
See the contents of the table
The table is updated with the students records transferred from 800 client with our selection program.
Reward if useful
Regrds
Jagadeesh.G -
Interaction between Distribution model, partner profile, etc.
Hello,
I am a newbie in the SAP world, and I am a little bit lost in the behavior of the Outbound Processing (the send of an IDoc to an external non-SAP system).
Actually my question is how the following components interact during an outbound process :
- RFC Destination
- Logical Port
- Logical System
- Partner Profile
- Distribution Model
- SAP Gateway
- IDOC Repository
- ALE Service
Currently, the only thing I think I have really understood is that the RFC Destination allows to hide to SAP the Program ID of the registered external server...
Thanks a lot
SebastienFor each logical system and each basic message type (for example, LOIBOM), a unique message type has to be defined by reducing the original one (for example, MYBOM).
If you reduce a message type, only the obligatory fields are automatically selected. You must select those segments and fields you want to have transferred. Fields that have not been selected for transfer always contain the value "/".
Maintain partner profile
Each of the message types of the customer distribution model (see above) must be assigned to the partner profile. Enter the receiver port (see above), package size, output mode and IDoc type in the detail screen of the receiver port. You must also define whether the IDocs should be sent immediately, or if they should be collected first.
Maintain customer distribution model directly
First define a customer model for a logical R/3 system. The displayed list shows which logical system is the sender and all the possible receiving systems that have been defined. "Create message type" defines which logical system receives information from the logical R/3 system.
When maintaining the customer distribution model, you usually add all (reduced) message types that should be sent from the R/3 system to the external system. -
ALE: how do I use dependent distribution for customer and vendor addresses?
Hello SDN'ers
Hopefully someone can help me with an ALE question.
We have two ERP systems connected with ERP - Retail and AFS.
Customers and Vendors may be created in Retail, and are distributed to AFS using DEBMAS, CREMAS and ADRMAS messages.
Not all customers and vendors are required in AFS, so we have various filters set up in the Retail distribution model (BD64).
However with the filters in place, addresses were still being distributed for customers and vendors that had been filtered out.
To try and avoid this for vendors, we created a filter group for AddressOrg.SaveReplica in receiver determination. In the filter group we selected Dependent Distribution for CREMAS (Address owner object).
This works perfectly for vendors - vendor addresses are now only distributed if the vendor itself is distributed.
However I've now discovered it is preventing any customer addresses from being sent! I was surprised about this: I expected CREMAS dependency to only affect vendor addresses. Can someone tell me:
- is this how dependent distribution is designed to work? In which case can anyone offer any suffestions to achieve the filtering some other way?
- or are we doing something wrong to be getting this result?
Thanks for any help!
regards, RogerHi all,
as Robert suggested, I've written an exit to get round this, although I'm surprised I should need to!
What I did was to code an enhancement in function group BDBF, at the start of subroutine COMPUTE_LOGIC_EXPRESSION.
* In the case of addresses, dependencies should only be applied for the appropriate type of address
data: lwa_tbd14 type tbd14.
if P_MODEL_DATA-FTYPE = C_FTYPE_DEPENDENCY_FROM_MESTYP.
* Dependency from Message Type.
* Read the Address Object type
READ TABLE P_FILTER_VALUES
WITH KEY OBJTYPE = 'AD_OBJTYPE'
BINARY SEARCH.
if sy-subrc = 0.
* Check if the Message Type is linked to the Address Owner Object Type
* (Table is buffered on DB)
select single *
from TBD14
into lwa_tbd14
where MESTYP = P_MODEL_DATA-FMESTYP
and OBJTYP = P_FILTER_VALUES-OBJVALUE.
if sy-subrc <> 0.
* Wrong type of address for this dependency - stop here
P_REPLICATE = c_true.
exit.
else.
* Correct address type. Standard processing continues, checking any
* filter values set up against the Address Owner Object Type.
endif.
else.
* It isn't an address - continue with standard processing
endif.
endif.
Let me know if this helps you, or if you know of a better way to achieve the same result.
Roger -
Error On Distribution Model in the Backend
Hello,
I'm customizing our SRM and Backend to work together.
I'm in the part Distribution Model. It works on SRM but on my backend, when I want to "Generate Partner" I have a message "No messages have been defined for the selection conditions in the model" and nothing is done.
I don't know why...
I don't know if it is link but me RFC connexion that I created on SRM to link to the backend name for example ABC_020 and in the backend is one RFC is ABCMAND020. doesn't it matter if they don't have the same name?
Thanks in advance.
If someone has a cookbook or documentation about SRM can you please send me at "[email protected]"
Thanks twice.Hi Eileen,
We have observed that without local RFCs i.e.
SRM to SRM
R/3 to R/3
the business objects (matl/services) don't get replicated as you can not configure the Middleware sites in SMOEAC.
Don't know whether it will help for Distribution model but worth trying
BR
Dinesh
<b>Reward if helps</b> -
I have Mac with Lion, with an AIrport Extreme wi-fi network. I am trying to configure a Airport (model A1264) to extend the network. I read the Apple article on how to configure an extended network. Unfortunately my Airport Utility seems to have none of the functionality mentioned in the article. The article states to choose manual configuration of the base station. I can find no such option in my Airport Utility. Secondly, it the article states to check "create a wireless network," which I can find, but then says to check box to "allow this network to be extended." No such option appears anywhere in my Airport Utility. Lastly, my Mac is not even recognizing the existence of the Airport Express. It does not even appear as a wireless device, nor does it appear in Airport Utility as an "Other Airport Base Stations. It does however continue to flash amber. Does anyone know what might be the problem?
Thanks,
bmarrI read the Apple article on how to configure an extended network. Unfortunately my Airport Utility seems to have none of the functionality mentioned in the article.
The article was written a few years ago and Lion 10.7.4 was not around at the time.
I suggest that you download and install the full featured version of AirPort Utility 5.6 for Mac OS X Lion . I think you will find that it will track with the article (if it is the one that I think it is) very nicely.
You can keep both AirPort Utility 5.6 and AirPort Utility 6.0 on your Mac. -
Hi All,
I have a very basic question regarding Distribution model.
My scenario is IDOC-->File ( SAP R/3 --> XI). So all I am trying to do is send the IDOC frrom R/3 to XI. ( Within XI I am going to do an FTP to the 3rd party file server)
I have created a distribution model, but was wondering if I really need to create one as message is going from R/3 to XI and not from R/3 to another R/3.
Please help let me know If I need to distribute this model to XI or to SAP production sytem or I do not need to duistribute at all for this scenario.
Thanks
ShirinHi,
if you create partner profiles and port via t.code.
i hope, it's not required to maintain Distribution model.
please check the below points.
Configuration Steps for Idoc to File Scenario.
This is complete step by step document for configuring the idoc to file scenario along with ALE Settings
To Configure the IDOC TO FILE SCENARIO, SETTINGS IN SAP-XI
STEP 1:ALE SETTINGS IN SAP-XI
We need to do the following settings in XI
1) Create an RFC Destination to the Sending System in transaction code (SM59)
a) Choose create
b) Specify the name of the RFC destination
c) Select connection type as 3 and save
d) In the technical settings tab enter the details SAP SID/URL and system number#
e) Enter the Gateway host as same details above SID/URL
f) Gateway service is 3300+system number#
g) In the Logon /Security tab, enter the client user & Password details of Destination system
h) Test the connection and remote logon.Both should be succesful
2) Create Port Using Transaction Code IDX1
a) Select create new button
b) Enter the port name as SAP+SID (The starting char should be SAP)
c) Enter the destination client
d) Enter the RFC Destination created in SAP R/3 towards other system
e) Save
3) Load Meta Data for IDOC Using transaction Using Transaction (IDX2)
a) Create new
b) IDOC Message Type
c) Enter port created in IDX1
SETTINGS IN SAP R/3
We need to do the following settings in R/3
Logon to Sap R/3 System
1) ALE SETTINGS TO POST IDOC OUT OF SAP-R/3 ***********************************************************************
a) Create RFC Destination using T.code in SM59.
b) Specify the name of the RFC destination
c) Select connection type as 3 and save
d) In the technical settings tab enter the details SAP SID/URL and system number#
e) Enter the Gateway host as same details above SID/URL
f) Gateway service is 3300+system number#
g) In the Logon /Security tab, enter the client user & Password details of Destination system
h) Test the connection and remote logon.Both must be succesful
2) Create communication Port for Idoc processing Using Transaction(We21)
a) First Select Transactional RFC and then click create button
b) Enter the destination port name as SAP+SID (The starting char should be SAP)
d) Enter the RFC Destination created in SAP R/3 towards other system.
e) Save
3) Create Partner Profile with Outbound Parameters (WE20)
a) Create New
b) Create the Partner no. name as same the logical system name of the destination system
c) Select Partner type LS
d) Enter details for Type: US/USER, Agent, and Lang
Then Save
e) Select Partner no. and LS which were create above
f) Now we have to give some Outbound Parameters.So click on ADD TO Create Outbound Parameter
g) Select Message type
h) Double click on Message Type and Then Enter the details for Receiving port, Pack size=1 and Basic type
I) save
4) In Transaction SALE, Create Logical System
a). Go to Basic Settings-> First Define logical systems
and then assign logical systems
b) Double click on Define the logical systems
c) Give data for your Logicaal System and Name
d) Now click on Save.Here one window may appear just click on Continue.Now the Logical System name is ready
e) Assign the logical system name to the client
5) Create Customer Distribution model in the transaction code BD64
1) Click on the Create modal View button and enter the short text, Technical name etc as shown below
2) Now select the created model view and click on Add message type button .A pop up box appears, enter Sending system, receiving system and message type
3) Save the Distribution model
Generate Partner Profiles
Click on Menu Item u2018Generate Partner Profilesu2019
It leads to the next transaction where in the selection screen you have to provide Model view name, Partner System logical system and execute
Then, you will be intimated about the partners, port creation, and outbound parameters creation
4) Distribute Customer Distribution Model
In the menu item GO to Edit->Modal View-> u2018Distributeu2019 to the destination client
Popup window appears ,press Enter
You will be intimated about the the Modal View Distributed
warm regards
mahesh. -
hi,
in the ale interface, why some processes no distribution model and some need distribution model?
for example of processes no distribution model:
billing from sender system to create vendor invoice in receiver system using invoic message type.
or create purchase order in receiving system or any other processes.
they make use of partner profile to post/send immediately/backgrd.
wish to have advice.
thanks
rgdsHi,
Could you please explain your query correctly?
Generally speaking the Distribution Model determines which messages are distributed to which logical systems. If you say like, there are two systems exchanging business between each other, then there has to be BAPI-based distribution of data between them. And one more common feature we can observe under the Distribution Model is that it is meant to find out the number of recipients willing to receive the business documents.
For ex: Let us consider your example: Billing from Sender System to create the vendor invoice in the receiving system using INVOICE message type.
Under this process, there could be multiple receivers who would be looking for Billing documents, but for some of the recipients it is filtered with message type INVOICE and for some, it is filtered with some other message type. Or they might not be needing the receipt of the message type.
The use of Distribution Model is all requirement dependent.
Regards,
-Syed. -
How do I manually configure a Timecapsule after having restored it to original settings?
I have been experiencing very slow wifi speeds over my wireless and having done some research on the topic, many suggest that completely eliminating previous settings by restoring the Timecapsule and manually reconfiguring it may help. I have tried to do this, but despite changing the setting to "manually configure" in the hardware settings in the airport utility, every time I restore Timecapsule and begin to configure it, it tells me that it is reading the settings from the base station.
In addition, despite removing the check mark from the "remember previously joined networks" in airport utility, it still lists my previous SSID in the list of networks.
Since the wireless speed hasn't improved at all (in fact, it has deteriorated some) I am afraid the old set ups are still there and slowing things down. How can I completely remove all previous settings from my Timecapsule, my airport express and the airport utility software and start from scratch?
Thanks.How can I completely remove all previous settings from my Timecapsule, my airport express and the airport utility software and start from scratch?
There are two parts to this answer. The first relates to performing a Factory Default Reset separately on the Time Capsule and AirPort Express. This will erase the current network settings and return them to default values. This will not affect any backups that you may have stored on the Time Capsule disk. ***
Use the information in this Apple support document for that:
Resetting an AirPort Base Station or Time Capsule FAQ
Part two would be to delete the previous wireless settings on your iMac. Here's how:
Open System Preferences (gear icon on the dock)
Open Network
Open Wi-Fi or AirPort
Click Advanced at the lower right of the window
Click on the name of a wireless network that you no longer need to highlight it
Click the - (minus) button at the bottom of the list to delete it
Do the same for other networks that you no longer need
Click OK, then click Apply
Open Macintosh HD > Applications > Utilities > KeyChain Access
Click on the name of a wireless network that you want to delete to highlight it
Click the Delete key on your keyboard
Do the same for other networks that you no longer need
Close KeyChain Access
*** If you need to erase the Time Capsule disk completely, post back for additional instructions. We need to know which version of AirPort Utility you are using to provide specific details. -
Error while generating Distribution Model in ERP to EWM
I am trying to generate new distribution Model from ERP to EWM for my warehouse.
In system one distribution Model already exists for another warehouse. Below error encountered.Hi Suraj,
Thanks for the answer
Yes i was using the Wrong Distribution Model , I should have selected EWM , but i was giving some new name as i thought that was required. Hence message came.
I did with EWM distribution Model and all worked well.
Thanks
Inder -
Hi,
i m leaning JTable recently, following is an experimental code which i wrote, it has a custom table model and custom tablecellrenderer, the custom tablecellrender determine the column of # of Years greater or equal than 5 should display color green, less than 5 should display color red, it works well, however, the custom table model should be smart enough to know that the # of Years column contains numbers (which should generally be right aligned and have a particular format), it also should know that the Vegetarian column contains boolean values, which can be represented by check boxes, but it didn't, i don't know why, i have implement a getColumnClass method,
but it seems not work, have i make any mistakes? Any idea? Thanks
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.UIManager;
import java.awt.Color;
import java.util.Vector;
public class CellRenderTestVector extends JFrame {
protected JTable table;
protected int width = 100;
protected MyCustomTableModel model;
public CellRenderTestVector() {
JPanel pan0 = new JPanel(new BorderLayout());
Container contentPane = getContentPane();
pan0.setPreferredSize(new Dimension(500,200));
model = new MyCustomTableModel();
table = new JTable();
table.setAutoCreateColumnsFromModel(false);
table.setModel(model);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
TableColumn column = null;
for (int i = 0; i < model.getColumnCount(); i++) {
DefaultTableCellRenderer renderer = new
ColoredTableCellRenderer();
column = new TableColumn(i,
width, renderer, null);
table.addColumn(column);
TableColumn t_column = table.getColumnModel().getColumn(2);
System.out.println(table.getColumnModel());
JScrollPane scrollPane = new JScrollPane(table);
pan0.add(scrollPane, BorderLayout.CENTER);
contentPane.add(pan0);
public class ColoredTableCellRenderer extends DefaultTableCellRenderer {
public void setValue(Object value) {
Color m_color;
Color GREEN = new Color(0, 128, 0);
Color RED = Color.red;
if (value instanceof Integer) {
Integer m_data = (Integer)value;
m_color = m_data.intValue() >= 5 ? GREEN : RED;
setForeground(m_color);
setText(m_data.toString());
else {
super.setValue(value);
public class Columndata {
protected String m_title;
public Columndata(String title) {
m_title = title;
public class Rowdata {
protected String fname;
protected String lname;
protected String sport_type;
protected Integer no_year;
protected Boolean vegetarian;
public Rowdata(String fn, String ln,
String sp, int ny, boolean vg) {
fname = fn;
lname = ln;
sport_type = sp;
no_year = new Integer(ny);
vegetarian = new Boolean(vg);
public class MyCustomTableModel extends AbstractTableModel {
protected final Columndata m_column[] =
{new Columndata("First Name"),
new Columndata("Last Name"),
new Columndata("Sport"),
new Columndata("# of Years"),
new Columndata("Vegetarian")
protected Vector m_vector;
public MyCustomTableModel() {
m_vector = new Vector();
setDefaultData();
public void setDefaultData() {
m_vector.removeAllElements();
m_vector.addElement(new Rowdata("Mary", "Campione",
"Snowboarding", 5, false));
m_vector.addElement(new Rowdata("Alison", "Huml",
"Rowing",3,true));
m_vector.addElement(new Rowdata("Kathy", "Walrath",
"Knitting",2, false));
m_vector.addElement(new Rowdata("Sharon", "Zakhour",
"Speed reading",20,true));
m_vector.addElement(new Rowdata("Philip", "Milne",
"Pool",10,false));
public int getColumnCount() {
return m_column.length;
public int getRowCount() {
return m_vector==null ? 0 : m_vector.size();
public String getColumnName(int col) {
return m_column[col].m_title;
public Object getValueAt(int nRow, int nCol) {
if (nRow < 0 || nRow>=getRowCount()) return "";
Rowdata row = (Rowdata)m_vector.elementAt(nRow);
switch (nCol) {
case 0: return row.fname;
case 1: return row.lname;
case 2: return row.sport_type;
case 3: return row.no_year;
case 4: return row.vegetarian;
return "";
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
public static void createAndShowGUI() {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception evt) {}
JFrame f = new CellRenderTestVector();
f.setTitle("TableTest");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}You need to write your custom TableCellRenderes/Editors for each type. And don't forget to register your custom renderes via myTable.setDefaultRendere().
-
JTable: Custom Table Model (pI)
This is a follow-up to thread http://forum.java.sun.com/thread.jspa?threadID=725162 and thread http://forum.java.sun.com/thread.jspa?threadID=725158.
As I'm hoping to have a table of 5 columns, where the 4th and 5th columns are for integer and float data types respectively, I am creating a custom table model under the assumption that I will not know beforehand the number of rows the table will contain.
Problems? Having not specified the cell contents of the table, since it will be pupulated by users unknown to me, I did not declare or initialize a variable similar to TableDemo's data variable of type Object (see the TableDemo tutorial http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/TableDemo.java). As such, I am unable to specify the return parameters for the getRowCount() and getValueAt(~, ~) methods.
To overcome this, I sought to replicate the example shown in TableDemo by doing the following:
Object[][] cell = {"", "", "", new Integer(0), new Float(0.00f)};
public int getRowCount()
returncell.length;
public Object getValueAt(int row, int column)
return cell[row][column];
//...I got the following errors:
pathname\CustomTableModel.java:line #: incompatible types
found: java.lang.String
required: java.lang.Object[]
and the errors continue...
So I tried
Object[] cell = {"", "", "", new Integer(0), new Float(0.00f)};
// ...However, I got this error:
C:\...\CustomTableModel.java:line #:array required, but java.lang.String found
return cell[row][column];
.......................... ^
I just want to set the return parameters for getRowCount() and getValueAt(~,~) in the custom table model I'm creating. How do I do this?
Cheers!
PS Thanks for reading this far...I decided to use the DefaultTableModel, after all. I was using it before, but at the time, i didn't know that certain things I wanted to accomplish, it could too.
Anyways, here's what I have been doing: http://forum.java.sun.com/thread.jspa?threadID=725861
Thanks nonetheless for your help. And by the way, my client is adamant that I use a LinkedList, rather than a Vector for this project. But nevertheless, thanks.
Maybe you are looking for
-
How to delete photos that are "saved images" on iphone 5?
No iCloud Win7 Professional iPhone says 1631 pix, 88 vids, and 12GB Camera roll says 773 photos, 9 vids iTunes says 1719 pix, along with 12 GB used I have individually deleted massive numbers of pix. Not a problem; just can't get rid of the "remnant
-
How do i reset my admin password without losing all of my data?
i have just got a macbook pro from kijiji and the seller and i both don't know the admin password. how do i reset it without losing evrything?
-
Publising only 1 of many sites
Hello All! I have created multiple sites using iWeb - as I can easily publish material that I don't want to go to .Mac to its own folder and upload it through a separate ftp server. Even though I created multiple sites, I want 1 of my 3 iWeb sites to
-
Preimere Elements 10 Crash issue
Basically on the admin account it installs and works fine but when other users ( on school network ) try to start it its crashes. this is the log we get. [Moved to the Elements forum and log deleted.]
-
Can only see a few emails on iphone
Mac Mail is my email client. When I use my iphone 5S to search for an old email, it is very limited and does not allow me to go back very far. How can I increase the number of emails to look at it in the inbox, and also how can I search back farther?