01-09-2007 11:07 AM
Hi Experts,
I am prepring a interactive report.Consider the first table in the report shows some details like material number, profit center,status,creation date for materials entered on selection screen.
On double click on any of this material(or any place at the row) it should show its component details since the header materials entered on the selction screen is a BOM.
i've all component details in another table.I want to display the second table based on the value seleted on first screen.
Could anybody help.
Thanks in advance,
Ponraj.s.
01-09-2007 11:10 AM
Hello PONRAJ,
U can do it.
When u are writing the first list, after write statement hide the<b> matnr</b> field
Write: Itab-matnr.
Hide: Itab-matnr.
In At line-selection event.
LOOP at ITAB2 where matnr = itab1-matnr.
Write ******.
ENDLOOP.
If useful reward.
Vasanth
01-09-2007 11:10 AM
Hello PONRAJ,
U can do it.
When u are writing the first list, after write statement hide the<b> matnr</b> field
Write: Itab-matnr.
Hide: Itab-matnr.
In At line-selection event.
LOOP at ITAB2 where matnr = itab1-matnr.
Write ******.
ENDLOOP.
If useful reward.
Vasanth
01-09-2007 11:15 AM
refer this demo code of mine - look program ZGILL_IT on D47 server
REPORT zgill_it message-id rp .
INCLUDE <icon> .
TABLES : zgill_main,zgill_details.
selection-screen:
pushbutton 1(20) gocfg user-command amit,
skip 1.
*parameters: p_file default ' '
data d_flag value 'X'.
parameters fpath like rlgrap-filename default 'C:\Temp\ABC.xls' MODIF id 1.
parameters fpath1 like DXFIELDS-LONGPATH default 'D:\usr\sap\D47\DVEBMGS00\data\KISS' .
SELECT-OPTIONS l_pernr FOR zgill_main-pernr OBLIGATORY NO INTERVALS.
data: cursorfield(20).
DATA : BEGIN OF itab OCCURS 0,
pernr like zgill_main-pernr,
name like zgill_main-name,
dob like zgill_main-dob,
org like zgill_main-org,
INCLUDE STRUCTURE zgill_main.
*DATA : fname LIKE zgill_details-fname,
fname LIKE zgill_details-fname,
lname LIKE zgill_details-lname,
dname LIKE zgill_details-dname,
plans LIKE zgill_details-plans,
salary LIKE zgill_details-salary,
hdate LIKE zgill_details-hdate.
DATA: END OF itab.
AT SELECTION-SCREEN OUTPUT.
write icon_configuration as icon to gocfg.
concatenate gocfg 'Feilds for selection/delection' into gocfg.
perform modify_screen.
at selection-screen.
if sy-ucomm = 'AMIT' .
perform toggle_flag.
endif.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR fpath1.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = 'A'
I_SERVER = '?'
I_PATH =
FILEMASK = '.'
FILEOPERATION = 'R'
IMPORTING
O_LOCATION_FLAG =
O_SERVER =
O_PATH = fpath1
ABEND_FLAG =
EXCEPTIONS
RFC_ERROR = 1
ERROR_WITH_GUI = 2
OTHERS = 3.
START-OF-SELECTION.
PERFORM get_main_data.
********************ki
perform appplication.
if d_flag = 'X'.
PERFORM write_main.
else .
perform download_itab.
endif.
*
END-OF-SELECTION.
AT LINE-SELECTION.
PERFORM get_other_details.
GET CURSOR FIELD CURSORFIELD.
case cursorfield.
when 'ITAB-PERNR' .
PERFORM get_other_details.
when 'ZGILL_DETAILS-FNAME'.
submit ZGILL_CALLREPORT
with P_RNAME EQ SY-REPID .
*submit ZGILL_CALLREPORT exporting list to memory and return.
endcase.
if cursorfield = 'ITAB-PERNR'.
PERFORM get_other_details.
endif.
if cursorfield = 'ZGILL_DETAILS-DNAME'.
submit ZGILL_CALLREPORT
with P_RNAME EQ SY-REPID .
endif.
&----
*& Form get_main_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM get_main_data .
LOOP AT l_pernr.
SELECT SINGLE * FROM zgill_main WHERE pernr = l_pernr-low.
MOVE-CORRESPONDING zgill_main TO itab.
APPEND itab.
ENDLOOP.
ENDFORM. " get_main_data
&----
*& Form write_main
&----
text
----
--> p1 text
<-- p2 text
----
FORM write_main .
FORMAT INTENSIFIED ON COLOR 1.
WRITE: 5'PERNR' ,15 'NAME' ,40 'BirthDate',55 'Org Unit'.
*write: 5'PERNR' color 1 ,15 'NAME' color 1,40 'BirthDate' color 1,55 'Org Unit' color 1 .
SKIP 1.
FORMAT INTENSIFIED OFF COLOR OFF..
LOOP AT itab.
WRITE: 5 itab-pernr HOTSPOT ON COLOR 3 ,15 itab-name COLOR 2,40 itab-dob COLOR 2,55 itab-org COLOR 2.
HIDE itab-pernr.
SKIP 1.
write: 5 'also transfer to application server just look at it open AL11' COLOR 5.
ENDLOOP.
ENDFORM. " write_main
&----
*& Form get_other_details
&----
text
----
--> p1 text
<-- p2 text
----
FORM get_other_details .
SELECT SINGLE * FROM zgill_details WHERE pernr = itab-pernr .
MOVE-CORRESPONDING zgill_details TO itab.
FORMAT INTENSIFIED ON COLOR 1.
WRITE: 5'FNAME' ,20 'LNAME' ,35 'DNAME',50 'Position' ,65 'Salary',85 'HireDate'.
SKIP 1.
FORMAT INTENSIFIED OFF COLOR OFF.
WRITE: 5 zgill_details-fname HOTSPOT ON COLOR 3,20 zgill_details-lname COLOR 2,35 zgill_details-dname COLOR 2,
50 zgill_details-plans COLOR 2,65 zgill_details-salary LEFT-JUSTIFIED COLOR 2,85 zgill_details-hdate COLOR 2.
ENDFORM. " get_other_details
&----
*& Form modify_screen
&----
text
----
--> p1 text
<-- p2 text
----
form modify_screen .
LOOP AT SCREEN.
IF SCREEN-GROUP1 = '1'.
OR SCREEN-GROUP1 = '4'.
IF d_FLAG EQ 'X'.
SCREEN-ACTIVE = 0.
ELSE.
SCREEN-ACTIVE = 1.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
endform. " modify_screen
&----
*& Form toggle_flag
&----
text
----
--> p1 text
<-- p2 text
----
form toggle_flag .
IF d_FLAG = 'X'.
CLEAR d_FLAG.
ELSE.
d_FLAG = 'X'.
ENDIF.
endform. " toggle_flag
&----
*& Form download_itab
&----
text
----
--> p1 text
<-- p2 text
----
form download_itab .
DATA: full_file_name TYPE string.
full_file_name = fpath.
*CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = full_file_name
filetype = 'ASC'
NO_AUTH_CHECK = c_x
codepage = '1160'
IMPORTING
FILELENGTH = z_akt_filesize
CHANGING
data_tab = itab[]
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = full_file_name
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ','
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = '1160'
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
FILELENGTH =
tables
data_tab = itab[].
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
*
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE i016 WITH 'Download-Error; RC:' sy-subrc.
else.
write 'successfull'.
ENDIF.
endform. " download_itab
&----
*& Form appplication
&----
text
----
--> p1 text
<-- p2 text
----
FORM appplication .
data:c_tab type c
value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
v_text type string.
open dataset fpath1 for output IN TEXT MODE ENCODING DEFAULT .
if sy-subrc = 0.
loop at itab.
concatenate itab-pernr itab-name itab-dob itab-org into v_text
separated by c_tab.
transfer v_text to fpath1.
endloop.
endif.
close dataset fpath1.
ENDFORM. " appplication
01-09-2007 11:16 AM
use Fms
F4_IF_FIELD_VALUE_REQUEST
DYNP_VALUES_UPDATE
DYNP_VALUES_READ
use this in the selection screen.
if in a report(interactive) then do the coding in
at line selection.
regards,
vijay
01-09-2007 11:17 AM
Check this sample code
________________________________________
report zmjud001 no standard page heading line-size 85 line-count 50.
DATA /TABLES DECLARATION*
tables: eban.
data: prog_nam(8).
data: begin of pur_req occurs 100,
ekgrp like eban-ekgrp,
werks like eban-werks,
banfn like eban-banfn,
bnfpo like eban-bnfpo,
bsart like eban-bsart,
estkz like eban-estkz,
matnr like eban-matnr,
menge like eban-menge,
meins like eban-meins,
numb(3) type n.
data: end of pur_req.
THE REPORT HEADER
prog_nam = sy-repid.
top-of-page.
perform header_write.
SELECTION
start-of-selection.
pur_req-numb = 1.
SELECT ONLY THOSE FIELDS THAT WILL BE USED FROM THE TABLE EBAN, AND ONLY
*THE FIRST100 RECORDS OF THE THE PLANT 'PL01'
select banfn bnfpo bsart ekgrp matnr werks menge meins frgdt estkz
into corresponding fields of eban from eban up to 100 rows
where bsart = 'NB' "document type 'NB' = purchase requisition
and werks = 'PL01'
and statu = 'N' "processing status
and loekz = ' '. "deletion indicator
THE SELECTED RECORDS SHOULD BE APPENDED TO INTERNAL TABLE 'PUR_REQ'
pur_req-banfn = eban-banfn.
pur_req-matnr = eban-matnr.
pur_req-werks = eban-werks.
pur_req-ekgrp = eban-ekgrp.
pur_req-bnfpo = eban-bnfpo.
pur_req-bsart = eban-bsart.
pur_req-menge = eban-menge.
pur_req-meins = eban-meins.
pur_req-estkz = eban-estkz.
append pur_req.
pur_req-numb = pur_req-numb + 1.
endselect.
CHECK WHETHER THE TABLE EBAN CONTAINS ANY PURCHASE REQUISITIONS
if sy-subrc ne 0.
write: / 'No Purchase Requisition found.'.
endif.
PROCESS THE INTERNAL TABLE; WRITE OUT THE REQUIRED FIELDS AND HIDE THE
*FIELDS YOU ARE GOING TO USE LATER
loop at pur_req.
write: /1 pur_req-numb, 9 pur_req-banfn, 21 pur_req-bnfpo, 31 pur_req-bsart, 41 pur_req-matnr,
61 pur_req-menge unit pur_req-meins, 82 pur_req-meins.
hide: pur_req-matnr, pur_req-werks, pur_req-banfn.
endloop.
clear pur_req-banfn. clear pur_req-matnr. clear pur_req-werks.
IN THE MENU PAINTER (SE41) CREATE A STATUS TO YOUR PROGRAM. HERE YOU CAN
*DEFINE THE PUSH-BUTTON
set pf-status 'basic'.
CHOOSE A REQUISITION (WITH DOUBLE CLICKING OR PUSH-BUTTON) IN THE LIST! THE
*PURCHASE REQUISITION IS GOING TO COME UP
at line-selection.
if pur_req-banfn <> space.
set parameter id 'BAN' field pur_req-banfn. " parameter id for pruchase req. number
call transaction 'ME52' and skip first screen. "trans. code 'ME52': Change Purchase Requis.
clear pur_req-banfn. clear pur_req-matnr.
clear pur_req-werks.
endif.
FORM THE HEADER
form header_write.
write: / prog_nam, 32 'FUN-FACTORY',
/ 'Purch.Gr.:', pur_req-ekgrp, 26 'Purchase Requisition List',
61 'As Of Date:', 75 sy-datum,
/ 'Plant:', pur_req-werks, 61 'Page:', 75 sy-pagno.
uline.
write: / text-001,
/ text-002.
uline.
endform.
01-09-2007 11:24 AM
Hi Ponraj,
here a short example:
REPORT ZGRO_TEST1.
*
TABLES: mara.
*
START-OF-SELECTION.
*
select * from mara UP TO 100 ROWS.
write: / mara-matnr, mara-mtart.
HIDE: mara-matnr.
ENDSELECT.
*
END-OF-SELECTION.
*
at LINE-SELECTION.
*
write: / mara-matnr.
*
Regards, Dieter
01-09-2007 11:51 AM
Hi All,
I understood ur point,at selction screen or hide statement will works only with classical report.In my case the first display itself is ALV grid.
so it would perform handle user command actions.In that case how would i porceed further.
Also how to make the field as hotspot after the fisrt alv is displayed.
Thanks,
Ponraj..s
01-09-2007 11:59 AM
Hello,
In the field Catalog Make the HOTSPOT = 'X'. and do the following in the User command event
*----
*
--> p1 text
<-- p2 text
*----
*
FORM F_ALV_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
*--- Hotspot selektion
CASE RS_SELFIELD-FIELDNAME.
WHEN 'POSID'.
*------ PSP-Element
*----
-
Click auf PSP Element -> PSP Element anzeigen (CJ12)
SET PARAMETER ID 'PSP' FIELD SPACE.
SET PARAMETER ID 'PRO' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'CJ12' AND SKIP FIRST SCREEN.
WHEN 'STTXT_INT'.
*------ Systemstatus
G_STTXT_INT = RS_SELFIELD-VALUE.
*----
-
G_T_LEGENDE erfüllen
PERFORM F_FILL_G_T_LEGENDE_INT.
G_R_LAYOUT-WINDOW_TITLEBAR = 'Systemstatus'(004).
PERFORM F_STATUS_LEGENDE_POPUP.
WHEN 'STTXT_EXT'.
*------ Anwenderstatus
G_STTXT_EXT = RS_SELFIELD-VALUE.
*----
-
G_T_LEGENDE erfüllen
PERFORM F_FILL_G_T_LEGENDE_EXT.
G_R_LAYOUT-WINDOW_TITLEBAR = 'Anwenderstatus'(005).
PERFORM F_STATUS_LEGENDE_POPUP.
ENDCASE.
ENDCASE.
ENDFORM. "F_USER_COMMAND_ALV
If useful reward.
vasanth
01-09-2007 12:07 PM
Hi,
chk out this interactive alv part of the code.
FORM alv-display.
*if rad_ex2 = 'X' .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_bypassing_buffer = 'X'
i_buffer_active = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = t_fieldalv[]
i_save = 'A'
TABLES
t_outtab = itab3.
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. "ALV-DISPLAY
&----
*& Form SET_PF_STATUS
&----
text
----
-->RT_EXTAB text
----
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'PFALVMD04'.
ENDFORM. "pf_status
&----
*& Form user_command
&----
text
----
-->UCOMM1 text
-->SELFIELD text
----
FORM user_command USING ucomm1 LIKE sy-ucomm
selfield TYPE slis_selfield."#ec *
DATA:l_msg(100).
DATA l_self(15) TYPE c.
DATA : w_index TYPE i.
w_index = selfield-tabindex.
READ TABLE itab3 INDEX w_index.
CHECK sy-subrc EQ 0.
IF selfield-fieldname = 'ZZMNG06'.
CLEAR selfield-fieldname.
READ TABLE itab3 INDEX w_index.
CLEAR: i_prqty,i_prqty[].
SELECT banfn bnfpo erdat menge bsmng FROM eban INTO TABLE i_prqty
WHERE matnr = itab3-zmatnr AND werks = itab3-zwerks AND frgkz = 'Y'
AND loekz = ' '.
PERFORM initial_alv_fieldcat_prqty CHANGING rt_fieldcat[].
PERFORM alv_prqty.
endif.
FORM initial_alv_fieldcat_prqty CHANGING rt_fieldcat TYPE
slis_t_fieldcat_alv.
CLEAR : rt_fieldcat,rt_fieldcat[].
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA:cntr TYPE i VALUE 1.
CLEAR ls_fieldcat.
cntr = cntr + 1.
ls_fieldcat-col_pos = cntr.
ls_fieldcat-fieldname = 'BANFN'.
ls_fieldcat-seltext_l = 'PR No'.
ls_fieldcat-outputlen = 15.
APPEND ls_fieldcat TO rt_fieldcat.
CLEAR ls_fieldcat.
cntr = cntr + 1.
ls_fieldcat-col_pos = cntr.
ls_fieldcat-fieldname = 'BNFPO '.
ls_fieldcat-seltext_l = 'PR Serial No'.
ls_fieldcat-outputlen = 10.
APPEND ls_fieldcat TO rt_fieldcat.
gd_layout-colwidth_optimize = 'X'.
ENDFORM. " initial_alv_fieldcat
&----
*& Form alv_prqty
&----
text
----
--> p1 text
<-- p2 text
----
FORM alv_prqty .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_bypassing_buffer = 'X'
i_buffer_active = ' '
i_callback_program = sy-repid
it_fieldcat = rt_fieldcat[]
is_layout = gd_layout
i_save = 'A'
TABLES
t_outtab = i_prqty.
ENDFORM. " alv_prqty
01-09-2007 2:02 PM