ALV to another Drilldown ALV...???
Hi..
I have a requirement in which i have to create an ALV report.
Now if any particular cell is selected.... for example... Sales Organization cell is selected...
Then what i need to do is to show another ALV report as a drilldown with that sales organization only and other related data..for that sales organization only from the first report ....
So.. i have to capture.. the field.. ie.. whether the field is sales organization or sales office or.. something else etc..and then the value of that field..and then..generate another drill down alv..
How do i do.. this... can anyone give a sample report to achieve this...
I have done the first part ie the first ALV part is done.. but second part i am confused..
Regards,
Subash
hi,
use this code .
REPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
MESSAGE-ID ZZ_9838 .
TYPE-POOLS: SLIS.
*type declaration for values from ekko
TYPES: BEGIN OF I_EKKO,
EBELN LIKE EKKO-EBELN,
AEDAT LIKE EKKO-AEDAT,
BUKRS LIKE EKKO-BUKRS,
BSART LIKE EKKO-BSART,
LIFNR LIKE EKKO-LIFNR,
END OF I_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
WA_EKKO TYPE I_EKKO.
*type declaration for values from ekpo
TYPES: BEGIN OF I_EKPO,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
MENGE LIKE EKPO-MENGE,
MEINS LIKE EKPO-MEINS,
NETPR LIKE EKPO-NETPR,
END OF I_EKPO.
DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
WA_EKPO TYPE I_EKPO .
*variable for Report ID
DATA: V_REPID LIKE SY-REPID .
*declaration for fieldcatalog
DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
declaration for events table where user comand or set PF status will
be defined
DATA: V_EVENTS TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT.
declartion for layout
DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
declaration for variant(type of display we want)
DATA: I_VARIANT TYPE DISVARIANT,
I_VARIANT1 TYPE DISVARIANT,
I_SAVE(1) TYPE C.
*PARAMETERS : p_var TYPE disvariant-variant.
*Title displayed when the alv list is displayed
DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
INITIALIZATION.
V_REPID = SY-REPID.
PERFORM BUILD_FIELDCATLOG.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_REPORT.
*& Form BUILD_FIELDCATLOG
Fieldcatalog has all the field details from ekko
FORM BUILD_FIELDCATLOG.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SELTEXT_M = 'DATE.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'BUKRS'.
WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKKO'.
WA_FIELDCAT-FIELDNAME = 'LIFNR'.
WA_FIELDCAT-NO_OUT = 'X'.
WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG
*& Form EVENT_CALL
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "EVENT_CALL
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form data_retrieval
retreiving values from the database table ekko
FORM DATA_RETRIEVAL.
SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
ENDFORM. "data_retrieval
*& Form bUild_listheader
text
-->I_LISTHEADEtext
FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA HLINE TYPE SLIS_LISTHEADER.
HLINE-INFO = 'this is my first alv pgm'.
HLINE-TYP = 'H'.
ENDFORM. "build_listheader
*& Form display_alv_report
text
FORM DISPLAY_ALV_REPORT.
V_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = I_TITLE_EKKO
I_GRID_SETTINGS =
IS_LAYOUT = ALV_LAYOUT
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKKO
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_alv_report
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
PERFORM BUILD_FIELDCATLOG_EKPO.
PERFORM EVENT_CALL_EKPO.
PERFORM POPULATE_EVENT_EKPO.
PERFORM DATA_RETRIEVAL_EKPO.
PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
PERFORM DISPLAY_ALV_EKPO.
ENDCASE.
ENDFORM. "user_command
*& Form BUILD_FIELDCATLOG_EKPO
text
FORM BUILD_FIELDCATLOG_EKPO.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_EKPO'.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SELTEXT_M = 'UOM'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'I_EKPO'.
WA_FIELDCAT-FIELDNAME = 'NETPR'.
WA_FIELDCAT-SELTEXT_M = 'PRICE'.
APPEND WA_FIELDCAT TO I_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. "BUILD_FIELDCATLOG_EKPO
*& Form event_call_ekpo
we get all events - TOP OF PAGE or USER COMMAND in table v_events
FORM EVENT_CALL_EKPO.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "event_call_ekpo
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
FORM POPULATE_EVENT_EKPO.
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-FORM.
ENDIF.
ENDFORM. "POPULATE_EVENT
*& Form TOP_OF_PAGE
text
FORM F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo =
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
*& Form USER_COMMAND
text
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
*retreiving values from the database table ekko
FORM DATA_RETRIEVAL_EKPO.
SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
ENDFORM.
FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: HLINE1 TYPE SLIS_LISTHEADER.
HLINE1-TYP = 'H'.
HLINE1-INFO = 'CHECKING PGM'.
ENDFORM.
FORM DISPLAY_ALV_EKPO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'F_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_EKPO
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = I_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT =
I_SAVE = 'A'
IS_VARIANT =
IT_EVENTS = V_EVENTS
TABLES
T_OUTTAB = IT_EKPO
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.
Similar Messages
-
Seperate ALV Properties in Blocked ALV
Hi All,
I have created a blocked ALV. The standard ALV functionalities like Sort ,Filter etc is working only for the first list.
Is there any techniques to give seperate functionalities for each list?
Iam using reuse_alv_grid_display .
and LAYOUT-LIST_APPEND to show the blocked ALV.
thanks and regards,
Subeesh KannottilHi Yawa Ding,
I have 3 lists .The standard ALV unctionality works only for the first list.
I want all these properties to be applied to all lists
Thanks and Regards,
Subeesh Kannottil -
What is the difference b/w ALV Function Module and ALV Methods?
Hello Friends,
Can anybody help me in finding out the difference between ALV Function Modules and ALV methods?
Thanks & Regards
Sathish KumarHi Sathish,
Plz go through this info. It is very useful.
hi,
chk these excellent links.
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
OOPs:
Check this for basic concepts of OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
Tabstrip
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
Rewords some points if it is helpful.
Rgds,
P.Naganjana Reddy -
Hi all,
Please let me know the advantages and disadvantages of ALV control over Classical ALV.
Thanks & regards,
Naresh.ALV LIST Can be coded using only FMs
ALV control Can be coded using FMs and object oriented concepts
ALV LIST Can be displayed hieraicharlly
ALV GRID cannot be displayed hierarichally
Alv grid (using oo concept) requires
designing the screen layout .
Hence, in one screen, we can show more
then one alv grid
(we cannot show more than
one alv list on one screen)
ALV LIST is Display Only.
Whereas
ALV Grid Can Be made EDITABLE for entry purpose. -
Move data from alv to another perform
i have an alv, and i make 1 field etidable ( fieldcatalog-edit = 'X'.)
my qa: when i change the field i want to pass it to another itab how???Hi,
Look at this sample code -:D It uses OO ALV.
code
*& Report Z_DUMMY_ATG
REPORT Z_DUMMY_ATG NO STANDARD PAGE HEADING.
TABLES: SPFLI.
*============================================================
Variables
*============================================================
DATA: OK_CODE TYPE SY-UCOMM,
L_MODE TYPE RAW4,
W_TABIX TYPE SY-TABIX.
*============================================================
Tablas internas
*============================================================
DATA: L_S_LAYO TYPE LVC_S_LAYO.
DATA: WA_EDIT TYPE LVC_T_STYL WITH HEADER LINE.
DATA: IT_EDIT TYPE LVC_T_STYL WITH HEADER LINE.
DATA: BEGIN OF G_WA_SFLIGHT.
INCLUDE STRUCTURE SPFLI.
DATA: CELL_TAB TYPE LVC_T_STYL.
DATA: END OF G_WA_SFLIGHT.
TYPES: BEGIN OF SPFLI_TAB.
INCLUDE STRUCTURE SPFLI.
TYPES: CELL_TAB TYPE LVC_T_STYL.
TYPES: END OF SPFLI_TAB.
TYPES: SPFLI_TABS TYPE STANDARD TABLE OF SPFLI_TAB.
DATA: GI_SFLIGHT TYPE SPFLI_TABS.
DATA: BEGIN OF AUX_TAB OCCURS 0,
CARRID LIKE SPFLI-CARRID,
CONNID LIKE SPFLI-CONNID,
CITYFROM LIKE SPFLI-CITYFROM,
AIRPFROM LIKE SPFLI-AIRPFROM,
CITYTO LIKE SPFLI-CITYTO,
AIRPTO LIKE SPFLI-AIRPTO,
END OF AUX_TAB.
DATA: SPFLI_TAB_WA LIKE G_WA_SFLIGHT.
FIELD-SYMBOLS: SET_TABLE_FOR_FIRST_DISPLAY(
EXPORTING I_STRUCTURE_NAME = 'SPFLI'
IS_LAYOUT = L_S_LAYO
CHANGING IT_OUTTAB = GI_SFLIGHT ).
*============================================================
Dynpro
*============================================================
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '100'.
ENDMODULE.
*& Module USER_COMMAND_0100 INPUT
MODULE USER_COMMAND_0100 INPUT.
OK_CODE = SY-UCOMM.
IF OK_CODE = 'BACK'.
SET SCREEN 0.
LEAVE SCREEN.
CLEAR OK_CODE.
ENDIF.
ENDMODULE.
/code
Greetings,
Raj. -
Callinfg ALV from another component
Hi all,
We have a main component in which on press of a button we need to show alv which is in another component.
I am trying to follow these steps but i need your inputs
1. I have declared the component which calls alv in used components
2. In the main view of my component i have placed a VCU
3. In the window of the main component i have embedded that VCU and embedded the view of the component which calls the alv.
Now how can i call alv on press of that button ?
Please let me know your suggestions
Regards
BhanuHi,
Aditya has the right idea in my opinion. I always do things this way (altering visibility) because 1. it's easiest and 2. you don't have initializing problems. Here's how you can do it:
First of all, set your ViewContainer invisible in design time.
1. Go to the Component controller of your main component (where your ViewContainer is in), go to attributes
2. Add an attribute Z_GO_VIEW, Public, Type ref to, IF_WD_VIEW.
3. Go to your View of the CC where the VC actually is in.
4. Go to hook method WDDOMODIFYVIEW
5. Add the following code:
IF first_time = abap_true.
wd_comp_controller->z_go_view = view.
ENDIF.
--> now you have the instance of your view interface.
6. Make a button
7. In the event handler method of the button, code something alike to this:
DATA:
lo_el_ui_root TYPE REF TO cl_wd_uielement_container,
lo_el_trans_cont1 TYPE REF TO cl_wd_uielement_container,
lo_el_button1 TYPE REF TO cl_wd_button.
DATA: lv_visibility TYPE WDUI_VISIBILITY.
lo_el_ui_root ?= wd_comp_controller->z_go_view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lo_el_trans_cont1 ?= lo_el_ui_root->get_child( ID = 'TC_ONE' ).
lo_el_button1 ?= lo_el_trans_cont1->get_child( ID = 'I_AM_THE_MIGHTY_BUTTON' ).
lv_visibility = '02'.
lo_el_button1->set_visible( value = lv_visibility ).
This isn't exactly what you'll need but you get the picture: Get the View Instance, Downcast the UI tree for the Element you want to dynamically alter, use the right method for alterations.
This should solve your problem. If it doesn't, ask us again
regards, Lukas -
How to fetch data from ALV to another Selection Screen
hi...
i need to export the two fields that is VBELN and POSNR to some other selection screen of a transaction which is triggered by pressing a button on ALV...
Could u please let me know ki how can i transport these two fields to the screen of that transaction which is 'MASS ORDER CHANGE' transaction...
Regards:
Gaurav Aroratry this program:
IF NOT p_vbeln IS INITIAL.
PERFORM set_data USING 'P_VBELN' p_vbeln '' 'S' 'I' 'EQ'.
ENDIF.
<b> SUBMIT zprogram
USING SELECTION-SET xvar
* xvar is variant name in program zprogram
WITH SELECTION-TABLE seltab
AND RETURN.</b>
FORM set_data USING pr_selname
pr_value_low
pr_value_high
pr_kind
pr_sign
pr_option.
CLEAR seltab_wa.
MOVE: pr_selname TO seltab_wa-selname,
pr_kind TO seltab_wa-kind,
pr_sign TO seltab_wa-sign,
pr_option TO seltab_wa-option.
IF NOT pr_value_low IS INITIAL.
MOVE pr_value_low TO seltab_wa-low.
ENDIF.
IF NOT pr_value_high IS INITIAL.
MOVE pr_value_high TO seltab_wa-high.
ENDIF.
APPEND seltab_wa TO seltab.
ENDFORM. "set_data -
Drilldown + ALV + List
hi,
iam working on ALV. could any body send an example on <b>drill down to use ALV with lists</b>. any documents on that.
urgent.
chanduhi please check the code below, copy paste and run it, thiw will run both for Grid And List Display
Drill down in ALV
PLease note the code marked in BOLD
REPORT Z_50657_ALV_EX5 NO STANDARD PAGE HEADING
LINE-COUNT 65(3)
LINE-SIZE 220
MESSAGE-ID ZZ.
Type Pools *
TYPE-POOLS: SLIS, ICON.
Tables *
TABLES : VBRK, "Billing Master table
VBRP. "Billing Item table
VARIABLES DECLARATION *
DATA: STR_DATE LIKE SY-DATUM.
DATA: X_FIELDCAT_VBRK TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT_VBRK TYPE SLIS_T_FIELDCAT_ALV.
DATA: X_FIELDCAT_VBRP TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT_VBRP TYPE SLIS_T_FIELDCAT_ALV.
DATA: L_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA: CUR_VBELN(15), CUR_VBELN_VALUE(15).
DATA: TEMP_VBELN(10).
DATA: CTAB LIKE SY-TABIX.
Internal Tables *
Internal table to hold data from VBRK
DATA: BEGIN OF IT_VBRK OCCURS 0,
VBELN LIKE VBRK-VBELN,
WAERK LIKE VBRK-WAERK,
VKORG LIKE VBRK-VKORG,
FKDAT LIKE VBRK-FKDAT,
BUKRS LIKE VBRK-BUKRS,
BUTXT LIKE T001-BUTXT,
CHECK(1) TYPE C,
END OF IT_VBRK.
Internal table to hold data from VBRP
DATA: BEGIN OF IT_VBRP OCCURS 0,
VBELN LIKE VBRP-VBELN,
POSNR LIKE VBRP-POSNR,
FKIMG LIKE VBRP-FKIMG,
VRKME LIKE VBRP-VRKME,
NETWR LIKE VBRP-NETWR,
MATNR LIKE VBRP-MATNR,
ARKTX LIKE VBRP-ARKTX,
END OF IT_VBRP.
DATA: BEGIN OF IT_T001 OCCURS 0,
BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
END OF IT_T001.
Selection-Screen *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN,
S_FKDAT FOR VBRK-FKDAT,
S_MATNR FOR VBRP-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
PARAMETERS : LIST RADIOBUTTON GROUP G1,
GRID RADIOBUTTON GROUP G1 DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK B2.
INITIALIZATION ********************
INITIALIZATION.
STR_DATE = SY-DATUM - 200.
S_FKDAT-LOW = STR_DATE.
S_FKDAT-HIGH = SY-DATUM.
S_FKDAT-SIGN = 'I'.
APPEND S_FKDAT.
At Selection-Screen Output *
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN.
IF SCREEN-NAME = 'S_FKDAT-HIGH'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
At Selection-Screen *
AT SELECTION-SCREEN.
PERFORM VALIDATION.
Start of Selection *
START-OF-SELECTION.
*POPULATION OF DATA INTO INTERNAL TABLE IT_VBRK AND IT_VBRP
PERFORM GET_DATA_VBRK.
PERFORM FIELDCATALOG_CHANGE.
*ALV GRID/LIST DISPLAY
PERFORM FIRST_SCREEN_DISPLAY.
*& Form VALIDATION
text
FORM VALIDATION.
IF S_VBELN[] IS NOT INITIAL.
SELECT SINGLE VBELN
FROM VBRK
INTO VBRK-VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE A000 WITH 'PLEASE ENTER CORRECT BILLING DOCUMENT'.
STOP.
ENDIF.
ENDIF.
IF S_FKDAT[] IS INITIAL.
MESSAGE I000 WITH 'PLEASE ENTER ALL THE MANDATORY FIELDS'.
STOP.
ENDIF.
IF S_MATNR[] IS NOT INITIAL.
SELECT SINGLE MATNR
FROM MARA
INTO VBRP-MATNR
WHERE MATNR IN S_MATNR.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'PLEASE ENTER CORRECT MATERIAL NUMBER'.
STOP.
ENDIF.
ENDIF.
ENDFORM. "VALIDATION
*& Form GET_DATA_VBRK
text
FORM GET_DATA_VBRK.
SELECT VBELN
WAERK
VKORG
FKDAT
BUKRS
FROM VBRK INTO TABLE IT_VBRK
WHERE VBELN IN S_VBELN
AND FKDAT IN S_FKDAT.
SORT IT_VBRK BY VBELN BUKRS.
SELECT BUKRS
BUTXT
FROM T001 INTO TABLE IT_T001
FOR ALL ENTRIES IN IT_VBRK
WHERE BUKRS = IT_VBRK-BUKRS.
LOOP AT IT_VBRK.
CTAB = SY-TABIX.
LOOP AT IT_T001 WHERE BUKRS = IT_VBRK-BUKRS.
IF SY-SUBRC = 0.
IT_VBRK-BUTXT = IT_T001-BUTXT.
MODIFY IT_VBRK INDEX CTAB.
CLEAR CTAB.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. "GET_DATA
*& Form FIELDCATALOG_CHANGE
text
FORM FIELDCATALOG_CHANGE.
*Layout Change
L_LAYOUT-ZEBRA = 'X'.
L_LAYOUT-BOX_FIELDNAME = 'CHECK'.
*Define seperate Color for the fields
X_FIELDCAT_VBRK-COL_POS = 1.
X_FIELDCAT_VBRK-FIELDNAME = 'CHECK'.
X_FIELDCAT_VBRK-SELTEXT_M = 'chek'.
X_FIELDCAT_VBRK-CHECKBOX = 'X'.
X_FIELDCAT_VBRK-INPUT = 'X'.
X_FIELDCAT_VBRK-EDIT = 'X'.
APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.
CLEAR X_FIELDCAT_VBRK.
X_FIELDCAT_VBRK-COL_POS = 2.
X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.
X_FIELDCAT_VBRK-FIELDNAME = 'VBELN'.
X_FIELDCAT_VBRK-EMPHASIZE = 'C301'.
X_FIELDCAT_VBRK-OUTPUTLEN = 15.
APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.
CLEAR X_FIELDCAT_VBRK.
X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.
X_FIELDCAT_VBRK-FIELDNAME = 'WAERK'.
X_FIELDCAT_VBRK-EMPHASIZE = 'C201'.
X_FIELDCAT_VBRK-OUTPUTLEN = 15.
APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.
CLEAR X_FIELDCAT_VBRK.
X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.
X_FIELDCAT_VBRK-FIELDNAME = 'VKORG'.
X_FIELDCAT_VBRK-EMPHASIZE = 'C300'.
X_FIELDCAT_VBRK-OUTPUTLEN = 15.
APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.
CLEAR X_FIELDCAT_VBRK.
X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.
X_FIELDCAT_VBRK-FIELDNAME = 'FKDAT'.
X_FIELDCAT_VBRK-EMPHASIZE = 'C600'.
X_FIELDCAT_VBRK-OUTPUTLEN = 15.
APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.
CLEAR X_FIELDCAT_VBRK.
X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.
X_FIELDCAT_VBRK-FIELDNAME = 'BUKRS'.
X_FIELDCAT_VBRK-EMPHASIZE = 'C400'.
X_FIELDCAT_VBRK-OUTPUTLEN = 15.
APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.
CLEAR X_FIELDCAT_VBRK.
X_FIELDCAT_VBRK-TABNAME = 'IT_VBRK'.
X_FIELDCAT_VBRK-FIELDNAME = 'BUTXT'.
X_FIELDCAT_VBRK-EMPHASIZE = 'C500'.
X_FIELDCAT_VBRK-OUTPUTLEN = 15.
APPEND X_FIELDCAT_VBRK TO IT_FIELDCAT_VBRK.
CLEAR X_FIELDCAT_VBRK.
ENDFORM. "FIELDCATALOG_CHANGE
*& Form FIRST_SCREEN_DISPLAY
text
FORM FIRST_SCREEN_DISPLAY.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBRK'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT_VBRK
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.
CHECK RADIO BUTTON SELECTION AND ACCORDINGLY DISPLAY LIST OR GRID ALV
IF LIST = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT_VBRK
IT_EVENTS =
TABLES
T_OUTTAB = IT_VBRK
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.
CLEAR LIST.
ENDIF.
IF GRID = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT_VBRK
IT_EVENTS =
TABLES
T_OUTTAB = IT_VBRK
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.
CLEAR GRID.
ENDIF.
ENDFORM. "FIRST_SCREEN_DISPLAY
*& Form STATUS
text
-->P_EXTAB text
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.
ENDFORM. "STATUS
<b>&----
*& Form USER_COMMAND
text
-->R_UCOMM text
-->RS_SELFIELD text
----</b>
<b>FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'BACK' OR 'CANC' OR 'EXIT'.
LEAVE TO SCREEN 0.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'VBELN'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = RS_SELFIELD-VALUE
IMPORTING
OUTPUT = TEMP_VBELN.
TEMP_VBELN = RS_SELFIELD-VALUE.
PERFORM GET_DATA_VBRP.
PERFORM GET_SECOND_SCREEN_DISPLAY.
ENDIF.
ENDCASE.
ENDFORM. "USER_COMMAND</b>
*& Form GET_DATA_VBRP
text
FORM GET_DATA_VBRP.
SELECT VBELN
POSNR
FKIMG
VRKME
NETWR
MATNR
ARKTX
FROM VBRP INTO TABLE IT_VBRP
WHERE VBELN = TEMP_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH ' NO BILLING DETAILS FOUND'.
EXIT.
ELSE.
MESSAGE S000 WITH 'SUCCESSFUL'.
ENDIF.
ENDFORM. "GET_DATA_VBRP
<b>&----
*& Form GET_SECOND_SCREEN_DISPLAY
text
FORM GET_SECOND_SCREEN_DISPLAY.</b>
FIELDCATALOG CALL
<b> X_FIELDCAT_VBRP-TABNAME = 'IT_VBRP'.
X_FIELDCAT_VBRP-FIELDNAME = 'VRKME'.
X_FIELDCAT_VBRP-EMPHASIZE = 'C500'.
X_FIELDCAT_VBRP-OUTPUTLEN = 10.
APPEND X_FIELDCAT_VBRP TO IT_FIELDCAT_VBRP.
CLEAR X_FIELDCAT_VBRP.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBRP'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FIELDCAT_VBRP
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.
CHECK RADIO BUTTON SELECTION AND ACCORDINGLY DISPLAY LIST OR GRID ALV
IF LIST = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT_VBRP
I_SCREEN_START_COLUMN = 1
I_SCREEN_START_LINE = 1
I_SCREEN_END_COLUMN = 100
I_SCREEN_END_LINE = 10
IT_EVENTS =
TABLES
T_OUTTAB = IT_VBRP
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.</b>
IF GRID = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = L_LAYOUT
IT_FIELDCAT = IT_FIELDCAT_VBRP
I_SCREEN_START_COLUMN = 1
I_SCREEN_START_LINE = 1
I_SCREEN_END_COLUMN = 100
I_SCREEN_END_LINE = 10
IT_EVENTS =
TABLES
T_OUTTAB = IT_VBRP
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. "GET_SECOND_SCREEN_DISPLAY -
Hello Folks,
I have an ALV table view, after selecting any line item in the view i have button "DETAIL" which would pop up another view with the details in ALV view again.
I have done the below steps but iam unable to get the alv pop-up with details. I would really appreciate if anyone can help me with this.
My main view <i>V_OVERVIEW</i> is the initial Table view and i have created another View <i>V_POPUP</i> which just has a Viewcontainer. <i>V_OVERVIEW</i> is embeded in window <i>W_MAIN</i> and <i>V_POPUP</i> is embeded in <i>W_POPUP</i>.
The view V_POPUP has the following code in its MODIFYVIEW method.
DATA:node_wage TYPE REF TO if_wd_context_node,
node_detail type ref to if_wd_context_node,
lt_sltd_elmnts TYPE wdr_context_element_set,
lr_element TYPE REF TO if_wd_context_element,
wa_detail TYPE if_v_pop_up=>element_wage_benefit,
it_detail TYPE if_v_pop_up=>elements_wage_benefit.
data : lt_ssn type table of ZUT_XFERRED_SSN,
lt_return type table of bapiret2.
node_wage = wd_context->get_child_node( 'WAGE_BENEFIT' ).
lt_sltd_elmnts = node_wage->get_selected_elements( abap_true ).
lr_element->get_static_attributes(
IMPORTING static_attributes = wa_detail ).
CALL FUNCTION 'ZZ_GET_DETAIL'
EXPORTING
i_ob_key = objectkey
i_quarter = -quarter
TABLES
T_DTL = lt_dtl
T_RETURN = lt_return.
navigate from <CONTEXT> to <TP_RATES> via lead selection
node_detail = wd_context->get_child_node( name =
ig_componentcontroller=>wdctx_ssn_details ).
node_detail->bind_elements( new_items = lt_dtl ).
The main View V_OVERVIEW has the button "DETAIL" which calls the window W_POPUP to show view V_POPUP embeded in it as a popup, here is the code in the Button handler
DATA:
l_api_main TYPE REF TO if_wd_view_controller,
l_window_manager TYPE REF TO if_wd_window_manager,
l_popup TYPE REF TO if_wd_window,
l_cmp_api TYPE REF TO if_wd_component.
* Pop to confirm
CLEAR : l_api_main, l_cmp_api,
l_window_manager, l_popup.
l_api_main = wd_this->wd_get_api( ).
l_cmp_api = wd_comp_controller->wd_get_api( ).
l_window_manager = l_cmp_api->get_window_manager( ).
l_popup = l_window_manager->CREATE_WINDOW(
WINDOW_NAME = 'W_POP_UP'
TITLE = 'Details' ).
l_popup->open( ).hey folks nevermind i got it.
Thanks -
Switching between Hierarchical ALV and List/Grid ALV
Hello!
I was checking out the List of GR/IR Balances report (tcode MB5S), which uses Hierarchical ALV. I noticed that there's a button in the output toolbar that enables you to switch from Hierarchical ALV to Grid ALV. Is there a specific setting in the ALV that you need to define in order to use this feature?
Thanks in advance.Hi,
there is no need of any specific settings.
those properties will came when u use the related function module.all the code for this will exist in the function module u r using for creating the hierarchial display.
regards,
bharat. -
Page-break in alv background job for alv output variant not coming correctl
Hi,
I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1. I have already build the sort criteria and using:
gs_sort-group = '* '. "New-Page
Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
Regards,
RakeshHello Everyone,
I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
gs_sort-group = '* '. "New-Page
If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
*C-- Process separately for jobs running in Background. Actually
*C-- sortcat-group solves the problem only in Foreground. In background
*C-- when ALV layout variant is not selected then it works otherwise it
*C-- fails. So for background jobs we are reading the fieldcat and then
*C-- passing the same in the display FM.
IF sy-batch = 'X'.
CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
EXPORTING
i_dialog = ' '
i_user_specific = ' '
i_default = ' '
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
it_default_fieldcat = gt_fieldcat
i_layout = gs_layout
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
IMPORTING
* E_EXIT =
et_fieldcat = lt_fieldcat
* et_sort = gt_sort[]
* ET_FILTER =
* es_layout = gs_layout
CHANGING
cs_variant = gs_disvariant
EXCEPTIONS
wrong_input = 1
fc_not_complete = 2
not_found = 3
program_error = 4
OTHERS = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR gs_fieldcat.
LOOP AT gt_fieldcat INTO gs_fieldcat.
*C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
CLEAR ls_fieldcat.
READ TABLE lt_fieldcat
INTO ls_fieldcat
WITH KEY fieldname = gs_fieldcat-fieldname.
IF sy-subrc = 0.
gs_fieldcat-row_pos = ls_fieldcat-row_pos.
gs_fieldcat-col_pos = ls_fieldcat-col_pos.
gs_fieldcat-no_out = ls_fieldcat-no_out.
MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
CLEAR gs_fieldcat.
ENDIF.
ENDLOOP.
*C-- Clear the disvariant for the background job as it contains the ALV
*C-- layout varinat
CLEAR gs_disvariant.
gs_disvariant-report = 'ZGPPMP0001'.
Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
I was getting ABAP runtime errors MESSAGE_TYPE_X in the following part of the standard code.
000310 LOOP AT CT_SORT INTO LS_SORT.
000320
000330 READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
000340 WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
000350 IF SY-SUBRC NE 0.
> MESSAGE X000(0K).
000370 ENDIF.
000380
000390 LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons. -
Different between coding of simple ALV report and interactive ALV report
Hi
Please some one tell me the difference (extra coding) for interactive ALV report.
I know how to design simple ALV report but i dont know what extra I hace to code for interactive ALV report.
Thanks in advance.View at se38, ALV grid demos, search BCALGRID
-
Scroll text in ALV column using OO ALV grid
Hi All,
I have displayed ALV grid on the screen which has four columns. One of the columns is a text field with text255 domain. This Column is also editable. I have following problem and need help;
The column for some reason displays only 130 chars. I tried to set the output length in field cat to 255 still no difference. My custom container width is equivalent to max screen width of 255.
I also tried to crunch the other three columns to display as much characters as needed so that I am left with enough space for the last column which is comments but still it displays on 130 characters. And thoughts on why this is happening.
Thanks,
YogeetaHi,
The ALV will only let you show 130 characters. You could use 2 columns to display the text.
Martin -
Toolbar in alv display using oops alv
i have written code for displaying toolbar in alv display using oops, but it is not displaying please find the below code and let me know reason.
*& Report ZTRANSFER_ORDER2 *
REPORT ZTRANSFER_ORDER2 .
*& Report ZTRANSFER_ORDER *
TABLES:sflight.
TYPE-POOLS : icon.
* G L O B A L I N T E R N A L T A B L E S
CLASS lcl_event_receiver DEFINITION DEFERRED.
types : begin of ty_mara,
matnr type matnr,
mtart type mtart,
mbrsh type mbrsh,
matkl type matkl,
bismt type bismt,
meins type meins,
end of ty_mara.
DATA: t_mara type STANDARD TABLE OF ty_mara.
* G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
g_wa_mara type ty_mara.
DATA : t_fcat type LVC_T_FCAT.
DATA : l_VAR TYPE disvariant.
DATA : gs_layout type lvc_s_layo.
* Declare reference variables to the ALV grid and the container
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
data : it_toolbar TYPE stb_button,
event_receiver TYPE REF TO lcl_event_receiver.
* S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
CALL SCREEN 100 .
*CLASS lcl_event_receiver DEFINITION.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
*handling toolbar for interactive
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
*handling menu button
handle_menu_button
FOR EVENT menu_button OF cl_gui_alv_grid
IMPORTING e_object e_ucomm,
*On click of the menu button
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
handle toolbar
CLEAR it_toolbar.
MOVE 'DETAIL' TO it_toolbar-function.
MOVE icon_detail TO it_toolbar-icon.
MOVE 2 TO it_toolbar-butn_type.
APPEND it_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_menu_button.
handle own menubuttons
IF e_ucomm = 'DETAIL'.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'DISPLAY'
text = 'DISPLAY'.
ENDIF.
ENDMETHOD. "handle_menu_button
METHOD handle_user_command.
*On click
CASE e_ucomm.
WHEN 'DISPLAY'.
MESSAGE 'Menu Clicked' TYPE 'I'.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
sET PF-STATUS 'STATUS'.
Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form load_data_into_grid
FORM load_data_into_grid.
Read data from table SFLIGHT
SELECT matnr mtart mbrsh matkl bismt meins
FROM mara
INTO corresponding fields of TABLE t_mara.
PERFORM fld_cate changing T_fcat.
l_var-report = sy-repid.
gs_layout-grid_title = 'Analysis Report'.
gs_layout-NO_TOOLBAR = 'X'.
gs_layout-BOX_FNAME = 'Selection'.
Load data into the grid and display them
caLL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'S_MVKE'
i_save = 'A'
is_variant = l_var
is_layout = gs_layout
CHANGING
it_outtab = t_mara[]
it_fieldcatalog = t_fcat.
endform.
*& Module pai INPUT
text
MODULE pai INPUT.
data: l_valid type c.
clear ok_code.
break-point.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
call method go_grid->check_changed_data
importing
e_valid = l_valid.
loop at t_mara into g_wa_mara.
endloop.
ENDCASE.
ENDMODULE. " pai INPUT
*& Form fld_cate
text
<--P_T_FCAT text
FORM fld_cate CHANGING P_T_FCAT TYPE lvc_t_fcat.
DATA : s_fcat type LVC_S_FCAT .
REFRESH: t_fcat.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX1'.
s_fcat-coltext = 'Box1'.
s_fcat-seltext = 'Box1'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 1.
s_fcat-col_pos = 1.
s_fcat-fieldname = 'MATNR'.
s_fcat-ref_field = 'MATNR'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material'.
s_fcat-seltext = 'Material'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 2.
s_fcat-col_pos = 2.
s_fcat-fieldname = 'MTART'.
s_fcat-ref_field = 'MTART'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material type'.
s_fcat-seltext = 'Material type'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX2'.
s_fcat-coltext = 'Box2'.
s_fcat-seltext = 'Box2'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 3.
s_fcat-col_pos = 3.
s_fcat-fieldname = 'MBRSH'.
s_fcat-ref_field = 'MBRSH'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Industry Sector'.
s_fcat-seltext = 'Industry Sector'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 4.
s_fcat-col_pos = 4.
s_fcat-fieldname = 'MATKL'.
s_fcat-ref_field = 'MATKL'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Material Group'.
s_fcat-seltext = 'Material Group'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 5.
s_fcat-col_pos = 5.
s_fcat-fieldname = 'BISMT'.
s_fcat-ref_field = 'BISMT'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Old material number'.
s_fcat-seltext = 'Old material number'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-row_pos = 6.
s_fcat-col_pos = 6.
s_fcat-fieldname = 'MEINS'.
s_fcat-ref_field = 'MEINS'.
s_fcat-ref_table = 'T_MARA'.
s_fcat-coltext = 'Base Unit of Measure'.
s_fcat-seltext = 'Base Unit of Measure'.
APPEND s_fcat TO P_T_FCAT.
CLEAR s_fcat.
s_fcat-fieldname = 'BOX3'.
s_fcat-coltext = 'Box3'.
s_fcat-seltext = 'Box3'.
s_fcat-CHECKBOX = 'X'.
s_fcat-EDIT = 'X'.
APPEND s_fcat TO P_T_FCAT.
ENDFORM. " fld_cate .MOVE 2 TO it_toolbar-butn_type.
Try changing the 2 (menu) to 0 (button) and see if that helps
also you need to set the event handler after you create your alv object
set handler handle_toolbar for [whatever object is called].
Edited by: Kev Mycock on Jul 24, 2008 7:59 AM -
ALV heading required using ALV opps-urgent
Hi All,
I developed one report which is displaying ouput in grid using ALV OOPS concept.
i need heading as foloows.
Header :
Program ID : EDI report program name
Date/Time : date/time where the report is generated
Page No :
User id : logon ID
anybody can send me the code how to display this header in my logic using oops concept only.
thanks,
maheedharHi
Use the std class
cl_salv_form_layout_grid to displayn this
use the methods
create_Label and create_text for creating this
see the sample
DATA: ln_grid TYPE REF TO cl_salv_form_layout_grid,
ln_flow TYPE REF TO cl_salv_form_layout_flow,
ln_label TYPE REF TO cl_salv_form_label,
ln_text TYPE REF TO cl_salv_form_text.
Program name
ln_label = lcn_grid->create_label( row = 2 column = 1 text = 'Program:'(t02) tooltip = 'Program technical name'(t20) ).
ln_text = lcn_grid->create_text( row = 2 column = 2 text = sy-cprog tooltip = sy-cprog ).
System
ln_label = lcn_grid->create_label( row = 3 column = 1 text = 'System:'(t03) tooltip = 'System:'(t03) ).
ln_text = lcn_grid->create_text( row = 3 column = 2 text = sy-sysid tooltip = sy-sysid ).
Client
ln_label = lcn_grid->create_label( row = 3 column = 3 text = 'Client:'(t04) tooltip = 'Client:'(t04) ).
ln_text = lcn_grid->create_text( row = 3 column = 4 text = sy-mandt tooltip = sy-mandt ).
Regards
Anji
Maybe you are looking for
-
How do I view Adobe Flash Player documents in my min ipad?
I want to view the seating chart at www.ticketmaster.com and it comes in Adobe Flash Player, but I cannot see it as the mini ipad does not support this sw. Can you tell me how to solve this issue, especially, when it is a standard in the web communi
-
Differences between audigy 4 and audigy 4
Hi. I am in position to buy Audigy 4 bulk version (non pro). I would like to know If there are any other differences besides extended box, especially if DACs are the same (CS4382 or CS 4398?). Thanks in advance
-
Upgraded to CS5 and duplex landscape printing if way off
Since upgrading to Indesign CS5 from actually CS2, I cannot get landscape duplex printing to align properly (centered as it is on screen). I have troubleshooted the Print Setup dialog box to death and nothing fixes this issue. I've tried Centered, Ce
-
Hi friends, When I do the "Printout" step in F110, the print is not going directly to the printer, but a spool is created eventhough I am checking "Print immediatey" in the Variant. The message in SP02 is "Frontend unavailable". Can someone tell me w
-
I still get, even after uninstalling the virusscanner, deleting cache and firewall reset the message:"The page you want to visit cannot be diplayed....Invalid or Unsupported form of compression". In IE the site works fine.