How to Extract the selected line in alv?
Hi,
I am learning ABAP and i have a doubt.It is as follows.
In interactive reports, by clicking on a ROW we can display the line by using SY_LISEL in AT LINE_SELECTION event .
Now i want to have a pop up window when we click on a selected row of ALV report I want that single ROW to be displayed . How can i do this?
Hi Ravindra,
I think this is not possible with ALV reports because these use field catalogs unlike Interactive reports. Interactive reports only has the capability of popping up the data in the next list when clicked on row with the help of the events.
Hope this helps.
Please reward if useful.
Thanks,
Srinivasa
Similar Messages
-
How to find the selected item in alv grid or table control
can any one tell me please
how to find the selected item in alv grid or table controlIn table control, If you goto screen painter and goto table control properties ( f2 ), there is one check-box w/selColumn check that and give column name. Then add that column to your internal table.
IN PAI
LOOP AT it_tkhdr.
FIELD it_tkhdr-sel_row
MODULE tab_tkhdr_mark ON REQUEST.
ENDLOOP.
MODULE tab_tkhdr_mark INPUT.
MODIFY it_tkhdr INDEX tc_tkhdr-current_line.
ENDMODULE. " tab_tkhdr_mark INPUT
here it_TKHDR is internal table sel_row is field for selection
After that, you can loop at it_tkhdr where sel_row is 'X' to get selected rows.
regards,
Gagan -
How to extract the column width in ALv report if its executed in background
I am executing an ALV report in background , in front end i am getting data properly, in back end for some columns some of the digits are missing.For example if PO no is of 10 digits it will display only 8 becos column size is like that , how to extract coulmns in back ground.
I have executed in background and checked the spool and for some of the columns width is not sufficient to display comeplete data so please suggest how to extract the columns sizes if executed inj background for an ALVHi Deepthi,
you can try with the above mentioned suggestions ,if its worked its fine ,
If not use Docking container instead of custom container, For ALV in back ground jobs, its suggest to use docking container instead of custom container , below you can find the declaration for docking container and code to use docking and custom container in your program for fore and back ground.
or you can use docking container alone for both operations.
Data : G_DOCK1 TYPE REF TO CL_GUI_DOCKING_CONTAINER,
IF CCON IS INITIAL. (ccon is container name )
*Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
*Run in foreground
CREATE OBJECT CCON
EXPORTING
CONTAINER_NAME = 'CON1'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = parent_1.
ELSE.
*Run in background
CREATE OBJECT GRID1
EXPORTING
I_PARENT = G_DOCK1.
ENDIF.
ENDIF.
B&R,
Saravana.S -
ALV Classic - How to extract the selection long text of TYPE LVC_T_FCAT?
DATA: e_dyntab_tb TYPE lvc_t_fcat,
e_dyntab_wa TYPE lvc_s_fcat,
t_line_reftab TYPE REF TO data.
*Populate ALV fiels of TYPE LVC_T_FCAT
MOVE: c_matnr TO e_dyntab_wa-fieldname.
MOVE: c_material TO e_dyntab_wa-scrtext_l.
APPEND e_dyntab_wa TO e_dyntab_tb.
LOOP AT t_hwk_date ASSIGNING <fs_hwk_date>. "t_hwk_date is DYNAMIC
CONCATENATE c_hwk <fs_hwk_date>-index INTO e_dyntab_wa-fieldname.
CONCATENATE c_hwk <fs_hwk_date>-calender_wk INTO e_dyntab_wa-scrtext_l.
APPEND e_dyntab_wa TO e_dyntab_tb.
ENDLOOP.
*Create dynamic itab from dynamic ALV output
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = e_dyntab_tb "Pass alv_fcat here
IMPORTING
ep_table = i_reftab.
* Create Dynamic Work Area and assign to FS
ASSIGN i_reftab->* TO <fs_final_itab>. "Assigning the Final Table,
CREATE DATA t_line_reftab LIKE LINE OF <fs_final_itab>.
ASSIGN t_line_reftab->* TO <fs_line_reftab>. "Create a Work Area
QUESTION:
e_dyntab_wa-fieldname = this is the fieldname / column heading for the dynamic internal table
e_dyntab_tb-scrtext_l = this "should" be the 1st row(Column Heading Title) for the dynamic itab
= this data will be used for MS Excel Functionality as always as the first row as
column heading in the MS Excel
Legend:
How can I extract the entries of e_dyntab_tb-scrtext_l to an internal table containing the same structure of <fs_line_reftab>?Maybe I missed something, but you already have the long text for the columns in your FCAT structure. The problem you will have is that you will NOT be able to place those fields in the table that you have created because the headings will always be text and the columns may or may not be text (i.e. placing a heading into a numeric). You will be required to use a different structure.
Since you are writing a custom export, you will need to do one of the following:
Option A:
1. Retrieve the layout from the ALV as it will not necessarily be the same as when the original was created. The user may have moved a column or hidden one.
2. Create a structure for the export file that has only text fields. It should contain all of the columns from the FCAT. This can be done by creating another dynamic table and using the original FCAT and current layout.
3. Insert the headings as the first row of the export file.
4. Loop thru the internal table, compare it with the layout, and only insert the requested records into the export file.
5. Export the file.
or Option B:
1. Make sure the internal table has only text fields and insert the headings as the first record.
2. Insert all other records with fields converted to alphanumeric.
3. Use the standard export function.
Hope this helps,
Brian -
How can we get the selected line number from JTextArea ?
how can we get the selected line number from JTextArea ? and want to insert line/string given line number into JTextArea??? is it possible ?
Praitheesh wrote:
how can we get the selected line number from JTextArea ?
textArea.getLineOfOffset(textArea.getCaretPosition());
and want to insert line/string given line number into JTextArea??? is it possible ?
int lineToInsertAt = 5; // Whatever you want.
int offs = textArea.getLineStartOffset(lineToInsertAt);
textArea.insert("Text to insert", offs); -
How to use the select option to get the multiple bom explosion
hi friends,
i have completed the bom exp using parameters to get one material
input,but i need to adopt select option to give from and to materials
i ll gives from and to materials with description and bom deails
i here gave the coding also, pl give me a suggestion how to adpot the select
optoins instead of parameters ,very urgent
REPORT PP_BOM_EXPLOSION.
tables :mara,marc,stpo.
TYPE-POOLS : SLIS.
*parameters: p_werks like t001w-werks obligatory.
SELECT-OPTIONS : p_matnr FOR mara-matnr obligatory.
**select-options : p_matnr for mara-matnr obligatory.
PARAMETERS : P_WERKS LIKE T001W-WERKS OBLIGATORY,
P_MATNR LIKE MARA-MATNR OBLIGATORY.
*parameters: p_werks like marc-werks obligatory,
*p_matnr like marc-matnr obligatory.
constants c_x value 'X'.
data: begin of it_comp occurs 0,
matnr like mara-matnr,
maktl like makt-maktx,
idnrk like stpox-idnrk,
ojtxp like stpox-ojtxp,
menge like stpox-menge,
meins like stpox-meins,
matkl like stpox-matmk,
end of it_comp.
data : topmat like cstmat.
data: w_topmat like cstmat.
DATA : IT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : WA_FIELDCAT_LN LIKE LINE OF IT_FIELDCAT.
DATA : IT_EVENTCAT TYPE SLIS_T_EVENT.
DATA : WA_EVENTCAT_LN LIKE LINE OF IT_EVENTCAT.
DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: S_COL_POS TYPE I.
start-of-selection.
perform explode_assembly.
PERFORM BUILD_FIELDCATALOG.
PERFORM DATA_DISPLAY.
*end-of-selection.
*perform write_report.
*top-of-page.
*perform print_header.
*form print_header.
*write: /(18) 'Component'(h00),
*(40) 'Description'(h01),
*'Mat.Group'(h02),
*(18) 'Quantity'(h03).
*uline.
*endform.
*form write_report.
*write: / w_topmat-matnr under text-h00 color col_heading,
*w_topmat-maktx under text-h01 color col_heading.
*loop at it_comp.
*write: /
*it_comp-idnrk under text-h00,
*it_comp-ojtxp under text-h01,
*it_comp-matkl under text-h02,
*it_comp-menge unit it_comp-meins under text-h03,
*it_comp-meins.
*endloop.
*uline.
*endform.
form explode_assembly.
data: it_stb like stpox occurs 0 with header line,
it_stb2 like stpox occurs 0 with header line,
it_stb3 like stpox occurs 0 with header line,
w_msg(255) type c.
SELECT MATNR FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA
WHERE MATNR IN P_MATNR.
Explode highest level:
*LOOP AT IT_MARA.
call function 'CS_BOM_EXPL_MAT_V2'
exporting
auskz = c_x
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
BGIXO = c_x
MKMAT = c_x
MMAPS = c_x
FBSTP = c_x
FTREL = c_x
mtnrv = P_MATNR
werks = p_werks
importing
topmat = w_topmat
tables
stb = it_stb
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
*write: / w_msg.
exit.
endif.
Don't process documents
delete it_stb where idnrk is initial.
Don't process valid from furure:
delete it_stb where datuv >= sy-datum.
Explode phantom assemblies up to last level
*do.
it_stb2[] = it_stb[].
*delete it_stb2 where dumps is initial.
*if it_stb2[] is initial.
*exit.
*endif.
*delete it_stb where not dumps is initial.
delete it_stb where VPRSV <> 'S' OR MMSTA = '61'.
loop at it_stb2.
call function 'CS_BOM_EXPL_MAT_V2'
exporting
capid = 'PP01'
auskz = c_x
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
FBSTP = c_x
FTREL = c_x
mtnrv = it_stb2-idnrk
werks = p_werks
tables
stb = it_stb3
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
*write: / w_msg.
else.
delete it_stb3 where idnrk is initial.
delete it_Stb3 where sobsl = 50.
loop at it_stb3 .
multiply it_stb3-menge by it_stb2-menge.
modify it_stb3 transporting menge.
endloop.
append lines of it_stb3 to it_stb.
endif.
*ENDLOOP.
endloop.
*enddo.
Build table of components collecting the same components from
all levels
loop at it_stb.
it_comp-matkl = it_stb-matmk.
it_comp-idnrk = it_stb-idnrk.
it_comp-ojtxp = it_stb-ojtxp.
it_comp-menge = it_stb-menge.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
EXPORTING
INPUT = IT_STB-MEINS
LANGUAGE = SY-LANGU
IMPORTING
LONG_TEXT =
OUTPUT = IT_STB-MEINS
SHORT_TEXT =
EXCEPTIONS
UNIT_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.
it_comp-meins = it_stb-meins.
collect it_comp.
clear it_comp.
endloop.
*READ TABLE IT_COMP INDEX 1.
*IF SY-SUBRC = 0.
IT_COMP-MATNR = w_topmat-matnr.
IT_COMP-MAKTL = w_topmat-maktx.
INSERT IT_COMP index 1.
*ENDIF.
ENDFORM.
FORM TO APPEND DATA INTO ALV FORM
FORM BUILD_FIELDCATALOG.
PERFORM BUILD_FIELDCAT USING 'MATKL' 'Component'.
PERFORM BUILD_FIELDCAT USING 'MATKL' 'Component'.
*loop at it_comp.
PERFORM BUILD_FIELDCAT USING 'MATNR' 'Material'.
PERFORM BUILD_FIELDCAT USING 'MAKTL' 'Material Description'.
PERFORM BUILD_FIELDCAT USING 'IDNRK' 'Component'.
PERFORM BUILD_FIELDCAT USING 'OJTXP' 'Description'.
PERFORM BUILD_FIELDCAT USING 'MATKL' 'Material Group'.
PERFORM BUILD_FIELDCAT USING 'MENGE' 'Quantity'.
PERFORM BUILD_FIELDCAT USING 'MEINS' 'Unit Of MEASUREMENT'.
*endloop.
ENDFORM.
FORM TO BUILD IN FIELD CATALOG FOR ALV FORM
FORM BUILD_FIELDCAT USING L_FIELDNAME LIKE DD03L-FIELDNAME S_TEXT LIKE DD03P-SCRTEXT_M.
CLEAR WA_FIELDCAT_LN.
ADD 1 TO S_COL_POS.
WA_FIELDCAT_LN-REF_TABNAME = 'IT_COMP'.
WA_FIELDCAT_LN-FIELDNAME = L_FIELDNAME.
WA_FIELDCAT_LN-SELTEXT_M = S_TEXT.
WA_FIELDCAT_LN-COL_POS = S_COL_POS.
WA_FIELDCAT_LN-QFIELDNAME = SPACE.
WA_FIELDCAT_LN-HOTSPOT = SPACE.
WA_FIELDCAT_LN-JUST = 'R'.
APPEND WA_FIELDCAT_LN TO IT_FIELDCAT.
ENDFORM.
FORM TO BUILD IN FIELD CATALOG FOR ALV FORM
FORM DATA_DISPLAY.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = TEXT-001
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_COMP
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.
endform.
Thanks in advance
Regards
senthilkumar Dtables :mara,marc,stpo.
parameters: p_werks like t001w-werks obligatory.
*p_matnr like mara-matnr obligatory.
*select-options : p_matnr for mara-matnr obligatory.
select-options : P_matnr for mara-matnr.
*parameters: p_werks like marc-werks obligatory,
*p_matnr like marc-matnr obligatory.
constants c_x value 'X'.
data: begin of it_comp occurs 0,
idnrk like stpox-idnrk,
ojtxp like stpox-ojtxp,
menge like stpox-menge,
meins like stpox-meins,
matkl like stpox-matmk,
end of it_comp.
data: w_topmat like cstmat.
data : begin of itab occurs 0,
matnr like mara-matnr,
end of itab.
*data : itab type table of mara with header line.
start-of-selection.
perform explode_assembly.
end-of-selection.
perform write_report.
top-of-page.
perform print_header.
form print_header.
write: /(18) 'Component'(h00),
(40) 'Description'(h01),
'Mat.Group'(h02),
(18) 'Quantity'(h03).
uline.
endform.
form write_report.
write: / w_topmat-matnr under text-h00 color col_heading,
w_topmat-maktx under text-h01 color col_heading.
loop at it_comp.
write: /
it_comp-idnrk under text-h00,
it_comp-ojtxp under text-h01,
it_comp-matkl under text-h02,
it_comp-menge unit it_comp-meins under text-h03,
it_comp-meins.
endloop.
uline.
endform.
form explode_assembly.
data: it_stb like stpox occurs 0 with header line,
it_stb2 like stpox occurs 0 with header line,
it_stb3 like stpox occurs 0 with header line,
w_msg(255) type c.
select matnr from mara into table itab where matnr between p_matnr-low and p_matnr-high.
loop at p_matnr.
itab-matnr = p_matnr-low.
append itab.
itab-matnr = p_matnr-high.
append itab.
clear itab.
endloop.
Explode highest level:
loop at itab.
call function 'CS_BOM_EXPL_MAT_V2'
exporting
auskz = c_x
capid = 'PP01'
cuols = c_x
datuv = sy-datum
knfba = c_x
ksbvo = c_x
mbwls = c_x
mdmps = c_x
BGIXO = c_x
MKMAT = c_x
MMAPS = c_x
FBSTP = c_x
FTREL = c_x
mtnrv = itab-matnr
werks = p_werks
importing
topmat = w_topmat
tables
stb = it_stb
exceptions
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
conversion_error = 8
others = 9.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into w_msg.
write: / w_msg.
exit.
*else.
endif.
loop at it_stb.
it_comp-matkl = it_stb-matmk.
it_comp-idnrk = it_stb-idnrk.
it_comp-ojtxp = it_stb-ojtxp.
it_comp-menge = it_stb-menge.
it_comp-meins = it_stb-meins.
collect it_comp.
clear it_comp.
endloop.
endloop.
endform.
i got the low and high from selectoption and then move it into itab.
then i pass itab-matnr into fm. using loop.
but i got only one output
but ineet to got from and to output.
give me a solution
Regards
ds -
How to add the double headings in Alv Report.
Hi All,
Plz suggest me how to add the double headings in ALv Report.
RamHi,
Try out this program....
REPORT ypm_historycard_rep.
TYPE-POOLS : slis.
DATA : it_cbm TYPE STANDARD TABLE OF mara.
DATA : it_layout TYPE STANDARD TABLE OF slis_layout_alv WITH HEADER LINE,
wa_fcat TYPE slis_fieldcat_alv,
it_fcat TYPE slis_t_fieldcat_alv.
START-OF-SELECTION.
SELECT *
FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_cbm
where matnr = 'D80K7'.
END-OF-SELECTION.
it_layout-zebra = 'X'.
it_layout-colwidth_optimize = 'X'.
it_layout-f2code = '&ETA'.
APPEND it_layout.
DEFINE macro4fcat.
wa_fcat-col_pos = &1.
wa_fcat-fieldname = &2.
wa_fcat-tabname = &3.
wa_fcat-seltext_l = &4.
append wa_fcat to it_fcat.
clear wa_fcat.
END-OF-DEFINITION.
macro4fcat '1' 'MATNR' 'IT_CBM' 'MATERIAL NO' .
DESCRIBE TABLE it_cbm.
IF sy-ucomm = '&F03'.
MESSAGE 'hi hello good morning "press enter button" this is quiz' TYPE 'S'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
is_layout = it_layout
it_fieldcat = it_fcat
i_save = 'A'
TABLES
t_outtab = it_cbm
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.
*& Form html_top_of_page
* text
* -->TOP text
FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
DATA: l_text(255) TYPE c.
DATA: text1(255) TYPE c.
DATA: t_header TYPE REF TO cl_dd_table_element ,
wa_header TYPE REF TO cl_dd_table_area.
CALL METHOD top->add_gap
EXPORTING
width = 10.
CALL METHOD top->add_text
EXPORTING
text = 'hello'
sap_style = 'HEADING'
CALL METHOD top->add_gap
EXPORTING
width = 20.
CALL METHOD top->add_text
EXPORTING
text = 'HOW ARE YOU'
sap_style = 'HEADING'.
CALL METHOD TOP->new_line
* EXPORTING
* repeat =
CALL METHOD top->add_gap
EXPORTING
width = 50.
CALL METHOD top->add_text
EXPORTING
text = '____________________________________________________________'
sap_style = 'HEADING'.
CALL METHOD TOP->new_line
* EXPORTING
* repeat =
CALL METHOD top->add_gap
EXPORTING
width = 90.
CALL METHOD top->add_text
EXPORTING
text = 'YOU CAN TRY LIKE THIS'
sap_style = 'HEADING'.
ENDFORM. "html_top_of_page
Regards
Debarshi -
How to extract the Fast Formula Body through database?
Hi All
The Oracle fast formulas are stored in the ff_formulas_f table under the column formula_text having the datatype long. I want to extract the formula text through back end. When I use the statement, Select formula_text from ff_formulas_f, I am getting only the first line.
How to extract the full formula text?
Regards
RahmanHere's a unix shell script to do it for you based on the info given by the other posters.
#!/bin/sh
if \[ "$1" == "" \]; then
echo Syntax: $0 FAST_FORMULA_NAME
exit 1
fi
ffname=`echo $1|tr \[:lower:\] \[:upper:\]`; export ffname
sqlplus -silent $ORAUSER/$ORAPASSWD <<END
set define off serveroutput on format wrapped linesize 512 pagesize 0 feedback off verify off heading off echo off pause off long 100000
column formula_text format a512;
select formula_text from ff_formulas_f where formula_name = '$ffname';
exit;
END
Also this will list the formula names given a substring:
#!/bin/sh
if \[ "$1" == "" \]; then
echo Syntax: $0 FAST_FORMULA_NAME
exit 1
fi
ffname=`echo $1|tr \[:lower:\] \[:upper:\]`; export ffname
sqlplus -silent $ORAUSER/$ORAPASSWD <<END
set define off serveroutput on format wrapped linesize 512 pagesize 0 feedback off verify off heading off echo off pause off long 5000
select formula_name from ff_formulas_f where formula_name like '%$ffname%';
exit;
END -
How to extract the details of the stored procedures in the database?
Dear all,
How to extract the details of them?
Bst Rgds,
EdwardHi Wa-Man Edward Chan,
Following is the PLSQL Block Which Will Give Package, Procedure, Function Source
set verify off
undefine which_object;
undefine which_line;
declare
Shows lines with context of:
VIEW
FUNCTION
PROCEDURE
TRIGGER
PACKAGE SPECIFICATION
PACKAGE BODY
The script uses to temporary tables ERROR_TABLE_TEMP and ERROR_CLOB_TEMP created with:
CREATE GLOBAL TEMPORARY TABLE ERROR_TABLE_TEMP(line number, text varchar2(4000));
CREATE GLOBAL TEMPORARY TABLE ERROR_CLOB_TEMP(TEXT CLOB);
v_offset number:= 5; -- Controls how many lines before and after the line in focus are to be shown
v_obj_name varchar2(100);
v_obj_type varchar2(100);
v_obj_type_new varchar2(100);
v_obj_line number;
v_counter number := 0;
v_text varchar2(32767);
v_subtext varchar2(1000);
v_from number;
v_len number;
v_marker varchar2(10);
v_found number;
v_line_from number;
v_line_to number;
v_long_text clob;
procedure ins_line (p_text in varchar2) is
begin
v_counter := v_counter + 1;
insert into error_table_temp(line,text)
values (v_counter,p_text);
end;
begin
delete error_table_temp;
select ltrim(rtrim(upper('&which_object'))), nvl(to_number('&which_line'),0)
into v_obj_name, v_obj_line
from dual;
begin
select decode(object_type,'PACKAGE','PACKAGE BODY',object_type)
into v_obj_type
from user_objects
where object_name = v_obj_name
and nvl(v_obj_line,0) > 0
and rownum = 1;
exception when no_data_found then
ins_line('ERROR: Object/line not found');
return;
end;
ins_line(v_obj_name||' ('||v_obj_type||')');
if v_obj_type in ('PACKAGE BODY','PACKAGE','FUNCTION','PROCEDURE') then
v_obj_type_new := v_obj_type;
ins_line('----------------------- PROGRAM LISTING -------------------------');
for code in (select trim(text) text, lpad(line,4,' ')||' '||decode(line,v_obj_line,'>>>>> ',' ') marker, type
from user_source
where name = v_obj_name
and line between v_obj_line-v_offset and v_obj_line+v_offset
order by decode(type,v_obj_type,1,2),line) loop
if v_obj_type_new != code.type then
ins_line(null);
v_obj_type_new := code.type;
v_counter := -100000; -- In order to show specification before body
ins_line(v_obj_name||' ('||v_obj_type_new||')');
ins_line('----------------------- PROGRAM LISTING -------------------------');
end if;
ins_line(code.marker||code.text);
end loop;
elsif v_obj_type = 'VIEW' then
select text
into v_text
from user_views
where view_name = v_obj_name;
v_line_from := v_obj_line-v_offset;
v_line_to := v_obj_line+v_offset;
v_obj_line := v_obj_line -1;
ins_line('------------------------------- PROGRAM LISTING -------------------------------');
for i in v_line_from..v_line_to loop
begin
if i = v_obj_line then
v_marker := '>>>>> ';
else
v_marker := ' ';
end if;
if i = 0 then
v_from := 0;
v_len := instr(v_text,chr(10));
else
v_from := instr(v_text,chr(10),1,i);
v_len := instr(v_text,chr(10),1,i+1) - v_from;
end if;
v_subtext := substr(v_text,v_from+1,v_len-1);
if v_len > 0 then
ins_line(lpad(to_char(i+1),4,' ')||' '||v_marker||v_subtext);
end if;
exception when others then
null;
end;
end loop;
elsif v_obj_type = 'TRIGGER' then
ins_line('----------------------- PROGRAM LISTING -------------------------');
delete error_clob_temp;
execute immediate 'insert into error_clob_temp (text) '||
'select to_lob(trigger_body) '||
'from user_triggers ' ||
'where trigger_name = '''||v_obj_name||'''';
select text
into v_long_text
from error_clob_temp;
v_obj_line := v_obj_line-1;
v_line_from := v_obj_line-v_offset;
v_line_to := v_obj_line+v_offset;
for i in v_line_from..v_line_to loop
begin
if i = v_obj_line then
v_marker := '>>>>> ';
else
v_marker := ' ';
end if;
if i = 0 then
v_from := 0;
v_len := dbms_lob.instr(v_long_text,chr(10));
else
v_from := dbms_lob.instr(v_long_text,chr(10),1,i);
v_len := dbms_lob.instr(v_long_text,chr(10),1,i+1) - v_from;
end if;
v_subtext := dbms_lob.substr(v_long_text,v_len-1,v_from+1);
if v_len > 0 then
ins_line(lpad(to_char(i+1),4,' ')||' '||v_marker||v_subtext);
end if;
exception when others then
null;
end;
end loop;
end if;
if v_counter = 0 then
ins_line('*********** NO CODE FOUND ***********');
else
ins_line(null);
end if;
exception when others then
ins_line('*********** ERROR: NOT POSSIBLE TO SHOW THE CODE ***********');
ins_line(' FEJL: '||sqlerrm);
end;
set linesize 4000
set heading off
set feedback off
set verify on
select text
from error_table_temp
order by line;
set linesize 80
set heading on
set feedback on
Prashant -
Hi gurur's how we do the interactive report in ALV
hi gurur's how we do the interactive report in ALV.
PLZ HELP MEHi Srivasu,
I will send a sample code along with Comments check it once ok.copy the below code and execute it and debug it ok..
*& Report YPURCHASEORDER_ALV_LISTDISP *
*& DEVELOPER : KIRAN KUMAR.G *
& PURPOSE : CREATING A PURCHASE ORDER BASED ON PURCHASE DOC NUMBER
*& CREATION DT: 22/11/2007 *
*& REQUEST : ERPK900035 *
REPORT YPURCHASEORDER_ALV_LISTDISP.
Tables
TABLES : ekko, "Purchasing Document Header
ekpo. "Purchasing Document Item
Type pools
TYPE-POOLS: slis.
Internal Tables
DATA: BEGIN OF gt_headerdat OCCURS 0,
ebeln LIKE ekko-ebeln, " Purchasing Document Number
bukrs LIKE ekko-bukrs, " Company Code
bstyp LIKE ekko-bstyp, " Purchasing Document Category
bsart LIKE ekko-bsart, " Purchasing Document LIKE
aedat LIKE ekko-aedat, " Date on which the recordwascreate
ernam LIKE ekko-ernam, " Name of Person who Created Object
lifnr LIKE ekko-lifnr, " Vendor's account number
spras LIKE ekko-spras, " Language Key
ekorg LIKE ekko-ekorg, " Purchasing Organization
ekgrp LIKE ekko-ekgrp, " Purchasing group
END OF gt_headerdat.
DATA: BEGIN OF gt_item OCCURS 0,
matnr LIKE ekpo-matnr, "Material Number
werks LIKE ekpo-werks, "Plant
lgort LIKE ekpo-lgort, "Storage location
matkl LIKE ekpo-matkl, "Material group
menge LIKE ekpo-menge, "Purchase order quantity
meins LIKE ekpo-meins, "Order unit
netpr LIKE ekpo-netpr, "Net price in purchasing document
kunnr LIKE ekpo-kunnr, "Customer Number 1
END OF gt_item.
Global Structures
DATA: gt_header TYPE slis_t_listheader, "For Headings
wa_header TYPE slis_listheader,
gt_fieldcat TYPE slis_t_fieldcat_alv, "Structure Defintion
wa_fieldcat TYPE slis_fieldcat_alv,
gt_fieldcat1 TYPE slis_t_fieldcat_alv,
wa_fieldcat1 TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv, "Layout
gt_events TYPE slis_t_event, "For Events
wa_events TYPE slis_alv_event.
Selection Screen
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln.
SELECTION-SCREEN: END OF BLOCK b1.
Initialization
INITIALIZATION.
PERFORM initial.
Fetch Data
START-OF-SELECTION.
PERFORM fetch_data.
END-OF-SELECTION.
Bulid fieldcatalog
PERFORM fieldcat.
Change fieldcatalog
PERFORM fieldcat_change.
Events Triggering
PERFORM place_events.
Layout.
PERFORM layout.
Display Data
SORT gt_headerdat BY ebeln.
PERFORM display_list.
*& Form initial
text
--> p1 text
<-- p2 text
FORM initial .
s_ebeln-sign = 'I'.
s_ebeln-option = 'BT'.
s_ebeln-low = '3000000090'.
s_ebeln-high = '3000000166'.
APPEND s_ebeln.
ENDFORM. " initial
*& Form fetch_data
text
--> p1 text
<-- p2 text
FORM fetch_data .
REFRESH gt_headerdat. "Clear the Body of Internal Table
CLEAR gt_headerdat. "Clear Header Line
SELECT ebeln
bukrs
bstyp
bsart
aedat
ernam
lifnr
spras
ekorg
ekgrp
FROM ekko
INTO TABLE gt_headerdat
WHERE ebeln IN s_ebeln.
ENDFORM. " fetch_data
*& Form display_list
text
--> p1 text
<-- p2 text
FORM display_list .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-cprog
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USERCOMMAND'
I_STRUCTURE_NAME =
is_layout = wa_layout
it_fieldcat = gt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = gt_events
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_headerdat
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.
ENDFORM. " display_list
*& Form place_events
text
--> p1 text
<-- p2 text
FORM place_events .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = gt_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.
CLEAR wa_events. "Clear Header Line
READ TABLE gt_events INTO wa_events WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc = 0.
wa_events-form = 'HEADING'.
MODIFY gt_events FROM wa_events INDEX sy-tabix.
ENDIF.
CLEAR wa_events. "Clear Header Line
READ TABLE gt_events INTO wa_events WITH KEY name = 'END_OF_LIST'.
IF sy-subrc = 0.
wa_events-form = 'PAGEDOWN'.
MODIFY gt_events FROM wa_events INDEX sy-tabix.
ENDIF.
CLEAR wa_events. "Clear Header Line
READ TABLE gt_events INTO wa_events WITH KEY name = 'USER_COMMAND'.
IF sy-subrc = 0.
wa_events-form = 'USERCOMMAND'.
MODIFY gt_events FROM wa_events INDEX sy-tabix.
ENDIF.
ENDFORM. " place_events
*& Form layout
text
--> p1 text
<-- p2 text
FORM layout .
CLEAR wa_layout. "Clear Header Line
wa_layout-zebra = 'X'. "Zebra Lines in the Output
wa_layout-colwidth_optimize = 'X'. "Optimize the Column Width
ENDFORM. " layout
*& Form heading
text
FORM heading.
WRITE:/6 'THIS REPORT DISPLAYS THE PURCHASE ORDER DETAILS'.
WRITE:/6 'CLICK ON PURCHASE DOC NO FIELD(INTERACTIVE LIST)'.
ENDFORM. "heading
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM fieldcat .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = SY-CPROG
i_internal_tabname = 'GT_HEADERDAT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = SY-CPROG
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_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. " fieldcat
*& Form fieldcat_change
text
--> p1 text
<-- p2 text
FORM fieldcat_change .
LOOP AT gt_fieldcat INTO wa_fieldcat.
CASE wa_fieldcat-fieldname.
WHEN 'EBELN'.
wa_fieldcat-hotspot = 'X'.
ENDCASE.
MODIFY gt_fieldcat FROM wa_fieldcat INDEX sy-tabix.
ENDLOOP.
ENDFORM. " fieldcat_change
*& Form pagedown
text
FORM pagedown.
WRITE:/35 'HAVE A NICE DAY...' COLOR 4.
ENDFORM. "pagedown
*& Form usercommand
text
-->UCOMM text
-->SELFIELD text
FORM usercommand USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
READ TABLE gt_headerdat INDEX selfield-tabindex.
CASE selfield-sel_tab_field.
WHEN 'GT_HEADERDAT-EBELN'.
REFRESH : gt_item.
CLEAR : gt_item.
SELECT matnr
werks
lgort
matkl
menge
meins
netpr
kunnr
FROM ekpo
INTO TABLE gt_item
WHERE ekpo~ebeln EQ gt_headerdat-ebeln.
*Build a Field Catalog
PERFORM fieldcat1.
*For Heading in the Interactive List
PERFORM heading1.
*Display Interactive Data
PERFORM display_data1.
ENDCASE.
ENDFORM. "usercommand
*& Form fieldcat1
text
--> p1 text
<-- p2 text
FORM fieldcat1 .
REFRESH : gt_fieldcat1.
CLEAR : wa_fieldcat1.
wa_fieldcat1-col_pos = '1'. "Column Postion
wa_fieldcat1-fieldname = 'MATNR'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-key = 'X'. "Blue Color
wa_fieldcat1-seltext_l = 'MATERIAL NO'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '2'. "Column Postion
wa_fieldcat1-fieldname = 'WERKS'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'PLANT'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '3'. "Column Postion
wa_fieldcat1-fieldname = 'LGORT'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'STORAGE LOCATION'."Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '4'. "Column Postion
wa_fieldcat1-fieldname = 'MATKL'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'MATERIAL GRP'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '5'. "Column Postion
wa_fieldcat1-fieldname = 'MENGE'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal TAble
wa_fieldcat1-seltext_l = 'PO QUANTITY'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '6'. "Column Pos tion
wa_fieldcat1-fieldname = 'MEINS'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal TAble
wa_fieldcat1-seltext_l = 'BASE UNIT MEASURE'."Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '7'. "Column Postion
wa_fieldcat1-fieldname = 'NETPR'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'NET PRICE'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-col_pos = '8'. "Column Postion
wa_fieldcat1-fieldname = 'KUNNR'. "Field Name
wa_fieldcat1-tabname = 'GT_ITEM'. "Internal Table
wa_fieldcat1-seltext_l = 'CUSTOMER NO'. "Display Text Screen
APPEND wa_fieldcat1 TO gt_fieldcat1.
CLEAR wa_fieldcat1.
ENDFORM. " fieldcat1
*& Form heading1
text
--> p1 text
<-- p2 text
FORM heading1 .
REFRESH : gt_header.
CLEAR : wa_header.
wa_header-typ = 'H'.
wa_header-info = 'THIS IS AN INTERACTIVE LIST'.
APPEND wa_header TO gt_header.
ENDFORM. " heading1
*& Form top
text
FORM top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_header
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM. "top
*& Form display_data1
text
--> p1 text
<-- p2 text
FORM display_data1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = SY-CPROG
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'TOP'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = gt_fieldcat1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = gt_item
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.
ENDFORM. " display_data1
Reward points if helpful.
Kiran Kumar.G.A
Have a Nice Day.. -
V v urgent ... how to get the selected rows in the vl02n transaction
Hi ,
I have requirement that i have selected the line items in the vl02n transaction.
If I select only one row there is option gs_get_cursor-line.
If I select more than one line item at a time I am getting only the last value in to gs_get_cursor-line.
Can anybody let me know how to get the multiple line items that are selected
It is very urgent ..
Plz HelpHi,
can you check the E_row_id .
v_row type LVC_S_ROW
read table itab index E_ROW-index.
regards,
Ajay
Edited by: Ajay on Feb 14, 2008 6:22 PM -
How to wrap the heading text in alv.
HI all,
I need help, how to wrap the heading text in alv.
can any help ... plz..
Advanced Thanks
Regards
GUhapriyanHello GuhaPriyan,
I assume that you're referring to the ALV Grid's title. The maximum length for this title is 70 characters and this would generally fit in the one line.
Are you intending to wrap it because you purposefully want the text to come in two lines? In that case, I'm not sure that it's possible.
But otherwise, there's an option in the Layout called SMALLTITLE. You can set this attribute so that the title would be displayed in a amaller font and hopefully, all of your text shows up on the screen.
Regards,
Anand Mandalika. -
How to extract the date value of IBOR date="12/12/2009"
I have the following query, but do not get the date value out:
WITH ibors AS (
SELECT xmltype('<?xml version="1.0" encoding="utf-8"?>
<IBOR date="12/12/2009">
<LIBOR currency="USD">
<OneYear>1.38875</OneYear>
</LIBOR>
</IBOR>
') ibor_xml
FROM dual
SELECT i.ibor_date, i.ibor_oneyear
FROM ibors,
XMLTABLE(
'//IBOR'
PASSING ibors.ibor_xml
COLUMNS ibor_date VARCHAR2(20) PATH '/IBOR/date',
ibor_oneyear VARCHAR2(20) PATH '/IBOR/LIBOR/OneYear'
) i;
How to extract the date value of <IBOR date="12/12/2009">?Hi,
The date is an attribute of element IBOR. So you must use "@date" in the xpath expression :
WITH ibors AS (
SELECT xmltype('<?xml version="1.0" encoding="utf-8"?>
<IBOR date="12/12/2009">
<LIBOR currency="USD">
<OneYear>1.38875</OneYear>
</LIBOR>
</IBOR>
') ibor_xml
FROM dual
SELECT i.ibor_date, i.ibor_oneyear
FROM ibors,
XMLTABLE(
'//IBOR'
PASSING ibors.ibor_xml
COLUMNS
ibor_date VARCHAR2(20) PATH '/IBOR/@date',
ibor_oneyear VARCHAR2(20) PATH '/IBOR/LIBOR/OneYear'
) i; -
How to extract the contents of the Jar file?
Hello,
Can anyone tell me how to extract the contents of the Jar file?
An example will be highly appreciated.
Thanks.From command line, or from within a java application?
Kaj
Btw. Why do you need to do it. You do know that you can add jars to the classpath and read resources from them without extracting the file? -
How to extract the customer's list
Hi,
Please help me how to extract the list of customers (sold-to-party) for whom email id is not maintained in contact person's details.
Waiting for ur replies..
Thanks in advance.
Regards,
RahulHi,
You can select the data from KNVK..
Get the customers..
Then use the personnel numbers KNVK-PRSNR
to get the email address from the table ADR6..
If there is no value in the ADR6-SMTP_ADDR ..Then the email address is not maintained..
Thanks,
Naren
Maybe you are looking for
-
G/L Account can't find in T-Code OAMK
I had created a G/L account by T-Code FS01, and set Account group : AS Assets accounts, Recon. account for acct type : A Assets. When I used T-Code OAMK to delete reconcilation Ind. for all accts, but I can't find new G/L account In the "Change contr
-
Since installing Leopard, I have at least 5 applications that will randomly quit (Safari, Firefox, Excel, Final Draft, iTunes) and weird other problems like freezing on quickbooks. Should I go back to Tiger? How would I even do that? Does anyone else
-
Officejet 6000 wireless connect to Mac and Windows machines?
Just bought this printer. Is it possible to use Windows XP and Mac, to print?
-
When I run disk permissions, I get Group differs on "Private/etc/cups" , should be 0, group is 26. Repairing gives the same error. Is this a problem, How do I fix it. I am running latest updates.
-
I have a Mac OS X version 10.5.8 and recently got an Iphone4. I can not access Icloud from my computer. Is there any software, new operating system or anything I can purchase that will allow me access to the cloud?