At line selection b/w normal output and alv output in 1 report
hi,
i had developed a report in which its starting output is normal out put and when i click on the itemid i should display the alv which i had developed. i dont know how to display the functionality in my report.
plzz provide me guideliens as help will be deifnately rewarded.
its a interactive report.
execute this sample report.
*& Report Z_ALVREPORT *
report z_alvreport .
tables:vbak,vbap,mara.
type-pools: slis.
*PARAMETERS:P_VBELN TYPE VBAK-VBELN.
types: begin of i_vbak,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
erzet like vbak-erzet,
ernam like vbak-ernam,
LINE_COLOR(4) TYPE C, "ROW COLOR
end of i_vbak.
data: it_vbak type standard table of i_vbak initial size 0,
wa_vbak type i_vbak.
*DATA:wa_sort1 TYPE slis_t_sortinfo_alv.
*TYPES:BEGIN OF I_MARA,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
END OF I_MARA.
*DATA: IT_MARA TYPE STANDARD TABLE OF I_MARA INITIAL SIZE 0,
WA_MARA TYPE I_MARA.
*DATA: WA_COLOR TYPE LVC_S_SCOL. "FOR ROW COLOR
*DATA: IT_COLOR TYPE TABLE OF LVC_S_SCOL.
types: begin of i_vbap,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
matwa like vbap-matwa,
end of i_vbap.
data: it_vbap type standard table of i_vbap initial size 0,
wa_vbap type i_vbap .
*variable for current 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,
col_pos type i.
*Title displayed when the alv list is displayed
data: i_title_vbak type lvc_title value 'FIRST LIST DISPLAYED'.
data: i_title_vbap type lvc_title value 'SECONDRY LIST DISPLAYED'.
initialization.
v_repid = sy-repid.
perform build_fieldcatlog.
PERFORM BUILD_LAYOUT. "FOR COLOR
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 vbak
form build_fieldcatlog.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-seltext_m = 'SALES DOCUMENT NUMBER.'.
wa_fieldcat-hotspot = 'X'.
WA_FIELDCAT-COL_POS = 1.
wa_fieldcat-emphasize = 'C110'.
wa_fieldcat-edit = 'X'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-fieldname = 'ERDAT'.
wa_fieldcat-seltext_m = 'DATE.'.
WA_FIELDCAT-COL_POS = 2.
wa_fieldcat-emphasize = 'C210'.
wa_fieldcat-edit = 'X'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-fieldname = 'ERZET'.
wa_fieldcat-seltext_m = 'ENTRY TIME'.
WA_FIELDCAT-COL_POS = 3.
wa_fieldcat-emphasize = 'C310'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-seltext_m = 'NAME'.
WA_FIELDCAT-COL_POS = 4.
wa_fieldcat-emphasize = 'C410'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'IT_VBAK'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
WA_FIELDCAT-COL_POS = 4.
wa_fieldcat-emphasize = 'C510'.
wa_fieldcat-hotspot = 'X'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
endform. "BUILD_FIELDCATLOG
*form build_layout
*FORM BUILD_LAYOUT.
*ALV_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
*ENDFORM. "END BUILD_LAYOUT.
*& 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 vbak
form data_retrieval.
*DATA:ID_COLOR(1) TYPE C.
select vbeln erdat erzet ernam from vbak into table it_vbak .
SELECT MATNR FROM MARA INTO TABLE IT_MARA.
LOOP AT IT_VBAK INTO WA_VBAK.
WA_VBAK-LINE_COLOR = 'C410'.
ID_COLOR = ID_COLOR + 1.
IF ID_COLOR = 7.
ID_COLOR = 1.
ENDIF.
CONCATENATE 'C' ID_COLOR '10' INTO WA_VBAK-LINE_COLOR.
MODIFY IT_VBAK FROM WA_VBAK.
ENDLOOP.
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 INTERACTIVE ALV'.
hline-typ = 'H'.
endform. "build_listheader
*& Form Status
using the PF-Status enable the SAVE, UPDATE, BACK, CANCEL and EXIT
button and give some OKCODE has been give to each of these Button
and this is handled in USER_COMMAND
form status using p_extab type slis_t_extab.
*----PF Status -
set pf-status 'STATUS'.
endform. " status
*& 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 = 'STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = i_title_vbak
I_GRID_SETTINGS =
is_layout = alv_layout
it_fieldcat = i_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = wa_sort1
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
i_save = 'A'
is_variant = i_variant
it_events = v_events
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_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 = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID = 'TOP_OF_PAGE'.
endform. "TOP_OF_PAGE
*& Form USER_COMMAND
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
if rs_selfield-fieldname = 'VBELN'.
read table it_vbak into wa_vbak index rs_selfield-tabindex.
refresh i_fieldcat.
perform build_fieldcatlog_vbap.
perform event_call_vbap.
perform populate_event_vbap.
perform data_retrieval_vbap.
perform build_listheader using it_listheader.
perform display_alv_vbap.
elseif rs_selfield-fieldname = 'MATNR'.
set parameter id 'MAT' field mara-matnr.
call transaction 'ZCHANG' and skip first screen.
endif.
when 'SAVE'.
loop at it_vbak into wa_vbak.
modify it_vbak from wa_vbak.
endloop.
endcase.
endform. "user_command
*& Form BUILD_FIELDCATLOG_VBAP
text
form build_fieldcatlog_vbap.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-seltext_m = 'SALES DNO.'.
wa_fieldcat-emphasize = 'C110'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-fieldname = 'POSNR'.
wa_fieldcat-seltext_m = 'ITEM'.
wa_fieldcat-emphasize = 'C210'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-seltext_m = 'MATERIAL NO.'.
wa_fieldcat-emphasize = 'C310'.
wa_fieldcat-edit = 'X'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'IT_VBAP'.
wa_fieldcat-fieldname = 'MATWA'.
wa_fieldcat-seltext_m = 'MATERIAL'.
wa_fieldcat-emphasize = 'C410'.
wa_fieldcat-edit = 'X'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
endform. "BUILD_FIELDCATLOG_VBAP
*& Form event_call_vbap
we get all events - TOP OF PAGE or USER COMMAND in table v_events
form event_call_vbap.
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_VBAP
*& Form POPULATE_EVENT
Events populated for TOP OF PAGE & USER COMAND
form populate_event_vbap.
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
*retreiving values from the database table VBAP
form data_retrieval_vbap.
select vbeln posnr matnr matwa from vbap into table it_vbap. " WHERE VBELN = P_VBELN.
endform.
form build_listheader_vbap using i_listheader type slis_t_listheader.
data: hline1 type slis_listheader.
hline1-typ = 'H'.
hline1-info = 'CHECKING PGM'.
endform.
form display_alv_vbap.
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 = 'GUI_STAT'
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_vbap
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 =
i_save = 'A'
IS_VARIANT =
it_events = v_events
tables
t_outtab = it_vbap
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
-
Difference between normal funcation and ALV funcational module
Hi Gurus,
Please answer for this question
what is the differnce between normal funcation and ALV funcational module ?
Thanks/Radha.Hi,
There are two ways of reporting List report and alv report.
the normal write statement usage gives us a listt report.
But ALV report offers a good asthetic report output. It almost function as your Excel File .
You can do many functions Total ,Subtotaling,sorting,filtering,
etc.
There two ways to do ALV report i.e. using function module REUSE_ALV_GRID_DISPLAY and using OOPS concept. -
Differences between normal list and ALV list
Hi All,
where can i find the differences between a Normal SAP List and ALV List(Documentation part).Imagine you have to write a report that lists out customer addresses. You will write code to get the input from the user via selection screen and then read the data based on the seletion from the database into an internal table(or a set of internal tables). Now once you have the data you will need to output this. In normal list reports, you will have to use 'WRITE' statements to format the output into columns and rows. Now suppose user wants some interactivity in it. Then you will have to provide some buttons and/or menu options through custom pf-status and then write logic for reacting to the user actions. After writing many such reportsm, you will feel like some of this can generalized and reused in every report.
That is exactly what ALV does. It takes out most of repeated sections of the code from out of you and provides you with excellent outputting functionality. It provides many standard functions like 'print', 'sort', 'filter', 'sum' etc by default. Imagine writing code yourself for all these if you were writing normal list program. One more major difference is the editing feature. If you were write a program that gives the user with editing features, then you will have to write a lot of logic. But with ALV, all the features like adding a row, deleting a row, copying a row, editing some fields of a row etc come by default.
Likewise, interactivity has become quite easy to implement. Like double clicking on a customer number, if the user wants to go to display customer transaction, it is very easy using ALV.
As pointed out here by others, go through the documentation of ALV and go through some of those demo programs and you will know the difference. ALV takes out a lot of burden of coding everything away from you and lets you worry about the business functionality that your report provides, rather than formatting the output or providing interactivity to the output.
Hope this helps,
Srinivas -
Select -options (fields as mandatory) and alv
Hi all,
i have 5 fields in select options and alv table , based on selection criteria values will display in alv table. now i want to make 2 fields as mandatory in select-options. without entering values in those two fields it should not allow the values to display iin alv table , it should rise a message..
(i have not created node for select-options ,i have directly used data type in wddoinit for select-options and for alv table i have created node)
thanks allHi,
In wddoinit while creating select options by ADD_SELECTION_FIELD method ,it has a parameter called I_OBLIGATORY. Set it as X and thus the field becomes mandatory.
Regards
Karthiheyan M -
Printing a Table Control AND ALV grid from same report
Hello,
I am trying to figure out how to print the output of my report, which consist of a table control and a OO-driven ALV grid under it. i tried several possibilities but I only get the ALV in my spool....?
Answers will be rewarded !Keep a break point in that method. Press print in the ALV, check it stops in the break point. If yes then you can use write statement, the values what ever u r writing it come in the print-out. If the control doesn't stop in the break point then there is some problem in the method declartion.
Check my code - I written every thing in the global declaration.
ALV Class Definition
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_top_of_list
FOR EVENT print_top_of_list OF cl_gui_alv_grid,
handle_end_of_list
FOR EVENT print_end_of_list OF cl_gui_alv_grid.
ENDCLASS. "lcl_event_receiver DEFINITION
DATA: o_event_receiver TYPE REF TO lcl_event_receiver.
ALV Class Implementation
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_top_of_list.
DATA: lws_top1(20) TYPE c,
lws_top2(150) TYPE c,
lws_top3(150) TYPE c,
lws_len_file TYPE i,
lws_file(80) TYPE c,
lws_file1(100) TYPE c,
lws_file2(100) TYPE c,
lws_file3(100) TYPE c.
WRITE: / text-001.
*Date
CONCATENATE text-008 ws_date INTO lws_top1 SEPARATED BY space.
WRITE : /1 lws_top1.
Source File Name
WRITE: / text-009.
lws_len_file = STRLEN( p_upload ).
IF lws_len_file < 80.
MOVE p_upload TO lws_top2.
WRITE : /1 lws_top2.
ELSE.
MOVE p_upload TO lws_file.
MOVE p_upload+80(48) TO lws_file1.
DO.
IF lws_file+79(1) EQ '\'.
EXIT.
ELSE.
CONCATENATE lws_file+79(1) lws_file2 INTO lws_file2.
SHIFT lws_file RIGHT.
ENDIF.
ENDDO.
IF lws_file2 IS INITIAL.
MOVE lws_file TO lws_top2.
WRITE : /1 lws_top2.
WRITE : /1 lws_file1.
ELSE.
CONDENSE lws_file.
MOVE lws_file TO lws_top2.
WRITE : /1 lws_top2.
CONCATENATE lws_file2 lws_file1 INTO lws_file3.
WRITE : /1 lws_file3.
ENDIF.
ENDIF.
ENDMETHOD. "handle_top_of_list
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
Regards,
Prakash. -
AT LINE SELECTION AN AT USER-COMMAND IN ONE REPORT
hiiii friends.....
hw can i go for both at line selection an at user comond in one report....
ie if double click on basic list it should shw sm output an when i choose menu optoin it should perform sm other output......You need to crate a PF-Status and in the PF-staus you need to include some essentials buttons and the button for your list on the USER-COMMAND.
Say,
BACK
EXIT
CANC
PICK ... should be assigned to F2 .. to work with LINE-SELECTION.
NEW_LIST ... for USER-COMMAND
In your report:
START-OF-SELECTION.
SET PF-STATUS 'Z_OWN'.
AT LINE-SELECTION.
WRITE : 'I AM LINE SELECTION'.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'NEW_LIST'.
WRITE / 'I AM CALLED FROM USER COMMAND'.
ENDCASE.
Regards,
Naimesh Patel -
How to handle at line-selection event for 2 different fields
Hi,
The requirement is there are 2 fields in a report output.
One is Material number
and the other is Material document number.
On clicking the material number, the user should be taken to MM03 screen.
On clicking the Material document number, the user should be taken to MB03 screen.
I am able to take care of the first one by putting a HOTSPOT on material number and I am using at line-Selection event, call transaction MM03 and it is working fine
I want to know how can I handle similarly for the document number?
Thanks,
Kumar.Hi,
chk this sample code.
Some part of code is higlighted which meets ur rewuirement.
REPORT z50871sd_rept_interactiverept NO STANDARD PAGE HEADING.
STRUCTURE DECLARATIONS*
INTERNAL TABLE DECLARATIONS*
WORKAREA DECLARATIONS*
TYPES : BEGIN OF st_kna1,
kunnr TYPE kna1-kunnr, "CUSTOMER NUMBER
name1 TYPE kna1-name1, "CUSTOMER NAME
END OF st_kna1.
TYPES : BEGIN OF st_vbak,
kunnr TYPE kna1-kunnr,
vbeln TYPE vbak-vbeln, "SALES DOCUMENT NUMBER
erdat TYPE vbak-erdat, "DATE ON WHICH THE RECORD WAS CREATED
audat TYPE vbak-audat, "DOCUMENT DATE
auart TYPE vbak-auart, "SALES DOCUMENT TYPE
ernam TYPE vbak-ernam, "NAME OF PERSON WHO CREATED THE OBJECT.
augru TYPE vbak-augru, "ORDER REASON
END OF st_vbak.
TYPES : BEGIN OF st_vbap,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr, "SALES DOCUMENT ITEM
matnr TYPE vbap-matnr, "MATERIAL NUMBER
charg TYPE vbap-charg, "BATCH NUMBER
matkl TYPE vbap-matkl, "MATERIAL GROUP
posar TYPE vbap-posar, "ITEM TYPE
END OF st_vbap.
DATA : it_kna1 TYPE STANDARD TABLE OF st_kna1,
it_vbak TYPE STANDARD TABLE OF st_vbak,
it_vbap TYPE STANDARD TABLE OF st_vbap,
wa_kna1 TYPE st_kna1,
wa_vbak TYPE st_vbak,
wa_vbap TYPE st_vbap.
DATA : v_fld(15),
v_kunnr TYPE kna1-kunnr,
v_vbeln TYPE vbak-vbeln.
SELECT-OPTIONS*
PARAMETERS*
SELECT-OPTIONS so_kunnr FOR v_kunnr. "CUSTOMER NUMBER
PARAMETERS : p_max TYPE i. "NUMBER OF HITS
START-OF-SELECTION*
START-OF-SELECTION.
PERFORM get_customerdata.
SET PF-STATUS 'MENU1'.
AT LINE-SELECTION**
*AT LINE-SELECTION.*
*IF sy-lsind = 1.*
*PERFORM get_salesheader.*
*ELSEIF sy-lsind = 2.*
*PERFORM get_salesitemdata.*
*ENDIF.*
AT USER-COMMAND*
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'DISP'.
PERFORM get_salesheader.
WHEN 'ITEM'.
PERFORM get_salesitemdata.
WHEN 'VA03'.
SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
TOP-OF-PAGE*
TOP-OF-PAGE.
ULINE AT /1(56).
WRITE : /1 sy-vline ,
2(15) text-004 COLOR 1 ,
sy-vline ,
20(35) text-005 COLOR 1 ,
sy-vline.
ULINE AT /1(56).
TOP-OF-PAGE DURING LINE-SELECTION.*
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-lsind.
WHEN 1.
PERFORM get_topofpage1.
WHEN 2.
PERFORM get_topofpage2.
ENDCASE.
FORM GET_CUSTOMERDATA*
FORM get_customerdata.
SELECT kunnr name1
FROM kna1
INTO TABLE it_kna1
UP TO p_max ROWS
WHERE kunnr IN so_kunnr.
IF sy-subrc EQ 0.
LOOP AT it_kna1 INTO wa_kna1.
WRITE : / sy-vline,
2(15) wa_kna1-kunnr ,
sy-vline ,
20 wa_kna1-name1,
sy-vline.
HIDE : wa_kna1-kunnr , wa_kna1-name1.
CLEAR wa_kna1.
ENDLOOP.
ULINE AT : /1(56).
ELSE.
MESSAGE w000(z50871msg).
ENDIF.
ENDFORM. "GET_CUSTOMERDATA
FORM GET_SALESHEADER*
FORM get_salesheader.
SET PF-STATUS 'MENU2'.
GET CURSOR FIELD v_fld VALUE v_kunnr.
IF v_fld = 'WA_KNA1-KUNNR'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kunnr
IMPORTING
output = v_kunnr.
SELECT kunnr vbeln erdat audat auart ernam augru
FROM vbak
INTO TABLE it_vbak
WHERE kunnr = v_kunnr.
IF sy-subrc EQ 0.
LOOP AT it_vbak INTO wa_vbak.
WRITE : / sy-vline ,
2(22) wa_vbak-vbeln ,
sy-vline,
27(25) wa_vbak-erdat ,
sy-vline ,
55(15) wa_vbak-audat ,
sy-vline ,
73(15) wa_vbak-auart ,
sy-vline,
91(16) wa_vbak-ernam ,
sy-vline,
109(13) wa_vbak-augru,
123 sy-vline.
HIDE : wa_vbak-vbeln.
CLEAR wa_vbak.
ENDLOOP.
*ULINE AT : /1(123).*
ELSE.
MESSAGE i015(z50871msg).
ENDIF.
ELSE.
MESSAGE i013(z50871msg).
ENDIF.
ENDFORM. "GET_SALESHEADER
FORM GET_SALESITEMDATA
FORM get_salesitemdata.
SET PF-STATUS space.
GET CURSOR FIELD v_fld VALUE v_vbeln.
IF v_fld = 'WA_VBAK-VBELN'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_vbeln
IMPORTING
output = v_vbeln.
SELECT vbeln posnr matnr charg matkl posar
FROM vbap
INTO TABLE it_vbap
WHERE vbeln = v_vbeln.
LOOP AT it_vbap INTO wa_vbap.
WRITE : /1 sy-vline,
2(13) wa_vbap-posnr ,
sy-vline,
18(18) wa_vbap-matnr ,
sy-vline,
40(13) wa_vbap-charg ,
sy-vline,
56(16) wa_vbap-matkl ,
sy-vline,
75 wa_vbap-posar,
112 sy-vline.
CLEAR wa_vbap.
ENDLOOP.
ULINE AT : /1(112).
ELSE.
MESSAGE i014(z50871msg).
ENDIF.
ENDFORM. "GET_SALESITEMDATA
FORM GET_TOPOFPAGE1
FORM get_topofpage1.
ULINE AT : /1(123).
WRITE : / sy-vline ,
2 text-000 ,
wa_kna1-kunnr ,
75 text-001 ,
wa_kna1-name1,
123 sy-vline.
ULINE AT : /1(123).
WRITE : / sy-vline ,
2(22) text-006 COLOR 1,
sy-vline,
27(25) text-007 COLOR 1 ,
sy-vline ,
55(15) text-008 COLOR 1 ,
sy-vline ,
73(15) text-009 COLOR 1 ,
sy-vline,
91(16) text-010 COLOR 1 ,
sy-vline,
109(13) text-011 COLOR 1,
123 sy-vline.
ULINE AT : /1(123).
ENDFORM. "GET_TOPOFPAGE1
FORM GET_TOPOFPAGE2
FORM get_topofpage2.
ULINE AT : /1(112).
WRITE : / sy-vline ,
2 text-000 ,
wa_kna1-kunnr ,
35 text-001 ,
wa_kna1-name1 ,
85 text-003 ,
wa_vbak-vbeln ,
112 sy-vline.
ULINE AT : /1(112).
WRITE : /1 sy-vline,
2(13) text-012 COLOR 1,
sy-vline,
18(18) text-013 COLOR 1 ,
sy-vline,
40(13) text-014 COLOR 1 ,
sy-vline,
56(16) text-015 COLOR 1 ,
sy-vline,
75 text-016 COLOR 1 ,
112 sy-vline.
ULINE AT : /1(112).
ENDFORM. "GET_TOPOFPAGE2
Regards
Sandeep Reddy -
Hi all,
I have create a select-options with 5 fields and alv and a button(get list) in webdynpro, i have to retrieve the values into alv from table through select-options by clicking on button.
and i have written a function module for select options. so based on input, the values are fetched from table in function module.
i am getting confused with the coding part, so can anybody tel me the coding part for alv by calling function module nd how to pass the values to function module(i,e select-option fields.)
( written code for select-options in wddoinit)
Thanks all in advanceHi VANI,
I hope you have declared the component usage for select option properly.
Now do as follows:-
1. Add 2 attributes in the tab 'Attribute' to implement select option for a particular field.
Like i want to implement select option in PO_NO ( EKPO-EBELN) & ITEM_NO( EKPO-EBELP).
Declare usage in properties in particular view:-
Declare attributes :- M_HANDLER_Report - Type ref to - IF_WD_SELECT_OPTIONS
M_WD_SELECT_OPTIONS_Report - Type ref to - IWCI_WDR_SELECT_OPTIONS
In WDDOINIT :-
create instantiate component usage from code wizard.
then set normal properties for display:-
WD_THIS->M_WD_SELECT_OPTIONS_REPORT = WD_THIS->WD_CPIFC_SELECT_OPTION_REPORT( ).
init the select screen
WD_THIS->M_HANDLER_REPORT = WD_THIS->M_WD_SELECT_OPTIONS_REPORT->INIT_SELECTION_SCREEN( ).
WD_THIS->M_HANDLER_REPORT->SET_GLOBAL_OPTIONS(
I_DISPLAY_BTN_CANCEL = ABAP_FALSE
I_DISPLAY_BTN_CHECK = ABAP_FALSE
I_DISPLAY_BTN_RESET = ABAP_FALSE
I_DISPLAY_BTN_EXECUTE = ABAP_FALSE ).
To assign a field in select option code like below:-
create a range table that consists of this new data element
LT_RANGE_TABLE = WD_THIS->M_HANDLER_REPORT->CREATE_RANGE_TABLE( I_TYPENAME = 'EBELN' ). " enter the data element of the field
add a . field to the selection
WD_THIS->M_HANDLER_REPORT->ADD_SELECTION_FIELD( I_ID = 'EBELN' "field name
IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).
to add more field proceed as above again with different field.
create a range table that consists of this new data element
LT_RANGE_TABLE = WD_THIS->M_HANDLER_REPORT->CREATE_RANGE_TABLE( I_TYPENAME = 'EBELP' ). " enter the data element of the field
add a . field to the selection
WD_THIS->M_HANDLER_REPORT->ADD_SELECTION_FIELD( I_ID = 'EBELP' "field name
IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).
Now in particular action by which you want to get values bind to your alv table:-
Declare variable and field symbol to hold values from selection
DATA: RT_PO_NO TYPE REF TO DATA.
DATA: RT_ITEM_NO TYPE REF TO DATA.
FIELD-SYMBOLS: <FS_PO_NO> TYPE TABLE,
<FS_ITEM_NO> TYPE TABLE,
Retrieve the data from the select option
RT_PO_NO = WD_THIS->M_HANDLER_REPORT->GET_RANGE_TABLE_OF_SEL_FIELD(
I_ID = 'EBELN' ).
Assign it to a field symbol
ASSIGN RT_PO_NO->* TO <FS_PO_NO>.
Retrieve the data from the select option
RT_ITEM_NO = WD_THIS->M_HANDLER_REPORT->GET_RANGE_TABLE_OF_SEL_FIELD(
I_ID = 'EBELP' ).
Now use select statement to get data from table
Select < field name > FROM < table name > INTO CORRESPONDING FIELDS OF TABLE < internal table to hold data > WHERE
PO_NO IN <FS_PO_NO> AND
ITEM_NO IN <FS_ITEM_NO> .
Regards,
Monishankar C -
Default selection on current month, week and date
Hi,
We are on Dashboard 4.1 sp3 the same version as BI.
The dashboard report is using LiveOffice connection. We are now facing an issue with default selection on current month, week and date.
The dashboard report drilled down from month, to week, then to date. The dashboard feed -live office report is on month/week/date ascending order - becuase we have running average calcualtion on LO report, it seems have to be in ascending order to get the correnct runnning average.
I tried to on Insertion to change default seletion, it works on month, but it doesnt working on week and daily.
but when LO report is on ascending order, on dashboard column chart the default selection is not on the current month, week and date.
Is there a way to solve the issue. Could anyone please help.
Thanks,Hi Suman,
Thanks for the quick reply.
Do you mean I Enable sorting -by categrory labels on Behaviour - common tab.
Thanks, -
At line-selection and user command
hi,
is it possible to use both at line selecion and at user command at a time.Hi Kiran,
Yes, it is possible to use both at line selecion and at
user command at a time.
AT LINE-SELECTION.
Event in interactive reporting
This event is processed whenever the user chooses a valid line in the list (i.e. a line generated by statements such as WRITE,ULINE, or SKIP) with the cursor and presses the function key which has the function PICK in the interface definition. This should normally be the function key F2, because it has the same effect as double-clicking the mouse, or clicking once in the case of a hotspot.
The processing for the event AT LINE-SELECTION usually generates further list output (the details list) which completely covers the current list display. If you want the current list display to remain visible (to aid user orientation), you can do this with the key word WINDOW.
AT USER-COMMAND.
Event in interactive reporting
This event is executed whenever the user presses a function key in the list or makes an entry in the command field.
DATA: NUMBER1 TYPE I VALUE 20,
NUMBER2 TYPE I VALUE 5,
RESULT TYPE I.
START-OF-SELECTION.
WRITE: / NUMBER1, '?', NUMBER2.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'ADD'.
RESULT = NUMBER1 + NUMBER2.
WHEN 'SUBT'.
RESULT = NUMBER1 - NUMBER2.
WHEN 'MULT'.
RESULT = NUMBER1 * NUMBER2.
WHEN 'DIVI'.
RESULT = NUMBER1 / NUMBER2.
WHEN OTHERS.
WRITE 'Unknown function code'.
EXIT.
ENDCASE.
WRITE: / 'Result:', RESULT.
After entry of a function code, the appropriate processing is performed under the event AT USER-COMMAND and the result is displayed in the details list.
Reward points if helpful,
Rgds,
Sumana -
CL_GUI_ALV_GRID: Line selection and backend table
Dear community,
is there a way to propagate line selection of ALV GRID GUI automagically to the backend data table?
This is my scenario:
1) A table containing several records with one column 'SELECTED' for selection status
2) ALV_GRID to display the table with layout info for line selection
alv_layo-sel_mode = 'A'.
alv_layo-box_fname = 'SELECTED'.
3) At PBO methods set_table_for_first_display and refresh_table_display are called with the table containing some records marked as 'SELECTED'.
First problem here: 'SELECTED' entries are not propagated to the ALV grid (the lines in the GUI are not marked). I know I could use set_selected_rows to force the selection, but is this really necessary?
4) Then, at PAI method check_changed_data is called (and yes, event mc_evt_modified is registered).
Second problem: Changes in selection are not propagated automagically to the underlying table. I also know I could use get_selected_rows to force this update manually, but again: is this really necessary?
Can anyone explain the behavior why sorting etc. is propagated automatically to the underlying table, but not the selection of rows? Am I missing something?
Hint: Removing box_fname = 'SELECTED' and setting the fieldcatalog to display the column 'SELECTED' as editable checkbox works also. But our users are familiar with the rowmark, so this is no option.
Any suggestions are welcome.
Thanks,
Torsten.
Here an (almost) complete listing of the code:
PROCESS BEFORE OUTPUT.
MODULE SET_STATUS_TITLE_0100.
MODULE INIT_ALV_GRID_0100.
MODULE DISPLAY_DATA_0100.
MODULE SET_GRID_SELECTION_0100.
PROCESS AFTER INPUT.
MODULE EXIT_COMMAND_0100 AT EXIT-COMMAND.
MODULE UPDATE_TABLE_DATA_0100.
MODULE USER_COMMAND_0100.
MODULE init_alv_grid_0100 OUTPUT.
IF NOT gr_container IS BOUND.
* Container erzeugen
CREATE OBJECT gr_container ...
* ALV Grid erstellen
CREATE OBJECT gr_alv_grid ...
* ALV für die erste Anzeige vorbereiten
gs_alv_layo-zebra = on. " Gestreifte Anzeige
gs_alv_layo-no_toolbar = on. " Keine Toolbar
gs_alv_layo-no_rowmark = off. " Keine Zeilenmarkierung
gs_alv_layo-edit = off. " Editieren ermöglichen
gs_alv_layo-sel_mode = 'A'. " Selektionsmodus
gs_alv_layo-cwidth_opt = off. " Optimierte Spaltenbreite!
gs_alv_layo-info_fname = 'LCOLOR'. " ALV-Control: Feldname mit
" einfacher Farbcodierung für
" Zeile
gs_alv_layo-ctab_fname = 'CCOLOR'. " ALV-Control: Feldname mit
" komplexer Farbcodierung
" für Zellen
gs_alv_layo-box_fname = 'SELECTED'. " Markierte Zeilen
* Feldkatalog für die Anzeige vorbereiten
* CLEAR gs_fcat. " Mehrfachsel. ermöglichen
* gs_fcat-fieldname = 'SELECTED'. " Dazu muss das Feld für die
* gs_fcat-edit = on. " Selektion editierbar sein.
* gs_fcat-checkbox = on. " Ausserdem muss die
** gs_fcat-outputlen = '3'. " Zeilenmark. eingeschaltet
* APPEND gs_fcat TO gt_fcat. " und box_fname gesetzt sein.
* Ereignisbehandlung
SET HANDLER
lcl_event_handler=>on_click
lcl_event_handler=>on_hotspot
lcl_event_handler=>on_double_click
lcl_event_handler=>on_user_command
lcl_event_handler=>on_data_changed
FOR gr_alv_grid.
CALL METHOD gr_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified
EXCEPTIONS
error = 1
OTHERS = 2.
ENDIF.
ENDMODULE. " INIT_ALV_GRID_0100 OUTPUT
MODULE display_data_0100 OUTPUT.
* PBO Modul für alle weiteren Anzeigezyklen.
IF gr_alv_grid IS BOUND.
CALL METHOD gr_alv_grid->set_table_for_first_display ...
ENDIF.
ENDMODULE. " DISPLAY_DATA_0100 OUTPUT
MODULE set_grid_selection_0100 OUTPUT.
IF gr_alv_grid IS BOUND.
CALL METHOD gr_alv_grid->refresh_table_display.
ENDIF.
* Alterative: Set selected rows manually
* CALL METHOD gr_alv_grid->set_selected_rows
ENDMODULE. " SET_GRID_SELECTION_0100 OUTPUT
MODULE update_table_data_0100 INPUT.
CALL METHOD gr_alv_grid->check_changed_data.
* Alternative: Get selected rows and update table manually
* CALL METHOD gr_alv_grid->get_selected_rows ...
ENDMODULE. " UPDATE_TABLE_DATA_0100 INPUTHello Torsten
I may be wrong but I think the field LVC_S_LAYO-BOX_FNAME is a relict from the stone-age SLIS-based ALV programming.
Using modern OO-based ALV we do not need any kind of "MARK" row but we have the appropriate methods available.
Regards
Uwe -
Multiple line selection and then capturing the selected values
Dear all
in my alv program ,i need to capture multiple line selections using checkboxes.
I have appended check boxes by adding it in the internal table & filling in field catalog.
but problem is i'm not able to capture multiple selected check boxes dynamically,
i could capture only the last selected check box,
option i found was to use class method get-selected-rows,but i'm unable to use it properly, could anyone explain in detail
i have already gone through the various examples in sdn but i am not able to work out.
like using parameters etc....
CAN ANY ONE HELP ME WITH THE CODE
help reqired immediately,
Thanks in advance.Hi Ankur,
In the PAI, just after the selection of your user event, button or menu,
add this code before getting the selected records.
<b>CALL METHOD grid1->check_changed_data
IMPORTING
e_valid = ws_x.</b>
where grid1 TYPE REF TO cl_gui_alv_grid,
Now fetch the selected records.
Check this code for reference
C O M P A N Y C O N F I D E N T I A L **
Care should be taken to prevent its unauthorized use. **
REPORT zfipost MESSAGE-ID f4 NO STANDARD PAGE HEADING .
AUTHOR : Susmitha Susan Thomas
DATE : August 18, 2005
*Abridged Version : This report generates a list in Abap List Viewer of
all the selected records in VBKPF/VBSEG. * *
(TRANSACTION ZPPD:Modified from transaction FBV0)
-- Class definition--
CLASS lcl_event_receiver DEFINITION DEFERRED.
--Tables--
TABLES: vbkpf. " Belegkopf
TABLES: tsp1d, pri_params, spopli.
TYPE-POOLS slis.
---- Global Variables -
DATA: anzkr(6) TYPE n,
lsind LIKE sy-lsind,
no_output(1) TYPE c,
records(1) TYPE c,
xpick(1) TYPE c,
xpickc(1) TYPE c,
xbinp(1) TYPE c,
rc LIKE syst-subrc,
ok_code LIKE sy-ucomm,
index TYPE i,
char_x(1) TYPE c VALUE 'X',
post TYPE c,
ans TYPE n,
user(40) TYPE c.
DATA :BEGIN OF i_doctype OCCURS 0,
blart LIKE vbkpf-blart,
END OF i_doctype.
--AlV Initialization--
DATA: gs_layout TYPE lvc_s_layo,
gt_fieldcat TYPE lvc_t_fcat,
gs_fieldcat TYPE lvc_s_fcat,
gs_index_rows TYPE lvc_t_row,
l_layout TYPE disvariant,
g_repid LIKE sy-repid,
g_max TYPE i VALUE 100,
ws_row_idx TYPE lvc_t_row ,
ws_row_no TYPE lvc_t_roid,
i_excl_func TYPE ui_functions,
ls_prnt TYPE lvc_s_prnt,
refresh TYPE c,
i_fieldcat TYPE lvc_t_fcat,
post(1) TYPE c,
accr_def(1) TYPE c,
rev_cd(3) TYPE c,
ch(1) TYPE c.
DATA: list_index LIKE sy-lsind,
flag TYPE n VALUE 0,
fl TYPE n VALUE 0,
g_container TYPE scrfname VALUE 'GRID_CONTAINER',
grid_container TYPE REF TO cl_gui_docking_container,
grid1 TYPE REF TO cl_gui_alv_grid,
custom_container1 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO lcl_event_receiver,
gt_vbkpf1 TYPE STANDARD TABLE OF vbkpf WITH HEADER LINE,
i_vbkpf TYPE TABLE OF vbkpf WITH HEADER LINE,
i_ws_row_idx LIKE ws_row_idx WITH HEADER LINE.
---Internal table containing details of selected documents--
DATA : BEGIN OF gt_vbkpf OCCURS 0,
xpick(1) TYPE c,
belnr LIKE vbkpf-belnr,
gjahr LIKE vbkpf-gjahr,
bukrs LIKE vbkpf-bukrs,
blart LIKE vbkpf-blart,
budat LIKE vbkpf-budat,
bldat LIKE vbkpf-bldat,
bktxt LIKE vbkpf-bktxt,
waers LIKE vbkpf-waers,
usnam LIKE vbkpf-usnam,
xblnr LIKE vbkpf-xblnr,
rev_code(3) TYPE c,
rev_rsn(15) TYPE c,
rev_date(10) TYPE c,
linecolor(4) TYPE c,
END OF gt_vbkpf.
--Table to store long text--
DATA : BEGIN OF inline OCCURS 0,
tdformat TYPE tdformat,
tdline TYPE tdline,
END OF inline.
DATA: thead LIKE thead OCCURS 0 WITH HEADER LINE.
-- Records to be posted--
DATA: BEGIN OF tbkpf OCCURS 5.
INCLUDE STRUCTURE vbkpf.
DATA: END OF tbkpf.
---- Constants -
CONSTANTS: awtyp_bkpf TYPE awtyp VALUE 'BKPF '.
CONSTANTS: awtyp_space TYPE awtyp VALUE ' '.
Selection Screen
PARAMETER: funcl LIKE t020-funcl NO-DISPLAY. "P(ost),D(isplay),U(pd)
SELECTION-SCREEN SKIP 2.
SELECT-OPTIONS:
p_bukrs FOR vbkpf-bukrs,
p_belnr FOR vbkpf-belnr,
p_gjahr FOR vbkpf-gjahr,
p_budat FOR vbkpf-budat,
p_bldat FOR vbkpf-bldat,
p_blart FOR vbkpf-blart,
p_xblnr FOR vbkpf-xblnr,
p_bktxt FOR vbkpf-bktxt,
p_usnam FOR vbkpf-usnam.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK blk
WITH FRAME TITLE text-010 NO INTERVALS.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(35) text-002.
PARAMETER norm_doc TYPE c
RADIOBUTTON GROUP doc DEFAULT 'X' .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(35) text-001.
PARAMETER ad_doc TYPE c
RADIOBUTTON GROUP doc .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(35) text-003.
PARAMETER all_doc TYPE c
RADIOBUTTON GROUP doc .
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK blk.
CLASS lcl_event_receiver DEFINITION
For capturing events on the ALV *
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
to capture all recently changed data.
handle_data_changed FOR EVENT data_changed OF
cl_gui_alv_grid
IMPORTING er_data_changed,
for hot spot
handle_hotspot FOR EVENT hotspot_click OF
cl_gui_alv_grid
IMPORTING e_column_id e_row_id.
ENDCLASS. " lcl_event_receiver (Definition)
CLASS lcl_event_receiver (Implementation)
For capturing events on the ALV *
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
PERFORM f2200_handle_data_changed USING er_data_changed.
ENDMETHOD.
METHOD handle_hotspot.
PERFORM f2201_handle_hotspot USING e_column_id e_row_id .
ENDMETHOD.
ENDCLASS. " lcl_event_receiver (Implementation)
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
START-OF-SELECTION
START-OF-SELECTION.
---- Colors -
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
-------------------- Status und Title Bar----------------------------*
SET PF-STATUS funcl.
SET TITLEBAR funcl.
-- Read Records--
SELECT * FROM vbkpf INTO TABLE gt_vbkpf1
WHERE bukrs IN p_bukrs
AND ausbk IN p_bukrs
AND belnr IN p_belnr
AND gjahr IN p_gjahr
AND budat IN p_budat
AND bldat IN p_bldat
AND blart IN p_blart
AND bktxt IN p_bktxt
AND xblnr IN p_xblnr
AND usnam IN p_usnam
AND bstat EQ 'V'
AND ( awtyp IN (awtyp_bkpf, awtyp_space) OR
awtyp IS null )
ORDER BY PRIMARY KEY.
----Call the ALV Screen -
PERFORM alv_display.
END-OF-SELECTION.
FORM BELEG_PICKUP *
Indicate changing of the selected external record *
FORM beleg_pickup.
SET PARAMETER ID 'BUK' FIELD vbkpf-bukrs.
SET PARAMETER ID 'GJR' FIELD vbkpf-gjahr.
SET PARAMETER ID 'BLP' FIELD vbkpf-belnr.
CASE funcl.
WHEN 'P'.
IF anzkr IS INITIAL.
CALL FUNCTION 'ZPRELIMINARY_POSTING_POST_D'
EXPORTING
bukrs = vbkpf-bukrs
belnr = vbkpf-belnr
gjahr = vbkpf-gjahr.
ELSE.
IF sy-ucomm EQ 'BUCH'.
CALL FUNCTION 'ZPRELIMINARY_POSTING_POST_ALL'
EXPORTING
synch = char_x
bupbi = xbinp
TABLES
t_vbkpf = tbkpf.
ELSE.
CALL FUNCTION 'ZPRELIMINARY_POSTING_POST_ALL'
EXPORTING
bupbi = xbinp
TABLES
t_vbkpf = tbkpf.
wait up to 3 seconds.
commit work.
ENDIF.
ENDIF.
WHEN OTHERS.
IF sy-tcode = 'ZPPD'.
funcl = 'P'.
ENDIF.
CALL FUNCTION 'ZPRELIMINARY_POSTING_DISPLAY'
EXPORTING
bukrs = vbkpf-bukrs
belnr = vbkpf-belnr
gjahr = vbkpf-gjahr.
ENDCASE.
ENDFORM.
FORM TBKPF_FUELLEN *
Include records for posting in TBKPF *
FORM tbkpf_fuellen.
records = 'X'.
LOOP AT gt_vbkpf.
IF gt_vbkpf-xpick = 'X'.
CLEAR anzkr.
CLEAR records.
IF sy-subrc = 0.
anzkr = anzkr + 1.
MOVE-CORRESPONDING gt_vbkpf TO tbkpf.
APPEND tbkpf.
ELSE.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
FORM MALL *
Select All documents *
FORM mall.
LOOP AT gt_vbkpf.
gt_vbkpf-xpick = 'X'.
MODIFY gt_vbkpf.
ENDLOOP.
refresh = 'X'.
CALL METHOD grid1->refresh_table_display.
ENDFORM.
FORM EMAL *
Unselect all documents *
FORM emal.
LOOP AT gt_vbkpf.
gt_vbkpf-xpick = ' '.
MODIFY gt_vbkpf.
ENDLOOP.
refresh = 'X'.
CALL METHOD grid1->refresh_table_display.
ENDFORM.
Form alv_display *
To display the details on an ALV. *
FORM alv_display.
CALL SCREEN 100.
ENDFORM. " alv_display
*& Module PB0_100 OUTPUT
MODULE pb0_100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'POSTDOC'.
--To verify that posting is complete.--
---- Setting the layout -
IF grid1 IS INITIAL.
PERFORM fill_table.
-- Initializing the field catalog--
PERFORM fieldcat_init CHANGING i_fieldcat.
-- Initializing the ALV GRID and CONTAINER--
CLEAR gs_layout.
gs_layout-info_fname = 'linecolor'.
gs_layout-grid_title = 'Parked Documents'(100).
gs_layout-zebra = 'X'.
gs_layout-cwidth_opt = 'X'.
gs_layout-sel_mode = 'A'.
gs_layout-edit = 'X'.
l_layout-report = sy-repid.
------ Create a custom container control for ALV Control----
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT grid_container
EXPORTING
dynnr = '100'
ratio = '100'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-007. " Error in object creation
LEAVE LIST-PROCESSING.
ENDIF.
-- Create an instance of alv control--
CREATE OBJECT grid1
EXPORTING
i_lifetime = 1
i_parent = grid_container.
---- Disable all unwanted button in the ALV grid -
PERFORM disable_functions TABLES i_excl_func.
---- Call the display function of ALV grid -
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
is_print = ls_prnt
it_toolbar_excluding = i_excl_func
CHANGING it_outtab = gt_vbkpf[]
it_fieldcatalog = i_fieldcat.
ENDIF. " IF cl_gui_alv_grid=>offline IS INITIAL
CALL METHOD grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
---- Create a reciever object to handle events -
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_data_changed FOR grid1.
SET HANDLER event_receiver->handle_hotspot FOR grid1.
CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid1.
ENDIF. " IF grid1 IS INITIAL.
ENDMODULE. " PB0_100 OUTPUT
*& Form fill_table
Fills the data table to be passed to the ALV grid.
FORM fill_table.
LOOP AT gt_vbkpf1.
MOVE-CORRESPONDING gt_vbkpf1 TO gt_vbkpf.
IF ad_doc = 'X' OR all_doc = 'X'.
thead-tdobject = 'BELEG'.
CONCATENATE gt_vbkpf1-bukrs
gt_vbkpf1-belnr
gt_vbkpf1-gjahr INTO thead-tdname.
thead-tdspras = sy-langu.
thead-tdid = '0004'.
PERFORM read_text.
READ TABLE inline INDEX 1.
gt_vbkpf-rev_code = inline-tdline.
REFRESH inline.
CLEAR inline.
thead-tdid = '0005'.
PERFORM read_text.
READ TABLE inline INDEX 1.
gt_vbkpf-rev_rsn = inline-tdline.
REFRESH inline.
CLEAR inline.
thead-tdid = '0006'.
PERFORM read_text.
READ TABLE inline INDEX 1.
gt_vbkpf-rev_date = inline-tdline.
REFRESH inline.
CLEAR inline.
REFRESH inline.
CLEAR inline.
ENDIF.
APPEND gt_vbkpf.
CLEAR gt_vbkpf.
ENDLOOP.
ENDLOOP.
ENDFORM.
*& Form fieldcat_init
Initialize the field catalog
FORM fieldcat_init CHANGING i_fieldcat TYPE lvc_t_fcat.
DATA: i_fldcat TYPE lvc_t_fcat WITH HEADER LINE.
CHECKBOX
CLEAR i_fldcat.
i_fldcat-fieldname = 'XPICK'.
i_fldcat-checkbox = 'X'.
i_fldcat-key = 'X'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-outputlen = '4'.
i_fldcat-scrtext_l = 'ChkB'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'BELNR'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-hotspot = 'X'.
i_fldcat-outputlen = '15'.
i_fldcat-scrtext_l = 'Document Number'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'GJAHR'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'FYear'.
i_fldcat-outputlen = '5'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'BUKRS'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'CCode'.
i_fldcat-outputlen = '5'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'BLART'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Type'.
i_fldcat-outputlen = '6'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'BLDAT'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Doc Date'.
i_fldcat-outputlen = '12'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'BUDAT'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Park Date'.
i_fldcat-outputlen = '12'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'BKTXT'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Document Header Text'.
i_fldcat-outputlen = '25'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'WAERS'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Curr'.
i_fldcat-outputlen = '7'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'USNAM'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Parked By'.
i_fldcat-outputlen = '13'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'XBLNR'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Reference Text'.
i_fldcat-outputlen = '19'.
APPEND i_fldcat TO i_fieldcat.
IF ad_doc = 'X' OR all_doc = 'X'.
CLEAR i_fldcat.
i_fldcat-fieldname = 'REV_CODE'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'RC'.
i_fldcat-outputlen = '2'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'REV_RSN'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Rev Reason'.
i_fldcat-outputlen = '15'.
APPEND i_fldcat TO i_fieldcat.
CLEAR i_fldcat.
i_fldcat-fieldname = 'REV_DATE'.
i_fldcat-tabname = 'GT_VBKPF'.
i_fldcat-key = 'X'.
i_fldcat-scrtext_l = 'Rev Date'.
i_fldcat-outputlen = '10'.
APPEND i_fldcat TO i_fieldcat.
ENDIF.
ENDFORM. " fieldcat_init
*& Module PAI_100 INPUT
MODULE pai_100 INPUT.
CASE ok_code.
WHEN 'BACK'.
IF sy-dynnr = '1000'.
PERFORM exit_program.
ELSEIF sy-dynnr = '0100'.
LEAVE TO TRANSACTION 'ZPPD'.
ENDIF.
WHEN 'EXIT'.
IF sy-dynnr = '1000'.
PERFORM exit_program.
ELSEIF sy-dynnr = '0100'.
LEAVE TO TRANSACTION 'ZPPD'.
ENDIF.
WHEN '%EX'.
IF sy-dynnr = '1000'.
PERFORM exit_program.
ELSEIF sy-dynnr = '0100'.
LEAVE TO TRANSACTION 'ZPPD'.
ENDIF.
WHEN 'BINP'.
DATA : ws_x TYPE c VALUE 'X'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Posting Documents Via Batch Input'
text_question =
'Are you sure you want to post all the selected documents?'
text_button_1 = 'Yes'
text_button_2 = 'No'
start_column = 25
start_row = 6
IMPORTING
answer = ans.
IF ans = '1'.
CALL METHOD grid1->check_changed_data
IMPORTING
e_valid = ws_x.
xbinp = 'X'.
PERFORM tbkpf_fuellen.
IF records = 'X'.
MESSAGE s999(zv) WITH text-007.
ELSE.
PERFORM beleg_pickup.
ENDIF.
ENDIF.
WHEN 'MALL'.
PERFORM mall.
WHEN 'EMAL'.
PERFORM emal.
WHEN 'RW'.
IF sy-dynnr = '1000'.
PERFORM exit_program.
ELSEIF sy-dynnr = '0100'.
LEAVE TO TRANSACTION 'ZPPD'.
ENDIF.
WHEN 'BUCH'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'Posting Document'
text_question =
'Are you sure you want to post all documents selected?'
text_button_1 = 'Yes'
text_button_2 = 'No'
start_column = 25
start_row = 6
IMPORTING
answer = ans.
IF ans = '1'.
CALL METHOD grid1->check_changed_data
IMPORTING
e_valid = ws_x.
perform tbkpf_fuellen.
IF records = 'X'.
MESSAGE s999(zv) WITH text-007.
ELSE.
PERFORM beleg_pickup.
ENDIF.
ENDIF.
WHEN 'PICK'.
DATA : check TYPE n,
no_rec TYPE c.
check = 0.
no_rec = 'X'.
CALL METHOD grid1->check_changed_data
IMPORTING
e_valid = ws_x.
index = 0.
LOOP AT gt_vbkpf.
funcl = 'D'.
index = index + 1.
IF gt_vbkpf-xpick = 'X'.
check = 1.
CLEAR no_rec.
READ TABLE gt_vbkpf1 INDEX index INTO vbkpf.
PERFORM beleg_pickup.
ENDIF.
ENDLOOP.
IF check = 0.
CALL METHOD grid1->get_selected_rows
IMPORTING
et_index_rows = ws_row_idx.
IF NOT ws_row_idx IS INITIAL.
CLEAR no_rec.
ENDIF.
LOOP AT ws_row_idx INTO i_ws_row_idx.
READ TABLE gt_vbkpf1 INDEX i_ws_row_idx-index INTO vbkpf.
PERFORM beleg_pickup.
ENDLOOP.
IF no_rec = 'X'.
MESSAGE s999(zv) WITH text-007.
ENDIF.
ENDIF.
WHEN '&RNT_PREV'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '&RNT'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '%SC'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '&OL0'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '&OAD'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '&AVE'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '&AQW'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '&XXL'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '%PC'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN '&CRTEMPL'.
CALL METHOD grid1->set_function_code
CHANGING c_ucomm = ok_code.
WHEN OTHERS.
do nothing.
ENDCASE.
CLEAR ok_code.
ENDMODULE. " PAI_100 INPUT
*& Form exit_program
Exits from the program after freeing the grid and container *
FORM exit_program.
IF NOT grid_container IS INITIAL.
CALL METHOD grid_container->free.
ENDIF.
IF NOT grid1 IS INITIAL.
CALL METHOD grid1->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
ENDIF.
LEAVE PROGRAM.
ENDFORM. " exit_program
*& Form f2200_handle_data_changed
To handle event of change in data in ALV.
-->P_ER_DATA_CHANGED text
FORM f2200_handle_data_changed USING ir_data_changed
TYPE REF TO
cl_alv_changed_data_protocol.
DATA : ls_mod_cell TYPE lvc_s_modi ,
lv_value TYPE lvc_value,
lflg_check TYPE i.
DATA : wa_vbkpf LIKE LINE OF gt_vbkpf.
SORT ir_data_changed->mt_mod_cells BY row_id .
LOOP AT ir_data_changed->mt_mod_cells
INTO ls_mod_cell
WHERE fieldname = 'I_PICK'.
IF NOT ls_mod_cell-value IS INITIAL .
CALL METHOD ir_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cell-row_id
i_fieldname = ls_mod_cell-fieldname
i_value = ls_mod_cell-value.
READ TABLE gt_vbkpf INTO wa_vbkpf
INDEX ls_mod_cell-row_id.
IF ls_mod_cell-fieldname = 'I_PICK'.
wa_vbkpf-xpick = ls_mod_cell-value.
ENDIF.
MODIFY gt_vbkpf FROM wa_vbkpf
INDEX ls_mod_cell-row_id.
ENDIF .
ENDLOOP .
ENDFORM. " f2200_handle_data_changed
*& Form f2201_handle_hotspot
To handle event of clicking on hyperlink
-->P_E_COLUMN_ID text
FORM f2201_handle_hotspot USING p_e_column_id p_e_row_id.
READ TABLE gt_vbkpf1 INDEX p_e_row_id INTO vbkpf.
funcl = 'D'.
PERFORM beleg_pickup.
PERFORM exit_program.
ENDFORM. " f2201_handle_hotspot
Regards,
Susmitha
Dont forget to reward points for useful answers -
How to use AT LINE-SELECTION and AT USER-COMMAND in one report????
Dear all,
I have a problem in reports I want to use AT USER-COMMAND.and AT LINE-SELECTION.both in the one report.
But as soon as I use SET PF-STATUS my AT LINE-SELECTION event stop workingand only AT USER-COMMAND is working.
How can I use both of them in one report for your reference I am giving my test program below.
REPORT ZTEST111 .
SET PF-STATUS '100'.
DO 10 TIMES.
WRITE:/ SY-INDEX.
HIDE SY-INDEX.
ENDDO.
START-OF-SELECTION.
AT LINE-SELECTION.
MESSAGE I002(SY) WITH SY-INDEX.
AT USER-COMMAND.
MESSAGE I002(SY) WITH 'USER COMMAND'.
END-OF-SELECTION.
Thanks in advance
Sachin Gautamhi
Syntax
AT USER-COMMAND.
Effect
This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
Note
Self-defined function codes are all those that include character combinations, except for the following:
The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
Table 1
Function code Function
%CTX Call a context menu
%EX Exit
%PC Save to file
%PRI Print
%SC Search for ...
%SC+ Find next
%SL Search in office
%ST Save to report tree
Table 2
Function code Function
BACK Back
P- Scroll to previous page
P-- Scroll to first page
P+ Scroll to next page
P++ Scroll to last page
PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
PL- Scroll to first line of the page
PL-n Scroll n lines back
PL+ Scroll to last line of the page
PL+n Scroll n lines up
PNOP No effect
PP- Scroll back one page
PP-n Scroll n pages back
PP+ Scroll one page forward
PP+n Scroll n pages forwad
PPn Scroll to beginning of page n
PRI, PRINT Print
PS-- Scroll to first column
PS++ Scroll to last column
PS- Scroll one column to the left
PS-n Scroll n columns to the left
PS+ Scroll one column to the right
PS+n Scroll n columns to the right
PSn Scroll to column n
PZn Scroll to line n
RW Cancel -
How to use both At USER-COMMAND and AT LINE-SELECTION in one abap program
I am trying out a program where I need to use both line selection and user command events in one program. Suggest me how to do it.
USE the okcode 'PICK'. (I mean add a 'PICK' in the GUI staus or the menu.) When ever u use both the events u have to use PICK to trigger the at line selection.
U just need to add the PICK in the GUI status and ofcourse write code in the program.
AT LINE-SELECTION.
CASE sy-ucomm.
WHEN 'PICK'.
write:/ 'HELLO WORLD'.
ENDCASE. -
Premiere Elements 13 issue with the mouse on MAC OSX Yosemite 10.10.1
When I select a clip of video and move to a different place in my time line, Premiere Elements 13, will not release the clip from the mouse.
The clip follows my mouse movements and goes to other places in my time line.
I try to delete these extra insertions, but the mouse will not release the clip.
Action I’ve taken: I’ve re-installed Premiere Elements 13. Problem remains.
This issue has consumed too much of my time and does not go away. It ruins my video.
Help please.
ThanksI tried using the Guest Account on my Mac. In the Guest Account, Illustrator works perfect!
Then I started wondering what processes (tools/tweaks) I run by default on my account. Turned out the problem was called by a little background tool called RightZoom. RightZoom let's the green 'zoom' button always maximize your current window.
So thanks! Problem solved!
Maybe you are looking for
-
I am writing query like select * from emp where dname = 'marketing' works fine but besise dname marketing I have marketing 2 and marketing3 so I thought I can write select * from emp where dname like 'marketing%' but it work in sql environmen
-
Javabean-Timer to control the whole Forms-Session
Hello ! I am looking forr a solution to supervise the whole Forms-session with a javabean-Timer. I know the available javabean-timer on [http://forms.pjc.bean.over-blog.com|http://forms.pjc.bean.over-blog.com/]. But i am searching for an answer/solut
-
Dears, i have UCCE 7.2.5 environemnt , the customer requested to enable the supervispor to loging to webview to get report for any thing realting to his team. i created supervisor for a team , and enabled to loging to webview page but can't genrate
-
View sent/received text numbers in My Verizon
I was wondering where I could view the information about texts that I received in "My Verizon?" I'm just looking for the number I received it from, not the content. Stupid me erased some information from a potential employer and I need to find her nu
-
Shape3d, swing and elevation to a 2D shape
Hello, My problem is simple. I have 1 top view 1 side view of a 3d structure. I want to construct a Shape3d by using these two views. These views were drawn with Swing Shape(is it possible to solve my problem using java.awt). Also part of my problem