Display data in pivot format in ALV
Hi Experts,
I got some problem with data display in ALV. I had my internal table full of data, but I want it to be displayed in ALV in a special way. For example, I had the internal table of 3 fields: A,B, Ca & Cb with data like A1, B1....
A
B
Ca
Cb
A1
B1
C1
Cat
A1
B1
C2
Cry
A2
B2
C1
Cat
A2
B2
C2
Cry
A3
B3
C3
Car
Can they be displayed in ALV in a pivotal form like below
A
B
Cat
Cry
Car
A1
B1
C1
C2
A2
B2
C1
C2
A3
B3
C3
Appreciate any kind of help provided. Many thanks in advance.
HI,
PERFORM change_headings
USING
*.. Table name
'?' "put your table name i here!!
*.. Fieldname
'M112005'
*.. Short...
'NOV 2005'
*.. Long
'November 2005'
*.. Medium
'November 2005'
*.. Dictionary Heading
'November 2005'.
*& Form change_headings
Changes the short, long, medium and and dictionary heading
fields for a given output field.
-->us_fieldname name of field to deal with
-->us_short text for short heading
-->us_long text for long heading
-->us_medium text for medium heading
-->us_heading text for dictionary heading
FORM change_headings
USING
us_tabname TYPE tabname
us_fieldname TYPE fieldname
us_short TYPE scrtext_s
us_long TYPE scrtext_l
us_medium TYPE scrtext_m
us_heading TYPE reptext.
*.. Short...
PERFORM set_fieldcat_attribute
USING
us_tabname
us_fieldname
'seltext_S'
us_short
t_fieldcat.
*.. Long
PERFORM set_fieldcat_attribute
USING
us_tabname
us_fieldname
'seltext_L'
us_long
t_fieldcat.
*.. Medium
PERFORM set_fieldcat_attribute
USING
us_tabname
us_fieldname
'seltext_M'
us_medium
t_fieldcat.
*.. Dictionary Heading
PERFORM set_fieldcat_attribute
USING
us_tabname
us_fieldname
'reptext_ddic'
us_heading
t_fieldcat.
ENDFORM. " change_headings
*& Form SET_fieldCAT_attribute
sets a fieldcat attribute,
e.g. can hide a field in ALV output, change title, etc
-->pv_table table name
-->pv_field field name
-->pv_attrib name of attribute to be changed
-->pv_newval new value to be put in attribute
-->pt_fieldcat field catlog
FORM set_fieldcat_attribute
USING pv_table TYPE tabname
pv_field TYPE fieldname
pv_attrib TYPE fieldname
pv_newval TYPE any
pt_fieldcat TYPE slis_t_fieldcat_alv
FIELD-SYMBOLS: <attrib>,
<fieldcat> TYPE slis_fieldcat_alv.
ensure working in upper case
TRANSLATE pv_table TO UPPER CASE.
ensure working in upper case
TRANSLATE pv_field TO UPPER CASE.
find the entry matching the input fieldname
READ TABLE pt_fieldcat ASSIGNING <fieldcat>
WITH KEY fieldname = pv_field tabname = pv_table.
if found..
IF sy-subrc = 0.
*.. set up the full name of field
CONCATENATE '<FIELDCAT>-' pv_attrib INTO w_field_name.
*.. point a field-symbol to it
ASSIGN (w_field_name) TO <attrib>.
*.. fill it with the input new value
<attrib> = pv_newval.
ENDIF.
ENDFORM. " set_fieldcat_attribute
assume itab-date1 = M112005
assume itab-date2 = M112004
assume itab-date3 = M122005
assume itab-date4 = M112004
data : begin of itab1 occurs 0,
mon(2) type c, " example 11
mon_desc(15) type c, "example november
end of itab1.
loop at itab.
l_mon1 = itab-date1+1(2).
l_year1 = itab-date1+3(4).
itab1-mon = l_mon1.
append itab1.
clear itab1.
l_mon2 = itab-date2+1(2).
l_year2 = itab-date2+3(4).
itab1-mon = l_mon2.
append itab1.
clear itab1.
l_mon3 = itab-date3+1(2).
l_year3 = itab-date3+3(4).
itab1-mon = l_mon3.
append itab1.
clear itab1.
l_mon4 = itab-date4+1(2).
l_year4 = itab-date4+3(4).
itab1-mon = l_mon3.
append itab1.
clear itab1.
delete adjacent duplicates from itab1 comparing mon.
write one perform here to get month description for given month using CASE statement and store in itab1-mon_desc.
loop at itab1.
if l_mon_desc1 is initial.
l_mon_desc1 = itab1-mon_desc.
else.
l_mon_desc2 = itab1-mon_desc.
endif.
endloop.
write : 'material description' ,l_mon_desc1 , l_mon_desc2.
write : l_year1 ,l_year2 ,l_year3 ,l_year4 .
just assuming the layout what u had given
PLS: AWARD POINTS .
SRI
Similar Messages
-
Error displaying data in Excel Layout of ALV
Hi,
I am trying to display ALV data in a Excel layout. After changing the layout i am not able to view the data, rather the excel template is alone displayed.
Is there setting that i am supposed. I did not try this on a custom report but i used SE16 to display data.
Any help will be really appreciated!!!
Thanks in advance,
KathirvelHi,
Please make sure that you have made a <b>global</b>
<b>declaration</b> for the ALV Grid control.If not try
with this
Please reward points if this explanation is useful.
Regards,
Siva -
How to display data of yuv format without converting rgb in OpenGL ES?
I have being study about OpenGL ES for iOS.
I wonder that data of YUV format is can display without converting RGB.
In most, the yuv data have to convert RGB for display. But, converting process is very slow, Then, that is not display smoothly.
So, I would like to try to dispaly YUV data without convert to RGB.
Is it possible? If possible, what can I do?
Please, let me give a advice.Hi Morgan,
I think you have at least two choices:
1 - Replace the colons with ', ' (comma and space) - sort of reasonable on screen and in an export
2 - Create a second page that has the same report but uses the "export: csv" template. Create a manual link to this page to replace the standard Export link. When such report pages are requested, they download immediately instead of displaying. You can, therefore, use commas in this one and <br> tags in the on-screen report version
Andy
ps - To display tags in a post, use &lt; for < and &gt; for > -
Displaying data in Grid Format?
Hello Developers,
How to display data in a grid format using BSP in mobiles(Supporting all handheld devices)?
I have read that we can use HTMLB to display data in a Tableview.But will it supported by all mobile devices?
What's the solution to achieve above challenge?
ThanksI suggest you ask that question in the ABAP forum.
Markus -
Displaying data in readable format
select *from user_tables;
TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME STATUS PCT_FREE PCT_USED INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS
FREELIST_GROUPS LOG B NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES CACHE TABLE_LO SAMPLE_SIZE LAST_ANAL PAR IOT_TYPE T S NES BUFFER_ ROW_MOVE GLO USE
DURATION SKIP_COR MON CLUSTER_OWNER DEPENDEN COMPRESS DRO
JOB_GRADES USERS VALID 10 1 255 65536 1 2147483645
YES N 6 5 0 0 0 9 0 0 1 1 N ENABLED 6 03-SEP-12 NO N N NO DEFAULT DISABLED YES NO
DISABLED YES DISABLED DISABLED NO
ERROR USERS VALID 10 1 255 65536 1 2147483645
YES N 1 5 0 0 0 84 0 0 1 1 N ENABLED 1 03-SEP-12 NO N N NO DEFAULT DISABLED YES NO
DISABLED YES DISABLED DISABLED NO
TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME STATUS PCT_FREE PCT_USED INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS
FREELIST_GROUPS LOG B NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES CACHE TABLE_LO SAMPLE_SIZE LAST_ANAL PAR IOT_TYPE T S NES BUFFER_ ROW_MOVE GLO USE
DURATION SKIP_COR MON CLUSTER_OWNER DEPENDEN COMPRESS DRO
TEST_A USERS VALID 10 1 255 65536 1 2147483645
YES N 3 5 0 0 0 16 0 0 1 1 N ENABLED 3 03-SEP-12 NO N N NO DEFAULT DISABLED YES NO
DISABLED YES DISABLED DISABLED NO
COLLECTIONS_EG USERS VALID 10 1 255 65536 1 2147483645
YES N 1 1 N ENABLED NO N N NO DEFAULT DISABLED NO NO
TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME STATUS PCT_FREE PCT_USED INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS
FREELIST_GROUPS LOG B NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES CACHE TABLE_LO SAMPLE_SIZE LAST_ANAL PAR IOT_TYPE T S NES BUFFER_ ROW_MOVE GLO USE
DURATION SKIP_COR MON CLUSTER_OWNER DEPENDEN COMPRESS DRO
DISABLED YES DISABLED DISABLED NO
COUNTRIES VALID 0 0 0 0
N 4 0 19 0 1 1 N ENABLED 4 03-SEP-12 NO IOT N N NO DISABLED YES NO
DISABLED YES DISABLED DISABLED NO
DEPARTMENTS EXAMPLE VALID 10 1 255 65536 1 2147483645
TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME STATUS PCT_FREE PCT_USED INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS
FREELIST_GROUPS LOG B NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES CACHE TABLE_LO SAMPLE_SIZE LAST_ANAL PAR IOT_TYPE T S NES BUFFER_ ROW_MOVE GLO USE
DURATION SKIP_COR MON CLUSTER_OWNER DEPENDEN COMPRESS DRO
NO N 8 5 0 0 0 19 0 0 1 1 N ENABLED 8 03-SEP-12 NO N N NO DEFAULT DISABLED YES NO
DISABLED YES DISABLED DISABLED NO
EMPLOYEES EXAMPLE VALID 10 1 255 65536 1 2147483645
NO N 20 5 0 0 0 66 0 0 1 1 N ENABLED 20 03-SEP-12 NO N N NO DEFAULT DISABLED YES NO
DISABLED YES DISABLED DISABLED NOi want to display the data in readable format
10g oracle.Hi,
Rahul_India wrote:
i want to display the data in readable formatHow to do that depends on what you consider "readable".
SET PAGESIZE higher, to get fewer header rows.
SET LINESIZE higher, if appropriate
Look up the COLUMN command in the SQL*Plus manual The
FORMAT
FOLD_AFTER, FOLD_BEFORE
TRUNCATED, WRAPPED, WORD_WRAPPED
options are especially useful.
Do you really need to see all the columns? If not, don't use SELECT *.
Consider explicitly listing the columns in a different order. The output may be more readable if related columns are listed together, or one directly above the other. At any rate, you can probably pack multi-line output more tightly if you specify the order.
Do you have a text editor where reading long lines is easier than it is in the SQL*Plus window? If so, SPOOL the output, and read the file it creates in your editor. -
Displaying data in Two line in ALV report
Hi,
I want to know how to display the data in alv in two lines for Fild name as well as for fild value
like in below case
wa_fieldcata-fieldname = 'WRBTR'.
wa_fieldcata-seltext_l = 'AMOUNT IN DOCUMENT CURRENCY'.
wa_fieldcata-outputlen = 18.
wa_fieldcata-DO_SUM = 'X'.
APPEND wa_fieldcata TO it_fieldcat.
CLEAR wa_fieldcata.
by this on alv COLUMN headig is coming as 'AMOUNT IN DOCUMENT CURRENCY' in one linw i want to display 'AMOUNT IN ' in first line and then 'DOCUMENT CURRENCY' below that
'AMOUNT IN
DOCUMENT CURRENCY' ***
similarly how to display value of three fidls in one column
like for a vendor I have one column Vandor name in that column i want to display from table LFA1,
NAME1
NAME2
NAME3
NAME4,
in one column only how to do it.
regards,
zafarHi,
Ref . early reply can u help me how to uset his in ALV code and can u give some example for this how to display it in two lines as my column heading is of 60 characters 5 word i want to display it in two line in one column only .
How to use : SLIS_EV_AFTER_LINE_OUTPUT
to get this.
or is there any other method.
regards,
zafar -
Displaying a form in an iView & displaying data in .pdf format in an iView
Hi,
1)We want to show some details in an iView pertaining to the person who has logged into the portal. We are calling a function module (when a user clicks on a workset in the portal) and passing some parameters to it. The function module pulls the data from the tables and generates a sap script which displays the data in a SAP Script Form.
Now our problem is how do we display the form in the iView?
2) We want to show some details in an iView pertaining to the person who has logged into the portal. We are calling a function module (when a user clicks on a workset in the portal) and passing some parameters to it. The function module pulls the data from the tables and converts the data into a pdf file.
How do we display the data in the .pdf format in the iView.Hi,
displaying a PDF in an iView I receive the following errormessage:
Access denied:.....
security zone:.....
The portalapp.xml is like
<property name="SecurityZone" value="epp/NO_SAFETY"/>
<property name="ResourceBundleName" value="epp_lang"/>
<property name="AuthRequirement" value="none"/>
Any ideas?
Thanks
Walter -
How to display output only sort format in alv
Hi Experts,
I have one problem in alv output display. I'm developing alv report for orders raised during the period.I want to display each order wise value(netwr) and order quatity (kwmeng) . i set 8 radio buttons one radio btn click then i want output ex.in grid display click on sort then each order wise calculate the value and quantity . that particular data to display when click on radio button.
ex:click on sort in grid display.
(branch) (order no) (quantity) (value) (BSTNK)
AMUM 0000003354 2 10 3,271
AMUM 0000003354 1 10 6,542
(above qty sum 2+1=3)
(SUM) = AMUM 0000003354 3 20 9,813
HIP2 0000003362 2 5 17,810
HIP2 0000003362 1 5 23,075
(sum) = HIP2 0000003362 10 40,885
i display output in alv griddisplay.client asking one rb put in selection screen i want output like above only sum col.
when i click one radio button output is come like (sum) above.
Please help me.
Thanks & Regards,
Balakrishna Gajulahi you need to use sortinfo for your requirement.
ie see the below code.
"declare sortinfo at data declaration
data: wa_sort type slis_sortinfo_alv, "''' add this
layout type slis_layout_alv. "add this
""make the below changes in your fieldcat
wa_fieldcat-tabname = 'FINAL'.
wa_fieldcat-seltext_m = 'Td - Rvdt'.
wa_fieldcat-fieldname = 'QUANTITY'.
wa_fieldcat-do_sum = 'X'. """"""add this to your *QUANTITY field*
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'FINAL'.
wa_fieldcat-seltext_m = 'temp''.
wa_fieldcat-fieldname = 'VALUE'.
wa_fieldcat-do_sum = 'X'. """"""add this to your *VALUE field*
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
""""" you need to add this after workarea of fieldcat
wa_sort-fieldname = 'BRANCH'. " Here Branch indicates the fieldname
wa_sort-subtot = 'X'.
append wa_sort to it_sort.
clear wa_sort.
wa_sort-fieldname = 'ORDERNO'.
append wa_sort to it_sort.
clear wa_sort.
" in your alv fm add sortinfo
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-cprog
is_layout = layout
it_fieldcat = it_fieldcat
it_sort = it_sort """""""""add this
tables
t_outtab = final " your internal table name
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.
This solves your purpose.
Regards,
koolspy. -
Problem while displaying data in spool using oops alv
Hi,
I have created a oops alv, in which iam displaying 2 ALV's on 2 containers..
Iam able to display the data which i need when i execute the program in foreground , But when i execute the program in background iam not able to see the 2nd ALV in the spool....
The ALV displays one below the other.
How i can i correct it..?
VishwaHi,
The container created in ALV will work only in foreground as this is the framework the background cannnot initiate the container object and assign the ALV to the container.
Hence you cannot create the container object and assign the same to the ALV screen in background. Instead you need to use the factory method/ALV FM to display in background mode.
For background ALV processing, don't use OOPS! U can use this fm : REUSE_ALV_GRID_DISPLAY.
You can also refer below threads:
Re: ALV: Foreground Vs Background
Re: OO ALV in background job
Regards
Shiva -
Displaying data in HTML format
This has probably been answered before but when I try to display information from a table column in HTML it loses some formatting capabilities such as carriage returns. What causes this? Does it have to do with DOCTYPE?
Displaying where?
Success
Cor -
Display data column wise in alv
my problem is i want to display data in column wise in alv grid display
for example it will display
Name1 Amount
GTS 12000
TSL 8970
MJB 4678
but i want like:
GTS TSL MJB
12000 8970 4678
Edited by: jadav_avani on Nov 15, 2010 8:33 AM
Moderator Message: Search for available information.
Edited by: kishan P on Nov 15, 2010 1:50 PMmy problem is i want to display data in column wise in alv grid display
for example it will display
Name1 Amount
GTS 12000
TSL 8970
MJB 4678
but i want like:
GTS TSL MJB
12000 8970 4678
Edited by: jadav_avani on Nov 15, 2010 8:33 AM
Moderator Message: Search for available information.
Edited by: kishan P on Nov 15, 2010 1:50 PM -
How to display data in alv through double click
Hello Friends,
I am new to this community,please tell me if I make any mistake while posting.
Friends I had written this code. ALV is displayed at first time but when I am double clicking on the row then error is coming related to mismatch of actual and formal paramaters while calling function 'USER_COMMAND'. I am unable to locate where the error is. Please help me out.
REPORT ZALV12.
TYPE-POOLS SLIS.
DATA: it_vbak type standard table of VBAK,
it_vbap type table of VBAP.
DATA: wa_vbak like line of it_vbak,
wa_vbap like line of it_vbap.
DATA syrepid like sy-repid.
DATA:fld_vbak type SLIS_T_FIELDCAT_ALV,
fld_vbap type SLIS_T_FIELDCAT_ALV.
DATA:fld_wa_vbak type SLIS_FIELDCAT_ALV,
fld_wa_vbap type SLIS_FIELDCAT_ALV.
DATA:vevent type SLIS_T_EVENT,
waevent type SLIS_ALV_EVENT.
DATA:LST_HEADR type SLIS_T_LISTHEADER.
DATA title_alv type LVC_TITLE value 'LIST FOR VBAK'.
INITIALIZATION.
syrepid = sy-repid.
perform get_event.
perform populate_event.
perform set_list_headr using LST_HEADR.
perform field_cat.
START-OF-SELECTION.
..... "code for displaying data from table VBAK in ALV.
form USER_COMMAND using R_UCOMM type SY-UCOMM. "error is in this function.
data r_selfield type SLIS_SELFIELD.
case R_UCOMM.
when '&IC1'.
read table it_vbak into wa_vbak index r_selfield-TABINDEX.
perform data_select.
perform list_heading using LST_HEADR.
perform event_get.
perform build_event.
perform alv_display.
endcase.
endform.
form data_select.
select * from VBAP into table it_vbap up to 20 rows.
endform.
form list_heading using i_lst type SLIS_T_LISTHEADER.
data HLINE type SLIS_LISTHEADER.
HLINE-TYP = 'H'.
HLINE-INFO = 'FOR VBAP'.
append HLINE to i_lst.
endform.
form alv_display.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = syrepid
I_STRUCTURE_NAME = 'VBAP'
I_GRID_TITLE = 'SCREEN2_VBAP'
TABLES
T_OUTTAB = it_vbap
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.
form event_get.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = vevent
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.
endform.
form build_event.
read table vevent into waevent with key name = 'TOP_OF_PAGE'.
if sy-subrc = 0.
waevent-form = 'F_TOP_OF_PAGE'.
modify vevent from waevent transporting form
where name = 'TOP_OF_PAGE'.
endif.
endform.
form F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = LST_HEADR
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform.You missed one paramete in user_command form
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Regards,
Raymond -
How to get this output format in ALV report
Hi.
Can any one pls let me know how to get the following output format in ALV report.Following are the outputfields
companycode location position approver
300 800 01 watson
null null 03 candy
null null 04 smith
null null 05 michael
one empty line after this again
300 800 01 ryant
null null 02 gyan
null null 03 fermi
null null 04 ogata
*Note: Null indicates empty space .( i.e I need to get empty space in output where ever null is there.)
Thanks in advance.
Kind Regards,
samiulla.hi,
u can use 'REUSE_ALV_LIST_DISPLAY'
or
'REUSE_ALV_GRID_DISPLAY' function modules.
SAMPLE CODE :
*& Report Y101982CHD
* TABLES
TABLES: vbak. " standard table
* Type Pools *
TYPE-POOLS: slis.
* Global Structure Definitions *
*-- Structure to hold data from table CE1MCK2
TYPES: BEGIN OF tp_itab1,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
werks LIKE vbap-werks,
lgort LIKE vbap-lgort,
END OF tp_itab1.
*-- Data Declaration
DATA: t_itab1 TYPE TABLE OF tp_itab1.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
* Selection Screen *
*--Sales document-block
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
SELECTION-SCREEN END OF BLOCK b1.
*--Display option - block
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETERS: alv_list RADIOBUTTON GROUP g1,
alv_grid RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b2.
*file download - block
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS: topc AS CHECKBOX,
p_file TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK b3.
* Initialization. *
* At Selection Screen *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_FILE'
dyname = sy-cprog
dynumb = sy-dynnr
filetype = 'P' "P-->Physical
location = 'P' "P Presentation Srever
server = space.
AT SELECTION-SCREEN ON s_vbeln.
PERFORM vbeln_validate.
* Start Of Selection *
START-OF-SELECTION.
*-- Fetching all the required data into the internal table
PERFORM select_data.
* End Of Selection *
END-OF-SELECTION.
IF t_itab1[] IS NOT INITIAL.
IF topc IS NOT INITIAL.
PERFORM download.
MESSAGE 'Data Download Completed' TYPE 'S'.
ENDIF.
PERFORM display.
ELSE.
MESSAGE 'No Records Found' TYPE 'I'.
ENDIF.
* Top Of Page Event *
TOP-OF-PAGE.
*& Form : select_data
* Description : Fetching all the data into the internal tables
* parameters : none
FORM select_data .
SELECT vbeln
posnr
werks
lgort
INTO CORRESPONDING FIELDS OF TABLE t_itab1
FROM vbap
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
MESSAGE 'Enter The Valid Sales Document Number'(t04) TYPE 'I'.
EXIT.
ENDIF.
ENDFORM. " select_data
*& Form : display
* decription : to display data in given format
* parameters : none
FORM display .
IF alv_list = 'X'.
PERFORM build_fieldcat TABLES i_fieldcat[]
USING :
*-Output-field Table Len Ref fld Ref tab Heading Col_pos
'VBELN' 'T_ITAB1' 10 'VBAP' 'VBELN' '' 1,
'POSNR' 'T_ITAB1' 6 'VBAP' 'POSNR' '' 2,
'WERKS' 'T_ITAB1' 4 'VBAP' 'WERKS' '' 3,
'LGORT' 'T_ITAB1' 4 'VBAP' 'LGORT' '' 4.
*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'*
*EXPORTING*
*i_callback_program = sy-repid*
** i_callback_pf_status_set = c_pf_status*
*i_callback_user_command = 'USER_COMMAND '*
** it_events = t_alv_events[]*
*it_fieldcat = i_fieldcat[]*
*TABLES*
*t_outtab = t_itab1[]*
*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.
IF alv_grid = 'X'.
PERFORM build_fieldcat TABLES i_fieldcat[]
USING :
*-Output-field Table Len Ref fld Ref tab Heading Col_pos
'VBELN' 'T_ITAB1' 10 'VBAP' 'VBELN' '' 1,
'POSNR' 'T_ITAB1' 6 'VBAP' 'POSNR' '' 2,
'WERKS' 'T_ITAB1' 4 'VBAP' 'WERKS' '' 3,
'LGORT' 'T_ITAB1' 4 'VBAP' 'LGORT' '' 4.
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'*
*EXPORTING*
*i_callback_program = sy-repid*
** i_callback_pf_status_set = c_pf_status*
*i_callback_user_command = 'USER_COMMAND '*
*it_fieldcat = i_fieldcat*
*TABLES*
*t_outtab = t_itab1[]*
*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.*
ENDFORM. " display
*& Form : vbeln_validate
* description : to validate sales document number
* parameters : none
FORM vbeln_validate .
DATA: l_vbeln TYPE vbak-vbeln.
SELECT SINGLE vbeln
FROM vbak
INTO l_vbeln
WHERE vbeln IN s_vbeln.
IF sy-subrc NE 0.
MESSAGE 'ENTER THE VALID SALES DOCUMENT NO:' TYPE 'I'.
EXIT.
ENDIF.
ENDFORM. " vbeln_validate
*& Form :build_fieldcat
* Description : This routine fills field-catalogue
* Prameters : none
FORM build_fieldcat TABLES fpt_fieldcat TYPE slis_t_fieldcat_alv
USING fp_field TYPE slis_fieldname
fp_table TYPE slis_tabname
fp_length TYPE dd03p-outputlen
fp_ref_tab TYPE dd03p-tabname
fp_ref_fld TYPE dd03p-fieldname
fp_seltext TYPE dd03p-scrtext_l
fp_col_pos TYPE sy-cucol.
*-- Local data declaration
DATA: wl_fieldcat TYPE slis_fieldcat_alv.
*-- Clear WorkArea
wl_fieldcat-fieldname = fp_field.
wl_fieldcat-tabname = fp_table.
wl_fieldcat-outputlen = fp_length.
wl_fieldcat-ref_tabname = fp_ref_tab.
wl_fieldcat-ref_fieldname = fp_ref_fld.
wl_fieldcat-seltext_l = fp_seltext.
wl_fieldcat-col_pos = fp_col_pos.
*-- Update Field Catalog Table
APPEND wl_fieldcat TO fpt_fieldcat.
ENDFORM. "build_fieldcat
*& Form : download
* description : To Download The Data
* Parameters : none
FORM download .
DATA: l_file TYPE string.
l_file = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
TABLES
data_tab = t_itab1
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6.
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. " download
HOPE IT WILL HELP YOU
REGARDS
RAHUL SHARMA -
How to display data horizontally
Hi,
I have to display data the following format.
sales order item description 01/09/2010 02/09/2010 03/09/2010
100 1 test 3 4 6
in currently i am displaying the following format.
sales order date1 date2 date3
item
description
1.how to fill field catelog.
2. i have written code like below,
wa_lvc_cat-fieldname = 'COLUMNTEXT'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat.
wa_fieldcat-fieldname = 'COLUMNTEXT'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
wa_fieldcat-key = 'X'.
APPEND wa_fieldcat TO lt_fieldcat.
DESCRIBE TABLE i_final.
DO sy-tfill TIMES.
For each line, a column 'VALUEx' is created in the fieldcatalog
Build Fieldcatalog
WRITE sy-index TO wa_lvc_cat-fieldname LEFT-JUSTIFIED.
CONCATENATE 'VALUE' wa_lvc_cat-fieldname
INTO wa_lvc_cat-fieldname.
wa_lvc_cat-ref_field = 'VALUE'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat.
Build Fieldcatalog
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = wa_lvc_cat-fieldname.
wa_fieldcat-ref_fieldname = 'VALUE'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
APPEND wa_fieldcat TO lt_fieldcat.
ENDDO.
create dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_lvc_cat
IMPORTING
ep_table = l_dyntable.
ASSIGN l_dyntable->* TO <dynamictable>.
create structure as structure of the internal table
CREATE DATA l_structure LIKE LINE OF <dynamictable>.
ASSIGN l_structure->* TO <header>.
create structure = structure of the internal table
CREATE DATA l_structure LIKE i_final.
ASSIGN l_structure->* TO <ls_table>.
create field catalog from our table structure
wa_fieldcat-fieldname = 'DATE'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
wa_fieldcat-fieldname = 'CNT'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
wa_fieldcat-fieldname = 'FUNCT'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
wa_fieldcat-fieldname = 'ITEM'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
wa_fieldcat-fieldname = 'TRANS'.
wa_fieldcat-tabname = 'I_FINAL'.
APPEND wa_fieldcat TO lt_fieldcatalogue.
*call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_structure_name = <LS_TABLE>
changing
ct_fieldcat = lt_fieldcatalogue
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.
DESCRIBE TABLE lt_fieldcatalogue.
fill the internal to display <dynamictable>
DO sy-tfill TIMES.
IF sy-index = 1.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX 1.
ENDIF.
For each field of it_table
ASSIGN COMPONENT 1 OF STRUCTURE <header> TO <dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX sy-index.
Fill 1st column
<dynheader> = wa_fieldcat-seltext_m.
IF <dynheader> IS INITIAL.
<dynheader> = wa_fieldcat-fieldname.
ENDIF.
*filling the other columns
LOOP AT i_final INTO <ls_table>.
l_col = sy-tabix + 1.
ASSIGN COMPONENT sy-index OF STRUCTURE <ls_table> TO <dyndata>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT l_col OF STRUCTURE <header> TO
<dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
WRITE <dyndata> TO <dynheader> LEFT-JUSTIFIED.
ENDLOOP.
APPEND <header> TO <dynamictable>.
ENDDO.
*layout for alv output
lt_layout-zebra = 'X'.
lt_layout-no_colhead = 'X'..
lt_layout-colwidth_optimize ='X'.
lt_layout-window_titlebar = 'ALV GRID TRANSPOSED'.
*alv grid output for display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = lt_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <dynamictable>.
Plz correct me code.here's a sample to prepare a alv-fieldcatalog with many similar value-fields:
*get metadata of itab
DESCRIBE FIELD itab INTO td.
LOOP AT td-types INTO watypes.
READ TABLE td-names INTO wanames INDEX watypes-idx_name.
CHECK sy-subrc = 0.
MOVE wanames-name TO fld-name.
READ TABLE td-names INTO wanames INDEX watypes-idx_help_id .
MOVE wanames-name TO fld-def.
WHILE wanames-continue = '*'.
hindex = watypes-idx_help_id + 1.
READ TABLE td-names INTO wanames INDEX hindex.
CONCATENATE fld-def wanames-name INTO fld-def.
ENDWHILE.
APPEND fld.
ENDLOOP.
*build fieldcatalog
LOOP AT fld.
CLEAR katalog.
katalog-fieldname = fld-name.
IF fld-name = 'RCOMP'
OR fld-name ='GSBER'
OR fld-name ='ITEM'
OR fld-name ='FUNKTION'.
katalog-key = 'X'.
ENDIF.
SPLIT fld-def AT '-' INTO t f.
SELECT SINGLE scrtext_m leng
FROM dd03m INTO: (katalog-reptext_ddic, katalog-outputlen)
WHERE tabname = t
AND fieldname = f
AND ddlanguage = sy-langu.
IF sy-subrc <> 0.
katalog-reptext_ddic = fld-name.
ENDIF.
IF fld-name = 'TXT'.
katalog-outputlen = 30.
ELSEIF fld-name = 'GSBER'.
katalog-outputlen = 4.
ELSE.
katalog-tabname = t.
ENDIF.
*here: different value-fields
IF fld-name BETWEEN 'KSL00' AND 'KSL99'.
IF fld-name <> 'KSL99'.
CONCATENATE 'Periode' fld-name+3(2) '/' jahr INTO
katalog-reptext_ddic SEPARATED BY space.
*hide fields
IF NOT fld-name+3(2) IN buper.
katalog-no_out = 'X'.
ENDIF.
ELSE.
katalog-outputlen = 19.
IF ohnevj = 'X'.
katalog-reptext_ddic = 'Summe'.
ELSE.
*previous year
CONCATENATE 'Periode' buper-low '/' vorjahr INTO
katalog-reptext_ddic SEPARATED BY space.
ENDIF.
ENDIF.
katalog-currency = 'EUR'.
katalog-do_sum = 'X'.
katalog-inttype = 'P'.
katalog-datatype = 'CURR'.
ENDIF.
*hide more fields
CASE fld-name.
WHEN 'GSBER'.
MOVE x_gebe TO katalog-no_out.
katalog-reptext_ddic = 'Gsbr'.
WHEN 'ITEM'.
MOVE x_item TO katalog-no_out.
WHEN 'FUNKTION'.
MOVE x_func TO katalog-no_out.
WHEN 'TXT'.
MOVE x_text TO katalog-no_out.
ENDCASE.
APPEND katalog TO cat.
ENDLOOP.
grx
A. -
Hi, I have program which display data in Excel layout of ALV loaded from internal table..
It means that in sap i received excel sheet with all its functionality.
The problem is that sometimes there are missed some rows with data.
Did someone meet with similar situation?
Regards,
JoannaHI
DATA: v_file LIKE rlgrap-filename,
v_filename TYPE string.
REFRESH i_matcontrol.
CLEAR i_matcontrol.
TRANSLATE v_exten TO UPPER CASE.
IF v_exten = 'XLS'.
v_file = p_p_file.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_tab_raw_data = ws_rawdata
i_filename = v_file
TABLES
i_tab_converted_data = i_data.
ELSEIF v_exten = 'TXT'.
v_filename = p_p_file.
File upload
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename
filetype = 'ASC'
has_field_separator = 'T'
TABLES
data_tab = i_data
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
CASE sy-subrc.
WHEN 1.
MESSAGE e001(00) WITH text-001.
STOP.
WHEN 2.
MESSAGE e001(00) WITH text-002.
STOP.
WHEN 0.
IF i_data IS INITIAL.
MESSAGE s001(00) WITH text-008.
ENDIF.
ENDCASE.
ENDIF.
DELETE i_data WHERE matnr IS INITIAL AND
werks IS INITIAL.
Maybe you are looking for
-
Up until yesterday, I could open a new tab with a blank page. Now, every new tab opens to a bing search page and focus is in the search box. Very annoying when I begin to type a URL and have to click in the URL to continue typing. How do I get back t
-
Error While Performing a Software Update on iPad2
When I try to do a software update on my iPad, I am getting the following error: "An error occured while checking for a software update."
-
I updated my iPad mini to the ios7, now there's a music iTunes pic with a charger under it, it's already plugged in but nothing is happening. What do I do? Please help!
-
I am trying to start the em service on a w-xp machine but I have not been able to do it. I tried this: D:\oracle10\product\10.2.0>emctl start agent EM Configuration issue. D:\oracle10\product\10.2.0/herrero.mad.tecsidel.es_local10 not found.I thought
-
JDK installed in WindowsXP but without public jre. Problems!!
Hello everyone. I have a few questions regarding a jdk installation. I never install a public copy of the jre mainly because I think it's a waste of space. But here are the down sides. I haven't been able to use the java plugin with Firefox, even tho