From alv to standard transaction
Hi,
Iam using alv hiereracy for a report.
say i have a material field in header if i double click can i take me to mmo3 .
if yes pls let me know how to proceed with this
thanks
swathi
Hi,
Check this sample code..Instead of double click...A hotspot will be displayed..Let me know if you still want double click..
IF the user presses the hotspot it will take you to the material master MM03..
TYPE-POOLS: slis.
DATA: BEGIN OF itab OCCURS 0,
matnr TYPE matnr,
expand,
END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
matnr TYPE matnr,
werks TYPE werks,
END OF itab1.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'MATNR'.
s_fieldcatalog-hotspot = 'X'.
s_fieldcatalog-outputlen = '40'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'MATNR'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'MATNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'WERKS'.
s_fieldcatalog-tabname = 'ITAB1'.
s_fieldcatalog-rollname = 'WERKS_D'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
SELECT matnr UP TO 100 ROWS
FROM
mara
INTO TABLE itab.
IF NOT itab[] IS INITIAL.
SELECT matnr werks
FROM marc
INTO TABLE itab1
FOR ALL ENTRIES IN itab
WHERE matnr = itab-matnr.
ENDIF.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
DATA: s_keyinfo TYPE slis_keyinfo_alv.
s_keyinfo-header01 = 'MATNR'.
s_keyinfo-item01 = 'MATNR'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = t_fieldcatalog
i_callback_user_command = 'USER_COMMAND'
i_tabname_header = 'ITAB'
i_tabname_item = 'ITAB1'
is_keyinfo = s_keyinfo
TABLES
t_outtab_header = itab
t_outtab_item = itab1
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM user_command *
--> UCOMM *
--> SELFIELD *
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = '&IC1'.
READ TABLE itab INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'MAT' FIELD itab-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM.
Thanks,
Naren
Similar Messages
-
Passing different range of GL accounts from ALV to a transaction
I want to call the transaction FBL3n from ALV and also have to pass all the GL account ranges like 600000 to 699999, 700000 to 7199999 at the same time to the transaction from the alv. This is neccasary from me. How can i do that.
Hello,
U can do it.
Instead of using the CALL TRANSACTION use
SUBMIT RFITEMGL WITH SLECTION-SCREEN and don't use return.
Before the SUNMIT stmt fill the Range Table.
Vasanth
Message was edited by:
Vasanth M -
Data retrival from standard transaction with in a report
hi all,
i have a requirement like i need to pass the selection screen selections to a standard transaction ca80 and need to get the material list from there to my report for furthur processing. is it possible with bdc or a bapi for this.
can anyone please help urgent its eating my brain. points awarded for solution
thanks in advance
anupamahi deep kammula,
this is a sample code for your query just check. it may help you.
all the best.
reward me points if usefull.
Sample HR Reports - Allocate Petrol Allowance
Two ABAP HR Programs, which are interconnected, the first takes employee numbers which should not be given Petrol allowance and the other program gives the petrol allowance to employees.
FIRST PRG
REPORT ZPETROL_EXCLUDE .
TABLES SSCRFIELDS.
SELECTION-SCREEN BEGIN OF SCREEN 100.
SELECTION-SCREEN SKIP 9.
PARAMETERS NUMBER(200) TYPE C.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN:
BEGIN OF LINE,
PUSHBUTTON 2(10) TEXT-001 USER-COMMAND PROC,
END OF LINE.
SELECTION-SCREEN END OF SCREEN 100.
CALL SCREEN 100.
AT SELECTION-SCREEN.
CASE SSCRFIELDS.
WHEN 'PROC'.
SET PARAMETER ID: 'NUM' FIELD NUMBER.
CALL TRANSACTION 'ZP_PALLOWANCE'.
LEAVE TO SCREEN 0.
ENDCASE.
SECOND PRG
REPORT ZPR_PETROL_ALLOWANCE NO STANDARD PAGE
HEADING .
*-- Infotypes
INFOTYPES : 0000, "Actions
0002, "Personal Data
0008. "Basic pay details
*-- Tables
TABLES : PERNR, "Standard Selections for HR Master Data Reporting
PC207, "Payroll Results: Results Table
PCL1, "HR Cluster 1
PCL2, "HR Cluster 2
T510, "Pay scales
T549A, "Payroll areas
T549Q, "Payroll Periods
PA0002. "Personal details
*-- Internal Tables
*-- Internal Table Declaration For Holding The Data
DATA: BEGIN OF INT_PETROL OCCURS 0,
PERNR LIKE PA0008-PERNR, "Personnel Number
TRFST LIKE PA0008-TRFST, "Pay Scale Level
NAME(40), "Name of Employee
PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
END OF INT_PETROL.
DATA: BEGIN OF PA0015_DATA OCCURS 0,
PERNR LIKE PA0015-PERNR,
BETRG LIKE PA0015-BETRG,
END OF PA0015_DATA.
DATA:BEGIN OF INT_PETROL2 OCCURS 0,
PERNR LIKE PA0008-PERNR, "Personnel Number
VORNA LIKE PA0002-VORNA, "First Name
NACHN LIKE PA0002-NACHN, "Last Name
TRFST LIKE PA0008-TRFST, "Pay Scale Level
NAME(40), "Name of Employee
PALLOWANCE TYPE P DECIMALS 2, "Petrol Allowance Amount
END OF INT_PETROL2.
DATA : TITLE TYPE LVC_TITLE.
DATA: BEGIN OF PER_NO OCCURS 0,
PERNR LIKE PA0008-PERNR,
TRFST LIKE PA0008-TRFST,
END OF PER_NO.
DATA: BEGIN OF MSG OCCURS 0,
MSG1(100) TYPE C,
END OF MSG.
DATA: FLAG TYPE I VALUE '0',
DIS_FLAG TYPE I VALUE '0'.
DATA: INT_PETROL3 LIKE STANDARD TABLE OF INT_PETROL2 INITIAL SIZE 0
WITH HEADER LINE.
DATA: INT_PETROL1 LIKE STANDARD TABLE OF INT_PETROL INITIAL SIZE 0 WITH
HEADER LINE.
DATA: WA_PET_ALLOWANCE TYPE ZBPETROL_ALL. "WORKAREA FOR INSERTING
VALUES.
*DATA: P_LGART1 LIKE T512T-LGART VALUE '0010'. "CHANGE WAGE TYPE HERE
DATA: P_LGART1 LIKE T512T-LGART VALUE '0077'. "CHANGE WAGE TYPE HERE
DATA: BEGIN OF INT_0015 OCCURS 0,
PERNR(038),
BEGDA(010),
BETRG(018),
END OF INT_0015.
*-- Internal Table To Store Error Records.
DATA: E_INT_0015 LIKE INT_0015 OCCURS 0 WITH HEADER LINE.
*-- Batch Input Data of Single Transaction
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*-- Internal Table For Export and Import Payroll Results
DATA: INT_RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE,
LGTXT LIKE T512T-LGTXT.
DATA: BEGIN OF EMP_NO OCCURS 0,
PERNR(4) TYPE C,
END OF EMP_NO.
DATA: BEGIN OF EMP_NO1 OCCURS 0,
PERNR TYPE I,
END OF EMP_NO1.
DATA EMPNO LIKE STANDARD TABLE OF EMP_NO INITIAL SIZE 0.
DATA EMPNO1 LIKE STANDARD TABLE OF EMP_NO1 INITIAL SIZE 0 WITH HEADER
LINE.
DATA LEN1 TYPE I.
DATA: ERR LIKE MESSAGE.
DATA TEMP_NUM(200) TYPE C.
*-- Includes
*-- International Include
INCLUDE RPC2CD09. "Cluster CD data definition
INCLUDE RPC2CA00. "Cluster CA Data-Definition
INCLUDE RPPPXD00. "Data Definition buffer PCL1/PCL2 Buffer INCLUDE RPPPXD10.
"Common part buffer PCL1/PCL2 INCLUDE RPPPXM00. "Buffer Handling routine
*-- Country Specific Include
INCLUDE PC2RXIN0. "Cluster IN data definition
INCLUDE RPC2RX09.
*-- ALV Declaration
TYPE-POOLS : SLIS.
DATA: INT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
INT_EVENTS TYPE SLIS_T_EVENT,
INT_LAYOUT TYPE SLIS_LAYOUT_ALV,
WS_EVENTS TYPE SLIS_ALV_EVENT,
WS_REPID LIKE SY-REPID.
*-- Initialization
INITIALIZATION.
WS_REPID = SY-REPID.
*-- At Selection-Screen
START-OF-SELECTION.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) TEXT-002.
SELECTION-SCREEN POSITION 33.
PARAMETERS: P_RATE TYPE P DECIMALS 2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-003.
SELECTION-SCREEN BEGIN OF BLOCK B3.
PARAMETERS: P_UPLOAD AS CHECKBOX,
P_FG RADIOBUTTON GROUP G1,
P_BG RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B3.
SELECTION-SCREEN BEGIN OF BLOCK B4.
PARAMETERS: P_DI AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK B4.
SELECTION-SCREEN END OF BLOCK B2.
AT SELECTION-SCREEN.
*-- Wate Type Text
SELECT SINGLE LGTXT INTO LGTXT FROM T512T WHERE SPRSL = 'E' AND
MOLGA = '40' AND LGART = P_LGART1 .
*-- Data Retrieval From Logical Database PNP
GET PERNR.
PROVIDE PERNR FROM P0000 VORNA NACHN FROM P0002 BETWEEN PN-BEGDA AND
PN-ENDDA.
INT_PETROL1-PERNR = P0000-PERNR.
CONCATENATE P0002-VORNA P0002-NACHN INTO INT_PETROL1-NAME SEPARATED
BY SPACE.
ENDPROVIDE.
*-- Clear Data
CLEAR: RGDIR, INT_RGDIR.
REFRESH: RGDIR, INT_RGDIR.
*-- Read All The Payroll Runs For An Employee
CD-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-CU.
CHECK RP-IMP-CD-SUBRC EQ 0.
*-- Clear Data
REFRESH: RT.
Read IN Cluster.
LOOP AT RGDIR WHERE FPBEG >= PN-BEGDA AND FPEND <= PN-ENDDA.
MOVE-CORRESPONDING RGDIR TO INT_RGDIR.
APPEND INT_RGDIR.
CLEAR INT_RGDIR.
ENDLOOP.
Read the last record.
SORT INT_RGDIR BY SEQNR DESCENDING.
READ TABLE INT_RGDIR INDEX 1.
RX-KEY-SEQNO = INT_RGDIR-SEQNR.
RX-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-IN.
CHECK RP-IMP-IN-SUBRC EQ 0.
READ TABLE RT WITH KEY LGART = P_LGART1.
IF SY-SUBRC = 0.
INT_PETROL1-PALLOWANCE = RT-BETRG.
ENDIF.
APPEND INT_PETROL1.
CLEAR INT_PETROL1.
SELECT TRFST PERNR
INTO CORRESPONDING FIELDS OF TABLE PER_NO
FROM PA0008
WHERE TRFST LIKE 'L%'
AND BET01 > 0.
SORT PER_NO.
DELETE ADJACENT DUPLICATES FROM PER_NO.
*-- END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT INT_PETROL1.
READ TABLE PER_NO WITH KEY PERNR = INT_PETROL1-PERNR.
IF SY-SUBRC = 0.
INT_PETROL-TRFST = PER_NO-TRFST.
MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING TRFST.
ENDIF.
ENDLOOP.
SORT INT_PETROL1.
DELETE ADJACENT DUPLICATES FROM INT_PETROL1.
CONCATENATE 'From' ' : ' PN-BEGDA6(2) '.' PN-BEGDA4(2) '.' PN-
BEGDA+0(4)
' To' ' : ' PN-ENDDA6(2) '.' PN-ENDDA4(2) '.' PN-ENDDA+0(4)
INTO TITLE.
IF P_DI = 'X'. "TO DISPLAY PETROL ALLOWANCE ONLY
IF PNPTIMRA = 'X'. "CHECK OTHER PERIOD CHECKED
DIS_FLAG = 1.
ENDIF.
IF PNPTIMR9 = 'X'. "CHECK TO SEE CURRENT PERIOD SELECTED
CASES - NO RATE GIVEN, RATE GIVEN
CURRENT PERIOD UPLOADED BUT PAYROLL NOT WRITTEN SO NO RESULT FROM LDB
SELECT RATE INTO P_RATE FROM ZBPETROL_ALL WHERE BEGDA = PN- BEGDA AND ENDDA = PN-ENDDA.
ENDSELECT.
IF SY-DBCNT = 0.
MESSAGE I455(0) WITH 'NO PETROL RATE EXSISTS'.
ELSE.
FLAG = 1.
ENDIF. "OF SY-DBCNT
IF P_RATE > 0 AND FLAG = 1. " PETROL RATE EXSISTS.
SELECT PERNR SUM( BETRG ) INTO TABLE PA0015_DATA
FROM PA0015
WHERE BEGDA BETWEEN PN-BEGDA AND PN-ENDDA
GROUP BY PERNR.
SELECT APERNR ATRFST BVORNA BNACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON BPERNR = APERNR
WHERE A~TRFST LIKE 'L%'
AND A~BET01 > 0.
SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE PA0015_DATA WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC = 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
INT_PETROL-PALLOWANCE = PA0015_DATA-BETRG.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.
DIS_FLAG = 1.
ENDIF. "P_RATE > 0 AND FLAG = 1.
IF P_RATE > 0 AND FLAG = 0. "CURRENT PERIOD AND DATA NOT UPLOADED
SELECT APERNR ATRFST BVORNA BNACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON BPERNR = APERNR
WHERE A~TRFST LIKE 'L%'
AND A~BET01 > 0.
SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.
PERFORM GET_VALUE. "TO CONVERT THE FIRST SCREEN PERNR INTO
NUMBER FORMATE
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC <> 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.
PERFORM CAL_ALLOWANCE.
ENDIF. " OF P_RATE > 0
DIS_FLAG = 1.
ENDIF. " OF CURRENT PERIOD CHECK.
ENDIF. " OF CHECK DISPLAY.
*----BDC
IF P_UPLOAD = 'X'.
IF PNPTIMRA = 'X'. "CHECK OTHER PERIOD CHECKED
MESSAGE I455(0) WITH 'Petrol Allowance cannot be uploaded'.
LEAVE SCREEN.
ENDIF.
IF P_RATE > 0.
IF P_RATE > 0 OR P_RATE = 0.
IF PNPTIMR9 = 'X'. "CHECK TO SEE CURRENT PERIOD SELECTED
WA_PET_ALLOWANCE-BEGDA = PN-BEGDA.
WA_PET_ALLOWANCE-ENDDA = PN-ENDDA.
WA_PET_ALLOWANCE-RATE = P_RATE.
WA_PET_ALLOWANCE-CURR = 'INR'.
INSERT INTO ZBPETROL_ALL VALUES WA_PET_ALLOWANCE.
SELECT A~PERNR A~TRFST B~VORNA B~NACHN
INTO CORRESPONDING FIELDS OF TABLE INT_PETROL3
FROM PA0008 AS A
INNER JOIN PA0002 AS B ON B~PERNR = A~PERNR
WHERE A~TRFST IN ('L1' , 'L2' , 'L3')
AND A~BET01 > 0.
SORT INT_PETROL3.
DELETE ADJACENT DUPLICATES FROM INT_PETROL3.
REFRESH INT_PETROL1.
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
employee name
CONCATENATE INT_PETROL2-VORNA INT_PETROL2-NACHN INTO
INT_PETROL2-NAME SEPARATED BY SPACE.
MODIFY INT_PETROL3 FROM INT_PETROL2 TRANSPORTING NAME.
ENDLOOP.
PERFORM GET_VALUE. "TO CONVERT THE FIRST SCREEN PERNR INTO
NUMBER FORMATE
LOOP AT INT_PETROL3 INTO INT_PETROL2. "loop to transport
one
table to another table
READ TABLE EMPNO1 WITH KEY PERNR = INT_PETROL2-PERNR.
IF SY-SUBRC <> 0.
INT_PETROL-PERNR = INT_PETROL2-PERNR.
INT_PETROL-TRFST = INT_PETROL2-TRFST.
INT_PETROL-NAME = INT_PETROL2-NAME.
APPEND INT_PETROL TO INT_PETROL1.
ENDIF.
ENDLOOP.
PERFORM CAL_ALLOWANCE.
DIS_FLAG = 1.
SORT INT_PETROL1.
LOOP AT INT_PETROL1.
MOVE: INT_PETROL1-PERNR TO INT_0015-PERNR,
INT_PETROL1-PALLOWANCE TO INT_0015-BETRG.
CONCATENATE PN-ENDDA6(2) PN-ENDDA4(2) PN-ENDDA+0(4) INTO
INT_0015-BEGDA SEPARATED BY '.'.
APPEND INT_0015.
CLEAR INT_0015.
ENDLOOP.
LOOP AT INT_0015.
PERFORM F_BDCDATA.
IF P_FG = 'X'.
CALL TRANSACTION 'PA30' USING BDCDATA MODE 'A' UPDATE 'S'.
ELSE.
CALL TRANSACTION 'PA30' USING BDCDATA MODE 'N' UPDATE 'S'.
ENDIF.
*-- Handling Error records.
IF SY-SUBRC <> 0.
*-- Handling Error Messages
PERFORM ERROR_MSG.
MOVE-CORRESPONDING INT_0015 TO E_INT_0015.
APPEND E_INT_0015.
CLEAR E_INT_0015.
ENDIF.
REFRESH BDCDATA.
ENDLOOP.
*-- Downloading Error Records.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\Errors.Txt'
FILETYPE = 'ASC'
TABLES
DATA_TAB = E_INT_0015.
*-- Downloading Error Messages.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\Err_Msg.Txt'
FILETYPE = 'ASC'
TABLES
DATA_TAB = MSG.
ENDIF. " FOR CURRENT PERIOD
ENDIF.
ELSE.
MESSAGE I455(0) WITH 'Enter Petrol Rate'.
LEAVE TO SCREEN 0.
ENDIF. " FOR PETROL RATE
ENDIF. " FOR UPLOAD
IF DIS_FLAG = 1.
INT_LAYOUT-SUBTOTALS_TEXT = TEXT-004.
INT_LAYOUT-TOTALS_TEXT = TEXT-004.
INT_LAYOUT-ZEBRA = 'X'.
PERFORM FILL_FIELDCAT.
PERFORM GET_EVENTS_ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = WS_REPID
IS_LAYOUT = INT_LAYOUT
IT_FIELDCAT = INT_FIELDCAT[]
I_DEFAULT = 'X'
I_SAVE = 'X'
IT_EVENTS = INT_EVENTS
TABLES
T_OUTTAB = INT_PETROL1
EXCEPTIONS
PROGRAM_ERROR = 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.
ENDIF.
*& Form GET_VALUE
text
FORM GET_VALUE.
GET PARAMETER ID: 'NUM' FIELD TEMP_NUM.
IF TEMP_NUM <> ''.
LEN1 = STRLEN( TEMP_NUM ).
PERFORM GET_PERNR.
APPEND TEMP_NUM TO EMPNO.
LOOP AT EMPNO INTO EMP_NO.
CALL FUNCTION 'CHECK_AND_CONVERT_NUMERICS'
EXPORTING
DFELD = ' '
DMZEI = ','
DTYPE = 'STRING'
DYPNO = ' '
EFELD = EMP_NO-PERNR
FNAME = ' '
PROGR = ' '
IMP_DECIMALS = '0'
IMPORTING
ERROR =
IFELD = EMP_NO1-PERNR
MESSG = ERR
MSGLN =
IF ( ERR-MSGID = '' ).
APPEND EMP_NO1 TO EMPNO1.
CLEAR EMP_NO1-PERNR.
ELSE.
MESSAGE I455(0) WITH 'Could not convert employee number'.
LEAVE TO SCREEN 0.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. "GET_VALUE
*& Form GET_PERNR
text
FORM GET_PERNR.
SPLIT TEMP_NUM AT ',' INTO EMP_NO TEMP_NUM.
APPEND EMP_NO TO EMPNO.
CLEAR EMP_NO.
SEARCH TEMP_NUM FOR ','.
IF SY-SUBRC = 0.
PERFORM GET_PERNR.
ENDIF.
ENDFORM. "GET_PERNR
*& Form ERROR_MSG
text
--> p1 text
<-- p2 text
FORM ERROR_MSG.
IF SY-SUBRC <> 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
LANG = SY-LANGU
IMPORTING
MSG = MSG-MSG1.
APPEND MSG.
CLEAR MSG.
ENDIF.
ENDFORM. "ERROR_MSG
*& Form F_BDCDATA
text
FORM F_BDCDATA.
PERFORM BDC_DYNPRO USING 'SAPMP50A' '1000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=INS'.
PERFORM BDC_FIELD USING 'RP50G-PERNR'
INT_0015-PERNR.
PERFORM BDC_FIELD USING 'RP50G-TIMR6'
'X'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RP50G-CHOIC'.
PERFORM BDC_FIELD USING 'RP50G-CHOIC'
'0015'.
PERFORM BDC_DYNPRO USING 'MP001500' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'Q0015-BETRG'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'P0015-LGART'
'0077'. "CHANGE WAGE TYPE HERE
ALSO
PERFORM BDC_FIELD USING 'Q0015-BETRG'
INT_0015-BETRG.
PERFORM BDC_FIELD USING 'P0015-WAERS'
'INR'.
PERFORM BDC_FIELD USING 'P0015-BEGDA'
INT_0015-BEGDA.
PERFORM BDC_DYNPRO USING 'MP001500' '2000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'P0015-LGART'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=UPD'.
PERFORM BDC_FIELD USING 'P0015-LGART'
'0077'. "CHANGE WAGE TYPE HERE
ALSO
PERFORM BDC_FIELD USING 'Q0015-BETRG'
INT_0015-BETRG.
PERFORM BDC_FIELD USING 'P0015-WAERS'
'INR'.
PERFORM BDC_FIELD USING 'P0015-BEGDA'
INT_0015-BEGDA.
ENDFORM. "F_BDCDATA
*& Form BDC_DYNPRO
text
-->P_0732 text
-->P_0733 text
FORM BDC_DYNPRO USING VALUE(P_0732) TYPE C
VALUE(P_0733) TYPE C.
CLEAR BDCDATA.
BDCDATA-PROGRAM = P_0732.
BDCDATA-DYNPRO = P_0733.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
text
-->P_0755 text
-->P_0756 text
FORM BDC_FIELD USING VALUE(P_0755) TYPE C
VALUE(P_0756) TYPE C.
CLEAR BDCDATA.
BDCDATA-FNAM = P_0755.
BDCDATA-FVAL = P_0756.
APPEND BDCDATA.
ENDFORM. " BDC_FIELD
*& Form CAL_ALLOWANCE
text
FORM CAL_ALLOWANCE.
LOOP AT INT_PETROL1 INTO INT_PETROL.
IF INT_PETROL-TRFST = 'L1'.
INT_PETROL-PALLOWANCE = P_RATE * 100. "CHANGE TO SELECT WHEN
DISPLAY
ELSEIF INT_PETROL-TRFST = 'L2'.
INT_PETROL-PALLOWANCE = P_RATE * 150.
ELSEIF INT_PETROL-TRFST = 'L3'.
INT_PETROL-PALLOWANCE = P_RATE * 150.
ELSEIF INT_PETROL-TRFST = 'L4'.
INT_PETROL-PALLOWANCE = P_RATE * 200.
ELSEIF INT_PETROL-TRFST = 'L5'.
INT_PETROL-PALLOWANCE = P_RATE * 250.
ENDIF.
MODIFY INT_PETROL1 FROM INT_PETROL TRANSPORTING PALLOWANCE.
ENDLOOP.
ENDFORM. "CAL_ALLOWANCE
*& Form FILL_FIELDCAT
text
--> p1 text
<-- p2 text
FORM FILL_FIELDCAT.
INT_FIELDCAT-COL_POS = 1.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'PERNR'.
INT_FIELDCAT-SELTEXT_L = TEXT-005.
INT_FIELDCAT-OUTPUTLEN = 10.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.
INT_FIELDCAT-COL_POS = 2.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'NAME'.
INT_FIELDCAT-SELTEXT_L = TEXT-006.
INT_FIELDCAT-OUTPUTLEN = 25.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.
INT_FIELDCAT-COL_POS = 3.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'TRFST'.
INT_FIELDCAT-SELTEXT_L = TEXT-007.
INT_FIELDCAT-OUTPUTLEN = 5.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.
INT_FIELDCAT-COL_POS = 4.
INT_FIELDCAT-TABNAME = 'INT_PETROL1'.
INT_FIELDCAT-FIELDNAME = 'PALLOWANCE'.
INT_FIELDCAT-SELTEXT_L = TEXT-008.
INT_FIELDCAT-OUTPUTLEN = 16.
INT_FIELDCAT-KEY = 'X'.
APPEND INT_FIELDCAT.
CLEAR INT_FIELDCAT.
ENDFORM. " FILL_FIELDCAT
*& Form GET_EVENTS_ALV
text
--> p1 text
<-- p2 text
FORM GET_EVENTS_ALV.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 1
IMPORTING
ET_EVENTS = INT_EVENTS[]
EXCEPTIONS
LIST_TYPE_WRONG = 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.
READ TABLE INT_EVENTS INTO WS_EVENTS WITH KEY NAME =
SLIS_EV_TOP_OF_PAGE.
IF SY-SUBRC = 0.
WS_EVENTS-FORM = 'TOP'.
MODIFY INT_EVENTS FROM WS_EVENTS INDEX SY-TABIX.
ENDIF.
ENDFORM. " GET_EVENTS_ALV
*& Form TOP-OF-PAGE
text
FORM TOP.
*-- ALV Declarations
DATA: WS_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.
*-- Title
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = TEXT-009.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = TITLE.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = ' '.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = ' '.
APPEND WA_HEADER TO WS_HEADER.
CLEAR WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = WS_HEADER
I_LOGO = 'LOGO'.
ENDFORM. "TOP-OF-PAGE
regards
karthik
Edited by: KARTIKEYA (EDS-VZG) on May 5, 2008 1:41 PM -
i am calling a transaction from alv i want to select the check boxes on th called transaction and go to the next screen how do i do that
Hello Chandan
You have to handle the DOUBLE_CLICK event either in your callback form routine (FM-based ALV) or event handler method for event USER_COMMAND (ABAP-OO based ALV).
If you call the transaction directly you will not have the authority check for this transaction. If you need this, you can use function module <b>ABAP4_CALL_TRANSACTION</b> instead.
If you want to open the transaction in a new window you can use the static method <b>CL_RECA_GUI_SERVICES=>CALL_TRANSACTION</b> (no authority check!).
Regards
Uwe -
Calling custom dialog screen from Standard Transaction(user Exit)
Hi, I'm calling Standard Transaction from a Custom Screen. I'm calling a custom screen again with in standard transaction (implemented custom screen thru user exits using macros). But when I click 'continue/cancel' in the custom screen, control is going back to main cutom screen rather go back to standard transaction. Could anyone please help me out how to come back to standard transaction from custom screen rather going back to main cutom screen.
***INCLUDE LZ_R_FORWARD_FORWARD_LOADI01 .
*& Module USER_COMMAND_9000 INPUT
MODULE user_command_9000 INPUT.
CASE sy-ucomm.
WHEN 'EXEC'.
PERFORM validate_popup_data.
IF flag_error_screen NE 'X'.
MOVE-CORRESPONDING ZFFL_POPUP to var_ZFFL_POPUP.
clear flag_return.
SET SCREEN 0.
LEAVE SCREEN.
ENDIF.
WHEN 'CANC'.
flag_return = 'X'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Module exit_9000 INPUT
MODULE exit_9000 INPUT.
CASE sy-ucomm.
WHEN 'CANC'.
* MOVE perf_flag TO lbpla_exist_flag.
flag_return = 'X'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDMODULE. " exit_9000 INPUT
Thanks in advance.Hi
So the command SET SCREEN 0. LEAVE SCREEN. should "place" the program just after the calling of the popup so here:
FUNCTION z_call_screen.
* Call the Pop up screen
CALL SCREEN 9000 STARTING AT 35 05.
"<------------------------- The program should be here after going back from popup 9000
ENDFUNCTION.
Is it true?
Max -
How to get information from a text editor in the SAP standard transactions
Hi SAP gurus I have a requirement in which it is required to gte the information from a text editor(which is not a field) in mm02 (click on) goto Purchase Order Text in this view there is a text editor there is some text in te the text editor i have to get that information in a table can it be done if so please give example and steps
Points will be given to useful informationAh yes, excellent question, and not really a clear cut answer. In my experience, the easiest way to find this information is to simply create the text using the standard transaction, in this case MM02. Then go to transaction SE16, using table STXH, do a query on this table, entering your user name, and today's date as the creation date. The results should show the text that you just created, now you can see the object, id, and the way the name is being used here.
I also understand that in some cases, there is a button next to the editor in the screen which gives you some idea of these values, but this is not implemented everywhere, and I believe that I've only seen this in one place, can't remember where, but the first solution above will always work for you.
Regards,
Rich Heilman -
HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?
HI,
HOW TO PASS THE DATA FROM SELECTION SCREEN TO STANDARD TRANSACTION?
thanks,
samba.By selection screen, what do you mean? There is no selection screen in WDA as there was in classic dynpro. Do you mean you are using the Select-Options reusable component? Are you wanting to call a standard transaction via ITS - SAPGUI for HTML? Please provide more details to your question.
-
Call a ABAP webdynpro application from a standard transaction.
Hi Gurus,
Can we trigger a webdynpro application on a click of button from a standard transaction as IW31 and pass some of the parameters?
If so, how do we do that?
Please let me know.
Thanks,
DasHi,
You can trigger the webdynpro application on click of a button.
construct the URL dynamically or you can use the URL of the application present in WebDynpro application(if you are sure that if this application run only in this system).
We can display the application either in standard screen using HTML control or we can also open the browser on click of a button on standard screen using the code:
call method cl_gui_frontend_services=>execute
exporting
application = 'www.google.com'
exceptions
others = 1.
For passing the parameters to the application:
1. Create the parameters in the default interface plug of the application.
2. Associate the parameters to the WebDynpro application
3. Pass the parameters to the application by appending to the URL like (¶1=abc¶2=def).
Best regards,
Suresh
P.S. we can define the parameters in the Webdynpro component by defining the importing parameters in the default interface view's inbound plug's method. If we define the importing parameters in the inbound plug (for example DEFAULT plug of the window) then they are visible in the parameters tab in the WD application.
We can receive the parameters in the inbound plug method (HANDLE<plugname>) of the window (interface view associate in application).
Message was edited by:
Suresh Honnappanavar -
Can we call standard transaction from bsp
Hi,
Can anyone tell me how to call a standard transaction(va01) from bsp.
Points will be awarded,
Ugandhar.Hello,
check out this coding in a new bsp page and give it a try in your system landscape. It creates an sap short cut file with the .sap extension writes dynamically to the server cache and get the url back.
Regards, Bernd
Layout:
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<htmlb:page title="Start SAP GUI Transaction via BSP" >
<htmlb:form>
<htmlb:textView text = "Start SAP GUI Transaction via BSP"
design = "header1" />
<htmlb:textView layout = "paragraph"
text = "Fill in fields and press the button to create the link." />
<table width=200>
<tr>
<td>
<htmlb:label for = "client"
text = "Client" />
</td>
<td>
<htmlb:inputField id = "client"
value = "<%= client %>" />
</td>
</tr>
<tr>
<td>
<htmlb:label for = "sysid"
text = "SystemID" />
</td>
<td>
<htmlb:inputField id = "sysid"
value = "<%= sysid %>" />
</td>
</tr>
<tr>
<td>
<htmlb:label for = "userid"
text = "UserID" />
</td>
<td>
<htmlb:inputField id = "userid"
value = "<%= userid %>" />
</td>
</tr>
<tr>
<td>
<htmlb:label for = "transactioncode"
text = "Transaction Code" />
</td>
<td>
<htmlb:inputField id = "transactioncode"
value = "<%= transactioncode %>" />
</td>
</tr>
<tr>
<td colspan="2">
<htmlb:button id = "myButton"
text = "Create Link to start SAP Transaction"
onClick = "create_mime" />
</td>
</tr>
</table>
<%
if display_url is not initial.
%>
<htmlb:textView layout = "paragraph"
text = "Click the link to start SAP GUI Transaction." />
<htmlb:link id = "mylink"
reference = "<%= display_url %>"
text = "Link to Start SAP Transaction" />
<%
endif.
%>
</htmlb:form>
</htmlb:page>
</htmlb:content>
Page Atributes:
file_content TYPE STRING
guid TYPE GUID_32
host TYPE STRING
isolangu TYPE T002-LAISO
page_name TYPE STRING
parameters TYPE TIHTTPNVP
port TYPE STRING
sapworkdir TYPE SDOK_CHTRD
sysid TYPE SYSYSID
transactioncode TYPE TCODE
userid TYPE XUBNAME
OnInputProcessing:
* event handler for checking and processing user input and
* for defining navigation
* event handler for data retrieval
event = cl_htmlb_manager=>get_event( runtime->server->request ).
IF event->name = 'button' AND event->event_type = 'click'.
button_event ?= event.
IF button_event->server_event NE 'create_mime'.
RETURN.
ENDIF.
* get users workdir
CALL FUNCTION 'IW_C_GET_SAPWORKDIR'
IMPORTING
sapworkdir = sapworkdir.
* get iso language
CALL FUNCTION 'LANGUAGE_CODE_SAP_TO_ISO'
EXPORTING
sap_code = sy-langu
IMPORTING
iso_code = isolangu.
CONCATENATE
'[System]'
cl_abap_char_utilities=>cr_lf
'Name='
sysid
cl_abap_char_utilities=>cr_lf
'Description='
cl_abap_char_utilities=>cr_lf
'Client='
client
cl_abap_char_utilities=>cr_lf
'[User]'
cl_abap_char_utilities=>cr_lf
'Name='
userid
cl_abap_char_utilities=>cr_lf
'Language='
isolangu
cl_abap_char_utilities=>cr_lf
'Password='
cl_abap_char_utilities=>cr_lf
'[Function]'
cl_abap_char_utilities=>cr_lf
'Title='
cl_abap_char_utilities=>cr_lf
'Command='
transactioncode
cl_abap_char_utilities=>cr_lf
'[Configuration]'
cl_abap_char_utilities=>cr_lf
'WorkDir='
sapworkdir
cl_abap_char_utilities=>cr_lf
'[Options]'
cl_abap_char_utilities=>cr_lf
'Reuse=1'
INTO file_content.
CREATE OBJECT cached_response TYPE cl_http_response EXPORTING add_c_msg = 1.
cached_response->set_cdata( file_content ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = 'application/octet-stream ' ).
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->server_cache_expire_rel( expires_rel = 180 ).
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = guid.
CONCATENATE guid
'.sap'
INTO page_name.
* get server information
CALL METHOD cl_http_ext_webapp=>create_url_for_bsp_application
EXPORTING
bsp_application = runtime->application_url
bsp_start_page = page_name
bsp_start_parameters = parameters
IMPORTING
abs_url = display_url.
cl_http_server=>server_cache_upload( url = display_url
response = cached_response ).
ENDIF. -
COPY INFORMATION BUTTON FROM STANDARD TRANSACTION
Hi!
I want to copy the selection screen from the standard transaction QA07, and also I want to copy the information button that appers next to the excecution button.
How can I copy that information button????
Thanks a lot!!!!The report RQAAAS10 has the documentation and because of that documentation, the information button is coming on the QA07.
To copy this documentation:
Go to SE63
R3 Objects > Long Texts
Select the L5 > RE ( Reports, Function Groups, Logical Databases) node form the popup
Enter Report RQAAAS10
Select your languages and press Edit.
Select the Fullscreen Button.
Form the Fullscreen.. Text > Download.
Now, in your program upload this documentation.
By selecting the Text > Upload in the documentation section.
Regards,
Naimesh Patel -
Data retrival from standard transaction
hi all,
i have to get the material list from stadard t-code ca80 i have debugged the program and the whole material list is in tmapl internal table so if any one can find me a solution thats ll be very helpful. and points are rewarded
thanks in advance
anupamahi,
You can call transaction and send the data to it.
call transaction mm01 and skip first screen.
set parameter ID 'MAT' FIELD P_matnr.
Here you are passin gthe selection screen parameters to the standard transaction MM01 and skip the screen..
you start recording like in BDC and execute it here.
so you will be having the data in the internal table that you can update in the Database table.
Regards,
Madhavi -
Disable some standard buttons from ALV display
Hello All,
I am creating an ALV display using object oriented approach. I know how to exclude some of the standard function buttons from the list.
But suppose instead of deleting, the requirement is to disable (I mean grayed out)
some standard buttons from ALV. Could anyone please comment on how to do this.
Many thanks in advance.
Regards
IndrajitHello Indrajit
The following sample reports shows how to disable toolbar functions. Run the report and the push the ENTER button repeatedly.
*& Report ZUS_SDN_ALV_EVT_TOOLBAR
*& This sample report explains the handling of event TOOLBAR in order
*% to activate or inactive buttons of the ALV toolbar.
*& Based on: BCALV_GRID_DEMO
*& Procedure: Copy BCALV_GRID_DEMO and replace entire coding OR
copy screen '0100' and GUI status 'MAIN100' from
BCALV_GRID_DEMO to this report.
REPORT zus_sdn_alv_evt_toolbar.
TYPE-POOLS: abap, cntb, icon.
DATA:
ok_code TYPE ui_func,
gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
g_grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
PARAMETERS:
p_inact RADIOBUTTON GROUP grp1 DEFAULT 'X', " delete buttons
p_dele RADIOBUTTON GROUP grp1. " inactivate buttons
PARAMETERS:
p_newbut AS CHECKBOX DEFAULT ' ', " add new button
p_newddm AS CHECKBOX DEFAULT 'X'. " add dropdown menu
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_toolbar.
§ 2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
DATA:
ls_toolbar TYPE stb_button,
ls_menu type STB_BTNMNU.
E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
This class has got one attribute, namly MT_TOOLBAR, which
is a table of type TTB_BUTTON. One line of this table is
defined by the Structure STB_BUTTON (see data deklaration above).
A remark to the flag E_INTERACTIVE:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'e_interactive' is set, if this event is raised due to
the call of 'set_toolbar_interactive' by the user.
You can distinguish this way if the event was raised
by yourself or by ALV
(e.g. in method 'refresh_table_display').
An application of this feature is still unknown...
ADD 1 TO md_cnt. " a simple counter
(1.a) Inactivate toolbar buttons
IF ( p_inact = abap_true ).
LOOP AT e_object->mt_toolbar INTO ls_toolbar FROM 1 TO md_cnt.
ls_toolbar-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_toolbar.
ENDLOOP.
(1.b) Delete toolbar buttons
ELSE.
DO md_cnt TIMES.
DELETE e_object->mt_toolbar INDEX 1.
ENDDO.
ENDIF.
(2) Add new button
IF ( p_newbut = abap_true ).
Add separator to separate default and new buttons
CLEAR: ls_toolbar.
ls_toolbar-butn_type = cntb_btype_sep. " separator
APPEND ls_toolbar TO e_object->mt_toolbar.
Add new button "DETAIL"
CLEAR: ls_toolbar.
ls_toolbar-function = 'DETAIL'.
ls_toolbar-icon = icon_detail.
ls_toolbar-quickinfo = 'QuickInfo'.
ls_toolbar-butn_type = cntb_btype_button.
ls_toolbar-disabled = abap_false.
ls_toolbar-text = 'Details'.
ls_toolbar-checked = ' '.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
(3) Add new dropdown menu
IF ( p_newddm = abap_true ).
Add separator to separate default and new buttons
CLEAR: ls_toolbar.
ls_toolbar-butn_type = cntb_btype_sep. " separator
APPEND ls_toolbar TO e_object->mt_toolbar.
Add new dropdown menu "DETAIL"
CLEAR: ls_toolbar.
ls_toolbar-function = 'DDMENU'.
ls_toolbar-icon = icon_detail.
ls_toolbar-quickinfo = 'QuickInfo'.
ls_toolbar-butn_type = cntb_btype_dropdown.
ls_toolbar-disabled = abap_false.
ls_toolbar-text = 'DD-Menu'.
ls_toolbar-checked = ' '.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
MAIN *
SELECT * FROM sflight INTO TABLE gt_sflight.
CALL SCREEN 100.
END-OF-SELECTION.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
Instantiate ALV grid control
CREATE OBJECT g_grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD g_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = gt_sflight.
Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_toolbar FOR g_grid1.
ENDIF.
$Comment: Toolbar can be modified on-the-fly
g_grid1->set_toolbar_interactive( ).
ENDMODULE. "PBO OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN OTHERS.
do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD G_CUSTOM_CONTAINER->FREE.
CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM[/code]
Regards
Uwe -
How to restrict some users from viewing a screen of standard transaction
Hi All,
I need to restrict certain user ids from viewing the 'Payment Transactions' screen for the below mentioned transactions.
FK01, FK02, FK03, MK01, MK02, MK03, XK01, XK02, XK03
The Basis consultant has tried to configure it. However its not working. So need to find other solution.
For all transactions other than FK01, MK01, XK01 (create vendor), the BAdi GOS_SRV_SELECT is called before the payment transaction screen appears. But for transactions FK01, MK01and XK0, no such BAdi is there.
Also I'm not able to figure out how to restrict that particular screen using Badi GOS_SRV_SELECT. What will be the service name for this?
Please help !!!
Thanks in advance,
Radhikahi,
u can do this using user exits.
identify the appropriate exit for ur transaction and thn put condition like
if username = ...
loop at screen.
hide..
endloop.
i was just trying to give u some hint .make it to ur best.
reward if hlpful. -
Standard Transaction Customization
I want to use standard transaction(ME2N)and append three more fields to the displaying report.
here the LDB ENM used in the Program RM06EN00.. how to know the report output structure? and the output need to display in a normal ALV report.
Please help me... if any relative code provide me..
Thanks in advance..Hi,
go to customizing:
Materials Management -> Purchasing -> Reporting -> Scope of List -> Define Scope of List and create your own scope of list.
In ME2N fill in the new scope in list in the 3rd field from the top.
Regards,
Andreas Gieres -
Hi experts,
Please tell me how to generate Interactive list from ALV.
I have already created interactive list without ALV
( using AT LINE SELECTION)Please refer to the below code.
A very good example with most of the company Standards.
*& Report zalv *
REPORT zalv .
TYPE-POOLS: kkblo,
slis.
TABLES: mara, marc, mard.
DATA: disvariant LIKE disvariant,
eventcat TYPE slis_t_event,
eventcat_ln LIKE LINE OF eventcat,
fieldcat TYPE slis_t_fieldcat_alv,
fieldcat_kkb TYPE kkblo_t_fieldcat,
fieldcat_ln LIKE LINE OF fieldcat,
keyinfo TYPE slis_keyinfo_alv,
layout TYPE slis_layout_alv,
layout_kkb TYPE kkblo_layout,
pgm LIKE sy-repid,
printcat TYPE slis_print_alv,
sortcat TYPE slis_t_sortinfo_alv,
sortcat_ln LIKE LINE OF sortcat,
BEGIN OF coltab OCCURS 50,
fieldname LIKE fieldcat_ln-fieldname,
END OF coltab.
DATA: print TYPE slis_print_alv.
DATA : v_repid TYPE sy-repid.
DATA: BEGIN OF wa OCCURS 0,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
aenam TYPE mara-aenam,
werks TYPE marc-werks,
pstat TYPE marc-pstat,
lfmon TYPE mard-lfmon,
END OF wa.
DATA: itab LIKE TABLE OF wa.
**Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001..
SELECT-OPTIONS: mat_no FOR mara-matnr.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK b1.
* Parameter for list viewer display variant
PARAMETERS: variant LIKE disvariant-variant.
AT SELECTION-SCREEN ON variant.
CHECK NOT variant IS INITIAL.
PERFORM check_variant_existence USING variant 'U'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR variant.
PERFORM f4_display_variant USING variant 'U'.
*Initialization
INITIALIZATION.
v_repid = sy-repid.
*Start of selection
PERFORM check_tcode_authority USING 'SA38'.
START-OF-SELECTION.
SELECT a~matnr a~ersda
a~ernam a~aenam
c~werks c~pstat d~lfmon
INTO TABLE itab
UP TO 10 ROWS
FROM mara AS a
INNER JOIN marc AS c ON a~matnr = c~matnr
INNER JOIN mard AS d ON c~matnr = d~matnr
WHERE a~matnr IN mat_no.
*End of Selection
END-OF-SELECTION.
PERFORM call_list_viewer.
*& Form call_list_viewer
* text
FORM call_list_viewer .
PERFORM build_fieldcat USING:
'MATNR' 'ITAB'
'Material #' 'CHAR' 18 ' ' ' ' ' ' ' ' ' ',
'ERSDA' 'ITAB'
'Date Created' 'CHAR' 10 ' ' ' ' ' ' ' ' ' ',
'ERNAM' 'ITAB'
'Created By' 'CHAR' 10 ' ' ' ' ' ' ' ' ' ',
'AENAM' 'ITAB'
'Changed By' 'CHAR' 10 ' ' ' ' ' ' ' ' ' ',
'WERKS' 'ITAB'
'Plant' 'CHAR' 4 ' ' ' ' ' ' ' ' ' ',
'PSTAT' 'ITAB'
'Status' 'CHAR' 10 ' ' ' ' ' ' ' ' ' ',
'LFMON' 'ITAB'
'Current Period' 'CHAR' 8 ' ' ' ' ' ' ' ' ' '.
PERFORM build_eventcat USING: 'TOP_OF_LIST',
'TOP_OF_PAGE'.
PERFORM list_display TABLES itab.
ENDFORM. "call_list_viewer
* build field catalog entry *
FORM build_fieldcat USING a_fieldname
a_tabname
a_heading
a_datatype
a_outputlen
a_key
a_no_out
a_no_sum
a_do_sum
a_no_zero.
CLEAR fieldcat_ln.
fieldcat_ln-fieldname = a_fieldname.
fieldcat_ln-tabname = a_tabname.
fieldcat_ln-outputlen = a_outputlen.
fieldcat_ln-datatype = a_datatype.
fieldcat_ln-reptext_ddic = a_heading.
fieldcat_ln-key = a_key.
fieldcat_ln-no_out = a_no_out.
fieldcat_ln-no_sum = a_no_sum.
fieldcat_ln-do_sum = a_do_sum.
fieldcat_ln-no_zero = a_no_zero.
APPEND fieldcat_ln TO fieldcat.
ENDFORM. "BUILD_FIELDCAT
* FORM BUILD_EVENTCAT
FORM build_eventcat USING a_event.
eventcat_ln-name = eventcat_ln-form = a_event.
APPEND eventcat_ln TO eventcat.
ENDFORM. "BUILD_EVENTCAT
* call the ABAP list viewer *
FORM list_display TABLES a_output.
pgm = disvariant-report = sy-repid.
disvariant-variant = variant.
* call list viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = pgm
* i_callback_pf_status_set = 'SET_PF_STATUS'
it_fieldcat = fieldcat
is_variant = disvariant
is_layout = layout
is_print = print
i_save = 'A'
it_events = eventcat
it_sort = sortcat
* i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = a_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "LIST_DISPLAY
*& Form top_of_page
* text
FORM top_of_page.
PERFORM standard_headings.
PERFORM print_selection_screen TABLES:
mat_no USING 'Material No : ' 18 'N' 1.
ENDFORM. "top_of_page
* FORM CHECK_VARIANT_EXISTENCE
* Verify that a variant on the selection screen exists
FORM check_variant_existence USING varname LIKE disvariant-variant
save TYPE c.
DATA: xdisvar LIKE disvariant.
xdisvar-report = sy-repid.
xdisvar-variant = varname.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = save
CHANGING
cs_variant = xdisvar
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e256(56) WITH varname.
* Anzeigevariante &1 nicht gefunden
ENDIF.
disvariant-report = sy-repid.
disvariant-variant = varname.
ENDFORM. "check_variant_existence
* Form F4_DISPLAY_VARIANT
* F4 help to find a display variant
* varname = name of the dynpro field for which f4 is requested
* save = type of list variant saving
* ' ' = no saving allowed
* 'A' = standard & user specific variants can be saved
* 'U' = only user specific variants can be saved
* 'X' = only standard variants can be saved
FORM f4_display_variant USING varname LIKE disvariant-variant
save TYPE c.
disvariant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = disvariant
i_save = save
IMPORTING
es_variant = disvariant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
varname = disvariant-variant.
ELSE.
MESSAGE s245(56).
* Keine Anzeigevariante(n) vorhanden
ENDIF.
ENDFORM. " F4_DISPLAY_VARIANT
* FORM STANDARD_HEADINGS *
* Print standard page headings for report *
FORM standard_headings.
DATA: start_column TYPE i,
title_len TYPE i,
header_for_80_col(45),
date_time_for_80_col(45),
text_h0(11) VALUE 'Report No. ',
text_h1(5) VALUE 'Date ',
text_h2(6) VALUE 'Page -',
text_h3(7) VALUE 'System ',
text_h4(5) VALUE 'Time ',
text_h5(11) VALUE 'Run By '.
FORMAT INTENSIFIED ON.
CONDENSE syst-title.
IF syst-linsz > 80.
WRITE: / text_h0, "Report No.
12 syst-repid(8),
23 text_h1, "Date
sy-datlo.
title_len = STRLEN( syst-title ) / 2.
start_column = ( syst-linsz / 2 ) - title_len.
IF start_column < 40.
start_column = 40.
ENDIF.
WRITE: AT start_column syst-title.
ELSE.
WRITE: / text_h0, "Report No.
12 syst-repid(8).
start_column = 22.
WRITE syst-title TO header_for_80_col CENTERED.
WRITE: header_for_80_col.
ENDIF.
start_column = syst-linsz - 12.
WRITE: AT start_column text_h2, syst-pagno LEFT-JUSTIFIED.
IF syst-linsz > 80.
WRITE: / text_h3, "System
12 syst-sysid(4),
syst-mandt,
23 text_h4, "Time
syst-timlo.
WRITE: / text_h5, "Run By
12 syst-uname.
ELSE.
WRITE: / text_h3, "System
12 syst-sysid(4),
syst-mandt,
23 text_h1, "Date
syst-datlo.
WRITE: / text_h5, "Run By
12 syst-uname,
23 text_h4, "Time
syst-timlo.
ENDIF.
SKIP.
ENDFORM. "STANDARD_HEADINGS
* FORM PRINT_SELECTION_SCREEN *
* --> SIGN *
* --> OPTION *
* --> LOW *
* --> HIGH *
* --> D_IND *
* --> S_STRING *
FORM print_selection_screen TABLES r_selection TYPE table
USING p_name
p_length TYPE i
p_ind
p_start_col.
DATA: year(4) TYPE c,
month(2) TYPE c,
day(2) TYPE c,
low_date(10) TYPE c,
high_date(10) TYPE c,
offset(80) TYPE c.
DATA: BEGIN OF l_selline,
sign(1) TYPE c,
option(2) TYPE c,
data(200) TYPE c,
END OF l_selline.
DATA: l_string(80) TYPE c,
l_temp(80) TYPE c,
len TYPE i,
len1 TYPE i.
DESCRIBE FIELD p_name LENGTH len IN CHARACTER MODE.
len = len + p_start_col + 2.
LOOP AT r_selection.
IF syst-tabix = 1.
WRITE AT /p_start_col p_name.
ELSE.
len1 = ( STRLEN( l_string ) ).
len = len1 + len + 2.
ENDIF.
MOVE r_selection TO l_selline.
SHIFT l_selline-data LEFT DELETING LEADING '0'.
CLEAR l_string.
CASE l_selline-option.
WHEN 'EQ'.
CONCATENATE l_string '=' INTO l_string.
WHEN 'NE'.
CONCATENATE l_string 'not =' INTO l_string.
WHEN 'LT'.
CONCATENATE l_string '<' INTO l_string.
WHEN 'GT'.
CONCATENATE l_string '>' INTO l_string.
WHEN 'LE'.
CONCATENATE l_string '<=' INTO l_string.
WHEN 'GE'.
CONCATENATE l_string '>=' INTO l_string.
WHEN 'BT'.
CONCATENATE l_string 'between' INTO l_string.
WHEN 'NB'.
CONCATENATE l_string 'not between' INTO l_string.
WHEN 'CP'.
CONCATENATE l_string 'contains pattern' INTO l_string.
WHEN 'NP'.
CONCATENATE l_string 'no pattern' INTO l_string.
ENDCASE.
IF l_selline-sign EQ 'E'.
CONCATENATE 'NOT' l_string INTO l_string SEPARATED BY ' '.
ENDIF.
IF p_ind EQ 'Y'.
MOVE l_selline-data(4) TO year.
MOVE l_selline-data+4(2) TO month.
MOVE l_selline-data+6(2) TO day.
CONCATENATE month '/' day '/' year INTO low_date.
CONCATENATE l_string low_date INTO l_string SEPARATED BY ' '.
IF l_selline-option EQ 'BT' OR l_selline-option EQ 'NB'.
MOVE l_selline-data+p_length(4) TO year.
offset = p_length + 4.
MOVE l_selline-data+offset(2) TO month.
ADD 2 TO offset.
MOVE l_selline-data+offset(2) TO day.
CONCATENATE month '/' day '/' year INTO high_date.
CONCATENATE l_string 'and' high_date INTO l_string SEPARATED
BY ' '.
ENDIF.
ELSE.
MOVE l_selline-data(p_length) TO l_temp.
CONCATENATE l_string l_temp INTO l_string SEPARATED BY ' '.
IF l_selline-option EQ 'BT' OR l_selline-option EQ 'NB'.
MOVE l_selline-data+p_length(p_length) TO l_temp.
CONCATENATE l_string 'and' l_temp INTO l_string SEPARATED
BY ' '.
ENDIF.
ENDIF.
WRITE AT len l_string.
ENDLOOP.
IF syst-subrc <> 0.
WRITE: AT /p_start_col p_name, ' *** ALL ***'.
ENDIF.
ENDFORM. "PRINT_SELECTION_SCREEN
* FORM CHECK_TCODE_AUTHORITY *
* Check User Security Against A SAP Transaction *
* --> a_tcode Transaction Code For Security *
FORM check_tcode_authority USING a_tcode.
* if tcode is not passed, then return ok.
IF NOT a_tcode IS INITIAL.
CALL FUNCTION 'AUTHORITY_CHECK_TCODE'"Only People that
EXPORTING " have access to
tcode = a_tcode " Transaction t-tcode
EXCEPTIONS " are ALLOWED to execute
ok = 1 " this Program
not_ok = 2.
IF syst-subrc NE 1.
MESSAGE a999(zz) WITH 'YOU Do Not Have Authority to Execute'.
ENDIF.
ELSE.
MOVE 1 TO syst-subrc.
ENDIF.
ENDFORM. "CHECK_TCODE_AUTHORITY
Shreekant
Maybe you are looking for
-
Trouble downloading video on Zen Visio
I haven't been able to find a site to download a movie onto my Zen Vision M. I downloaded a movie from CinemaNow and it would play on my computer but wouldn't download to the Zen. I would really like to use the video feature for movies. Does anyone k
-
Im relitivley new to using AIR. Currently using the latest Free SDK and our HTML/JS app. Primary use for our app is to allow multi download/uploads into our web editor. The profile is 'extendedDesktop' as we need to execute a desktop app from within.
-
Hi Folks, We have the following scenario: - SunFire v490 server - DAT 72 tape, SCSI - LTO4 tape, FC (via qlogic HBA) - Solaris 9 + updated patches We need some help regarding the FC tape configuration. *"cfgadm -al"* shows the FC tape as: c4::500110a
-
Why can't I see my calendar in .mac?
When I go to my .mac account, I cannot open my calendar. Either to see what was syned or simply to enter a new entry. When I click on the icon, it brings me to a generic page. What gives?
-
For some reason the audio got out of sync with the video in my clip. I extracted the audio, scooted it over a little and it's fine. Now I want to put the two back together and get rid of the original audio so I can move the corrected clip to the Clip