Help for alv display
HI experts,
I have a requiment to display in ALV out put, for the TEXT COLUMM i need to display in single cell not in multiple cells.
please find below sceens for ref. so please help me how to proceeed its very urjent..
As is
To BE
Hi Raghu,
Please use word wrap functionality.
Refer to the link below for more information:
Word Wrap Functionality in ALV
Regards,
Ashvin
Similar Messages
-
Hi Experts,
I need to implement F4 help for ALV table field.
I my scenario, I am using two views. If we click on any record in fist view then it displays the popup window (second view) with relevant record details.
Here one of the columns having fieldnames corresponding values (old values), for correcting old values I have created new value editable column, we can enter new value for old value then we can save it. Till this functionality is ok.
Then I have included OVS help for new value field. Here I need to get f4 help for newvalue field relevant to fieldname.
For example: user clicks on f4 in cell (new value) then if corresponding fieldname is u2018WERKSu2019 then it shows the plant values
Here I can get fieldname, domain name and value table using method set_attribute ().
Same concept I have implemented in ALV using F4IF_FIELD_VALUE_REQUEST. It is working fine
Here I have little bit confusion. Please advise me how to implement in OVS.
Regards,
BBCHi,
you'll have to create a method for the OVS search help (define it in the "OVS component usage" field in the context).
Sample code (should work for WERKS):
method on_ovs .
declare data structures for the fields to be displayed and
for the table columns of the selection list, if necessary
types:
begin of lty_stru_input,
add fields for the display of your search input here
WERKS TYPE WERKS,
end of lty_stru_input.
types:
begin of lty_stru_list,
add fields for the selection list here
WERKS TYPE WERKS_D,
NAME1 type NAME1,
end of lty_stru_list.
data: ls_search_input type lty_stru_input,
lt_select_list type standard table of lty_stru_list,
ls_text type wdr_name_value,
lt_label_texts type wdr_name_value_list,
lt_column_texts type wdr_name_value_list,
lv_window_title type string,
lv_group_header type string,
lv_table_header type string,
lv_werks type werks_d.
field-symbols: <ls_query_params> type lty_stru_input,
<ls_selection> type lty_stru_list.
case ovs_callback_object->phase_indicator.
when if_wd_ovs=>co_phase_0. "configuration phase, may be omitted
in this phase you have the possibility to define the texts,
if you do not want to use the defaults (DDIC-texts)
Set label from Medium Description to something more logical...
ls_text-name = `NAME1`. "must match a field in list structure
ls_text-value = `Plant description`.
insert ls_text into table lt_label_texts.
Set col header from Medium Description to something more logical...
ls_text-name = `NAME1`. "must match a field in list structure
ls_text-value = `Plant description`.
insert ls_text into table lt_column_texts.
lv_window_title = wd_assist->get_text( `003` ).
lv_group_header = wd_assist->get_text( `004` ).
lv_table_header = wd_assist->get_text( `005` ).
ovs_callback_object->set_configuration(
label_texts = lt_label_texts
column_texts = lt_column_texts
group_header = lv_group_header
window_title = lv_window_title
table_header = lv_table_header
col_count = 2
row_count = 20 ).
when if_wd_ovs=>co_phase_1. "set search structure and defaults
In this phase you can set the structure and default values
of the search structure. If this phase is omitted, the search
fields will not be displayed, but the selection table is
displayed directly.
Read values of the original context (not necessary, but you
may set these as the defaults). A reference to the context
element is available in the callback object.
ovs_callback_object->context_element->get_static_attributes(
importing static_attributes = ls_search_input ).
pass the values to the OVS component
ovs_callback_object->set_input_structure(
input = ls_search_input ).
when if_wd_ovs=>co_phase_2.
If phase 1 is implemented, use the field input for the
selection of the table.
If phase 1 is omitted, use values from your own context.
if ovs_callback_object->query_parameters is not bound.
endif.
assign ovs_callback_object->query_parameters->*
to <ls_query_params>.
if not <ls_query_params> is assigned.
TODO exception handling
endif.
call method ovs_callback_object->context_element->get_attribute
exporting
name = 'WERKS'
importing
value = lv_werks.
data: lv_subcat_text type rstxtmd.
select werks
name1
into table lt_select_list
from T001W.
ovs_callback_object->set_output_table( output = lt_select_list ).
when if_wd_ovs=>co_phase_3.
apply result
if ovs_callback_object->selection is not bound.
endif.
assign ovs_callback_object->selection->* to <ls_selection>.
if <ls_selection> is assigned.
ovs_callback_object->context_element->set_attribute(
name = `WERKS`
value = <ls_selection>-werks ).
endif.
endcase.
endmethod. -
hi friends..
am using alv grid fm report.
i want the f4 help for standard sap field not my custom field in the grid.
how can i get this.
give me idea.Hi deva,
Please Refer this threads. Surely it will help you.
https://forums.sdn.sap.com/click.jspa?searchID=5369464&messageID=3897264
https://forums.sdn.sap.com/click.jspa?searchID=5369464&messageID=4105420
https://forums.sdn.sap.com/click.jspa?searchID=5369464&messageID=4133822
Thanks,
Reward If Helpful. -
DIfference between Reusable FM for ALV display and ALV display using class
Hi,
Is there any difference between alv display using Resuable FM and ALV display using classes except the later one uses OO concept.??
One mere thing i want to clarify is that is there any difference exist between REUSE_ALV_GRID_DISPLAY and REUSE_ALV_LIST_DISPLAY? If so, then let me know.
It could be easier to understand me if yuo give scenario where these FM comes into picture
Regards,
ParagHi,
(1) REUSE_ALV_LIST_DISPLAY
Display an ALV list as per parameters defined in the function call
(2) REUSE_ALV_GRID_DISPLAY
Display an ALV grid as per parameters defined in the function call
(3) REUSE_ALV_COMMENTARY_WRITE
List header information is output according to its type. The output information is put in an internal table. Output attributes are assigned to each line via the TYP field.This module outputs formatted simple header information at TOP-OF-PAGE.
(4) REUSE_ALV_HIERSEQ_LIST_DISPLAY
This module outputs two internal tables as a formated hierarchical-sequential list.
(5) REUSE_ALV_VARIANT_F4
Display variant selection dialog box.
(6) REUSE_ALV_VARIANT_EXISTENCE
Checks whether a display variant exists.
Other Useful Link :
Customize ALV grid layout at run time
Download ALV grid Control Tutorial
Understand ALV report ( Just Copy and paste )
Dynamic selection on ALV at run time
Dynamic selection on ALV at run time
Regards
Kiran -
Turning Tables in ABAP for ALV Display
Dear all,
I am running in a (for me) tricky problem:
I read any table definitions from the dictionary with function "DDIF_TABL_GET". In the next step I want to build a ALV Grid that displays some of the read data but not in rows but in lines.
Ok how does this look like:
For example use funktion DDIF_TABL_GET and use table MAKT as table parameter:
Result:
TABNAME FIELDNAME DD POSI K M ROLLNAME CHECKTABLE A I INTLEN REFTABLE
MAKT MANDT DE 0001 X MANDT T000 0 C 000003
MAKT MATNR DE 0002 X MATNR MARA 0 C 000018
MAKT SPRAS DE 0003 X SPRAS T002 0 C 000001
MAKT MAKTX DE 0004 MAKTX 0 C 000040
MAKT MAKTG DE 0005 MAKTG 0 C 000040
Ok what I want to do now is dynamically create a alv-Grid that shows the entries from the result above as list:
Example:
MAKT MAKT MAKT MAKT MAKT
MANDT MATNR SPRAS MAKTX MAKTG
DE DE DE DE DE
0001 0002 0003 0004 0005
X X X
MANDT MATNR SPRAS MAKTX MAKTG
There is a funktion in Excel called "Transponieren" (transpond) that does the same I search.
So the secret question is how to do this with ALV and dynamically???
Any idea?
Kind reagard for any hints and helps
Roman BeckerHi Roman,
my answer is kind of abstract: I implemented just the internal tables transposal.
I defined a structure of 99 string components, si you can put in whatever you want.
For illustration I fill the table with identifiers for row and column and the do the exel-like transposal.
The original table is lt_itab, the transposed one lt_trsp.
I used the string component's structure a couple of times now. This is smart because it won't waste more memory than needed.
Just cut&paste to get an idea, hope you like it!
FORM tab_transpose.
TYPES:
BEGIN OF ty_compstr,
f01 TYPE string,
f02 TYPE string,
f03 TYPE string,
f04 TYPE string,
f05 TYPE string,
f06 TYPE string,
f07 TYPE string,
f08 TYPE string,
f09 TYPE string,
f10 TYPE string,
f11 TYPE string,
f12 TYPE string,
f13 TYPE string,
f14 TYPE string,
f15 TYPE string,
f16 TYPE string,
f17 TYPE string,
f18 TYPE string,
f19 TYPE string,
f20 TYPE string,
f21 TYPE string,
f22 TYPE string,
f23 TYPE string,
f24 TYPE string,
f25 TYPE string,
f26 TYPE string,
f27 TYPE string,
f28 TYPE string,
f29 TYPE string,
f30 TYPE string,
f31 TYPE string,
f32 TYPE string,
f33 TYPE string,
f34 TYPE string,
f35 TYPE string,
f36 TYPE string,
f37 TYPE string,
f38 TYPE string,
f39 TYPE string,
f40 TYPE string,
f41 TYPE string,
f42 TYPE string,
f43 TYPE string,
f44 TYPE string,
f45 TYPE string,
f46 TYPE string,
f47 TYPE string,
f48 TYPE string,
f49 TYPE string,
f50 TYPE string,
f51 TYPE string,
f52 TYPE string,
f53 TYPE string,
f54 TYPE string,
f55 TYPE string,
f56 TYPE string,
f57 TYPE string,
f58 TYPE string,
f59 TYPE string,
f60 TYPE string,
f61 TYPE string,
f62 TYPE string,
f63 TYPE string,
f64 TYPE string,
f65 TYPE string,
f66 TYPE string,
f67 TYPE string,
f68 TYPE string,
f69 TYPE string,
f70 TYPE string,
f71 TYPE string,
f72 TYPE string,
f73 TYPE string,
f74 TYPE string,
f75 TYPE string,
f76 TYPE string,
f77 TYPE string,
f78 TYPE string,
f79 TYPE string,
f80 TYPE string,
f81 TYPE string,
f82 TYPE string,
f83 TYPE string,
f84 TYPE string,
f85 TYPE string,
f86 TYPE string,
f87 TYPE string,
f88 TYPE string,
f89 TYPE string,
f90 TYPE string,
f91 TYPE string,
f92 TYPE string,
f93 TYPE string,
f94 TYPE string,
f95 TYPE string,
f96 TYPE string,
f97 TYPE string,
f98 TYPE string,
f99 TYPE string,
END OF ty_compstr.
DATA:
lt_itab TYPE TABLE OF ty_compstr,
lt_trsp TYPE TABLE OF ty_compstr,
ls_irec TYPE ty_compstr,
lv_num2 TYPE num2,
lv_num2_i TYPE num2.
FIELD-SYMBOLS:
<anyfield> TYPE ANY,
<anyrec> TYPE ANY,
<anyfield_t> TYPE ANY,
<anyrec_t> TYPE ANY.
random fill
DO 99 TIMES.
lv_num2 = sy-index.
DO 99 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE ls_irec TO <anyfield>.
lv_num2_i = sy-index.
CONCATENATE 'ROW' lv_num2 'COL' lv_num2_i ':' <anyfield>
INTO <anyfield> SEPARATED BY space.
ENDDO.
APPEND ls_irec TO lt_itab.
ENDDO.
Transposal
LOOP AT lt_itab ASSIGNING <anyrec>.
lv_num2 = sy-tabix.
DO.
lv_num2_i = sy-index.
ASSIGN COMPONENT sy-index OF STRUCTURE <anyrec> TO <anyfield>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
READ TABLE lt_trsp INDEX lv_num2_i ASSIGNING <anyrec_t>.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO lt_trsp.
READ TABLE lt_trsp INDEX sy-tfill ASSIGNING <anyrec_t>.
ENDIF.
ASSIGN COMPONENT lv_num2 OF STRUCTURE <anyrec_t> TO <anyfield_t>.
<anyfield_t> = <anyfield>.
ENDDO.
ENDLOOP." at lt_itab assigning <anyrec>.
ENDFORM. " tab_transpose
C. -
Hallow I doing a alv report that display org. unit. for that I use function
That bring all the unit below and the level of the org. unit .my problem is that I wont to display the org.unit below write side the father
For that I can use the level but I dont now how
thankes
Org units
Ex.
163
271
315
415
LOOP AT org_itab INTO wa_org_itab-objid.
CALL FUNCTION 'RHPH_STRUCTURE_READ'
EXPORTING
plvar = '01'
otype = 'O'
objid = wa_org_itab-objid
wegid = 'ORGEH'
begda = sy-datum
endda = sy-datum
PUP_INFO = 'X'
WITH_STEXT = 'X'
TDEPTH = 0
TABLES
stru_tab = stru_tab
EXCEPTIONS
CATALOGUE_PROBLEM = 1
ROOT_NOT_FOUND = 2
WEGID_NOT_FOUND = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
MOVE wa_stru_tab-objid TO wa_t_itab-org_unit.
The biggest problem is that I wont to do it in alv (maybe take the field of org unit and make it bigger and move the org.unit in field accordingly. to the level )
Thanks for your suggestion.Hello Antonio,
I did'nt get your question clearly.But if you are trying to display the org unit in ascending order,then you can sort the internal table that you pass to your alv before calling the method SET_TABLE_FOR_FIRST_DISPLAY.
ie:
Sort t_itab by org_unit ASCENDING.
Now call the method
ALV_GRID_INSTANCE ->SET_TABLE_FOR_FIRST_DISPLAY and pass the above internal tabe t_itab.
Hope this helps.
Regards,
Beejal
**Reward if it helps -
Hi good souls,
I have 8 check boxes and when i want to insert the record in my table and check any of checkboxes the required field gets updated. but the problem is coming when i want to display the values.
the check boxes are not marked when i display the result. please help me by code and by your ideas on how to display the check mark when i press display.
data: mac1 type c,
mac2 type c,
mac3 type c,
mac4 type c,
mac5 type c,
mac6 type c,
mac7 type c.
WHEN 'INSERT'.
if mac1 = 'X'.
zaa_st-mc1 = 'CORRUGATOR'.
endif.
if mac2 = 'X'.
zaa_st-mc2 = 'INLINE'.
endif.
if mac3 = 'X'.
zaa_st-mc3 = 'LANGSTON'.
endif.
if mac4 = 'X'.
zaa_st-mc4 = 'DRO'.
endif.
if mac5 = 'X'.
zaa_st-mc5 = 'BOBST'.
endif.
if mac6 = 'X'.
zaa_st-mc6 = 'EMBA PRINTER'.
endif.
if mac7 = 'X'.
zaa_st-mc7 = 'EMBA GLUER'.
endif.
INSERT ZAA_ST.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORD INSERTED'.
ELSE.
MESSAGE E001(0) WITH 'RECORD NOT INSERTED'.
ENDIF.Hi friend,
How is your zaa_st table? Is it contains any field for check box (i.e: check_box). If yes, transfer 'X' to check_box field.
ex:
data: mac1 type c,
mac2 type c,
mac3 type c,
mac4 type c,
mac5 type c,
mac6 type c,
mac7 type c.
WHEN 'INSERT'.
if mac1 = 'X'.
zaa_st-mc1 = 'CORRUGATOR'.
endif.
if mac2 = 'X'.
zaa_st-mc2 = 'INLINE'.
endif.
if mac3 = 'X'.
zaa_st-mc3 = 'LANGSTON'.
endif.
if mac4 = 'X'.
zaa_st-mc4 = 'DRO'.
endif.
if mac5 = 'X'.
zaa_st-mc5 = 'BOBST'.
endif.
if mac6 = 'X'.
zaa_st-mc6 = 'EMBA PRINTER'.
endif.
if mac7 = 'X'.
zaa_st-mc7 = 'EMBA GLUER'.
endif.
* check box
zaa_st-check_box = 'X'.
INSERT ZAA_ST.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORD INSERTED'.
ELSE.
MESSAGE E001(0) WITH 'RECORD NOT INSERTED'.
ENDIF.
please check and reply
regards, -
How to use filter for alv display in webdynpro
hi,
i have use select-options and what ever data is coming from the data base i display it using alv.
i also want to include functionality like filter and all that , that comes in normal alv.please guide me how can i do it.
thankshi please remind that this is not the proper forum for this ...go to this
Expert Forums » ABAP Development » UI Programming -
Is there any help for ALV report development with funcation modules?
Hi,
please tell me any help or example to understand the ALV function module.Hi neha,
1. very simple alv
(with minimum code)
2. just copy paste
3.
report abc.
TYPE-POOLS : slis.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvfcwa TYPE slis_fieldcat_alv.
data : begin of itab occurs 0.
include structure usr02.
data : end of itab.
START-OF-SELECTION.
select * from usr02
into table itab.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
regards,
amit m. -
Help for checkbox display as marked
HI ALL,
I am facing some problem displaying the check box as marked or flagged when displaying the record.
my requirement is that when i display a record it should also display the check box as marked. how do i do that. help me with the code.
i have 8 checkboxes and when each checkbox is marked, the respective field is filled with a record. and when i display ( using push button) the selected record , it should show me the check box as marked if the field is not empty. how do i do it?LOOP AT T_SFLIGHT INTO sflight.
WRITE:
/ SFLIGHT-FLDATE,
SFLIGHT-SEATSMAX,
SFLIGHT-SEATSOCC.
MODIFY CURRENT LINE FIELD FORMAT BOX INPUT on.
BOX = 'X'.
MODIFY CURRENT LINE FIELD VALUE BOX.
ENDLOOP.
ULINE.
Try the highlighted lines.It will helps u.I -
Hi regarding how to put f4 help for alv grid editable
Hi,
Please guide me with sample program how to pass f4 value for particular selected field . In case i haved kunnr ,sales org , channel , division and i select kunnr for selected kunnr i need to exaactact the data for kunnr in kna1 table and place that value in f4 editable field .
Regarding
anilHi
Please check program BCALV_GRID_EDIT_DELTA
Thanks
Vishal Kapoor -
Help for J3D display in JSplitPane!!!
I create a JSplitPane component to load a J3D canvas in it's right side and
another panel in it's left .
At first, It feels good.
But after the windows of J3D canvas collapsed and expand it again,the
problem appeard, and reports:
Fail to Reset() D3D device, try Recreate device again. - D3DERR_DRIVERINTERNALERROR
I view the bug-report of this error,and no use.
Here is the code:
http://zhdodo.8866.org/default/splitPaneTest1.java
http://zhdodo.8866.org/default/actionTest1.javaDid you ever find a workaround for this problem? I've been having lots of problems with java3d-1_3_2-beta3 using the openGL driver, with the program frequently not redisplaying panes containing Java3D content (although it's better than beta2). Eventually, as a last resort, I tried the DirectX implementation. This seemed to fix the redisplay problem until I collapsed and then expanded a pane within the splitter and ran into the problem you described. Java3D is turning into a bit of a minefield :-(
-
Hi,
i need to add coloums for the existing report which picks from G/L account.
in this report I need to add some more columns from COSP-KSTAR, which shows the cost element details from G/L account.
I need to restrict that cost element number according to the company code.
Plz see this and let me know the things.
1. I need to add FISCAL YEAR(COEP-GJAHR) in selection screen.
2. I need to add column: Employee Cost (CSKS-KOSTL)
3. add a column Staff Welfare (COSP-KSTAR) this is to restrict for the cost element 3000200 from G/L account
4. add a column Recruitment restrict for the cost element(COSP-KSTAR) 3100040 from G/L account
5. add a column Travels (suppressing some cost elements(COSP-KSTAR) and putting into Travels)
6. add a column Subcontracts restrict for the cost element (COSP-KSTAR)3100360 from G/L account
7. add a column Communication suppressing some cost elements and putting into Communication)
8. add a column Rent restrict for the cost element (COSP-KSTAR)3100055 from G/L account
9. add a column Back end Cost restrict for the cost element (COSP-KSTAR)3100065 from G/L account
i can hardcode these cost elements.
i did according to some of our sdn friends guidence but it is going to dump.
hear i am sending the code what i changed.
it is giving the error with the select.
SELECT BUKRS KOKRS gjahr kstar OBJNR OBJNR_N1 PERIO BEKNZ WKGBTR WOGBTR FROM
COEP INTO TABLE
IT_COEP FOR ALL ENTRIES IN IT_AUFK WHERE OBJNR = IT_AUFK-OBJNR and
perio in S_PERIO.
plz try to help me out in this issue.
hear i am sending the complete code what i worte.
*& Report ZPROJECT_PROFIT2
REPORT ZPROJECT_PROFIT2.
*********************MAIN DOCUMENTATION BLOCK*************************
Project Code :
Program Name :Zproject_profit1.
Purpose of program :This report will give the gross margin for a project as
*a whole based on some selected input criteria.
Author of program :JAYA KRISHNA .B.
INPUT/OUTPUT FILE :nil
TYPE-POOLS : SLIS."For ALV display.
TABLES : COEP, "CO Object: Line Items (by period).
AUFK, "Order master data.
csks, "Cost center master data
cosp. "CO Objects
*& Include ZSTRUCTURE
types: BEGIN OF TY_COEP , "structure of table COEP.
BUKRS LIKE COEP-BUKRS,
KOKRS LIKE COEP-KOKRS,
OBJNR LIKE COEP-OBJNR,
gjahr like coep-gjahr,
kstar like coep-kstar,
OBJNR_N1 LIKE COEP-OBJNR_N1,
PERIO LIKE COEP-PERIO,
BEKNZ LIKE COEP-BEKNZ,
WKGBTR LIKE COEP-WKGBTR,
WOGBTR LIKE COEP-WOGBTR,
BELNR LIKE COEP-BELNR,
END OF TY_COEP,
BEGIN OF TY_AUFK , "structure of table AUFK.
BUKRS LIKE AUFK-BUKRS,
KOKRS LIKE AUFK-KOKRS,
OBJNR LIKE AUFK-OBJNR,
KTEXT LIKE AUFK-KTEXT,
ANFAUFNR LIKE AUFK-ANFAUFNR,
AUFEX LIKE AUFK-AUFEX,
USER2 LIKE AUFK-USER2,
USER0 LIKE AUFK-USER0,
USER1 LIKE AUFK-USER1,
USER3 LIKE AUFK-USER3,
USER6 LIKE AUFK-USER6,
USER7 LIKE AUFK-USER7,
USER8 LIKE AUFK-USER8,
ABKRS(10) TYPE C,
USER9 LIKE AUFK-USER9,
AUFNR LIKE AUFK-AUFNR,
END OF TY_AUFK,
begin of ty_csks,
kokrs like csks-kokrs,
kostl like csks-kostl,
bukrs like csks-bukrs,
objnr like csks-objnr,
end of ty_csks.
DATA : BEGIN OF IT_COSP occurs 100,
OBJNR LIKE COSP-OBJNR,
GJAHR LIKE COSP-GJAHR,
KSTAR LIKE COSP-KSTAR,
END OF IT_COSP.
DATA : IT_COEP TYPE TABLE OF TY_COEP, " Declaraton of tables COEP and AUFK.
IT_AUFK TYPE TABLE OF TY_AUFK,
IT_CSKS TYPE TABLE OF TY_CSKS.
IT_COSP TYPE TABLE OF TY_COSP.
DATA : WA_COEP LIKE LINE OF IT_COEP, " Declaration of work areas for tables COEP and AUFK.
WA_AUFK LIKE LINE OF IT_AUFK,
WA_CSKS LIKE LINE OF IT_CSKS.
WA_COSP LIKE LINE OF IT_COSP.
DATA : BEGIN OF IT_DISPLAY OCCURS 0, " Declaration of display table.
OBJNR_N1 LIKE COEP-OBJNR_N1,
OBJNR_N12 LIKE COEP-OBJNR_N1,
KTEXT1 LIKE AUFK-KTEXT,
WKGBTR LIKE COEP-WKGBTR,
WOGBTR LIKE COEP-WOGBTR,
WKGBTR1 LIKE COEP-WTGBTR,
WOGBTR1 LIKE COEP-WOGBTR,
ADDK LIKE COEP-WOGBTR,
ADDO LIKE COEP-WOGBTR,
ADDK1 LIKE COEP-WOGBTR,
ADDO1 LIKE COEP-WOGBTR,
PROFIT1 LIKE COEP-WOGBTR,
PROFIT2 LIKE COEP-WOGBTR,
BEKNZ LIKE COEP-BEKNZ,
BUKRS LIKE AUFK-BUKRS,
anfaufnr LIKE AUFK-anfaufnr,
aufex like aufk-aufex,
OBJNR LIKE AUFK-OBJNR,
USER2 LIKE AUFK-USER2,
USER0 LIKE AUFK-USER0,
USER1 LIKE AUFK-USER1,
USER3 LIKE AUFK-USER3,
USER6 LIKE AUFK-USER6,
USER7 LIKE AUFK-USER7,
USER8 LIKE AUFK-USER8,
ABKRS LIKE AUFK-ABKRS,
USER9 LIKE AUFK-USER9,
PERIO LIKE COEP-PERIO,
AUFNR LIKE AUFK-AUFNR,
STR(5) TYPE C,
WORK(10) TYPE C,
END OF IT_DISPLAY,
: BEGIN OF IT_DISPLAY1 OCCURS 0, " Declaration of second display table.
OBJNR_N1 LIKE COEP-OBJNR_N1,
OBJNR_N12 LIKE COEP-OBJNR_N1,
KTEXT1 LIKE AUFK-KTEXT,
WKGBTR LIKE COEP-WKGBTR,
WOGBTR LIKE COEP-WOGBTR,
WKGBTR1 LIKE COEP-WTGBTR,
WOGBTR1 LIKE COEP-WOGBTR,
ADDK LIKE COEP-WOGBTR,
ADDO LIKE COEP-WOGBTR,
ADDK1 LIKE COEP-WOGBTR,
ADDO1 LIKE COEP-WOGBTR,
PROFIT1 LIKE COEP-WOGBTR,
PROFIT2 LIKE COEP-WOGBTR,
BEKNZ LIKE COEP-BEKNZ,
BUKRS LIKE AUFK-BUKRS,
anfaufnr like aufk-anfaufnr,
aufex like aufk-aufex,
OBJNR LIKE AUFK-OBJNR,
USER2 LIKE AUFK-USER2,
USER0 LIKE AUFK-USER0,
USER1 LIKE AUFK-USER1,
USER3 LIKE AUFK-USER3,
USER6 LIKE AUFK-USER6,
USER7 LIKE AUFK-USER7,
USER8 LIKE AUFK-USER8,
ABKRS LIKE AUFK-ABKRS,
USER9 LIKE AUFK-USER9,
PERIO LIKE COEP-PERIO,
AUFNR LIKE AUFK-AUFNR,
STR(5) TYPE C,
WORK(10) TYPE C,
END OF IT_DISPLAY1.
data : it_field type slis_fieldcat_alv, " Declaration of ALV variables
it_field_t type slis_t_fieldcat_alv,
xlayout TYPE slis_layout_alv.
data : it_event type slis_t_event,
wa_event like line of it_event.
DATA : WA_TOP TYPE SLIS_LISTHEADER,
IT_TOP TYPE SLIS_T_LISTHEADER.
data:w_lines type i,
w_occurs type i,
STR(5) TYPE C,
WORK(10) TYPE C.
constants : c_selection type char20 value 'Selection based on'. " Declaration of a constant.
selection-screen BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS S_BUKRS FOR AUFK-BUKRS OBLIGATORY.
SELECT-OPTIONS S_OBJNR FOR AUFK-AUFNR.
SELECT-OPTIONS S_ANF FOR AUFK-ANFAUFNR.
SELECT-OPTIONS S_AUFEX FOR AUFK-AUFEX.
SELECT-OPTIONS S_USER2 FOR AUFK-USER2.
SELECT-OPTIONS S_USER0 FOR AUFK-USER0.
SELECT-OPTIONS S_USER1 FOR AUFK-USER1.
SELECT-OPTIONS S_USER3 FOR AUFK-USER3.
SELECT-OPTIONS S_USER6 FOR AUFK-USER6.
SELECT-OPTIONS S_ABKRS FOR AUFK-ABKRS.
SELECT-options s_gjahr for coep-gjahr obligatory.
SELECT-OPTIONS S_PERIO FOR COEP-PERIO OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BLK .
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
PARAMETERS : ONSITE RADIOBUTTON GROUP RADI.
PARAMETERS : OFFSHORE RADIOBUTTON GROUP RADI.
PARAMETERS : BOTH RADIOBUTTON GROUP RADI.
SELECTION-SCREEN END OF BLOCK BLK1 .
start-of-selection.
*ZAUFK
" Selection of records from aufk to internal table.
IF ONSITE EQ 'X' .
SELECT
BUKRS
KOKRS
OBJNR
KTEXT
anfaufnr
aufex
USER2
USER0
USER1
USER3
USER6
USER7
USER8
ABKRS
USER9
AUFNR
FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
anfaufnr IN s_anf AND
aufex in s_aufex and
aufnr IN S_OBJNR AND
USER2 IN S_USER2 AND
USER0 IN S_USER0 AND
USER1 IN S_USER1 AND
USER3 IN S_USER3 AND
USER6 IN S_USER6 AND
ABKRS IN S_ABKRS AND
USER9 EQ 'X' .
ENDIF.
IF OFFSHORE EQ 'X'.
SELECT
BUKRS
KOKRS
OBJNR
KTEXT
anfaufnr
aufex
USER2
USER0
USER1
USER3
USER6
USER7
USER8
ABKRS
USER9
AUFNR
FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
anfaufnr IN S_anf AND
aufex in s_aufex and
aufnR IN S_OBJNR AND
USER2 IN S_USER2 AND
USER0 IN S_USER0 AND
USER1 IN S_USER1 AND
USER3 IN S_USER3 AND
USER6 IN S_USER6 AND
ABKRS IN S_ABKRS AND
USER9 <> 'X'.
ENDIF.
IF BOTH EQ 'X'.
SELECT
BUKRS
KOKRS
OBJNR
KTEXT
anfaufnr
aufex
USER2
USER0
USER1
USER3
USER6
USER7
USER8
ABKRS
USER9
AUFNR
FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
anfaufnr IN S_anf AND
aufex in s_aufex and
aufNR IN S_OBJNR AND
USER2 IN S_USER2 AND
USER0 IN S_USER0 AND
USER1 IN S_USER1 AND
USER3 IN S_USER3 AND
USER6 IN S_USER6 AND
ABKRS IN S_ABKRS.
ENDIF.
*& Include ZCOEP
" Selection of records from coep to internal table.
SELECT BUKRS KOKRS gjahr kstar OBJNR OBJNR_N1 PERIO BEKNZ WKGBTR WOGBTR FROM
COEP INTO TABLE
IT_COEP FOR ALL ENTRIES IN IT_AUFK WHERE OBJNR = IT_AUFK-OBJNR and
perio in S_PERIO.
*& Include ZPROFIT_CALC
" Calculations for income and Profit of the employee.
if not it_coep[] is initial.
select objnr gjahr wrttp versn kstar from cosp into TABLE It_cosp for
all entries in it_coep where objnr = IT_COEP-objnr .
endif.
LOOP AT IT_coep INTO WA_coep.
read table IT_aufk into WA_aufk with key OBJNR = wa_coep-OBJNR.
case it_cosp-kstar.
when '3000200'.
it_cosp-kstar = cosp-kstar.
when '3100040'.
it_cosp-kstar = cosp-kstar.
when '3100360'.
it_cosp-kstar = cosp-kstar.
when '3100055'.
it_cosp-kstar = cosp-kstar.
when '3100065'.
it_cosp-kstar = cosp-kstar.
when '3100115'.
it_cosp-kstar = cosp-kstar.
when '3100120'.
it_cosp-kstar = cosp-kstar.
when '3100130'.
it_cosp-kstar = cosp-kstar.
when '3100135'.
it_cosp-kstar = cosp-kstar.
when '3100140'.
it_cosp-kstar = cosp-kstar.
when '3100145'.
it_cosp-kstar = cosp-kstar.
when '3100150'.
it_cosp-kstar = cosp-kstar.
when '3100155'.
it_cosp-kstar = cosp-kstar.
when '3100160'.
it_cosp-kstar = cosp-kstar.
when '3100165'.
it_cosp-kstar = cosp-kstar.
when '3100170'.
it_cosp-kstar = cosp-kstar.
endcase.
IT_DISPLAY-BUKRS = WA_AUFK-BUKRS.
IT_DISPLAY-anfaufnr = WA_AUFK-anfaufnr.
it_display-aufex = wa_aufk-aufex.
IT_DISPLAY-OBJNR = WA_AUFK-OBJNR.
IT_DISPLAY-USER2 = WA_AUFK-USER2.
IT_DISPLAY-USER0 = WA_AUFK-USER0.
IT_DISPLAY-USER1 = WA_AUFK-USER1.
IT_DISPLAY-USER3 = WA_AUFK-USER3.
IT_DISPLAY-USER6 = WA_AUFK-USER6.
IT_DISPLAY-USER7 = WA_AUFK-USER7.
IT_DISPLAY-USER8 = WA_AUFK-USER8.
IT_DISPLAY-ABKRS = WA_AUFK-ABKRS.
IT_DISPLAY-USER9 = WA_AUFK-USER9.
IT_DISPLAY-KTEXT1 = WA_AUFK-KTEXT.
if WA_AUFK-abkrs = 01.
IT_DISPLAY-STR = 'TM'.
ENDIF.
IF WA_AUFK-ABKRS = 02.
IT_DISPLAY-STR = 'FP'.
ENDIF.
IF WA_AUFK-USER9 = 'X'.
IT_DISPLAY-WORK = 'ONSITE'.
ENDIF.
IF WA_AUFK-USER9 <> 'X'.
IT_DISPLAY-WORK = 'OFFSHORE'.
ENDIF.
it_display-ABKRS = it_display-user7.
IF wa_coep-BEKNZ = 'S'.
IT_DISPLAY-WKGBTR = WA_COEP-WKGBTR.
IT_DISPLAY-WOGBTR = WA_COEP-WOGBTR.
IT_DISPLAY-ADDK = IT_DISPLAY-ADDK + IT_DISPLAY-WKGBTR.
IT_DISPLAY-ADDO = IT_DISPLAY-ADDO + IT_DISPLAY-WOGBTR.
IT_DISPLAY-ADDK1 = 0.
IT_DISPLAY-ADDO1 = 0.
IT_DISPLAY-PROFIT1 = IT_DISPLAY-ADDK1 + IT_DISPLAY-ADDK.
IT_DISPLAY-PROFIT2 = IT_DISPLAY-ADDO1 + IT_DISPLAY-ADDO.
APPEND IT_DISPLAY.
ENDIF.
IF WA_COEP-BEKNZ = 'H'.
IT_DISPLAY-WKGBTR1 = WA_COEP-WKGBTR.
IT_DISPLAY-WOGBTR1 = WA_COEP-WOGBTR.
IT_DISPLAY-ADDK1 = IT_DISPLAY-ADDK + IT_DISPLAY-WKGBTR1.
IT_DISPLAY-ADDO1 = IT_DISPLAY-ADDO + IT_DISPLAY-WOGBTR1.
IT_DISPLAY-ADDK = 0.
IT_DISPLAY-ADDO = 0.
IT_DISPLAY-PROFIT1 = IT_DISPLAY-ADDK1 + IT_DISPLAY-ADDK.
IT_DISPLAY-PROFIT2 = IT_DISPLAY-ADDO1 + IT_DISPLAY-ADDO.
APPEND IT_DISPLAY.
ENDIF.
collect it_display into it_display1.
clear it_display.
ENDLOOP.
"calc
*& Include ZPROFIT_DISPLAY
LOOP AT IT_DISPLAY1. "it_display.
read table IT_COEP into WA_COEP with key OBJNR =
IT_DISPLAY-OBJNR.
read table IT_AUFK into WA_AUFK with key aufnr = IT_DISPLAY-aufnr.
if WA_AUFK-abkrs = 01.
STR = 'TM'.
ENDIF.
IF WA_AUFK-ABKRS = 02.
STR = 'FP'.
ENDIF.
IF WA_AUFK-USER9 = 'X'.
WORK = 'ONSITE'.
ENDIF.
IF WA_AUFK-USER9 <> 'X'.
WORK = 'OFFSHORE'.
ENDIF.
endloop.
clear it_field.
it_field-col_pos = 1.
it_field-fieldname = 'AUFNR'.
it_field-seltext_l = 'project id.'.
it_field-outputlen = 15.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 2.
it_field-fieldname = 'KTEXT1'.
it_field-seltext_l = 'Project Name'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 3.
it_field-fieldname = 'USER7'.
it_field-seltext_l = 'Start Date'.
it_field-do_sum = 'X'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 4.
it_field-fieldname = 'USER8'.
it_field-seltext_l = 'End Date'.
it_field-do_sum = 'X'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 5.
it_field-fieldname = 'USER2'.
it_field-seltext_l = 'Location'.
it_field-do_sum = 'X'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
clear it_field.
it_field-col_pos = 6.
it_field-fieldname = 'USER0'.
it_field-seltext_l = 'Vertical'.
it_field-do_sum = 'X'.
it_field-outputlen = 20.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 7.
it_field-fieldname = 'USER1'.
it_field-seltext_l = 'Sub_vertical'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 8.
it_field-fieldname = 'USER3'.
it_field-seltext_l = 'Technology'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 9.
it_field-fieldname = 'USER6'.
it_field-seltext_l = 'Department'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 10.
it_field-fieldname = 'WORK'.
it_field-seltext_l = 'Onsite/Offshore'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 11.
it_field-fieldname = 'STR'.
it_field-seltext_l = 'T&M/FP'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 12.
it_field-fieldname = 'KOSTL'.
it_field-seltext_l = 'EMP COST'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 13.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'STAFF WELFARE'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 14.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'RECRUITMENT'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 15.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'TRAVELS'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 16.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'SUBCONTRACT'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 17.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'COMMUNICATION'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 18.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'RENT'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 19.
it_field-fieldname = 'KSTAR'.
it_field-seltext_l = 'BACKEND COST (PROJECT EXP)'.
it_field-outputlen = 10.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 20.
it_field-fieldname = 'ADDO'.
it_field-seltext_l = 'Direct costs'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 21.
it_field-fieldname = 'ADDO1'.
it_field-seltext_l = 'Income'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 22.
it_field-fieldname = 'PROFIT2'.
it_field-seltext_l = 'Profit(income-costs)'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 23.
it_field-fieldname = 'ADDK'.
it_field-seltext_l = 'Direct costs(Grp cur)'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 24.
it_field-fieldname = 'ADDK1'.
it_field-seltext_l = 'Income(Grp Cur)'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
it_field-col_pos = 25.
it_field-fieldname = 'PROFIT1'.
it_field-seltext_l = 'Profit(income-costs)'.
it_field-outputlen = 20.
it_field-do_sum = 'X'.
append it_field to it_field_t.
CLEAR it_field.
xlayout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 'ZPROJECT_PROFIT1'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE_PROFIT'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = xlayout
IT_FIELDCAT = it_field_t
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_DISPLAY1
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 it_field_t.
"it_display.
FORM USER_COMMAND using r_ucomm like sy-ucomm rs type slis_selfield.
include zinteractive_profit."Secondary list for calling KO03.
ENDFORM. "USER_COMMAND.
Thanks & Regards,
Lakshmi..Hi,
i did according to ur suggession.
now it is going dump.
and it is telling like this.
2629 i_event_name = 'SUBTOTAL_TEXT'
2630 is_subtottxt_info = ls_subtot_info
2631 ip_subtot_line = lr_data
2632 changing
2633 c_subtottxt = l_subtottxt.
2634 ls_lvc_data-value = l_subtottxt.
2635
2636 append ls_lvc_data to ct_lvc_data.
2637 endif.
2638
2639 ************************************
2640 * Column per Fieldcat Entry
2641 ************************************
2642 clear ls_lvc_data-style.
2643 loop at it_fcat_local assigning <ls_fcat>
2644 where tech ne 'X' and no_out ne 'X'.
2645 if l_invisible eq 'X'.
2646 clear l_invisible.
2647 if <ls_fcat>-do_sum is initial.
2648 continue.
2649 else.
2650 clear ls_lvc_data-col_pos.
2651 endif.
2652 endif.
2653
2654 add 1 to ls_lvc_data-col_pos.
2655
2656 assign component <ls_fcat>-fieldname
2657 of structure <ls_data> to <l_field_val
2658 if sy-subrc ne 0.
>>>>> message x000(0k).
2660 endif.
2661
2662 *... work on average
2663 if <ls_fcat>-do_sum eq 'C'.
2664 clear l_entries.
2665
2666 assign space to <l_unit>.
2667 if not <ls_fcat>-cfieldname is initial.
2668 assign component <ls_fcat>-cfieldname
2669 of structure <ls_data> to <l_unit>.
2670 endif.
2671 if not <ls_fcat>-qfieldname is initial.
2672 assign component <ls_fcat>-qfieldname
2673 of structure <ls_data> to <l_unit>.
2674 endif.
2675
2676 l_from = ls_grpl-index_from.
2677 l_to = ls_grpl-index_to.
2678 if ls_grpl-index_from is initial and
plz any of u help me to come out with solution.
Thanks & Regards,
Lakshmi.. -
Nee help on ALV report for Total of BSEG-BUZEI & F1 document in FB03
Hi friends,
I need to diplay line items total & when double clicked on BELNR field it should open the F1 document in FB03.
Could anyone plz guide me on this.
Waiting for response.
below is my code,
Kindly needed help.
REPORT YALV_1.
TABLES : BKPF,BSEG.
Data for ALV display
TYPE-POOLS: SLIS.
data : int_fcat type SLIS_T_FIELDCAT_ALV,
fieldcatalog type slis_t_fieldcat_alv with header line.
DATA: wa_sortinfo TYPE slis_sortinfo_alv,
i_sortcat TYPE slis_t_sortinfo_alv.
TYPES : BEGIN OF T_BKPF,
BUKRS TYPE BKPF-BUKRS,
BELNR TYPE BKPF-BELNR,
GJAHR TYPE BKPF-GJAHR,
BLART TYPE BKPF-BLART,
BLDAT TYPE BKPF-BLDAT,
BUDAT TYPE BKPF-BUDAT,
END OF T_BKPF.
types: begin of t_bseg,
BUZEI TYPE BSEG-BUZEI,
end of t_bseg.
DATA : it_bkpf TYPE STANDARD TABLE OF t_bkpf with header line,
wa_bkpf TYPE t_bkpf,
it_bseg type standard table of t_bseg.
wa_bseg type t_bseg.
field to store report name
DATA : i_repid like sy-repid.
select bukrs belnr gjahr blart bldat budat from bkpf into table
it_bkpf where blart = 'AA'.
field to check table length
*data i_lines like sy-tabix.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
PERFORM sortcat_init CHANGING i_sortcat.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but
*can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such
*as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'BUKRS'.
fieldcatalog-seltext_m = 'Company Code'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 4.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BELNR'.
fieldcatalog-seltext_m = 'Doc No'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'GJAHR'.
fieldcatalog-seltext_m = 'Fiscal Year'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLART'.
fieldcatalog-seltext_m = 'DOC Type'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BLDAT'.
fieldcatalog-seltext_m = 'Doc Date'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUDAT'.
fieldcatalog-seltext_m = 'Popsting Date'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'BUZEI'.
fieldcatalog-seltext_m = 'Line Items'.
fieldcatalog-col_pos = 6.
fieldcatalog-do_sum = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
FORM sortcat_init CHANGING i_sortcat TYPE slis_t_sortinfo_alv.
CLEAR wa_sortinfo.
wa_sortinfo-fieldname = 'BUKRS'.
wa_sortinfo-tabname = 'T_BKPF'.
wa_sortinfo-spos = 1. " First sort by this field.
wa_sortinfo-up = 'X'. " Ascending
wa_sortinfo-subtot = 'X'. " Subtotal at Name1
APPEND wa_sortinfo TO i_sortcat.
CLEAR wa_sortinfo.
wa_sortinfo-fieldname = 'BELNR'.
wa_sortinfo-tabname = 'T_BKPF'.
wa_sortinfo-spos = 2. " Sec sort by this field.
wa_sortinfo-up = 'X'. " Ascending
wa_sortinfo-subtot = 'X'. " Subtotal at Name1
APPEND wa_sortinfo TO i_sortcat.
ENDFORM. " sortcat_init
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
i_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_sort = i_sortcat
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = IT_BKPF
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 DATA_RETRIEVAL
form data_retrieval.
IF it_bkpf[] IS NOT INITIAL.
select buzei from bseg into
table it_bseg for all entries in it_bkpf
where bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr.
endif.
endform. " DATA_RETRIEVAL.Hello
1.
form display_alv_report.
i_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = IT_BKPF
exceptions
program_error = 1
others = 2.
2.
* FORM USER_COMMAND
FORM user_command USING u_com LIKE sy-ucomm sel_lin TYPE slis_selfield.
CASE u_com.
WHEN '&IC1'.
CASE sel_lin.
WHEN 'BELNR'.
read TABLE IT_BKPF INDEX sel_lin-tabindex.
SET PARAMETER ID 'BLN' FIELD IT_BKPF-BELNR.
SET PARAMETER ID 'BUK' FIELD IT_BKPF-BUKRS.
SET PARAMETER ID 'GJR' FIELD IT_BKPF-GJAHR.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDCASE.
CLEAR u_com.
ENDCASE.
ENDFORM. "USER_COMMAND -
Code for hr-abap report in alv display
Hi Gurus,
I am new to hr-abap and I want some sample code to display a hr report in an alv.
Thanks,
Raj.This is one such...
REPORT yh_rep_hr_certified_instructor MESSAGE-ID yh_messages NO STANDARD
PAGE
HEADING .
Program : YH_REP_HR_CERTIFIED_INSTRUCTOR *
Description : Certified Instructor Eligibility Criteria *
TABLES *
TABLES :hrp1000 ,hrp1001, pa0000.
TYPE-POOLS *
*Type Pool for ALV display
TYPE-POOLS :slis. " Global types for generic cunning components
INTERNAL TABLES *
*Internal Table to keep Selection Screen field values
DATA : BEGIN OF t_validation OCCURS 0.
INCLUDE STRUCTURE dynpread.
DATA END OF t_validation.
*Internal Table for Business Event Groups
DATA : BEGIN OF t_bgrp OCCURS 0,
objid TYPE hrobjid,
blank(1),
stext TYPE stext,
END OF t_bgrp.
*Internal Table for Business Event Type IDs with text for selected Event
*GROUPS
DATA : BEGIN OF t_btyp OCCURS 0,
objid TYPE hrobjid,
blank(1),
stext TYPE stext,
END OF t_btyp.
*Internal Table for Business Event Type IDs for selected Event Groups
DATA : BEGIN OF t_eventtypelist OCCURS 0,
objid TYPE hrobjid,
END OF t_eventtypelist.
*Internal table to store the business Groups
DATA : BEGIN OF t_group OCCURS 0,
objid LIKE hrp1001-objid,
sobid LIKE hrp1001-sobid,
sclas LIKE hrp1001-sclas,
END OF t_group.
*Internal table to hold the business event group and/or bus. event types
DATA : BEGIN OF t_eventgroup OCCURS 0,
objid LIKE hrp1001-objid,
END OF t_eventgroup.
*Internal Table for FieldCatalog used for ALV Display
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
*Work Area for Checking Business Event Group Validity
DATA: BEGIN OF wa_bgrp,
objid TYPE hrobjid,
stext TYPE stext,
END OF wa_bgrp.
*Internal table to fetch object id for Qualification
DATA: BEGIN OF t_objid OCCURS 0,
objid TYPE hrp1000-objid,
sobid TYPE hrp1001-sobid,
sobid_copy TYPE hrp1001-objid,
END OF t_objid.
*Internal table to fetch Id of related object
*Fetches Pernr of Certified Instructors
DATA: BEGIN OF t_sobid OCCURS 0,
objid TYPE hrp1000-objid,
sobid TYPE hrp1001-sobid,
adatanr TYPE hrpad31-adatanr,
sobid_copy TYPE hrp1001-objid,
END OF t_sobid.
*Internal table to fetch skill rating
*of the Instructor
DATA: BEGIN OF t_prof OCCURS 0,
adatanr TYPE hrpad31-adatanr,
chara TYPE hrpad31-chara,
END OF t_prof.
*Internal table to fetch grade
*of the Insturctor
DATA: BEGIN OF t_grade OCCURS 0,
pernr TYPE pa0008-pernr,
yysalgr TYPE pa0008-yysalgr,
END OF t_grade.
*Internal table which contains all information about the Person like
*Name Project Project Manager Name Account and Vertical Name
DATA: t_projdetails TYPE zbapi_projdetails OCCURS 0 WITH HEADER LINE.
*Final Internal table which contains all information
*about the Instructors
DATA: BEGIN OF t_final OCCURS 0,
empid TYPE pa0000-pernr,
empname(84) TYPE c,
grade TYPE pa0008-yysalgr,
atndttt(3) TYPE c,
sklrate TYPE hrpad31-chara,
pgmng TYPE pa0001-ename,
accname TYPE hrp1000-stext,
vertname TYPE hrp1000-stext,
END OF t_final.
VARIABLES *
*ALV layout
DATA: gs_layout TYPE slis_layout_alv, "alvtot test
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
gs_variant LIKE disvariant, "For Layout
g_save. "For Layout Save
DATA: w_pos TYPE i VALUE 1, " Position of Fields in ALV
w_sort TYPE slis_t_sortinfo_alv, "ITab for Sorting Options
w_flag TYPE i,
w_repid TYPE sy-repid,
w_lineno TYPE sy-tabix.
DATA: l_short TYPE hrp1000-short. "variable to check the heirarchy
SELECTION-SCREEN DESIGN *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. "NO INTERVALS .
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-009 MODIF ID xyz.
PARAMETERS : p_bgrp TYPE hrobjid OBLIGATORY,
p_bgrp1 TYPE stext .
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS :s_btyp FOR hrp1000-objid OBLIGATORY NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION *
INITIALIZATION.
*Assign Program Name into a variable
w_repid = sy-repid.
*Build layout for list display
gs_layout-detail_popup = 'X'.
*To get All Events in TOP-OF-PAGE
perform eventtab_build using gt_events[].
gs_variant-report = w_repid.
g_save = 'A'.
AT SELECTION SELECTION *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bgrp.
PERFORM get_bgrp.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_btyp-low.
IF NOT p_bgrp IS INITIAL .
PERFORM get_btyp USING 'l'.
ELSE .
MESSAGE s999 WITH text-e09.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_btyp-high.
IF NOT p_bgrp IS INITIAL .
PERFORM get_btyp USING 'h'.
ELSE .
MESSAGE s999 WITH text-e09.
ENDIF.
AT SELECTION-SCREEN ON p_bgrp.
SELECT SINGLE objid stext
FROM hrp1000
INTO wa_bgrp
WHERE objid = p_bgrp AND
otype = 'L' AND
plvar = '01' AND
( short = 'ROLE' OR
short = 'TECH_PROGRAM' ).
IF sy-subrc EQ 0.
p_bgrp1 = wa_bgrp-stext.
ELSE.
MESSAGE e999 WITH text-e09.
ENDIF.
AT SELECTION-SCREEN ON s_btyp.
CLEAR : t_eventtypelist, t_group, t_eventgroup.
REFRESH : t_eventtypelist, t_group, t_eventgroup.
CLEAR : w_flag.
*Fetch all the subordinates under given Event Group - L/D
SELECT objid
sobid
sclas
FROM hrp1001
INTO TABLE t_group
WHERE objid = p_bgrp
AND plvar = '01'
AND rsign = 'B'
AND relat = '003'
AND ( sclas = 'L' OR sclas = 'D' ).
WHILE w_flag <> 1.
PERFORM get_objids.
ENDWHILE.
IF NOT t_eventtypelist[] IS INITIAL.
*Get only valid Event Types from input Event Types, for given Event
*Group - by deleting others..
LOOP AT t_eventtypelist.
IF t_eventtypelist-objid IN s_btyp.
EXIT.
ELSE.
DELETE t_eventtypelist.
ENDIF.
AT LAST.
*since we r checking Event Types, All other fields will be locked
*but we need Event Group field to be unlocked to edit again,
*if theres no theres no valid Event Types in given input
LOOP AT SCREEN.
CHECK screen-name = 'P_bgrp'.
screen-input = '1'.
MODIFY SCREEN.
ENDLOOP.
MESSAGE e999 WITH text-e04.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
CHECK screen-name = 'P_bgrp'.
screen-input = '1'.
MODIFY SCREEN.
ENDLOOP.
MESSAGE e999 WITH text-e03.
ENDIF.
FORM get_bgrp *
FORM get_bgrp .
SELECT objid stext
FROM hrp1000
INTO CORRESPONDING FIELDS OF TABLE t_bgrp
WHERE plvar = '01' AND
otype = 'L' AND
short = 'ROLE' OR
short = 'TECH_PROGRAM' .
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = 75
endpos_row = 20
startpos_col = 30
startpos_row = 05
titletext = 'Select Business Event Group'
IMPORTING
choise = w_lineno
TABLES
valuetab = t_bgrp
EXCEPTIONS
break_off = 1
OTHERS = 2.
IF sy-subrc EQ 0 .
READ TABLE t_bgrp INDEX w_lineno.
IF sy-subrc EQ 0.
p_bgrp = t_bgrp-objid.
p_bgrp1 = t_bgrp-stext.
ENDIF .
CLEAR t_bgrp .
REFRESH t_bgrp .
ENDIF .
ENDFORM . "get_bgrp
****subroutine for business eventtype input criteria
FORM get_btyp USING f_range.
CLEAR : t_validation,
t_btyp,
t_eventtypelist,
t_group,
t_eventgroup,
w_flag.
REFRESH : t_validation,
t_btyp,
t_eventtypelist,
t_group,
t_eventgroup.
t_validation-fieldname = 'P_BGRP'.
APPEND t_validation.
CLEAR t_validation.
*Getting Screen Values
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = w_repid
dynumb = '1000'
TABLES
dynpfields = t_validation
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE t_validation WITH KEY fieldname = 'P_BGRP'.
IF NOT t_validation-fieldname IS INITIAL.
*Getting Event Group ID that entered
LOOP AT t_validation.
IF t_validation-fieldname = 'P_BGRP'.
p_bgrp = t_validation-fieldvalue.
ENDIF.
ENDLOOP.
CLEAR t_validation.
REFRESH t_validation.
*To fetch the business event groups and business event types that belong
to the input business event group.Since a business group can have a
*business groups as well as business event types we have pick all of
*them
*Getting all subordinates - Event Group/Type under given Event Group
SELECT objid
sobid
sclas
FROM hrp1001
INTO TABLE t_group
WHERE objid = p_bgrp
AND plvar = '01'
AND rsign = 'B'
AND relat = '003'
AND endda = '99991231'
AND ( sclas = 'L' OR sclas = 'D' ).
*Getting all Event Types
WHILE w_flag <> 1.
PERFORM get_objids.
ENDWHILE.
IF NOT t_eventtypelist[] IS INITIAL.
SORT t_eventtypelist BY objid.
*Getting Names of Event Types
SELECT objid
stext
FROM hrp1000
INTO CORRESPONDING FIELDS OF TABLE t_btyp
FOR ALL ENTRIES IN t_eventtypelist
WHERE objid = t_eventtypelist-objid
AND otype = 'D' AND plvar = '01'
AND endda = '99991231'.
IF sy-subrc = 0.
*PopUp Display for Event Types
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = 75
endpos_row = 20
startpos_col = 30
startpos_row = 05
titletext = 'Select Business Event Type ID'
IMPORTING
choise = w_lineno
TABLES
valuetab = t_btyp
EXCEPTIONS
break_off = 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.
ELSE.
*Since the Table returned by function module will have data in Header,
*clear the Header
*Retreive Selected Event Type into Select Option
READ TABLE t_btyp INDEX w_lineno.
IF sy-subrc EQ 0.
IF f_range = 'l'.
s_btyp-low = t_btyp-objid.
ELSE.
s_btyp-high = t_btyp-objid.
ENDIF.
ENDIF.
ENDIF.
ELSE.
MESSAGE s999 WITH text-e03.
ENDIF.
ELSE.
MESSAGE s999 WITH text-e01.
ENDIF.
ENDIF.
ENDFORM. " EVNTTY
FORM get_objids *
FORM get_objids.
*To delete the business event types that are found and push it in
*another table
IF NOT t_group[] IS INITIAL.
LOOP AT t_group.
*If event type
IF t_group-sclas = 'D'.
t_eventtypelist-objid = t_group-sobid.
APPEND t_eventtypelist.
CLEAR t_eventtypelist.
DELETE t_group.
*If event group
ELSEIF t_group-sclas = 'L'.
t_eventgroup-objid = t_group-sobid.
APPEND t_eventgroup.
CLEAR t_eventgroup.
DELETE t_group.
CLEAR t_group.
ENDIF.
ENDLOOP.
ELSE.
w_flag = 1.
ENDIF.
IF NOT t_eventgroup[] IS INITIAL.
*To get the second level of business groups and business event type
SELECT objid sobid sclas
FROM hrp1001
INTO TABLE t_group
FOR ALL ENTRIES IN t_eventgroup
WHERE objid = t_eventgroup-objid
AND plvar = '01'
AND rsign = 'B'
AND relat = '003'
AND endda = '99991231'
AND ( sclas = 'L' OR sclas = 'D' ).
CLEAR t_eventgroup.
REFRESH t_eventgroup.
ENDIF.
ENDFORM. " GET_OBJIDS
Start of Selection *
START-OF-SELECTION.
*Pass the Event Type and fetch the Related Id
*for the Qualification imparted by the Event
SELECT objid sobid
FROM hrp1001
INTO TABLE t_objid
WHERE objid IN s_btyp AND
otype = 'D' AND
plvar = '01' AND
relat = '028' AND
rsign = 'A' AND
sclas = 'Q'.
IF sy-subrc EQ 0.
*Pass the Qualification Id and fetch Object Id of the
*person who fulfills this Qualification
SELECT objid sobid adatanr
FROM hrp1001
INTO TABLE t_sobid FOR ALL ENTRIES IN t_objid
WHERE sobid = t_objid-sobid AND
otype = 'P' AND
plvar = '01' AND
relat = '032' AND
rsign = 'A' AND
sclas = 'Q' .
IF sy-subrc = 0.
*Fetch only the Person along with the skillrating
*who has skill rating as '0001' or '0003'
SELECT adatanr chara
FROM hrpad31
INTO TABLE t_prof
FOR ALL ENTRIES IN t_sobid
WHERE adatanr = t_sobid-adatanr AND
( chara = '0001' OR chara = '0003' ).
IF sy-subrc NE 0.
MESSAGE s999 WITH text-s01.
EXIT .
ELSE .
*Fetch only Employee Id's who meets the required skill rating
*which inturn has the EMPID who are all are Certified Instructors
LOOP AT t_sobid.
READ TABLE t_prof WITH KEY adatanr = t_sobid-adatanr.
IF sy-subrc NE 0.
DELETE t_sobid .
ENDIF.
ENDLOOP.
SORT t_sobid BY objid.
DELETE ADJACENT DUPLICATES FROM t_sobid.
ENDIF.
ENDIF.
ENDIF.
IF NOT t_sobid[] IS INITIAL.
data: begin of it_trgpernr occurs 0,
objid type hrp1000-objid,
sobid type hrp1001-sobid,
end of it_trgpernr.
select objid sobid
from hrp1001
into table it_trgpernr for all entries in t_sobid
where otype ='P' and
objid = t_sobid-objid and
sclas = 'D' and
sobid = '50008220'.
*Fetch Grade of the Certified Instructors by passing their EmpId's
SELECT pernr yysalgr
FROM pa0008
INTO TABLE t_grade
FOR ALL ENTRIES IN t_sobid
WHERE pernr = t_sobid-objid AND endda = '99991231'.
ENDIF.
For Heading in the Output Display Layout
PERFORM heading USING gt_list_top_of_page[].
End of Selection *
END-OF-SELECTION.
Populating data into Final Table which contains all information aboutthe Certified Instructors
*Retrieve Employee Id for the Certified Instructors only if he is active
LOOP AT t_sobid.
SELECT SINGLE *
FROM pa0000
WHERE pernr = t_sobid-objid AND
begda <= sy-datum AND
endda >= sy-datum AND
stat2 ='3'.
IF sy-subrc = 0.
t_final-empid = t_sobid-objid.
SELECT SINGLE *
FROM hrp1001
WHERE otype = 'P' AND
objid = t_sobid-objid AND
rsign = 'B' AND
relat = '25' AND
sclas = 'D' AND
sobid = '50008220'.
*DATA:W_SOBID TYPE HRP1001-SOBID.
*W_SOBID = t_sobid-objid. .
SELECT SINGLE *
FROM hrp1001
WHERE otype = 'D' AND
objid = '50008220' AND
rsign = 'B' AND
relat = '25' AND
sclas = 'P' AND
sobid = W_SOBID.
IF sy-subrc EQ 0.
t_final-atndttt = 'YES'.
ELSE.
t_final-atndttt = 'NO'.
ENDIF.
*Retrieve Employee SkillRating for the Certified Instructors
*by passing the adatanr value which inturn is fetched based on the empid
READ TABLE t_prof WITH KEY adatanr = t_sobid-adatanr.
IF sy-subrc EQ 0.
t_final-sklrate = t_prof-chara.
ENDIF.
*Retrieve Employee Grade for the given id
READ TABLE t_grade WITH KEY pernr = t_sobid-objid.
IF sy-subrc EQ 0.
t_final-grade = t_grade-yysalgr.
ENDIF.
REFRESH t_projdetails.
CLEAR t_projdetails.
*function which fetches the name project name account and
*vertical name of the person for the given empid
CALL FUNCTION 'ZBAPI_PROJDETAILS'
EXPORTING
pernr = t_sobid-objid
TABLES
it_finaltab = t_projdetails.
IF NOT t_projdetails[] IS INITIAL.
SHIFT t_sobid-objid LEFT DELETING LEADING '0'.
READ TABLE t_projdetails WITH KEY pernr = t_sobid-objid.
IF sy-subrc EQ 0.
t_final-empname = t_projdetails-ename.
IF NOT t_projdetails-proj IS INITIAL.
t_final-pgmng = t_projdetails-pmname.
ELSE.
t_final-pgmng = t_projdetails-gmname.
ENDIF.
t_final-accname = t_projdetails-accname.
t_final-vertname = t_projdetails-vertname.
ENDIF.
ENDIF.
APPEND t_final.
ENDIF.
CLEAR t_final.
ENDLOOP.
SORT t_final BY empid.
DELETE ADJACENT DUPLICATES FROM t_final.
*Enabling Sort by PERNR & Global ID in ALV display
PERFORM sub_sort_info.
*Form to Populate Field Catalog
PERFORM populate_fieldcatalog.
For the ALV ROW Optimize Width
gs_layout-colwidth_optimize = 'X' .
*perform alv_display tables final fieldcatalog.
IF NOT t_final[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = gs_layout
it_fieldcat = t_fieldcatalog[]
it_sort = w_sort
i_save = 'A'
it_events = gt_events[]
TABLES
t_outtab = t_final
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.
ELSE.
MESSAGE s000(vz) WITH 'No Records found for Given Input Criteria'.
ENDIF.
TOP OF PAGE *
*Outputs formatted simple header information at TOP-OF-PAGE.
TOP-OF-PAGE.
PERFORM top_of_page.
Subroutines *
*& Form eventtab_build
text`
-->P_GT_EVENTS[] text
FORM eventtab_build USING rt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
DATA: g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE g_top_of_page TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. " eventtab_build
*& Form HEADING
text
FORM heading USING lt_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
*Layout Display Text - "Caritor ( India ) Pvt.Ltd "
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = text-h01.
APPEND ls_line TO lt_top_of_page.
*Layout Display Text - "Certified Instructor Eligibility List "
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = text-h02.
APPEND ls_line TO lt_top_of_page.
ENDFORM. " HEADING
*& Form top_of_page
text
--> p1 text
<-- p2 text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM. " top_of_page
*& Form sub_sort_info
text
--> p1 text
<-- p2 text
FORM sub_sort_info.
DATA : l_sort TYPE slis_sortinfo_alv .
CLEAR l_sort.
Employee ID
l_sort-fieldname = 'EMPID'.
l_sort-up = 'X'.
APPEND l_sort TO w_sort.
ENDFORM. " sub_sort_info
*& Form populate_fieldcatalog
text
--> p1 text
<-- p2 text
FORM populate_fieldcatalog.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'EMPID' ' ' text-011 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'EMPNAME' ' ' text-002 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'GRADE' ' ' text-003 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'ATNDTTT' ' ' text-004 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'PGMNG' ' ' text-006 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'ACCNAME' ' ' text-007 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'VERTNAME' ' ' text-008 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'SKLRATE' ' ' text-005 20 w_pos.
ENDFORM. " populate_fieldcatalog
*& Form FILL_FIELDS_OF_FIELDCATALOG
text
-->P_T_FIELDCATALOG text
-->P_0870 text
-->P_0871 text
-->P_0872 text
-->P_TEXT_001 text
-->P_20 text
-->P_W_POS text
FORM fill_fields_of_fieldcatalog TABLES fp_t_fieldcatalog STRUCTURE
t_fieldcatalog
USING fp_table
fp_field
fp_key
fp_text
fp_out_len
fp_pos.
fp_t_fieldcatalog-tabname = fp_table.
fp_t_fieldcatalog-fieldname = fp_field.
fp_t_fieldcatalog-seltext_l = fp_text.
fp_t_fieldcatalog-key = fp_key.
fp_t_fieldcatalog-outputlen = fp_out_len.
fp_t_fieldcatalog-col_pos = fp_pos.
APPEND fp_t_fieldcatalog.
CLEAR: fp_t_fieldcatalog.
fp_pos = fp_pos + 1.
ENDFORM. " FILL_FIELDS_OF_FIELDCATALOG
10.249.11.136\SAP-StudyMaterial
Maybe you are looking for
-
After sinc-ing my ipod touch with my MacBok Pro, Skype icon on ipod touch does not open to Skype communication community service. I tried to download Skype from Apps Store using itunes, but received message that i need iOS 4.3...What should i do? how
-
Problem with ADE, IE8 and Windows 7?
Encountering issues downloading ADE eBooks using IE8 in Windows 7? Is this a known issue and are there any fixes? Error states "Unable to Download. Unspecified Error."
-
Location of DW CS3 files on a Mac
I am running Dreamweaver CS3 on a Mac Pro running OSX 10.4 Tiger. I am about to upgrade to 10.5 Leopard and I want to do a clean install of all my CS3 products. I will have a full backup of my HD and I want to copy all my preferences for CS3 software
-
Illustrator file missing objects when placed in InDesign
I created an Illustrator file that has text converted to outlines. Some of it is white and some of it is other colors. When I save the file as eps, pdf or export as jpg and then place the files in InDesign, the white outlined text doesn't show up. Ad
-
Spotlight doesn't search Entourage 2004 email
Spotlight searches don't include Entourage email files, only Apple Mail email files. Spotlight in Tiger showed both. I don't see any pref to include Entourage (only exclusions, where it isn't listed).