Redundant Code / Unused Transactions
Hi
I am looking for any custom program developed to get list of all redundant code and unused objects.
Would appreciate if you can help can be provided.
thanks
Moderator message: duplicate post locked.
Edited by: Thomas Zloch on Nov 3, 2011 9:51 PM
Hi
U can use the statistics (transaction ST03N or STAD) in order to know which programms and/or transactions are usually used.
But I don't know if it's possible to create a rule in order to understand if an abap code is redundant
Max
Similar Messages
-
Make a G/L account code (with transaction history) as control account
Hi,
Currently G/L account code = 10001 is not control account at the beginning.
It had few transaction records with this account code, however I had try to make adjustment so that the balance become "0"
But when I try to check box on the control account, it doesn't work.
So just wonder is it possible to make a account code with transaction history to become a control account?
ThanksHi
You can't be change the code after transaction.
Because it's stored in transaction history.
Even after if your account balance is zero.
Thanks
Mohammad Imran -
How to calculate no.of records for a specific company Code and Transaction
Hi All,
Could you please help me how to calculate or count no.of records, in a table which are having a specific Company Code and Transaction Code and populate in an output table displaying that these many records are present for this company code and Transaction code.
The table is having the data like this:
LOB TRAN CODE COUNT
X1 1
X1 2
X1 3
X1 4
F1 NB 5
F1 NB 6
F1 NB 7
F1 NB 8
F1 NB 9
F1 NB 10
F1 NB 11
F1 NB 12
F1 NB 13
F1 NB 14
F1 NB 15
F1 NB 16
F1 NB 17
F1 NB 18
F1 NB 19
F1 NB 20
F1 NB 21
F1 NB 22
F1 NB 23
F1 24
F1 25
F1 26
F1 27
In the above table there are totally 27 records,where as the no.of records with F1 as company code and NB as transaction code are 18..so i have to display like F1 NB and 18 as one record as output.
Thanks and Regards,
JohnyYou can go for Control Breaks for your requirement.
First sort the internal table by company code and transaction. Declare a counter variable.
Now loop the internal table and increment the counter variable. within the loop use AT END OF tcode.......ENDAT. Within the control break append the counter variable as well as the company code and tcode to some other ITAB and clear the counter.
This will give you the total number of records for a combination of co code and tcodes.
This will be a good reference for your requirement. What I am doing here is, for each Vendor i am calculating total number of deliveries and amounts for that vendor. For every new vendor i am writing the ouput on to a list and clearing the counter variables.
LOOP AT t_vend_prod_grp INTO fs_vend_prod_grp.
w_total_delv = w_total_delv + 1.
w_total_amt = w_total_amt + fs_vend_prod_grp-dmbtr.
AT NEW matkl.
w_mat_grp = fs_vend_prod_grp-matkl.
* To display the material group and the header texts for the data
* grouped by material group and vendor.
SKIP 1.
WRITE: text-mtk COLOR COL_HEADING
INTENSIFIED,
/ w_mat_grp COLOR COL_NORMAL
INTENSIFIED OFF.
SKIP 1.
FORMAT COLOR COL_HEADING ON INTENSIFIED.
ULINE 1(54).
WRITE:/ sy-vline,
2 text-ven,
12 sy-vline,
text-dlv,
26 sy-vline,
38 text-amt,
sy-vline,
46 text-cur,
54 sy-vline.
ULINE /1(54).
FORMAT COLOR COL_HEADING OFF INTENSIFIED.
ENDAT. " AT NEW MATKL
AT END OF lifnr.
* To display the actual data for the grouping based on Material group
* and Vendor.
FORMAT COLOR COL_NORMAL ON INTENSIFIED OFF.
WRITE: / sy-vline,
2 fs_vend_prod_grp-lifnr COLOR COL_KEY,
12 sy-vline,
w_total_delv,
26 sy-vline,
w_total_amt CURRENCY text-usd,
sy-vline,
46 text-usd,
54 sy-vline.
FORMAT COLOR COL_NORMAL OFF INTENSIFIED OFF.
CLEAR: w_total_amt,
w_total_delv.
ENDAT. " AT END OF LIFNR
ENDLOOP. " LOOP AT T_VEND_PROD_GRP -
Hi all,
Can anyone of you provide me complete BDC code for Transaction XD01.
An early reply will be highly appreciated and would be rewarded.
Regards,
NeerajHi Prakash
hope this code will help you.
ABAP BDC SAMPLE CODE XD01
Table/Structure declarations. *
TABLES : KNA1. "Customer master
Constants declarations. *
CONSTANTS : C_MODE VALUE 'A',
C_UPDATE VALUE 'S',
C_X VALUE 'X',
C_SESS TYPE APQI-GROUPID VALUE 'ZCUSTOMER', "Session Name
C_XD01 LIKE TSTC-TCODE VALUE 'XD01'.
Variable declarations. *
DATA : V_FNAME(15) VALUE SPACE, " Name of file to be created
V_FAILREC TYPE I, " No of failed records
V_MSG(255), " Message Text
V_ERRREC TYPE I, " No of failed records
V_LINES TYPE I, " No of records
V_BANKS(15), " Table column BANKS
V_BANKL(15), " Table column BANKL
V_BANKN(15), " Table column BANKN
V_TIDX(2) TYPE N. " Table row index
*-- FLAG DECLARATIONS
DATA : FG_DATA_EXIST VALUE 'X', " Check for data
FG_SESSION_OPEN VALUE ' '. " Check for Session Open
*-- MACRO DEFINITIONS
*-- Macro for BANKS
DEFINE BANKS.
CLEAR V_BANKS.
CONCATENATE 'KNBK-BANKS(' &1 ')' INTO V_BANKS.
CONDENSE V_BANKS.
END-OF-DEFINITION.
*-- Macro for BANKL
DEFINE BANKL.
CLEAR V_BANKL.
CONCATENATE 'KNBK-BANKL(' &1 ')' INTO V_BANKL.
CONDENSE V_BANKL.
END-OF-DEFINITION.
*-- Macro for BANKN
DEFINE BANKN.
CLEAR V_BANKN.
CONCATENATE 'KNBK-BANKN(' &1 ')' INTO V_BANKN.
CONDENSE V_BANKN.
END-OF-DEFINITION.
Structures / Internal table declarations *
*-- Structure to hold BDC data
TYPES : BEGIN OF T_BDCTABLE.
INCLUDE STRUCTURE BDCDATA.
TYPES END OF T_BDCTABLE.
*-- Structure to trap BDC messages
TYPES : BEGIN OF T_MSG.
INCLUDE STRUCTURE BDCMSGCOLL.
TYPES : END OF T_MSG.
*-- Structure to trap ERROR messages
TYPES : BEGIN OF T_ERR_MSG,
MESSAGE(255),
END OF T_ERR_MSG.
*--Internal table to store flat file data
DATA : BEGIN OF IT_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
KTOKD LIKE T077D-KTOKD,
NAME1 LIKE KNA1-NAME1,
SORTL LIKE KNA1-SORTL,
ORT01 LIKE KNA1-ORT01,
PSTLZ LIKE KNA1-PSTLZ,
LAND1 LIKE KNA1-LAND1,
SPRAS LIKE KNA1-SPRAS,
LZONE LIKE KNA1-LZONE,
END OF IT_KNA1.
*--Internal table to store bank details
DATA : BEGIN OF IT_BANK OCCURS 0,
BANKS LIKE KNBK-BANKS,
BANKL LIKE KNBK-BANKL,
BANKN LIKE KNBK-BANKN,
END OF IT_BANK.
*-- Internal table to hold BDC data
DATA: IT_BDCDATA TYPE STANDARD TABLE OF T_BDCTABLE WITH HEADER LINE,
*-- Internal Table to store ALL messages
IT_MSG TYPE STANDARD TABLE OF T_MSG WITH HEADER LINE,
*-- Internal Table to store error messages
IT_ERR_MSG TYPE STANDARD TABLE OF T_ERR_MSG WITH HEADER LINE.
Selection Screen. *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_FLNAME(15) OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R_LIST RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN COMMENT 5(20) TEXT-003.
PARAMETERS : R_SESS RADIOBUTTON GROUP GRP1.
SELECTION-SCREEN COMMENT 30(20) TEXT-004.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
Event:Initialization *
INITIALIZATION.
AT Selection Screen. *
AT SELECTION-SCREEN.
Event: Start-of-Selection *
START-OF-SELECTION.
V_FNAME = P_FLNAME.
PERFORM GET_DATA.
PERFORM GET_BANKDATA.
PERFORM GENERATE_DATASET.
Event: End-of-Selection *
END-OF-SELECTION.
IF FG_DATA_EXIST = ' '.
MESSAGE I010 WITH TEXT-009.
EXIT.
ENDIF.
PERFORM GENERATE_BDCDATA.
PERFORM DISPLAY_ERR_RECS.
Event: top-of-page
TOP-OF-PAGE.
FORM DEFINITIONS *
*& Form get_data
Subroutine to get the data from mard
--> p1 text
<-- p2 text
FORM GET_DATA.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\XD01.TXT'
FILETYPE = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = IT_KNA1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 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.
ENDIF.
IF IT_KNA1[] IS INITIAL.
FG_DATA_EXIST = ' '.
ENDIF.
ENDFORM. " get_data
*& Form GENERATE_DATASET
text
--> p1 text
<-- p2 text
FORM GENERATE_DATASET.
MESSAGE I010 WITH 'OPENING FILE IN APPLICATION SERVER'.
**--Creating a data set in application server
OPEN DATASET V_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
**---Transfering data from internal table to dataset
MESSAGE I010 WITH 'TRANSFERING DATA FROM INETERAL TABLE TO THE FILE'.
LOOP AT IT_KNA1.
TRANSFER IT_KNA1 TO V_FNAME.
ENDLOOP.
**--Closing the dataset
MESSAGE I010 WITH 'CLOSING THE FILE'.
CLOSE DATASET V_FNAME.
ENDFORM. " GENERATE_DATASET
*& Form BDC_DYNPRO
text
-->P_0467 text
-->P_0468 text
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR IT_BDCDATA.
IT_BDCDATA-PROGRAM = PROGRAM.
IT_BDCDATA-DYNPRO = DYNPRO.
IT_BDCDATA-DYNBEGIN = 'X'.
APPEND IT_BDCDATA.
ENDFORM.
*& Form BDC_FIELD
text
-->P_0472 text
-->P_0473 text
FORM BDC_FIELD USING FNAM FVAL.
IF NOT FVAL IS INITIAL.
CLEAR IT_BDCDATA.
IT_BDCDATA-FNAM = FNAM.
IT_BDCDATA-FVAL = FVAL.
APPEND IT_BDCDATA.
ENDIF.
ENDFORM.
*& Form GENERATE_BDCDATA
text
--> p1 text
<-- p2 text
FORM GENERATE_BDCDATA.
REFRESH IT_KNA1.
Opening dataset for reading
OPEN DATASET V_FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
Reading the file from application server
DO.
CLEAR: IT_KNA1,IT_BDCDATA.
REFRESH IT_BDCDATA.
READ DATASET V_FNAME INTO IT_KNA1.
IF SY-SUBRC <> 0.
EXIT.
ELSE.
Populate BDC Data for Initial Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0100',
BDC_FIELD USING 'BDC_CURSOR' 'RF02D-KUNNR',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'RF02D-KUNNR' IT_KNA1-KUNNR,
BDC_FIELD USING 'RF02D-KTOKD' IT_KNA1-KTOKD.
Populate BDC Data for Second Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0110',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NAME1',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'KNA1-NAME1' IT_KNA1-NAME1,
BDC_FIELD USING 'KNA1-SORTL' IT_KNA1-SORTL,
BDC_FIELD USING 'KNA1-ORT01' IT_KNA1-ORT01,
BDC_FIELD USING 'KNA1-PSTLZ' IT_KNA1-PSTLZ,
BDC_FIELD USING 'KNA1-LAND1' IT_KNA1-LAND1,
BDC_FIELD USING 'KNA1-SPRAS' IT_KNA1-SPRAS.
Populate BDC Data for Third Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0120',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-LZONE',
BDC_FIELD USING 'BDC_OKCODE' '/00',
BDC_FIELD USING 'KNA1-LZONE' IT_KNA1-LZONE.
Populate BDC Data for Fourth Screen
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0125',
BDC_FIELD USING 'BDC_CURSOR' 'KNA1-NIELS',
BDC_FIELD USING 'BDC_OKCODE' '/00'.
Populate BDC Data for Table control for bank details.
V_TIDX = '01'.
LOOP AT IT_BANK.
BANKS V_TIDX.
BANKL V_TIDX.
BANKN V_TIDX.
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0130',
BDC_FIELD USING 'BDC_CURSOR' V_BANKN,
BDC_FIELD USING 'BDC_OKCODE' '=ENTR',
BDC_FIELD USING V_BANKS IT_BANK-BANKS,
BDC_FIELD USING V_BANKL IT_BANK-BANKL,
BDC_FIELD USING V_BANKN IT_BANK-BANKN.
V_TIDX = V_TIDX + 1.
ENDLOOP.
PERFORM : BDC_DYNPRO USING 'SAPMF02D' '0130',
BDC_FIELD USING 'BDC_CURSOR' V_BANKS,
BDC_FIELD USING 'BDC_OKCODE' '=UPDA'.
CALL TRANSACTION C_XD01 USING IT_BDCDATA
MODE C_MODE
UPDATE C_UPDATE
MESSAGES INTO IT_MSG.
IF SY-SUBRC <> 0.
*--In case of error list display
IF R_LIST = C_X.
V_ERRREC = V_ERRREC + 1.
PERFORM FORMAT_MESSAGE.
IT_ERR_MSG-MESSAGE = V_MSG.
APPEND IT_ERR_MSG.
CLEAR : V_MSG,IT_ERR_MSG.
ENDIF.
*--In case of session log
IF R_SESS = C_X.
*-- In case of transaction fails.
IF FG_SESSION_OPEN = ' '.
FG_SESSION_OPEN = C_X.
PERFORM BDC_OPEN_GROUP.
ENDIF. " IF FG_SESSION_OPEN = ' '.
*-- Insert BDC Data..
PERFORM BDC_INSERT_DATA.
ENDIF. " IF R_SESS = C_X.
ENDIF. " IF SY-SUBRC <> 0.
ENDIF. " IF SY-SUBRC <> 0.
ENDDO.
Closing the dataset
CLOSE DATASET V_FNAME.
*-- Close the session if opened
IF FG_SESSION_OPEN = C_X.
PERFORM BDC_CLOSE_GROUP.
CALL TRANSACTION 'SM35'.
ENDIF.
ENDFORM. " GENERATE_BDCDATA
*& Form BDC_OPEN_GROUP
text
--> p1 text
<-- p2 text
FORM BDC_OPEN_GROUP.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = C_SESS
HOLDDATE = FILLER8
KEEP = C_X
USER = SY-UNAME
RECORD = FILLER1
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
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. " BDC_OPEN_GROUP
*& Form BDC_INSERT_DATA
text
--> p1 text
<-- p2 text
FORM BDC_INSERT_DATA.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = C_XD01
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
TABLES
DYNPROTAB = IT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 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.
ENDIF.
ENDFORM. " BDC_INSERT_DATA
*& Form BDC_CLOSE_GROUP
text
--> p1 text
<-- p2 text
FORM BDC_CLOSE_GROUP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
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. " BDC_CLOSE_GROUP
*& Form FORMAT_MESSAGE
text
--> p1 text
<-- p2 text
FORM FORMAT_MESSAGE.
CLEAR V_LINES.
DESCRIBE TABLE IT_MSG LINES V_LINES.
READ TABLE IT_MSG INDEX V_LINES.
CLEAR V_MSG.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MSG-MSGID
LANG = IT_MSG-MSGSPRA
NO = IT_MSG-MSGNR
V1 = IT_MSG-MSGV1
V2 = IT_MSG-MSGV2
V3 = IT_MSG-MSGV3
V4 = IT_MSG-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
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. " FORMAT_MESSAGE
*& Form DISPLAY_ERR_RECS
text
--> p1 text
<-- p2 text
FORM DISPLAY_ERR_RECS.
LOOP AT IT_ERR_MSG.
WRITE: / IT_ERR_MSG-MESSAGE.
ENDLOOP.
ENDFORM. " DISPLAY_ERR_RECS
*& Form GET_BANKDATA
text
--> p1 text
<-- p2 text
FORM GET_BANKDATA.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = '1000'.
IT_BANK-BANKN = 'S.B A/C'.
APPEND IT_BANK.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = 'CITY'.
IT_BANK-BANKN = 'CURR. A/C'.
APPEND IT_BANK.
IT_BANK-BANKS = 'AD'.
IT_BANK-BANKL = 'H001'.
IT_BANK-BANKN = 'S.B A/C'.
APPEND IT_BANK.
reward if help. -
How to process AT END OF command for company code and transaction number.
Hi,
I have report with selection screen with company code and key date. Based ON key date given I should calculate Accrued interest for all transaction with in each company code.
When I run report with one company code it works fine. But when I run with multiple company codes the amounts are messed up.
I am getting all company codes with transaction details in to ITAB1 like this below, and PERFORM get_processdata. has my calculation for interest rate.
SORT itab1 BY company_code transaction.
LOOP AT itab1 INTO wa_tab1.
itab2 = wa_tab1.
APPEND itab2.
AT END OF transaction.
PERFORM get_processdata.
ENDAT.
ENDLOOP.
Thank you.Hello,
You need to use AT New event to clear your total variables.
AT New - this will go for first time also but we want to clear variables from second time. it requires flag to stop going it first time
Pseudo code:
clear: flag.
Loop at itab1 to itab2.
At New.
if flag eq c_x.
clear: <total variables>, intenal tables.
move c_x to flag.
endif.
tab2 = wa_tab1.
APPEND itab2.
AT END OF transaction.
PERFORM get_processdata.
ENDAT.
ENDLOOP. -
Deleting unused transactions from roles
I am planning for unused transaction cleanup activity for SAP roles as mentioned below.
There are lot of roles which are copied from SAP menu due to which they consist of around 1000 transactions. Now I know there will be around 50 transactions which might be used and rest of them not used at all. I have made the strategy to find all the transactions which are not used during the last 3 months(using ST03N) and than consult the list with the role owners and delete the unused transactions.
I would like to know whether this is the correct strategy to follow, will the ST03N data-> transactional profile provides the relevant data to sort out the transactions not used in last 3 months. Please suggest or any alternative strategy can be followed. I know about sm19 audit log, but the problem is that it cannot be activated for all the users due to file space and performance issues.
Regards,
SanjayThere are lot of roles which are copied from SAP menu due to which they consist of around 1000 transactions.
I am tempted to move this to the Test&Playground forum, because that is what building authorization roles from SAP Menü navigation nodes is.
If course if you do not care and it is better than manual profiles then it is not all bad, so I will leave it here in the security forum fir now.
From my side, if you have no clue... then go for the SAP standard roles and copy them into your own namepsace and work from there to start with. Check the objects included against audit check lists as step two. Take a closer look when you have a chance as step three (there are many manual auths in there...). You will be better off this ways than inventing roles of your own without any tcode or blue-print infos.
I would however still not call it "best practice" and it will backfire over time, but it can be done in a few days (so that you can get your bones out of the project and onto the next one without learning about the pain-points).
Eventually you become a professional bull-*******...
Cheers,
Julius -
I have lots of redundant code that I am trying to consolidate and I am having a hard time wrapping my brain around the problem to get it done. Each function seems to have 2 or 3 embedded lines of code that are different which makes writing an allPurpose function impossible. Just wondering if anyone had any ideas on how to consilidate this bit of code. not to mention the while(waitForSerial) thing has to totally be oblitherated becuase it freezes the whole thing. A little bit of advice would help greatly.
class EnterSerial implements ActionListener
public void actionPerformed(ActionEvent e)
SerialRead s;
String serialString;
int newline1,newline2;
String line1,line2,line3,linetmp;
String spindle,torque1,torque2,torque3,angle1,angle2,angle3;
serial_no=serial_text.getText();
s=new SerialRead();
s.findPort();
waitForSerial=true;
s.openConnection(); // open the serial connection
blank_l1.setText("Data Received. Please verify data!");
while(waitForSerial)
s.closeConnection();
serialString=serialBuffer.toString();
System.out.println(serialString);
System.out.println(":" + serialBuffer.toString() + ":");
line1=serialString.substring(0,(serialString.indexOf("ZZZ")));
System.out.println("here???");
linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
System.out.println("linetmped");
line2=linetmp.substring(0,(linetmp.indexOf("ZZZ")));
line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
System.out.println("afterlines");
torque1=line1.substring(32,37);
torque2=line2.substring(32,37);
torque3=line3.substring(32,37);
angle1=line1.substring(40,45);
angle2=line2.substring(40,45);
angle3=line3.substring(40,45);
torque1=line1.substring(1,6);
torque2=line2.substring(1,6);
torque3=line3.substring(1,6);
angle1=line1.substring(9,14);
angle2=line2.substring(9,14);
angle3=line3.substring(9,14);
serialBuffer.delete(0,((int) serialBuffer.length()));
accept_1.addActionListener(a1);
reject_1.addActionListener(r1);
class AcceptPass1 implements ActionListener{
public void actionPerformed(ActionEvent e){
SerialRead s;
String serialString;
int newline1,newline2;
String line1,line2,line3,linetmp;
String spindle,torque1,torque2,torque3,angle1,angle2,angle3;
s=new SerialRead();
s.findPort();
waitForSerial=true;
s.openConnection();
blank_l1.setText("Waiting for data from Pass #2");
while(waitForSerial){
blank_l1.setText("Data Received. Please verify data!");
s.closeConnection();
serialString=serialBuffer.toString();
line1=serialString.substring(0);
linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
line2=linetmp.substring(0);
line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
torque1=line1.substring(32,37);
torque2=line2.substring(32,37);
torque3=line3.substring(32,37);
angle1=line1.substring(40,44);
angle2=line2.substring(40,44);
angle3=line3.substring(40,44);
torque1=line1.substring(1,6);
torque2=line2.substring(1,6);
torque3=line3.substring(1,6);
angle1=line1.substring(9,13);
angle2=line2.substring(9,13);
angle3=line3.substring(9,13);
serialBuffer.delete(0,((int) serialBuffer.length()));
outputs[0].setText(torque1);
outputs[1].setText(angle1);
outputs[2].setText(torque2);
outputs[3].setText(angle2);
outputs[4].setText(torque3);
outputs[5].setText(angle3);
class RejectPass1 implements ActionListener{
public void actionPerformed(ActionEvent e){
SerialRead s;
String serialString;
int newline1,newline2;
String line1,line2,line3,linetmp;
String spindle,torque1,torque2,torque3,angle1,angle2,angle3;
/* outputs[0].setText("0.0");
outputs[1].setText("0.0");
outputs[2].setText("0.0");
outputs[3].setText("0.0");
outputs[4].setText("0.0");
outputs[5].setText("0.0");
ClearPass(1);
s=new SerialRead();
s.findPort();
waitForSerial=true;
s.openConnection();
blank_l1.setText("Pass #1 data rejected. Waiting for data!");
while(waitForSerial){
blank_l1.setText("Data Received. Please verify data!");
s.closeConnection();
serialString=serialBuffer.toString();
line1=serialString.substring(0,(serialString.indexOf("ZZZ")));
linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
line2=linetmp.substring(0,(linetmp.indexOf("ZZZ")));
line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
/* torque1=line1.substring(32,37);
torque2=line2.substring(32,37);
torque3=line3.substring(32,37);
angle1=line1.substring(40,44);
angle2=line2.substring(40,44);
angle3=line3.substring(40,44);
torque1=line1.substring(1,6);
torque2=line2.substring(1,6);
torque3=line3.substring(1,6);
angle1=line1.substring(9,13);
angle2=line2.substring(9,13);
angle3=line3.substring(9,13);
serialBuffer.delete(0,((int) serialBuffer.length()));
outputs[0].setText(torque1);
outputs[1].setText(angle1);
outputs[2].setText(torque2);
outputs[3].setText(angle2);
outputs[4].setText(torque3);
outputs[5].setText(angle3);
class AcceptPass2 implements ActionListener{
public void actionPerformed(ActionEvent e){
SerialRead s;
String serialString;
int newline1,newline2;
String line1,line2,line3,linetmp;
String spindle,torque1,torque2,torque3,angle1,angle2,angle3;
s=new SerialRead();
s.findPort();
waitForSerial=true;
s.openConnection();
blank_l1.setText("Waiting for data from Pass #3");
while(waitForSerial){
blank_l1.setText("Data Received. Please verify data!");
s.closeConnection();
serialString=serialBuffer.toString();
line1=serialString.substring(0,(serialString.indexOf("ZZZ")));
linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
line2=linetmp.substring(0,(linetmp.indexOf("ZZZ")));
line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
torque1=line1.substring(32,37);
torque2=line2.substring(32,37);
torque3=line3.substring(32,37);
angle1=line1.substring(40,44);
angle2=line2.substring(40,44);
angle3=line3.substring(40,44);
torque1=line1.substring(1,6);
torque2=line2.substring(1,6);
torque3=line3.substring(1,6);
angle1=line1.substring(9,13);
angle2=line2.substring(9,13);
angle3=line3.substring(9,13);
serialBuffer.delete(0,((int) serialBuffer.length()));
outputs[12].setText(torque1);
outputs[13].setText(angle1);
outputs[14].setText(torque2);
outputs[15].setText(angle2);
outputs[16].setText(torque3);
outputs[17].setText(angle3);
accept_2.removeActionListener(a2);
reject_2.removeActionListener(r2);
accept_3.addActionListener(a3);
reject_3.addActionListener(r3);
class RejectPass2 implements ActionListener{
public void actionPerformed(ActionEvent e){
SerialRead s;
String serialString;
int newline1,newline2;
String line1,line2,line3,linetmp;
String spindle,torque1,torque2,torque3,angle1,angle2,angle3;
/*outputs[6].setText("0.0");
outputs[7].setText("0.0");
outputs[8].setText("0.0");
outputs[9].setText("0.0");
outputs[10].setText("0.0");
outputs[11].setText("0.0");
ClearPass(2);
s=new SerialRead();
s.findPort();
waitForSerial=true;
s.openConnection();
blank_l1.setText("Pass #2 data rejected. Waiting for data!");
while(waitForSerial){
blank_l1.setText("Data Received. Please verify data!");
s.closeConnection();
serialString=serialBuffer.toString();
line1=serialString.substring(0,(serialString.indexOf("ZZZ")));
linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
line2=linetmp.substring(0,(linetmp.indexOf("ZZZ")));
line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
torque1=line1.substring(32,37);
torque2=line2.substring(32,37);
torque3=line3.substring(32,37);
angle1=line1.substring(40,44);
angle2=line2.substring(40,44);
angle3=line3.substring(40,44);
torque1=line1.substring(1,6);
torque2=line2.substring(1,6);
torque3=line3.substring(1,6);
angle1=line1.substring(9,13);
angle2=line2.substring(9,13);
angle3=line3.substring(9,13);
serialBuffer.delete(0,((int) serialBuffer.length()));
outputs[6].setText(torque1);
outputs[7].setText(angle1);
outputs[8].setText(torque2);
outputs[9].setText(angle2);
outputs[10].setText(torque3);
outputs[11].setText(angle3);
class AcceptPass3 implements ActionListener{
public void actionPerformed(ActionEvent e){
SerialRead s;
String serialString;
int newline1,newline2;
String line1,line2,line3,linetmp;
String spindle,torque1,torque2,torque3,angle1,angle2,angle3;
accept_3.removeActionListener(a3);
reject_3.removeActionListener(r3);
SaveData();
ClearPass(1);
ClearPass(2);
ClearPass(3);
blank_l1.setText(serial_no + " data saved. Enter next serial number!");
serial_text.setText("");
class RejectPass3 implements ActionListener{
public void actionPerformed(ActionEvent e){
SerialRead s;
String serialString;
int newline1,newline2;
String line1,line2,line3,linetmp;
String spindle,torque1,torque2,torque3,angle1,angle2,angle3;
/*outputs[12].setText("0.0");
outputs[13].setText("0.0");
outputs[14].setText("0.0");
outputs[15].setText("0.0");
outputs[16].setText("0.0");
outputs[17].setText("0.0");
ClearPass(3);
s=new SerialRead();
s.findPort();
waitForSerial=true;
s.openConnection();
blank_l1.setText("Pass #3 data rejected. Waiting for data!");
while(waitForSerial){
blank_l1.setText("Data Received. Please verify data!");
s.closeConnection();
serialString=serialBuffer.toString();
line1=serialString.substring(0,(serialString.indexOf("ZZZ")));
linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
line2=linetmp.substring(0,(linetmp.indexOf("ZZZ")));
line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
torque1=line1.substring(32,37);
torque2=line2.substring(32,37);
torque3=line3.substring(32,37);
angle1=line1.substring(40,44);
angle2=line2.substring(40,44);
angle3=line3.substring(40,44);
torque1=line1.substring(1,6);
torque2=line2.substring(1,6);
torque3=line3.substring(1,6);
angle1=line1.substring(9,13);
angle2=line2.substring(9,13);
angle3=line3.substring(9,13);
serialBuffer.delete(0,((int) serialBuffer.length()));
outputs[12].setText(torque1);
outputs[13].setText(angle1);
outputs[14].setText(torque2);
outputs[15].setText(angle2);
outputs[16].setText(torque3);
outputs[17].setText(angle3);
class RejectPart implements ActionListener
public void actionPerformed(ActionEvent e)
// System.out.println("The serial number was " + serial_no);
SaveData();
ClearPass(1);
ClearPass(2);
ClearPass(3);
blank_l1.setText(serial_no + " data saved. Enter next serial number!");
serial_text.setText("");
serial_text.requestFocus();
}Take it in pieces. Try this for example...
// Break the wait for serial part out.
public void waitForSerial( String pMessage )
SerialRead s;
String serialString;
s = new SerialRead();
s.findPort();
waitForSerial=true;
s.openConnection(); // open the serial connection
while(waitForSerial) {}
s.closeConnection();
public void setTorqueOutput(
JTextField pOutput,
String pLine,
int torqueStart )
output.setText( pLine.substring( torqueStart, torqueStart+5 ) );
public void setAngleOutput(
JTextField pOutput,
String pLine,
int angleStart )
output.setText( pLine.substring( torqueStart, angleStart+6 ) );
public void setTorqueOutputs(
JTestField[] pOutputs,
String[] pLines,
int start )
setTorqueOutput( pOutputs[0], pLines[0], start );
setTorqueOutput( pOutputs[1], pLines[1], start );
setTorqueOutput( pOutputs[2], pLines[2], start );
public void setAngleOutputs(
JTestField[] pOutputs,
String[] pLines,
int start )
setAngleOutput( pOutputs[0], pLines[0], start );
setAngleOutput( pOutputs[1], pLines[1], start );
setAngleOutput( pOutputs[2], pLines[2], start );
example of actionPerformed...
JTextField[] pTorqueOutputs = { outputs[0], outputs[2], outputs[4] );
JTextField[] pAngleOutputs = { outputs[1], outputs[3], outputs[5] );
String[] pLines = new String[3];
waitForSerial();
// code to set pLines
setTorqueOutputs( pTorqueOutputs, pLines, 1 );
setAngleOutputs( pAngleOutputs, pLines, 9 );
}Of course all that individual stuff has to still go in each actionPerformed routine but you've cut out a LOT of code space and will be able to see more clearly. -
What is TRANSACTION CODE for TRANSACTION VARIANTS?
what is TRANSACTION CODE for TRANSACTION VARIANTS?
please explainHi..
Goto Tcode: SHD0.
Create a Transaction Variant :
Name : ZTVAR1.
Tcode: MK01
Save the Settings of Screens as Screen Variants.
Finally Save the Transaction variant.
Goto Tcode: SE93.
Create a Transaction code (Eg: Zmk01) of type Variant transaction.
Assign ur Transaction variant here.
Now Save and Execute ZMK01.
<b>Reward if Helpful.</b> -
Looking for a sort of "activity code" in transactions ME51N/ME52N/ME53N
Hi all experts, got an - I hope - interesting question to ask you.
I have an user exit that is executed on every step done in creation/modify of a Purchase requisition. In this code (custom), executed from the transactions ME51(n)/ME52(n) and ME53(n) there's something like:
GET PARAMETER ID 'BAN' FIELD r_banfn. "Purchase Requisition number
GET PARAMETER ID 'BFC' FIELD r_frgab. "Release strategy
r_banfn should contain the number of the purchase requisition I'm working on. So far, so good.
The problem is that if in ANY transaction I press the New Document button, I can notice in debug that r_banfn contains the number of the purchase requisition that WAS active before pressing the "create new" button.
That's not good because that r_banfn value is then used to some checks, and should then be blank in case of creation of a new purchase requisitions.
I'm then asking you if there's a way in my user exit to distinguish between the two cases, which are:
-1- I'm modifying an existing purchase requisition (so, the field in r_banfn IS correct);
-2- I'm CREATING a new document (so, r_banfn value is NOT correct and should be set to blank).
This distinction must be coded into the previously cited user exit and should affect ME51(n), ME52(n) and ME53(n), from which the user can either create a new RdA or modify an existing one.
We tried to manage the situation as follow, but without success:
IF NOT r_banfn IS INITIAL.
CALL FUNCTION 'ENQUEUE_EMEBANE'
EXPORTING
banfn = r_banfn
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc NE 0.
* Can't lock --> means I'm actually working in modify mode on it
* leave it as is
ELSE.
* locked --> that means I'm not working on this purchase requisition
* first dequeue the locked purchase req, then set r_banfn to blank.
CALL FUNCTION 'DEQUEUE_EMEBANE'
EXPORTING
banfn = r_banfn.
* clear the variable -> I'm in CREATE mode.
CLEAR r_banfn.
ENDIF.
ENDIF.
The code is quite self-explaining but doesn't work because it seems that the "enqueue" phase goes ok even tho we're working on modification on the purchase requisition.
I'm guessing if there's a sort of "activity code" (create? modify? view?) I can catch @ runtime to solve this task.
Thanks in advance, as usual
Matteo
Edited by: Matteo Montalto on Mar 19, 2009 5:15 PM
Sorry, I edited the title in order to make it more explicative. :-P>
Hi Sandipan, sorry for the late, I tried to manage this task but without success.
The user exit I'm working on in EXIT_SAPLBBPK_001.
FUNCTION EXIT_SAPLBBPK_001.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(IM_BBPDECDATA) LIKE BBPDECDATA STRUCTURE BBPDECDATA
*" VALUE(IV_MANU_PROF) TYPE MANPRC OPTIONAL
*" CHANGING
*" VALUE(CH_PROFILE) LIKE T160EX-EPROFILE
INCLUDE ZXBBPU04.
ENDFUNCTION.
It includes ZXBBPU04, in which I have to understand if I'm working on a Purch. requisition in MODIFY mode or in CREATE mode. -
Creation of New T Code Using Transaction Variant
Hi,
I have created a new T code (YMM02) by using transaction variant. The new T code created is copy of MM02.
I have changed the material by using new T code (YMM02) which is created using Transaction variant. Once I complete the Transaction (i.e. have done changes in material master and save) it is going to original T Code (MM02). Requirement is it should be in the same T Code (YMM02), so that I can edit the material again with the new T Code (YMM02)
Regards,
Hari.Hi Hariprasad,
If restricting certain fields using field selection option is not suitable for you, you can go ahead with the option Screen Variend
Also refer the link
[https://wiki.sdn.sap.com/wiki/display/Snippets/Transaction%20Variant%20-%20A%20Step%20by%20Step%20Guide%20for%20Creation] -
Program code and transaction code for handling unit detail
Developed a SAP Script for the Handling unit details. Handling unit details is a document which has the details of materials, packaging materials and the level of packing. This Handling Units details will be issued to the customer at the time of delivery.
Hi,
Goto NACE transaction code , there you select the application area then it will give you the list of output types then select specific output click processing routines then you will see the program name and script used.
Or esle goto SPRO tcode then you can find the functional tab there also you can get the details.
Thanks,
Aditya -
Delete G/L Accounts for one company code when transaction data exists
SAP transaction OBR1 can be used to reset transaction data.
If you execute this transaction for a specific company code, the FI transaction data of that company is deleted. Because of the procedure to keep FI and CO in line, also the CO data has te be deleted.
But you can not reset CO transaction data for one company code. You have to reset CO transaction data for a whole controlling area.
If you can not delete the FI and CO transaction data for a specific G/L account in one company code, you can not delete that G/L account.
There exists another solution for the deletion of FI and CO transaction data for one company code, and thus for the deletion of G/L accounts?
Thank you very much for your feedback.
Edited by: E. Deleu on Mar 3, 2008 3:42 PMHelllo,
I believe the account group information is what you get when loading hierarchies. Please look into the hierarchy extractor 0GL_ACCOUNT_T011_HIER.
Regards,
Christoffer -
Can change GL account code with transactions
In Canadian Localization in CoA with segments I can change account code in account with transactions.
An issue found in 2007 PL 35 and 41.
Is it a bug oe new functionality?
Thanks,
OlgaHi Olga,
If the G/L Accounts are set up as segmented accounts then it is
possible to change the account codes. The code field of the G\L Accounts
is a description field (non unique, the unique key is internal, this is
only the case with segmented G/L accounts) and can be changed. This
will not affect the reports, only the name/code will change. System will identify the accounts with an internal code.
Regards,
Vijay kumar
SAP Business One Forums Team -
Adding "Sending company code" to Transaction FCHN
Hi,
We would like to add a column "Sending company code" to the report out of transaction FCHN. The info for this column is present in REGUH-ABSBU. Is there anyway this could be done without copying the standard program into a custom program and modifying it.
Any help will be appreciated.
Thanks,
ALAM.Hi
I believe you would need an exit cause, FCHN is feed from table PAYR, and in taht table you don t have the sending company code field
Regards
Jose -
T.code for transaction type groups (FI-AA)
Hi Friends,
Please can you tell me the t,code for creating transaction type groups. ( Transaction type groups are attached to transaction types in t.code AO73).
Thanks & Regards
BhairaviHiya,
T.Code: OAVJ
However, I wouldn't create Transaction Group Types if I were you... since there is a lot of config behind it that you need to be careful with.
I assume you know what you are doing.
Cheers.
Maybe you are looking for
-
Can I sync my iPhone contacts with a specific address book group?
My address book on my iMac has contacts organized by several groups. My wife and I have just purchased iPhones and want to keep our photos and music coordinated with one iCloud account. My whole address book is synced with iCloud. Can I set my iPhone
-
The LOV modal window could not return value to the base page
when practicing the "create1" task in tutorial, met an issue. when create an employee, manageName is a messageLovInput and managerID is a messageTextInput. The issue is the LOV modal window could not return value to the mangerName, but can return to
-
How many hard drives can i install in a new 2013 imac 27"
hi there, i was just wondering if the 2013 imac 27" came with two hard drive bays? when looking through the specs there no longer seems to be an option to have an ssd, as well as, a standard internal hd (only fusion drives/??) is it possible for me t
-
Transfer GL Accounts to a new SAP System
I need to transfer G/L accounts to a new SAP system. I am trying to use Data Transfer Workbench. I need to know do we create it in the Company Code from where I have to move the GL master data or in the target system. One more question, after Extract
-
When does O2s exclusive contract expire?
After looking at the new pricing for the iPhone 3Gs and the tethering charges etc I was wondering how many new phones Apple expects to sell this time around with O2 and how much longer it expects to maintain their exclusive operator right in the UK.