Display X line of a table
hi,
I have a table of 100 lines. How can I display with a select request only the 10 first lines or display lines 10 by 10 until 100. Like in the web site.
Thanks you.
The following example demonstrates how to select 10 rows at a time using a .sql script:
SQL> EDIT test
Type or copy the following, substituting the name of your table for table_name:
ACCEPT starting_number PROMPT 'Enter starting row number: '
SELECT row_num, a.*
FROM (SELECT ROWNUM row_num, b.*
FROM (SELECT *
FROM table_name
ORDER BY ROWID) b) a
WHERE row_num < &starting_number + 10
AND row_num >= &starting_number
Save the file.
SQL> START test
It will then prompt you to enter the starting row number and display the next 10 rows starting with that number.
The next example demonstrates how to select 10 rows at a time using a pl/sql stored procedure within a package and returning the results in a ref cursor:
SQL> EDIT getemployees_pkg
Type or copy the following, substituting your table name for emp and your column names for empno, ename, and sal:
CREATE OR REPLACE PACKAGE getemployees_pkg
AS
TYPE emp_curtype IS REF CURSOR;
PROCEDURE getemployees
(p_start_no IN NUMBER,
emp_cur OUT emp_curtype);
END getemployees_pkg;
CREATE OR REPLACE PACKAGE BODY getemployees_pkg
IS
PROCEDURE getemployees
(p_start_no IN NUMBER,
emp_cur OUT emp_curtype)
IS
BEGIN
OPEN emp_cur FOR
SELECT empno, ename, sal
FROM (SELECT empno, ename, sal, rn
FROM (SELECT empno, ename, sal, ROWNUM rn
FROM (SELECT empno, ename, sal
FROM emp
ORDER BY empno))
WHERE rn >= p_start_no
AND rn < p_start_no + 10);
END getemployees;
END getemployees_pkg;
Save the file.
SQL> START getemployees_pkg
Package created.
Package body created.
The procedure can then be executed from the SQL prompt:
SQL> VARIABLE g_out REFCURSOR
SQL> EXEC getemployees_pkg.getemployees(1, :g_out)
SQL> PRINT g_out
or the procedure can be called from within another procedure or from another calling environment.
null
Similar Messages
-
Number of displayed lines in a table
Hello colleagues,
We are using a table with a master column (tree). Additional we are using an input field where a user can enter a number so that the displayed lines can be change at runtime.
Problem:
I would like to know the displayed number of lines as it is displayed in the button line of the table in the view (where a user can jump direct to a line) - but I do not know how I get it.
Question:
How do I get the content of the max number of available lines in the button of the displayed table?
Thanks+greetings,
AchimHey Maheswaran.B,
thanks for the reply - the problem is not solved with the suggestion (because I do not get the maximum number of line displayed).
I did the following:
On the very first time if "modifyView" will be executed I do a loop over the table. If the maximum number is reached within the loop I set this number - if not I set the number of loops.
Here is a code example:
DO 10 TIMES.
ADD 1 TO l_counter.
CLEAR elem_tabletree.
elem_tabletree = node_tabletree->get_element( index = l_counter ).
IF elem_tabletree IS INITIAL.
SUBTRACT 1 FROM l_counter.
EXIT.
ENDIF.
ENDDO.
*--- set the value to the bound variable
elem_owner_node->set_attribute(
EXPORTING
name = `NUMBER_OF_LINES`
value = item_number_of_lines ). -
Displaying the contents of internal table- in email Step of workflows
Hello Folks,
I wanted to display the contents of an internal table ( would contain a list of opportunites ), in an email sent throught the workflow:
My idea was to LOOP AT <ITAB> into <WA> from an external program and then call the workflow for each content of the <WA>. This will be a problem as, if there are like 1000 records in the internal table, then workflows will be called 1000 times...sending 1000 emails..
My requirement is that we need to send a single email to the single person, displaying the content of the internal table in the email body......
My question
1) Is this scenario possible through worflows ?
2) If not, please provide an alternative ..
Thanks
AnandDo you mean to say that just by inserting the multiline element
within the body of the 'Send email' step type, the contents
of the multiline element is displayed automatically without
we having to loop at it somehow ?
Follow the below apporach,
1. First create a multiline container element in the workflow conatiner.
2. Populate the internla table , by using the bor methods and pass back the populated ITAB to the WF by using the binding concept.
3. Now create a mail step in the workflow, you have the option of inserting the workflow container elements into the mail conten, so insert the multiline container element , then it prompts to select the option like a) Do you liek to display only first line b) Display the ITAB line by line c) Display ITAB lines continuously with out line break.
4. based upon the requirement select any one of the options.
Note: Make sure the line length of the ITAB won't excced 132 charecters, because the send mail step will consider only 132 characters. -
Displaying filed value or other table filed in ALV output table
Hi,
I have a vendor leadger report displaying vendor balance statement witj all line item details, all data is present in One final table this final table i hvae shown in output but along with this in the first line in output i want to display openig balance of that vendor and in the last line i want to display closing balance of that vendor in the period for opening balance and closing balabce i have that amount in the diffrent tables or fileds how to display that amount in output along with my Final table .
regards,
zafarhi ,
Do this way
1) get the opening balance
2) append that line to final table
3) then append data from other table in final table where data for all line item
4) then again get closing balance
5) append that data in final table and you will get first line as opening balance ,then middle data and last closing data .
regards
Deepak . -
Crystal report -How to display multiple lines in line chart?
Hi,
M struggling to display multiple lines in line chart. All the values m fetching it from database into data table in below format & data type
Category(String).....year(Int).....graph_values(Int).....table_value(String)
Test.........................2006.......... -100............................(100)
Avg..........................2006..........20................................20
Median......................2006...........5................................5
Test..........................2007...........500.............................500
Avg...........................2007............90..............................90
Median.......................2007............45..............................45
M using cross tab to display data and chart to plot line. Following fields I used in Cross tab Expert & Chart expert
Cross tab expert-
Rows u2013 category
Columns u2013 year
Summarized fields u2013 Min of table_value
In Chart Expert u2013
On Change of - Year
Show values - graph values
In cross tab m able to see the data properly but not in graph.I have three categories. Hence it should plot three lines in line chart but m able to see only one line for test category.
FYI u2013 using VS 2008 and crystal report assembly version 10.5
Urgent. Please reply soon.
Thanks
ThakurSI got the solution.
In Chart Expert - I should use
On Change of -- Year, Category
Show values -- graph values
Thanks,
ThakurS -
How to display multiple lines in a text box defined in steploop.
Hi,
I have a requirement to display data ( which is dynamic in nature. I determine data type,length etc dynamically) in a table format. I am using step loop for the same. I am facing a problem. Some field can be as long as 256 char long. Is there any way to display multiple lines in text box defined in a step loop so that I can display the complete string as one entity.
I can't use custom control as custom control can't be defined in a step loop or table controlI would really appreciate your help on this.
Regards,
SanjeevHello Sanjeev
Perhaps it is possible to use a <b>mixed strategy</b> consisting of a classical table control (or, even better, an ALV grid list) where you display the first 250 character of the data and next to the table control you place a simple textedit control. When the user selects one of the text fragments in the table control the entire text will be displayed in the textedit control.
Regards
Uwe -
How to display records into a non table base block..
Hi,
Can anybody help me how to display records into a non table base block....
Find below is my coding but it only display the last record in the first line
in the block.
PROCEDURE CREATE_CARTON_QUESTION IS
CURSOR car_c IS
select /*+ rule */ question_id, question_description
from WHOP.QADB_QUESTIONS
where question_category = 'Carton'
and question_active_flag = 'Y';
v_found VARCHAR2(10);
v_status boolean;
v_error varchar2(150);
v_count number;
car_r car_c%rowtype;
begin
begin
select count(*) into v_count
from WHOP.QADB_QUESTIONS
where question_category = 'Carton'
and question_active_flag = 'Y';
exception
when no_data_found then
v_count := 0;
end;
if v_count > 0 then
for car_r in car_c loop
---populating carton questions
:la_carton.carton_question_id := car_r.question_id;
:la_carton.carton_question_answer := 'N';
:la_carton.carton_error_details := null;
:la_carton.attribute2 := car_r.question_description;
end loop;
end if;
end;
Thanks in advance.
Regards,
JunHi SNatapov,
Thanks for you reply but still I get this error...
FRM-40737 Illegal restricted procedure GO_BLOCK in WHEN-VALIDATE-ITEM trigger.
Please note that I call that program unit in the last field of my control block inside when-validate-item trigger the questions should be display in la_carton block which is my non-base table block.
Find below is the code....
begin
go_block('la_carton');
first_record;
for car_r in car_c loop
---populating carton questions
:la_carton.carton_question_id := car_r.question_id;
:la_carton.carton_question_answer := 'N';
:la_carton.carton_error_details := null;
:la_carton.attribute2 := car_r.question_description;
next_record;
end loop;
end;
Hoping you can help me this problem...
Thanks in advance.
Regards,
Jun -
OO ALV displaying without Values despite Internal table contains
My below OO ALV displaying without Values despite Internal table contains the values ...
Help please ...
REPORT zsd_concession1 NO STANDARD PAGE HEADING
LINE-SIZE 285
LINE-COUNT 64
MESSAGE-ID zz.
Program Description ******************************
This report is to Calculate consession against Quotations
complying standards for enhanced Performance, Readability &
Maintenance.
Change Log *********************************
Remedy # / Who When Why / What
Transport #
CLASS lcl_event_handler DEFINITION DEFERRED.
*& Data Definitions .
DATA: BEGIN OF vbap_wa,
vbeln TYPE vbak-vbeln, "Quotation#
erdat TYPE vbak-erdat, "Quot date
knumv TYPE vbak-knumv, "Cond Rec#
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF vbap_wa,
BEGIN OF konv_wa,
knumv TYPE konv-knumv, "Cond#
kposn TYPE konv-kposn, "Cond Item#
kappl TYPE konv-kappl, "Applic
kschl TYPE konv-kschl, "Cond Typ
kbetr TYPE konv-kbetr, "Price ZBP1,ZNAA,ZNAX
END OF konv_wa,
BEGIN OF vbpa_wa,
vbeln TYPE vbpa-vbeln, "Quot#
posnr TYPE vbpa-posnr, "Item#
parvw TYPE vbpa-parvw, "Prt Fn
kunnr TYPE vbpa-kunnr, "Cust#
END OF vbpa_wa,
BEGIN OF result_wa,
posnr TYPE vbap-posnr, "Line Item
matnr TYPE vbap-matnr, "Mat#
zansicat TYPE zmarall-zansicat, "AnsiCat#
zansigrd TYPE zmarall-zansigrd, "Grade
zcurrvaltnarea TYPE zco002-zcurrvaltnarea,"Val Area
zcurrcstusd TYPE zco002-zcurrcstusd, "Cost$
zzbrndnm TYPE mara-zzbrndnm, "Brand
zqedscgrp TYPE zglbprc-zqedscgrp, "QE Disc Grp
mstav TYPE mara-mstav, "Status
kwmeng TYPE vbap-kwmeng, "Qty
lprc TYPE konv-kbetr, "List Price ZBP1
sprc TYPE konv-kbetr, "Std Pric ZNAA,ZNAX
netpr TYPE vbap-netpr, "Quot price
mrgn TYPE konv-kbetr, "margin%
END OF result_wa.
DATA: ikonv LIKE STANDARD TABLE OF konv_wa,
ivbap LIKE STANDARD TABLE OF vbap_wa,
ivbpa LIKE STANDARD TABLE OF vbpa_wa,
iresult LIKE STANDARD TABLE OF result_wa.
*Work storage
DATA: BEGIN OF ws,
vbeln TYPE vbak-vbeln,
ok_code TYPE sy-ucomm,
alv_save TYPE c, "ALV save
alv_variant TYPE disvariant, "ALV Variant
alv_sort TYPE lvc_t_sort, "Sort table
END OF ws.
*Data declarations for ALV Main list
DATA : ty_lay1 TYPE lvc_s_layo,
it_fieldcat TYPE lvc_t_fcat ,
ty_fieldcat TYPE lvc_s_fcat ,
l_smenu TYPE REF TO cl_ctmenu,
c_alv1 TYPE REF TO cl_gui_alv_grid,
c_cont1 TYPE REF TO cl_gui_custom_container,
e_dclick TYPE REF TO lcl_event_handler.
*Data declarations for ALV Interactive list
DATA : ty_lay2 TYPE lvc_s_layo,
it_fcat TYPE lvc_t_fcat ,
ty_fcat TYPE lvc_s_fcat ,
c_alv2 TYPE REF TO cl_gui_alv_grid,
c_cont2 TYPE REF TO cl_gui_custom_container.
*Field-Symbols
FIELD-SYMBOLS:
<konv> LIKE konv_wa,
<vbap> LIKE vbap_wa.
*Constants
CONSTANTS:
c_end_row TYPE i VALUE 65000.
*CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row.
ENDCLASS. "lcl_event_handler DEFINITION
*CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_double_click.
DATA: sec_wa LIKE LINE OF iresult.
*Reading the selected data into a variable
READ TABLE iresult INDEX e_row-index INTO sec_wa.
*Select the field details of the selected table
SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
WHERE tabname EQ ls_dd02l-tabname.
*Calling the ALV containing the field values
CALL SCREEN 101.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*& SELECTION-SCREEN.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_vbeln FOR ws-vbeln DEFAULT '2002354788' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK a.
INITIALIZATION.
PERFORM setup_screen_defaults.
START-OF-SELECTION.
PERFORM gather_report_data.
END-OF-SELECTION.
PERFORM create_output.
*& Form initialization
FORM setup_screen_defaults.
CLEAR: ws, konv_wa, vbap_wa, vbpa_wa.
REFRESH: ivbpa, ikonv, ivbap, iresult.
ENDFORM. " setup_screen_defaults
*& Form gather_report_data
FORM gather_report_data.
SELECT vbeln posnr parvw kunnr
INTO TABLE ivbpa
FROM vbpa
WHERE vbeln IN s_vbeln
AND ( parvw = 'SP' OR "SoldTO
parvw = 'WE' OR "ShipTo
parvw = 'ZT' ). "Top Parent
SELECT vkvbeln vkerdat vkknumv vpposnr vp~matnr
z1zansicat z1zansigrd z2~zcurrvaltnarea
z2zcurrcstusd m1zzbrndnm zg~zqedscgrp
m1mstav vpkwmeng vp~netpr
INTO CORRESPONDING FIELDS OF TABLE ivbap
FROM vbak AS vk
INNER JOIN vbap AS vp
ON vpvbeln = vkvbeln
INNER JOIN zmarall AS z1
ON z1matnr = vpmatnr
INNER JOIN zco002 AS z2
ON z2matnr = vpmatnr
INNER JOIN zglbprc AS zg
ON zgmatnr = vpmatnr
INNER JOIN mara AS m1
ON m1matnr = vpmatnr
WHERE vk~vbeln IN s_vbeln
AND vk~auart = 'AG'."AG = Quot
SORT ivbap BY posnr matnr.
SELECT kvknumv kvkposn kvkappl kvkschl kv~kbetr
INTO TABLE ikonv
FROM konv AS kv
FOR ALL ENTRIES IN ivbap
WHERE kv~knumv = ivbap-knumv
AND kv~kposn = ivbap-posnr
AND kv~kappl EQ 'V'
AND ( kv~kschl EQ 'ZBP1'
OR kv~kschl EQ 'ZNAX'
OR kv~kschl EQ 'ZNAA' ).
SORT ikonv BY knumv kposn.
LOOP AT ivbap ASSIGNING <vbap>.
CLEAR konv_wa.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZBP1'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-lprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAX'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
READ TABLE ikonv INTO konv_wa WITH KEY
knumv = <vbap>-knumv
kposn = <vbap>-posnr
kschl = 'ZNAA'
BINARY SEARCH.
IF sy-subrc EQ 0.
<vbap>-sprc = konv_wa-kbetr.
ENDIF.
ENDLOOP.
SORT ivbap BY posnr matnr.
LOOP AT ivbap INTO vbap_wa.
MOVE-CORRESPONDING vbap_wa TO result_wa.
APPEND result_wa TO iresult.
CLEAR: vbap_wa, result_wa.
ENDLOOP.
ENDFORM. " gather_report_data
*& Form create_output
FORM create_output.
CALL SCREEN 100.
FREE: iresult.
ENDFORM. " create_output
*& Module PBO_0100 OUTPUT
text
MODULE pbo_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
IF c_cont1 IS INITIAL.
*Creating object of container
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CCONT1'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Alv layout
PERFORM alv_100_layout.
PERFORM save_alv_layout.
*Alv field catalogue
PERFORM alv_100_fieldcat.
*Displaying the ALV grid
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = ty_lay1
i_save = ws-alv_save
is_variant = ws-alv_variant
CHANGING
it_outtab = iresult[]
it_sort = ws-alv_sort
it_fieldcatalog = it_fieldcat[].
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Create object of the event class
*and setting handler for double click
CREATE OBJECT e_dclick.
SET HANDLER e_dclick->handle_double_click FOR c_alv1.
ENDIF.
ENDMODULE. " PBO_0100 OUTPUT
*& Module PAI_0100 INPUT
text
MODULE pai_0100 INPUT.
ws-ok_code = sy-ucomm.
CASE ws-ok_code.
WHEN 'BACK'.
CALL SELECTION-SCREEN 1000.
CLEAR ws-ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
CLEAR ws-ok_code.
EXIT.
WHEN OTHERS.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*& Form alv_100_layout
text
--> p1 text
<-- p2 text
FORM alv_100_layout.
ty_lay1-numc_total = 'X'. " Numc total line
ty_lay1-cwidth_opt = 'X'. " Optimal column width
ty_lay1-detailinit = 'X'. " Show values that are initial in
ty_lay1-sel_mode = 'A'. " Column selection mode
ty_lay1-no_merging = 'X'. " No merging while sorting columns
ty_lay1-keyhot = 'X'.
ty_lay1-grid_title = 'SD Concessions'.
ty_lay1-zebra = 'X'.
ty_lay1-no_toolbar = ' '.
ENDFORM. " alv_100_layout
*& Form alv_100_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_100_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 6.
ty_fieldcat-fieldname = 'zcurrcstusd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Cost $'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 7.
ty_fieldcat-fieldname = 'zzbrndnm'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Brand'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 8.
ty_fieldcat-fieldname = 'zqedscgrp'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'QE'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'mstav'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Status'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 9.
ty_fieldcat-fieldname = 'kwmeng'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Qty'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 10.
ty_fieldcat-fieldname = 'lprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'List Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 11.
ty_fieldcat-fieldname = 'sprc'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Discount'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 12.
ty_fieldcat-fieldname = 'netpr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Quot Price'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 13.
ty_fieldcat-fieldname = 'mrgn'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Margin%'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_100_fieldcat
*& Module PBO_0101 OUTPUT
text
MODULE pbo_0101 OUTPUT.
*Check if the Custom container exists.
IF c_cont2 IS INITIAL.
*Creating container object
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CCONT2'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*creating ALV grid for interactive list
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ALV layout
PERFORM alv_101_layout.
*ALV fieldcatalogue
PERFORM alv_101_fieldcat.
*Sorting the output by field position
SORT iresult BY posnr.
*ALV for display field details
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
is_layout = ty_lay2
CHANGING
it_outtab = iresult[]
it_fieldcatalog = it_fieldcat.
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.
ENDMODULE. " PBO_0101 OUTPUT
*& Module PAI_0101 INPUT
text
MODULE pai_0101 INPUT.
ENDMODULE. " PAI_0101 INPUT
*& Form alv_101_layout
text
--> p1 text
<-- p2 text
FORM alv_101_layout.
ty_lay2-grid_title = 'Line Details'.
ty_lay2-zebra = 'X'.
ty_lay2-no_toolbar = 'X'.
ENDFORM. " alv_101_layout
*& Form alv_101_fieldcat
text
--> p1 text
<-- p2 text
FORM alv_101_fieldcat.
REFRESH it_fieldcat.
REFRESH it_fcat.
CLEAR ty_fcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'posnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Item#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'matnr'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Mat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'zansicat'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'AnsiCat#'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'zansigrd'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Grade'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'zcurrvaltnarea'.
ty_fieldcat-tabname = 'iresult'.
ty_fieldcat-coltext = 'Val Area'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
ENDFORM. " alv_101_fieldcat
*& Form save_alv_layout
text
--> p1 text
<-- p2 text
form save_alv_layout.
ws-alv_save = 'A'.
ws-alv_variant-report = sy-repid.
endform. " save_alv_layoutHello
Creating fieldcatalogs manually is one of the major error sources in ALV programming.
There is hardly any reason why NOT to use the standard-fm LVC_FIELDCATALOG_MERGE in order to create a proper fieldcatalog.
If you need some modification of the standard fieldcatalog (e.g. renaming of columns, etc.) just do your post-processing after calling the fm.
Regards
Uwe -
How to display multiple lines of texts in a single rows in ALV
Hi,
I have a unique requirement in which i have to display multiple lines if texts for a single rows in ALV Grid. Right now in my output it is coming in single line which is not visible fully because that text is more than 255 character. So i want to display the test by splitting into multiple lines and show it on output. Please suggest some solution for this if this is possible in ALV.
Thanks,
RaghavHi Raghavendra,
Its not possible to display multiple line in one row of an alv, but i think you can acheive it by splitting the whole text into multiple sub-text.
For example, if your requirement is as below:
Field #1 Field #2
1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(200 characters)
2 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(220 character)
then you can break Field#2 value into say 50 character and then populate the internal table with repetative entries of Field#1 and the finally sort it by Field#1 value... as a result of which you output will be somewhat as below:
Field#1 Field#2
1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
yyyyyyyyyyyyyyyyyyyy
Hope it will help you in meeting your requirement.
Regards,
Shradha -
Question on line selection in table control in dialog programming....
Hello,
I have a internal table displayed on a screen using Table control wizard. Now, when user selects a particular line and double clicks it, I want to write a query based on the line user selected. How can this be achieved ?
Regards,
Rajesh.Assign a function code to F2 in your status and do the coding:
PROCESS PAI.
LOOP AT ITAB.
MODULE GET_CURSOR.
ENDLOOP.
MODULE USER_COMMAND.
MODULE GET_CURSOR.
GET CURSOR FIELD ws_field LINE ws_line.
ENDMODULE.
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'PICK'.
WS_LINE = <TABLE CONTROL>-TOP_LINE + WS_LINE - 1.
READ TABLE ITAB INDEX WS_LINE.
---> Show details
ENDMODULE. -
No page break between table header and first line of the table main area
Hi all.
I'm printing a form which contains a lot of tables. Sometimes while printing the table header line remains at the bootom of the page and the lines of internal table are printed on the next page (also with header because i have marked 'at page break' in the header). How is it possible not to break header line of 'Table'-node and the first line of internal table?
Regards, Nikolai.Hello Niki,
try to use page protection......
create a folder and place the text that r to be displayed without break.........
and check the checkbox page protection.
I think you cannot put an entire table in a folder & turn "Page Protection" on simultaneously.
Any ideas?
BR,
Suhas -
Using Numbers, I need to time-stamp each line in a table for when it was entered
I need to time-stamp each line in a table for when it was entered.
I have a formula which is
"=IF(F18="","",NOW())"
it gives me the answer I want, but every time I edit any data in the formula is recalculates the date/time to reflect the most recent edit. I do not want to do this. I am open to any and all solutions including using a script. I do not really know anything about scripts except that they are really easy to use once it's written.
I have a formula i use in excel but it requires circular references in excel. I tried using this formula in numbers but I get the error that says I cannot reference a cell that references back to the cell i’m inputting the formula into (circular reference. It is easy to use in excel just by limiting the # of iterations in preferences. I can’t seem to find any such preference in numbers. Do you know of one? here is the formula:
"=IF(D4=”",”",IF(B4=”",NOW(),B4))"
I use it to time stamp each line in a spreadsheet. It is the only way to keep all the previous line from recalculating everytime I add a new line. If I can’t use this formula, do you know of a way to timestamp each line without having it update everytime I add a line or edit the form?
Thanks in advance- I know this isn’t exaclty an easy question but I have honestly looked everywhere
emelyHi Emely,
Check the Insert menu:
The highlighted item is slightly misnamed, requiring a bit more than a simple selection (or keypress combination*) to act as a time stamp.
Simply choosing the menu item willproduce the result shown in A2: A time and date value is entered, but only the Date part is displayed.
Setting the cell format to Date and Time, with both parts displayed (as I've done in column B) does show both parts of the Date and Time value, but as you can see, the time part is set to midnight, as it is in any cell where you have entered only the Date part of a Date and Time value. The date was entered here in the same manner as in A3.
To enter both the current Date and current Time, the process has a few more steps:
Select the cell
Go Insert > Date & Time
Before confirming the entry, double-click the cell (now showing the Date) to open this small dialogue:
Click the pop-up menu under Choose Date format:
Choose the last item in the list.
Results as shown in A4 and B4 of the table above.
Regards,
Barry
•Regarding the KB shortcut shown: The Mac OS lets you define a KB shortcut for any top-level menu item. The one in the menu is a user-defined keypress combination, made to be easily remembered, not to be physically convenient to use. If doing your own, you may want to try for something eassier to get your fingers on. -
Display all line items.
Dear Friends,
I develop to new screen in this screen having table control. Table control fields I taken a table fields of ZMDISP_ITEM table fields. but I call to this table control I want to directly display ZMSAMP_ITEM fields in our table control table. I given below coding. In this coding only one line item displayed. what can i do please help me any body.
SELECT SINGLE * FROM ZMRECIPT_ITEM "INTO TABLE IT_REC_ITEM
WHERE ( BUKRS = P_BUKRS AND ZYEAR = P_YEAR AND RECREFNO = P_RREFNO ).
IF SY-SUBRC = 0.
ZMDISP_ITEM-RECREFNO = ZMRECIPT_ITEM-RECREFNO.
ZMDISP_ITEM-BUKRS = ZMRECIPT_ITEM-BUKRS.
ZMDISP_ITEM-LOTNO = ZMRECIPT_ITEM-LOTNO.
ZMDISP_ITEM-SMPCODE = ZMRECIPT_ITEM-SMPCODE.
ZMDISP_ITEM-CDDATE = ZMRECIPT_ITEM-CDDATE.
ZMDISP_ITEM-LOTQTY = ZMRECIPT_ITEM-LOTQTY.
ZMDISP_ITEM-MEINS = ZMRECIPT_ITEM-MEINS.
ZMDISP_ITEM-VARCD = ZMRECIPT_ITEM-VARCD.
clear zmrecipt_header.
CALL SCREEN '0001'.
populating Dispatch item details
SELECT * FROM ZMDISP_ITEM INTO TABLE IT_DISP_ITEM
WHERE ( BUKRS = P_BUKRS AND ZYEAR = P_YEAR AND RECREFNO = P_RREFNO ).
CLEAR P_RREFNO.
V_RREFNO = ZMDISP_HEADER-RECREFNO.
IT_DISP_ITEM-RECREFNO = ZMDISP_ITEM-RECREFNO.
IT_DISP_ITEM-BUKRS = ZMDISP_ITEM-BUKRS.
IT_DISP_ITEM-LOTNO = ZMDISP_ITEM-LOTNO.
IT_DISP_ITEM-SMPCODE = ZMDISP_ITEM-SMPCODE.
IT_DISP_ITEM-CDDATE = ZMDISP_ITEM-CDDATE.
IT_DISP_ITEM-LOTQTY = ZMDISP_ITEM-LOTQTY.
IT_DISP_ITEM-MEINS = ZMDISP_ITEM-MEINS.
IT_DISP_ITEM-VARCD = ZMDISP_ITEM-VARCD.
APPEND IT_DISP_ITEM.
Regards
Sreelakshmi.Dear Friends,
I develop to new screen in this screen having table control. Table control fields I taken a table fields of ZMDISP_ITEM table fields. but I call to this table control I want to directly display ZMRECIPT_ITEM fields in our table control table. I given below coding. In this coding only one line item displayed. what can i do please help me any body.
SELECT SINGLE * FROM ZMRECIPT_ITEM "INTO TABLE IT_REC_ITEM
WHERE ( BUKRS = P_BUKRS AND ZYEAR = P_YEAR AND RECREFNO = P_RREFNO ).
IF SY-SUBRC = 0.
ZMDISP_ITEM-RECREFNO = ZMRECIPT_ITEM-RECREFNO.
ZMDISP_ITEM-BUKRS = ZMRECIPT_ITEM-BUKRS.
ZMDISP_ITEM-LOTNO = ZMRECIPT_ITEM-LOTNO.
ZMDISP_ITEM-SMPCODE = ZMRECIPT_ITEM-SMPCODE.
ZMDISP_ITEM-CDDATE = ZMRECIPT_ITEM-CDDATE.
ZMDISP_ITEM-LOTQTY = ZMRECIPT_ITEM-LOTQTY.
ZMDISP_ITEM-MEINS = ZMRECIPT_ITEM-MEINS.
ZMDISP_ITEM-VARCD = ZMRECIPT_ITEM-VARCD.
clear zmrecipt_header.
CALL SCREEN '0001'.
populating Dispatch item details
SELECT * FROM ZMDISP_ITEM INTO TABLE IT_DISP_ITEM
WHERE ( BUKRS = P_BUKRS AND ZYEAR = P_YEAR AND RECREFNO = P_RREFNO ).
CLEAR P_RREFNO.
V_RREFNO = ZMDISP_HEADER-RECREFNO.
IT_DISP_ITEM-RECREFNO = ZMDISP_ITEM-RECREFNO.
IT_DISP_ITEM-BUKRS = ZMDISP_ITEM-BUKRS.
IT_DISP_ITEM-LOTNO = ZMDISP_ITEM-LOTNO.
IT_DISP_ITEM-SMPCODE = ZMDISP_ITEM-SMPCODE.
IT_DISP_ITEM-CDDATE = ZMDISP_ITEM-CDDATE.
IT_DISP_ITEM-LOTQTY = ZMDISP_ITEM-LOTQTY.
IT_DISP_ITEM-MEINS = ZMDISP_ITEM-MEINS.
IT_DISP_ITEM-VARCD = ZMDISP_ITEM-VARCD.
APPEND IT_DISP_ITEM.
ZMRECIPT_ITEM table data strored 5 line items. but i want to getting in my table control ZMRECIPT_ITEM table data of all line items. Table control fields are in zmdisp_item fields.
zmreceipt_item fields and zmrecipt_item_fields are same.
Regards.
Sreelakshmi. -
Dynamically picking the line item of table control
Hi all,
Can u suggest me a way to dynamically picking the no of line item in the table control displayed.
Regards,
Ashutosh KumarHi Ashutosh,
In BDC case, what you can do is use the "position button" instead of finding the number of lines on the table control.
Or else you can use call transaction with 'Options addition'
eg:
Call transaction parameters
clear gs_options.
<b> gs_options-defsize = 'X'. "Default size</b>
gs_options-dismode = 'N'.
gs_options-updmode = 'S'.
call transaction 'VI02' using t_bdcdata
"mode 'N'
"update 'S'
options from gs_options
messages into t_messages.
Please let us know why do you want to know the number of lines on the Table control.If the above answer doesn't satisfy you.
Regards,
Ravi -
Hi All,
We have a custom screen (Z Transaction and Z Screen) through which End User will be entering the data.
The data should be inserted into a Z Table.
No Line of the Z Table should be overweritten or modified... Each time, the data should be inserted as new line.
Please guide me how to perform this operation..
Thanks and Regards
PavanTable Maintenance Generator
When creating table, you will find a check box 'Table maintenance allowed'. If we check that option, we can manually enter entries using SE16 or table maintenance generator screen.
SE16 is for data browser.
How to create table maintenance generator?
Go to Se11, give the table name and click on change. Then Go to utilities--> Table maintenance generator.
In the table maintenance generator screen, we should give Authorization Group, Function Group name (Function Group name can be same as table name), Maintenance type can be one step or two step, usually we will create with one step. we should give maintenance screen number.
After clicking on create button, a table maintenance generator will be created.
To check it go to SM30 . In SM30, we find display, Maintain options.
We can view the table contents by choosing Display and we can create table entries by choosing Maintain.
Thank you,
Gopi.S
Maybe you are looking for
-
10.4.3 caused problems, now can't even load 10.4.0
Machine is a 1.67Ghz PowerBook with 1GB memory. (extra ram is apple dealer supplied and is supposed to be apple) Initial Problem. This is my wife's PB. After loading the 10.4.3 update through the autoupdate software, system became unstable. i.e. afte
-
How to restore a backed up iTunes library from discs?
I had backed up my iTunes library a while ago (more than a couple years) on CDs as Apple "demanded" at the time. Now I find that I need to restore my library to iTunes on the computer, and lo and behold, restoration doesn't work in the same manner a
-
Apple TV and Dual zone receivers
I have the lasted ATV and hooked it up to the surround sound. It works great throughout the main room but turn on the dual zone or 2 source I get no sound. Now after research I find that the dual zone only plays analog and not digital. I know i need
-
Library Management: External Hard Drive
I am running aperture 3 off of my laptop and, due to my hard drive filling up, hoping to house my library on an external hard drive. Ideally I would be able to set up a smart album for each project that housed photos rated 3 stars and up. The entire
-
I created my form, used the formcalc, previewed it, and got this message: Script failed (language is formcalc; context is xfa[0].form[0].#subform[0].tuitioncost[0]) script=NumericField8 Error: accessor 'NumericField8' is unknown However, when i "ok"e