Interacting with ALV output on Webdynpro
Hi expert,
I am displaying the output in ALV fromat using Webdynpro application.
When I click on a column, i want to perform some functionality.
How this can be achived?
Do we need to display that Column as a Button? Then, how to trigger that action from that column?
Thanks,
Sreenivas
Sreenivas,
Please post it in webdynpro for abap forum.
To give you hint you need to make the column as link to action and set an event handler onclick for the alv or you can search in webdynpro for abap forum
Thanks
Bala Duvvuri
Similar Messages
-
SUBMIT and RETUTN with ALV output into a interanl table.
Hello Friends,
I have one z program which returns ALV output.
I have to create a one new Z program and in that I want to call this program and want the final output into an internal table into my Zreport.
I used SUBMIT statement with RETURN but not working.
can anybody tell me what I missed?
or
How can we do this.
Thanks in advance.
SuhasHi Suhas,
In Zreport1.
Just open the first report program and assign internal table to some memory id like...
EXPORT it_tab1 to MEMORY ID 'ZNITS'.
In Zreport2.
Now create an internal table with the same structure of it_tab1 and write the following in your program...
SUBMIT Zreport1 WITH SELECTION-TABLE it_input
AND RETURN.
Note: it_input is of type rsparams and contains all selection parameters for *Zreport1*
* Import internal table content from memory id
IMPORT it_tab1 TO it_tab2 FROM MEMORY ID 'ZNITS'.
FREE MEMORY ID 'ZNITS'.
Thanks
Nitesh -
Hi,
I want to display a message on the status bar along with the output . That is output and message should appear on the same screen together. Neither before the output nor after the the output.
Best Regards,Hi,
One option is to use ALV Container. Create a screen with ALV container & keep some blank lines at the footer of the screen. Use classes to call the ALV footer for populating the message.
Thanks,
Best regards,
Prashant -
SUBMIT and RETUTN with ALV output
Hello Friends,
I have one standard program (RSVTPROT) which returns ALV output.
I want this output as internal table into my Zreport.
I used SUBMIT statement with RETURN but not working.
can anybody tell me what I missed?
Regards,
RHHi Ronny,
ALV output of called Program will not displayed when you use Submit and Return.
if you want to get the output of it . Identify the final Internal table where all the output of program RSVTPROT will be collected.
i guess its <gtab> ( Field symbol Table ) . try to get the same. -
How to use Write statement along with ALV output
Hi expert,
currently i have a requirement where i am first displaying message with write statement and after that ALV should be displayed ...something like below:
vendor number is wrong.
material number is wrong.
plant is wrong.
and then here ALV output -list of records updated in the database.
but as of now the ALV is shown first and when going back then the write message information is dispayed.
can anyone help how we can get this in only one screen?
Thanks!!!
RajeshMay below example give you some idea.
TYPE-POOLS: slis.
DATA: BEGIN OF it_kna1 OCCURS 0,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
ort01 TYPE kna1-ort01,
END OF it_kna1.
DATA: it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
START-OF-SELECTION.
SELECT kunnr name1 ort01
FROM kna1 INTO TABLE it_kna1 UP TO 10 ROWS.
END-OF-SELECTION.
WRITE:/ 'Write Statement Display' HOTSPOT ON.
AT LINE-SELECTION.
CLEAR it_fcat.
it_fcat-fieldname = 'KUNNR'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'Customer'.
APPEND it_fcat.
CLEAR it_fcat.
it_fcat-fieldname = 'NAME1'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'Customer Name'.
APPEND it_fcat.
CLEAR it_fcat.
it_fcat-fieldname = 'ORT01'.
it_fcat-tabname = 'IT_KNA1'.
it_fcat-seltext_l = 'City'.
APPEND it_fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fcat[]
TABLES
t_outtab = it_kna1[]. -
Problem with alv output export to text file
hi experts,
when iam exporting alv output to text file,
some data is missing in text file.say for example sold-to-party value is 1155027 in alv out put,but in text file it is showeing only 115502 ,
the last digit is missing,
can anyone help urgent!!!!!and when you export it to excel?
from here you could save it as text file too...
A. -
Issue with ALV output in production
Hi ,
Iam using REUSE_ALV_GRID_DISPLAY function module to display the alv output.
But the ALV is not displaying the data in production, where as it is working fine in Development and Quality.
I have checked the version there is no change.
Please advice how to fix this issue?I have checked all the Transport request for this particular report,
Even i did the Version management .
I didnt find any change in the versiopn management.
We didnt miss any Transport related to this Report.
Please see my coding for the same.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = V_ALV_LAYOUT
IT_FIELDCAT = V_ALV_FIELDCAT
I_DEFAULT = C_X
I_SAVE = 'A'
IT_EVENTS = V_ALV_EVENTS
TABLES
T_OUTTAB = IT_FINAL[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2 .
IF SY-SUBRC <> 0.
Edited by: vinay raj on Nov 23, 2010 11:34 AM -
Remove Header when running report with ALV output
Hi,
We are running ITS Version 6200.1022.63326.3, Build 84960 connecting to R/3 Enterprise 4.7 on 6.40 Kernel Patch 196.
I have a situation where I run a report through ITS, starting with a selection screen, I can remove the header part of the ITS generated screen by commenting out:
<!--
`SAP_TemplateHeader()`
-->
in my template. This works great.
Now when I run the report and the output is given in the form of an ALV grid, there is no screen to manipulate as it uses the webgui generated html due to me having set parameter:
GENERATEDYNPRO = 1.
When I receive the report output, the SAP header with "Quit" and "Help" is back, due to it being driven by the standard webgui generated templates.
I have searched on SDN and found some guidelines but no answers are answered and then the thread goes dead so I just wanted to know if someone has ever successfully removed this header.
I have set noheaderokcode = 1 in the service file, in webgui.srvc as well as in global.srvc.
I have also started editing the templatelibrary files but to me it is not a very clean solution.
If someone out there has had this challenge and solved it, please advise.
Thank you very much and regards,
Ronald G. MeyerHi,
Thanks for the feedback.
Does not seem like the Basis team will be patching the ITS landscape soon, so is there anyone who has more input on this?
I have found a programmatical example in this thread:
/thread/76409 [original link is broken]
But none of the examples work like I expect it to.
Just wanted to know if someone has implemented this successfully.
Regards,
Ronald Meyer -
Hi,
I am an intermediate director programmer and an advanced
designer looking for a head start on a director project that will
be on two monitors next to each other. the dimension are rather
large, and does not require two machines but willing to use two if
need be. the director project has around 10-11 buttons that will
play 6-8 different movies or static images/text across two big
monitor on top of each other. the interactivity will be across the
two monitors.
Was wondering your thoughts.
Personally was thinking of just setting the dimension rather
large like 4000 by 3000 and just setting the projector to center on
a pc with two monitors. if centering on two monitors does not work
defining the start position of the stage. or adjusting them at run
time.
If someone with more experience would care to share some
insight into correct method i would greatly appreciate it.
Or has a link to a tutorial or similar source.
Thank for reading my post,
joe at hyperactive.to
p.s director got me this job and keep this company running.
adobe please don't forget thatI would just set it up so that the stage stretches across two
screens. -
ALV: Send ALV output as mail - background processing
Hi all,
I'm a newbie in SDC and try to implement the following functionality (Version 4.0B):
A ABAP report (to be scheduled as e.g. a daily job run) with ALV output should send an automated email containing the ALV informations to a receiver specified in the selection criterias.
I already have the following pieces:
1) The report with ALV output (running online and clicking on List/send/office works perfectly, the alv-output is attached to the mail). The report runs also in background and generates a spool.
2) A subroutine wich sends a email (input has to be in an itab)
Now I try to put them together.
Question: How can I automate the send process?
I did a little bit of debugging, but got lost in the SAP Office functions.
Any help appreciated!
ThomasHi Michael,
thank you again a helpfull reply. To solve the issue I ended up writing a second little report.
Here is a short description of my solution just in case anybody else is also interested in.
I set up a Job with two steps.
Step 1 is the ABAP that creates e.g. a ALV output (anything that goes to spool).
Step 2 is a little ABAP that does nothing else than reading the output of step 1 (Spool) and send it as SAP Office Document. (To be a little more flexible I added some selection criterias for step 2 like Jobstep number, receiver, sendmode, ...).
It works fine online (by keying in the spool number manually) and in batch mode (by determining the spool number based on the job number). I think this solution is flexible and lightwight.
Kind regards,
Thomas
Message was edited by: Thomas Hager
Message was edited by: Thomas Hager -
How to hide ALV column in webdynpro
Hi frnds,
I want to hide one columns in ALV output on webdynpro , give the procedure ...
Thanks & Regards,
Rajesh.jProcedure is :
a) Get ALV Model reference
b) Get list of ALV Columns
c) Loop at each column and set visibility
Code would be something like this
I'm storing ALV model reference in view attributes wd_this->alv_config_table of type ref to CL_SALV_WD_CONFIG_TABLE.
Data: lo_cmp_usage type ref to if_wd_component_usage.
DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lt_column type salv_wd_t_column_ref,
ls_column type salv_wd_s_column_ref.
*create an instance of ALV component
lo_cmp_usage = wd_this->wd_cpuse_OVERVIEW_EARNED_ALV( ).
* if not initialized, then initialize
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
* get ALV component
lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_EARNED_ALV( ).
wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
lr_column_settings ?= wd_this->alv_config_table.
lt_column = lr_column_settings->get_columns( ).
loop at lt_column into ls_column.
CASE ls_column-id.
when 'POST_YEAR'.
ls_column-r_column->set_visible( if_wdl_core=>visibility_none ).
ENDCASE.
endloop. -
How to Print Selection-Screen along with ALV Report output
Hi,
I have a requirement wherein i need to also print the Selection Screen of a report when I print the ALV report output.
Basically i need to print the ALV output along with selection screen.
Could you plz suggest me the way.
Regards,
NitinHi,
My selection Screen is a very big one. It contains around 30 select-options.
So is their any standard method in which you can choose whether you want to take the output printout with or without Selection screen.
Regards,
Nitin -
Hi All,
I have created a list in ALV format ,now i want to interact with the list in alv and i want to catch the two fields from the record not one field, how it can be possible.
example in my record
vbeln kunnr posnr ...........etc
when i interact i have to catch the vbeln and kunnr in to different variables please help me how it can be done.
Regards
krishnaREPORT intractive.
TYPE-POOLS: slis.
TABLES: kna1,vbak.
TYPES: BEGIN OF ty_kna1,
kunnr LIKE kna1-kunnr,
land1 LIKE kna1-land1,
name1 LIKE kna1-name1,
ort01 LIKE kna1-ort01,
END OF ty_kna1.
TYPES: BEGIN OF ty_vbak,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
ernam LIKE vbak-ernam,
netwr LIKE vbak-netwr,
END OF ty_vbak.
DATA: it_kna1 TYPE TABLE OF ty_kna1,
wa_kna1 TYPE ty_kna1,
it_vbak TYPE TABLE OF ty_vbak,
wa_vbak TYPE ty_vbak.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_event TYPE slis_t_event,
wa_event TYPE slis_alv_event,
it_listheader TYPE slis_t_listheader,
wa_listheader TYPE slis_listheader,
wa_layout TYPE slis_layout_alv ,
hline TYPE slis_listheader.
wa_selfield TYPE slis_selfield.
DATA: i_title_KNA1 TYPE lvc_title VALUE 'FIRST LIST DISPLAYED',
i_title_VBAK TYPE lvc_title VALUE 'SECONDRY LIST DISPLAYED'.
SELECT-OPTIONS: s_kunnr FOR kna1-kunnr DEFAULT 1000 TO 1500.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS: r1 RADIOBUTTON GROUP g1 DEFAULT 'X'.
PARAMETERS: r2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b2.
INITIALIZATION.
PERFORM layout.
PERFORM fieldcat_kna1.
PERFORM event.
PERFORM eventpopulate.
START-OF-SELECTION.
PERFORM datafetch_kna1.
IF r1 = 'X'.
PERFORM display.
ENDIF.
IF r2 = 'X'.
PERFORM grid.
ENDIF.
*& Form fieldcat
text
FORM fieldcat_kna1.
**************FOR THE TABLE KNA1**********************
wa_fieldcat-fieldname = 'KUNNR'.
wa_fieldcat-seltext_l = 'CUSTOMER NUMBER'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-outputlen = 10.
wa_fieldcat-tabname = 'IT_KNA1'.
wa_fieldcat-key = 'X'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-col_pos = 1.
wa_fieldcat-emphasize = 'C11'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'LAND1'.
wa_fieldcat-seltext_l = 'COUNTRY CODE'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-outputlen = 10.
wa_fieldcat-tabname = 'IT_KNA1'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-col_pos = 4.
wa_fieldcat-emphasize = 'C61'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_l = 'CUSTOMER NAME'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-outputlen = 15.
wa_fieldcat-tabname = 'IT_KNA1'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-col_pos = 2.
wa_fieldcat-emphasize = 'C31'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ORT01'.
wa_fieldcat-seltext_l = 'COUNTRY '.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-outputlen = 10.
wa_fieldcat-tabname = 'IT_KNA1'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-col_pos = 3.
wa_fieldcat-emphasize = 'C71'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "fieldcat
*& Form datafetch
text
FORM datafetch_kna1.
SELECT kunnr land1 name1 ort01
FROM kna1
INTO TABLE it_kna1
WHERE kunnr IN s_kunnr.
ENDFORM. "datafetch
*& Form LAYOUT
text
FORM layout.
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
ENDFORM. "LAYOUT
*& Form display
text
FORM display.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET =
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
is_layout = wa_layout
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = it_event
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
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_kna1
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
*& Form GRID
text
--> p1 text
<-- p2 text
FORM grid .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_TITLE_KNA1
I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = it_event
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_kna1
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. "GRID
*& Form EVENT
text
--> p1 text
<-- p2 text
FORM event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_event
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. " EVENT
*& Form eventpopulate
text
--> p1 text
<-- p2 text
FORM eventpopulate .
READ TABLE it_event INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
MODIFY it_event FROM wa_event TRANSPORTING form WHERE name = wa_event-name.
ENDIF.
READ TABLE it_event INTO wa_event WITH KEY name = 'END_OF_LIST'.
IF sy-subrc EQ 0.
wa_event-form = 'END_OF_LIST'.
MODIFY it_event FROM wa_event TRANSPORTING form WHERE name = wa_event-name.
ENDIF.
READ TABLE it_event INTO wa_event WITH KEY name = 'USER_COMMAND'.
IF sy-subrc EQ 0.
wa_event-form = 'USER_COMMAND'.
MODIFY it_event FROM wa_event TRANSPORTING form WHERE name = wa_event-name.
ENDIF.
ENDFORM. " eventpopulate
*& Form top-of-page
text
FORM top_of_page.
hline-typ = 'H'.
hline-info = 'Customer Details'.
APPEND hline TO it_listheader.
CLEAR hline.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader
i_logo = 'JELOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM =
REFRESH it_listheader.
ENDFORM. "top-of-page
*& Form END-OF-PAGE
text
FORM end_of_list.
WRITE:/ 'JAGADISH RAJ KUMAR'.
ENDFORM. "end-of-LIST
*& Form USER-COMMAND
text
-->V_UCOMM text
FORM USER_COMMAND
USING U_COMM TYPE SY-UCOMM
R_SELFIELD TYPE SLIS_SELFIELD.
SELECT kunnr vbeln erdat ernam
FROM vbak
INTO corresponding fields of TABLE it_vbak
WHERE kunnr = R_SELFIELD-value.
PERFORM fieldcat_vbak.
PERFORM display_vbak.
ENDFORM. "USER-COMMAND
*& Form FIELDCAT_VBAK
text
FORM fieldcat_vbak.
refresh it_fieldcat.
clear wa_fieldcat.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-seltext_l = 'SALES ORDER'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-outputlen = 10.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-key = 'X'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-col_pos = 1.
wa_fieldcat-emphasize = 'C11'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERDAT'.
wa_fieldcat-seltext_l = 'CREATED ON'.
wa_fieldcat-datatype = 'DATS'.
wa_fieldcat-outputlen = 12.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-col_pos = 3.
wa_fieldcat-emphasize = 'C51'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-seltext_l = 'CREATED BY'.
wa_fieldcat-datatype = 'CHAR'.
wa_fieldcat-outputlen = 15.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-col_pos = 2.
wa_fieldcat-emphasize = 'C61'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-cfieldname = 'NETWR'.
wa_fieldcat-seltext_l = 'NET VALUE'.
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-outputlen = 10.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-col_pos = 4.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "FIELDCAT_VBAK
*& Form DISPLAY_VBAK
text
--> p1 text
<-- p2 text
FORM display_vbak .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_TITLE_VBAK
I_GRID_SETTINGS =
IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = it_event
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_vbak
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_VBAK -
Set color alv output cell abap webdynpro
Hi Guys ,
i wanted to set the color of some cells in alv output to red in ABAP WebDynpro.
i am using the salv_wd_table.
any piece of code is appreciated.
thanks,
Bobby.Bobby,
If let's say you are build a ALV table to output 'SFLIGHT' table, and you want PLANETYPE '747-400' to be displayed in green, and PLANETYPE '146-200' displayed in red.
Also, let's just say, you already had a context node 'SFLIGHT_NODE' that is mapped to the external node 'DATA' of your ALV.
Now:
1. you need to modify the context node 'SFLIGHT_NODE' to add an attribute -- say 'CELL_COLOR' of type 'WDY_UIE_LIBRARY_ENUM_TYPE' -- to the SFLIGHT_NODE (note, you need to delete 'DICTIONARY structure' that is bind to the 'SFLIGHT_NODE' node, otherwise, you will not be able to create addition attributes)
After, you will have something like this for your context node .
CONTEXT
--> SFLIGHT_NODE
> CARRID
> CONNID
> FLDATE
> PRICE
> PLANETYPE
> <and any other attributes you had pulled from SFLIGHT)
> CELL_COLOR (TYPE WDY_UIE_LIBRARY_ENUM_TYPE)
2. In your supply function to the 'SFLIGHT_NODE', you now need to supply the data to this newly added attribute:
METHOD supply_sflight_node .
** data declaration
DATA:
itab_sflight_node TYPE if_componentcontroller=>elements_sflight_node,
stru_sflight_node LIKE LINE OF itab_sflight_node.
** read sflight data
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE itab_sflight_node.
** populate the 'CELL_COLOR' field
LOOP AT itab_sflight_node INTO stru_sflight_node .
IF stru_sflight_node-planetype = '747-400'.
stru_sflight_node-cell_color = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-GOODVALUE_DARK .
ELSEIF stru_sflight_node-planetype = '146-200'.
stru_sflight_node-cell_color = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-BADVALUE_DARK .
ELSE.
stru_sflight_node-cell_color = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-STANDARD .
ENDIF.
modify itab_sflight_node from stru_sflight_node.
ENDLOOP.
** bind all the elements
node->bind_table(
new_items = itab_sflight_node
set_initial_elements = abap_true ).
ENDMETHOD.
3. Now, you need to obtain the configuration model of the ALV and config it before display. (say you have an method does this 'init_alv_table_settings', and it is called from your view's wddoinit() method)
METHOD init_alv_table_settings .
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv_table( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_alv_table( ).
DATA:
node_sflight_node TYPE REF TO if_wd_context_node .
node_sflight_node = wd_context->get_child_node( name = if_flights_view=>wdctx_sflight_node ).
CALL METHOD l_ref_interfacecontroller->set_data
EXPORTING
r_node_data = node_sflight_node.
** get ConfigurationModel from ALV Component
DATA: lr_table TYPE REF TO cl_salv_wd_config_table.
lr_table = l_ref_interfacecontroller->get_model( ).
** change the color of the cell
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
DATA: lr_column TYPE REF TO cl_salv_wd_column.
lr_column_settings ?= lr_table.
lr_column = lr_column_settings->get_column( 'PLANETYPE' ).
DATA: lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'PLANETYPE'.
lr_column->set_cell_editor( lr_input_field ).
lr_column->set_cell_design_fieldname( value = 'CELL_COLOR' ).
ENDMETHOD.
Compile and activate your code.
Regards,
Tina Yang
Message was edited by: Tina Yang -
Displaying alv output into excel with delimeter
Hai,
am downloading alv output to excel :
1. in that output one field is long text field with # delimeter at the end of sting .
while exporting this outout to excel it is not showing # and one empty column is adding after that field.Hi Satya,
Can you try out this piece of code below. It creates a demo Internal table to store some string with '#' as the final delimiter.
TYPES : BEGIN OF l_ty_demo,
data TYPE string,
END OF l_ty_demo.
DATA : l_i_demo TYPE STANDARD TABLE OF l_ty_demo.
DATA : l_wa_demo TYPE l_ty_demo.
DATA : l_v_i TYPE sy-tabix.
INCLUDE ole2incl.
* handles for OLE objects
DATA: h_excel TYPE ole2_object, " Excel object
h_mapl TYPE ole2_object, " list of workbooks
h_map TYPE ole2_object, " workbook
h_zl TYPE ole2_object, " cell
h_f TYPE ole2_object. " font
TABLES: spfli.
DATA h TYPE i.
WHILE l_v_i < 10.
l_wa_demo-data = 'Welcome to the world of computers#'.
APPEND l_wa_demo TO l_i_demo.
l_v_i = l_v_i + 1.
ENDWHILE.
* start Excel
CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
PERFORM err_hdl.
SET PROPERTY OF h_excel 'Visible' = 1.
PERFORM err_hdl.
* get list of workbooks, initially empty
CALL METHOD OF h_excel 'Workbooks' = h_mapl.
PERFORM err_hdl.
* add a new workbook
CALL METHOD OF h_mapl 'Add' = h_map.
PERFORM err_hdl.
LOOP AT l_i_demo INTO l_wa_demo.
h = sy-tabix + 1.
PERFORM fill_cell USING h 1 0 l_wa_demo-data.
ENDLOOP.
*& Form FILL_CELL
* text
* -->I text
* -->J text
* -->BOLD text
* -->VAL text
FORM fill_cell USING i j bold val.
CALL METHOD OF h_excel 'Cells' = h_zl EXPORTING #1 = i #2 = j.
PERFORM err_hdl.
SET PROPERTY OF h_zl 'Value' = val .
PERFORM err_hdl.
GET PROPERTY OF h_zl 'Font' = h_f.
PERFORM err_hdl.
SET PROPERTY OF h_f 'Bold' = bold .
PERFORM err_hdl.
ENDFORM. "FILL_CELL
*& Form ERR_HDL
* text
FORM err_hdl.
IF sy-subrc <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
STOP.
ENDIF.
ENDFORM. "ERR_HDL
Please refer to the following Demo ABAP Code for a complete reference.
RSDEMO01.
Hope this helps.
Thanks,
Samantak.
Maybe you are looking for
-
How can I use my Apple ID for my iCloud ID?
I can't set up iCloud as Apple will not accept my Apple ID which I have been using since the beginning of time. I keep getting sent in a loop. Every time I so to set up the account it rejects my password. I have Windows 7
-
MOVED: Sos Voltage Settings on MSI 785GM-E65 Help Help SOS
This topic has been moved to Overclockers & Modding Corner. https://forum-en.msi.com/index.php?topic=136226.0
-
Received the New Nano and Applecare
I am wondering how to register the Applecare for the new iPod Nano 6 gen. I just received. Also, should I register the Nano for the complimentary warranty or just register the Applecare. Do I need to register the Nano as a product first? Would it be
-
Debit memo and Invoice reference
Hi dear all, Please help me with the following situation. I am creating a billing document - Debit memo- with reference to an other docuemnt - Invoice. However, in the accounting document the nvoice reference is not filled and all the data are not co
-
IMac not COMPLETELY powering down...
Morning all... I upgraded my 24" iMac (bought Jan 2007) to Leopard on Saturday, and apart from a few minor software funnies, it seemed to go OK. I just upgraded - not archive and install or anything complicated like that. The problem I now have is th