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
Similar Messages
-
Bex query for BW abap report/ transaction
Hi Experts, Here is a scenario: I developed ABAP program in BW using multiple DSOs for complex logic. Since I cannot use abap program directly in BO reports, I need to develop a query in BW for my abap program. Is it possible to develop a bex query for BW abap report / transaction in BW? I have limited knowledge on BW and BO. Please help me. Thanks in advance Raghu
First of all thanks for your suggestion Matthew..!
As you said, I created virtual info cube based on function module.
In the info cube, I defined (4)dimensions and (1)key figure.
In the fucntion module, appropriate below parameters defined and code written for the data table (e_t_data)
CALL ZFM_XXXXXXX
EXPORTING
i_infoprov = " Name of InfoProvider
i_th_sfc = " rsdri_th_sfc: List of Characteristics
i_th_sfk = " rsdri_th_sfk: List of Key Figures
* i_t_range = " rsdri_t_range: Range List
* i_tx_rangetab = " rsdri_tx_rangetab: Table from Range List
* i_first_call = " rs_bool First Call
* i_packagesize = 100000 " i Package Size
IMPORTING
e_t_data = " standard table: Data Table
e_end_of_data = " rs_bool :End of Data Reached
e_t_msg = " rs_t_msg : BW: Table with Messages
Test:
Right click the info cube and choose "displayed data", immediately it triggered above function module.
when I see the import parameters data,
no characteristcs data in i_th_sfc. But, key figures has data (1 record) in i_th_sfk.
Not sure, Did I missed anything? Please help me.
Thanks in advance -
How to write code for totals and subtotals in alv programing?
how to write code for totals and subtotals in alv programing?
hi,
1. <u><b>TOTAL.</b></u>
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
2. <u><b>How do I add subtotals</b></u>
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
Regards
Anver -
Transaction code for SAP query reports
Hi All,
I am trying to create transaction code for sap query report but couldn't go further.
1) Created User group in SQ03
2) Created infoset in SQ03 and assigned that to the user group
3) Created query in SQ01 using the infoset.
I executed the report in SQ01 and it is working fine.
Now I try to create a transaction code in SE93 using the steps mentioned in the following link:
Assign transaction code to SAP Query (created via SQ01)
But when try to execute the report using the transaction code, it is giving error message 'User group xxxxxx is not yet created'
Could any one advice me if I miss something? Or please help me to create this transaction code and transport to production?
Thanks in advanceHI,
based on the thread you've already mentioned:
In SE93, Create a Paramter Transaction
-> Transaction = Start_report
-> In default values, give the below details:
D_SREPOVARI-REPORTTYPE = AQ
D_SREPOVARI-EXTDREPORT = Name of the Query
D_SREPOVARI-REPORT = User Group
So check if the user group is typed correct in SE93 and check also if the user group exits in the system where you are trying to run the transaction.
best regards, Christian -
How to get Transaction code for SAP standard report painter in FI
Hi All -
Please let me know, How to get the transaction code for Standard SAP report painter / report writer in FI module.
These report painters are created thru GR51...
Thanks,
KannanPlease refer to [Creating Transaction Code For Report Painter Reports|http://www.google.com/url?sa=t&source=web&ct=res&cd=1&ved=0CAgQFjAA&url=http%3A%2F%2Fdap-consulting.com%2Fyahoo_site_admin%2Fassets%2Fdocs%2FReport_Painter_Reports.47142031.pdf&ei=MiWYS5ilCYeOlAfn4pCGDQ&usg=AFQjCNEZ0YO6vJ97K24MbU_NI5ROTb5vJA&sig2=Ke-svnqddqrz8RMcTuEnaw].
-
How to Call another screen using the ABAP Report which is displaying ALV ou
Hello All,
I am developing a ABAP report in which I want to transfer the stock from material to another material.
My Report will include 3 to screens.
The first sleection screen will display all the material with their stock value.
When we execute the report I will get the list of materials along with their current stock. On the top of the output screen I want the Execute button. Also , each line of the output should have checkbox or the ALV provides the functionality of editing one cell like that.....Once the user tick the checkbox or the cell....then I want to move to another screen where user can enter the Quantity and then user will tick ok and then I will call one function module so that the material documnet is posted and transfer of posting form material to material is done successfully.
Could anyone please help me out how to call another screen from the output screen where user can enter the Quantity amount....
I dont want to use the Dialog programming.....I want to create the simple ALV Abap report.
Regards,
Komal Bhutada.Hi Raymond,
Thanks for the input...I will try this in my code .....
Can you please help me how to insert the checkbox in the ALV Output....so that I can select one of row and then press execute to process further?..
Thanks for the information.
Regards,
Komal. -
ABAP code for creating a report variant
Hi,
I would like to create parameter on selection screen type SLIS_VARI. I would like that the program will start with pre-defined variant in ALV grid, the same as it is on standard stock report (MB52)...
Can someone tell me how to do this, and where to put the code?
Thanks in advance,
SasoHi,
This is the code for variant as parameter and F4 help.
DATA: g_repid LIKE sy-repid,
g_dynnr LIKE sy-dynnr.
DATA: g_save(1) TYPE c VALUE 'A',
g_exit(1) TYPE c,
gx_variant LIKE disvariant,
g_variant LIKE disvariant.
PARAMETERS: p_vari LIKE disvariant-variant.
INITIALIZATION.
g_repid = sy-repid.
g_dynnr = sy-dynnr.
PERFORM variant_init.
*Get default variant
gx_variant = g_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gx_variant-variant.
ENDIF.
AT SELECTION SCREEN *
AT SELECTION-SCREEN.
*--PAI of selection screen
PERFORM pai_of_selection_screen.
*---F4 option for report variant
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
SUB-ROUTINES *
FORM variant_init.
CLEAR g_variant.
g_variant-report = g_repid.
ENDFORM. " variant_init
FORM pai_of_selection_screen.
IF NOT p_vari IS INITIAL.
MOVE g_variant TO gx_variant.
MOVE p_vari TO gx_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant.
g_variant = gx_variant.
ELSE.
PERFORM variant_init.
ENDIF.
ENDFORM. " pai_of_selection_screen
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
IMPORTING
e_exit = g_exit
es_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF g_exit = space.
p_vari = gx_variant-variant.
ENDIF.
ENDIF.
AND pass this gx_variant to ALV Function module.
Rewards points if helpful.
Regards,
Srinivas ch -
Bar code Generation in ABAP report
Hi,
Can anyone help me on how to generate bar code in ABAP report output.
My exact requirement in the exisiting 'Z' report,I need to generate Bar code for Sales order which is displaying in report output.Buisness will scan and they will use for further processing.The Device type is HPLJ5SI printer.
If possible please provide code for generating Bar code in ABAP report.
Since its very urgent, if anyone provide solution quickly it will be great helpful.
Thanks,
Senthilinternal table validation
Check here mate, should be helpful.
Mano sri -
I need a code for VENDOR AGEING REPORT
plz help me i am in urgent need of source code of
VENDOR AGEING REPORT.
if any body help me regarding this above report i will be
great ful to him/her.
bcoz deadline is today.
i need ur urgent help, i treid very much but i failed,
so hope help from anybody there.REPORT zvender_os NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 65.
Tables
TABLES: bsik, "open items (A/C: Secondary Index for Customers)
lfa1, "customer master
lfb1,
rf140, "temp stru (Work Fields for Corrence(SAPF140*))
bsak, "cleared items (A/c Secnd Index for Cust(Clrms))
skat.
constants and variables
TYPE-POOLS: slis.
DATA: fieldcat TYPE slis_t_fieldcat_alv,
fieldcat1 TYPE slis_t_fieldcat_alv,
fieldcat_ln TYPE slis_fieldcat_alv,
layout_in TYPE slis_layout_alv,
layout_in1 TYPE slis_layout_alv,
sortcat TYPE slis_t_sortinfo_alv,
sortcat1 TYPE slis_t_sortinfo_alv,
sortcat_ln LIKE LINE OF sortcat,
eventcat1 TYPE slis_t_event,
eventcat TYPE slis_t_event,
eventcat_ln LIKE LINE OF eventcat,
col_pos TYPE i.
DATA: targ_month(2) TYPE n, "0001
targ_year(4) TYPE n, "0001
targ_mth_abs TYPE p, "0001
doc_month(2) TYPE n, "0001
doc_year(4) TYPE n, "0001
doc_mth_abs TYPE p, "0001
mth_result TYPE p, "0001
doc_days TYPE p,
targ_days TYPE p,
addl_days TYPE p,
ext_days TYPE p,
v_days(3) TYPE c,
v_kkber LIKE knkk-kkber.
DATA:
BEGIN OF inrec OCCURS 1000, "0001
lifnr LIKE bsik-lifnr,
belnr LIKE bsik-belnr,
gjahr LIKE bsik-gjahr,
bldat LIKE bsik-bldat,
xblnr LIKE bsik-xblnr,
blart LIKE bsik-blart,
sgtxt LIKE bsik-sgtxt,
shkzg LIKE bsik-shkzg,
dmbtr LIKE bsik-dmbtr,
zfbdt LIKE bsik-zfbdt,
zbd1t LIKE bsik-zbd1t,
zbd2t LIKE bsik-zbd2t,
zbd3t LIKE bsik-zbd3t,
zuonr LIKE bsik-zuonr,
END OF inrec.
DATA:
BEGIN OF inrect OCCURS 1000, "0001
lifnr LIKE bsik-lifnr,
belnr LIKE bsik-belnr,
gjahr LIKE bsik-gjahr,
bldat LIKE bsik-bldat,
xblnr LIKE bsik-xblnr,
blart LIKE bsik-blart,
sgtxt LIKE bsik-sgtxt,
shkzg LIKE bsik-shkzg,
dmbtr LIKE bsik-dmbtr,
zfbdt LIKE bsik-zfbdt,
zbd1t LIKE bsik-zbd1t,
zbd2t LIKE bsik-zbd2t,
zbd3t LIKE bsik-zbd3t,
zuonr LIKE bsik-zuonr,
END OF inrect,
BEGIN OF t_item OCCURS 1000, " 0001
lifnr LIKE bsik-lifnr,
belnr LIKE bsik-belnr,
gjahr LIKE bsik-gjahr,
bldat LIKE bsik-bldat,
xblnr LIKE bsik-xblnr,
blart LIKE bsik-blart,
sgtxt LIKE bsik-sgtxt,
zfbdt LIKE bsik-zfbdt,
dmbtr LIKE bsik-dmbtr,
days(3) TYPE c,
zuonr LIKE bsik-zuonr,
END OF t_item,
t_line LIKE t_item OCCURS 1000 WITH HEADER LINE, " 0001
BEGIN OF itab OCCURS 1000,
lifnr LIKE lfa1-lifnr,
total LIKE bsik-dmbtr,
zfuture LIKE bsik-dmbtr,
zcurrent LIKE bsik-dmbtr,
crbal LIKE bsik-dmbtr,
30days LIKE bsik-dmbtr,
60days LIKE bsik-dmbtr,
90days LIKE bsik-dmbtr,
99days LIKE bsik-dmbtr,
120days LIKE bsik-dmbtr,
180days LIKE bsik-dmbtr,
365days LIKE bsik-dmbtr,
bzirk LIKE knvv-bzirk,
vkbur LIKE knvv-vkbur,
vwerk LIKE knvv-vwerk,
vkgrp LIKE knvv-vkgrp,
klimk LIKE knkk-klimk,
cashd LIKE knkk-cashd,
grupp LIKE knkk-grupp,
erdat LIKE lfa1-erdat,
name1 LIKE lfa1-name1,
name2 LIKE lfa1-name2,
stras LIKE lfa1-stras,
ort01 LIKE lfa1-ort01,
telf1 LIKE lfa1-telf1,
psort(10),
sperr LIKE lfa1-sperr,
totsal LIKE bsik-dmbtr,
txt50 LIKE skat-txt50,
gsber LIKE bsik-gsber,
END OF itab.
DATA: sel_tab TYPE TABLE OF rsparams WITH HEADER LINE,
p_debit(1) TYPE c,
p_credit(1) TYPE c.
DATA: t_variant LIKE disvariant OCCURS 0 WITH HEADER LINE.
parameters and select-options
SELECTION-SCREEN BEGIN OF BLOCK blck0 WITH FRAME TITLE text-002.
PARAMETERS: stida LIKE sy-datum DEFAULT sy-datum OBLIGATORY,
p_bukrs LIKE t001-bukrs DEFAULT 'PIIL' MEMORY ID buk
OBLIGATORY.
P_BUKRS LIKE T001-BUKRS DEFAULT 'CC01' OBLIGATORY. "0003
SELECT-OPTIONS: s_lifnr FOR bsik-lifnr ,
s_vkbur FOR knvv-vkbur,
s_vkgrp FOR knvv-vkgrp,
s_bzirk FOR knvv-bzirk,
s_konda FOR knvv-konda,
s_kdgrp FOR knvv-kdgrp NO-DISPLAY ,
s_kvgr2 FOR knvv-kvgr2 NO-DISPLAY ,
s_kkber FOR knkk-kkber NO-DISPLAY ,
s_grupp FOR knkk-grupp NO-DISPLAY ,
s_ctlpc FOR knkk-ctlpc,
s_akont FOR lfb1-akont,
s_gsber FOR bsik-gsber.
PARAMETERS: p_future AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK blck0.
SELECTION-SCREEN BEGIN OF BLOCK blck1 WITH FRAME TITLE text-002.
PARAMETERS: p_abs RADIOBUTTON GROUP zrad,
p_due RADIOBUTTON GROUP zrad DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK blck1.
*SELECTION-SCREEN BEGIN OF BLOCK blck2 WITH FRAME TITLE text-003.
*PARAMETERS: c_run RADIOBUTTON GROUP zrac DEFAULT 'X',
c_blk RADIOBUTTON GROUP zrac,
c_all RADIOBUTTON GROUP zrac.
*SELECTION-SCREEN END OF BLOCK blck2.
*SELECTION-SCREEN BEGIN OF BLOCK blck3 WITH FRAME TITLE text-004.
*PARAMETERS: p_debit AS CHECKBOX DEFAULT 'X' ,
p_credit AS CHECKBOX DEFAULT 'X' NO-DISPLAY,
*selection-screen end of block blck3.
start-of-selection.
START-OF-SELECTION.
PERFORM BUILD_EVENTCAT.
p_debit = 'X'.
p_credit = 'X'.
PERFORM get_customer_invoices.
filter records based on selection criteria
PERFORM filter_records.
END-OF-SELECTION.
PERFORM add_sort_field.
PERFORM modify_field.
PERFORM write_report.
*& Form FILTER_RECORDS
To collect all the required data from DB and store them in
internal table.
--> p1 text
<-- p2 text
FORM filter_records.
delete records based on selection criteria
LOOP AT itab.
SELECT vkbur vkgrp vwerk erdat konda kdgrp bzirk kvgr2
INTO (itab-vkbur, itab-vkgrp, itab-vwerk, knvv-erdat,
knvv-konda, knvv-kdgrp,itab-bzirk,knvv-kvgr2)
FROM knvv WHERE lifnr = itab-lifnr
ORDER BY erdat DESCENDING.
AKS :- Not Required for PI
CASE itab-vkbur.
WHEN 'SA1'.
itab-vkbur = 'SF25'.
WHEN 'QLD1'.
itab-vkbur = 'SF23'.
WHEN 'WA1'.
itab-vkbur = 'SF26'.
ENDCASE.
AKS.
EXIT.
ENDSELECT.
IF itab-vkbur IN s_vkbur AND
itab-vkgrp IN s_vkgrp AND
knvv-konda IN s_konda AND
knvv-kdgrp IN s_kdgrp AND
itab-bzirk IN s_bzirk AND
knvv-kvgr2 IN s_kvgr2.
ELSE.
DELETE itab.
CONTINUE.
ENDIF.
SELECT SINGLE klimk grupp cashd
INTO (itab-klimk, itab-grupp, itab-cashd)
FROM knkk WHERE lifnr = itab-lifnr
AND kkber IN s_kkber
AND ctlpc IN s_ctlpc
AND grupp IN s_grupp.
IF SY-SUBRC NE 0.
DELETE ITAB.
CONTINUE.
ENDIF.
SELECT SINGLE skat~txt50
INTO (itab-txt50)
FROM lfb1 INNER JOIN skat
ON lfb1akont EQ skatsaknr
WHERE lfb1~lifnr = itab-lifnr
AND lfb1~akont IN s_akont
AND skat~spras EQ 'EN'.
IF sy-subrc NE 0.
DELETE itab.
CONTINUE.
ENDIF.
SELECT SINGLE name1 name2 telf1 erdat stras ort01 sperr
INTO (itab-name1, itab-name2, itab-telf1,
itab-erdat, itab-stras, itab-ort01, itab-sperr )
FROM lfa1
WHERE lifnr = itab-lifnr
IF sy-subrc NE 0 .
DELETE itab.
CONTINUE.
ENDIF.
AKS For Filteration of Customer base on Block Area.
IF c_all NE 'X'.
IF c_run EQ 'X' AND itab-sperr EQ 'X'.
DELETE itab.
CONTINUE.
ELSE.
IF c_blk EQ 'X' AND itab-sperr NE 'X'.
DELETE itab.
CONTINUE.
ENDIF.
ENDIF.
ENDIF.
MODIFY itab.
ENDLOOP.
ENDFORM. " FILTER_RECORDS
*& Form GET_CUSTOMER_INVOICES
text
--> p1 text
<-- p2 text
FORM get_customer_invoices.
DATA:ztotcre LIKE bsik-dmbtr.
DATA:ztotsal LIKE bsik-dmbtr.
DATA: fsdate LIKE sy-datum.
DATA: l_perio(4) TYPE c.
MOVE stida TO rf140-stida.
MOVE rf140-stida+4(2) TO targ_month.
MOVE rf140-stida+0(4) TO targ_year.
MOVE rf140-stida+6(2) TO targ_days.
targ_mth_abs = ( targ_year * 12 ) + targ_month.
CALL FUNCTION 'ZGET_PERIOD_FROM_DATE'
EXPORTING
i_date = stida
IMPORTING
e_perio = l_perio.
CONCATENATE l_perio '0401' INTO fsdate.
select open items.
IF p_due EQ 'X'.
SELECT lifnr belnr gjahr bldat xblnr blart sgtxt " 0001
shkzg dmbtr zfbdt zbd1t zbd2t zbd3t
zuonr
FROM bsik INTO TABLE inrect
WHERE bukrs = p_bukrs
AND budat LE stida
AND lifnr IN s_lifnr
AND gsber IN s_gsber
AND umskz NE 'T'
AND umskz NE 'F'
AND umskz NE 'R'
AND umskz NE 'P'
AND umskz NE 'J'
AND umskz NE 'L'.
LOOP AT INREC.
IF INREC-SHKZG = 'H'.
INREC-DMBTR = INREC-DMBTR * -1.
ENDIF.
MOVE-CORRESPONDING INREC TO T_ITEM. " 0001
PERFORM COLLECT_INVOICE USING INREC-lifnr INREC-DMBTR
INREC-ZFBDT INREC-ZBD1T
INREC-ZBD2T INREC-ZBD3T.
APPEND T_ITEM.
CLEAR T_ITEM.
ENDLOOP.
LOOP AT inrect.
inrec-lifnr = inrect-lifnr.
inrec-belnr = inrect-belnr.
inrec-gjahr = inrect-gjahr.
inrec-bldat = inrect-bldat.
inrec-xblnr = inrect-xblnr.
inrec-blart = inrect-blart.
inrec-sgtxt = inrect-sgtxt.
inrec-shkzg = inrect-shkzg.
inrec-dmbtr = inrect-dmbtr.
CALL FUNCTION 'NJ_CAL_DATE_IN_INTERVAL'
EXPORTING
date = inrect-zfbdt
days = inrect-zbd1t
months = 00
signum = '+'
years = 00
IMPORTING
calc_date = inrec-zfbdt.
inrec-zbd1t = inrect-zbd1t.
inrec-zbd2t = inrect-zbd2t.
inrec-zbd3t = inrect-zbd3t.
inrec-zuonr = inrect-zuonr.
APPEND inrec.
CLEAR inrec.
ENDLOOP.
ELSE.
SELECT lifnr belnr gjahr bldat xblnr blart sgtxt " 0001
shkzg dmbtr zfbdt zbd1t zbd2t zbd3t
zuonr
FROM bsik INTO TABLE inrec
WHERE bukrs = p_bukrs
AND budat LE stida
AND lifnr IN s_lifnr
AND gsber IN s_gsber
AND umskz NE 'T'
AND umskz NE 'F'
AND umskz NE 'R'
AND umskz NE 'P'
AND umskz NE 'J'
AND umskz NE 'L'.
ENDIF.
SORT inrec BY lifnr shkzg zfbdt .
LOOP AT inrec.
AT NEW lifnr.
For Customers Credit Balance Transaction to be display in Report
End of Credit Balance
ztotcre = 0.
ztotsal = 0.
ENDAT.
IF inrec-shkzg = 'H'.
inrec-dmbtr = inrec-dmbtr * -1.
ztotcre = ztotcre + inrec-dmbtr.
ELSE.
IF inrec-blart = 'RV'.
IF inrec-bldat GE fsdate.
ztotsal = ztotsal + inrec-dmbtr.
ENDIF.
ENDIF.
ztotcre = ztotcre + inrec-dmbtr.
endif.
IF p_debit EQ 'X'.
IF ztotcre > 0.
MOVE-CORRESPONDING inrec TO t_item. " 0001
PERFORM collect_invoice USING inrec-lifnr ztotcre
inrec-zfbdt inrec-zbd1t
inrec-zbd2t inrec-zbd3t
ztotsal.
APPEND t_item.
CLEAR t_item.
ztotcre = 0.
ztotsal = 0.
ENDIF.
ENDIF.
ENDIF.
IF p_credit EQ 'X'.
AT END OF lifnr.
IF ztotcre < 0.
MOVE-CORRESPONDING inrec TO t_item. " 0001
PERFORM collect_invoice USING inrec-lifnr ztotcre
inrec-zfbdt inrec-zbd1t
inrec-zbd2t inrec-zbd3t
ztotsal.
APPEND t_item.
CLEAR t_item.
ztotcre = 0.
ztotsal = 0.
APPEND t_item.
CLEAR t_item.
ENDIF.
ENDAT.
ENDIF.
ENDLOOP.
select cleared items
IF p_due EQ 'X'.
REFRESH inrect. CLEAR inrect.
SELECT lifnr belnr gjahr bldat xblnr blart sgtxt
shkzg dmbtr zfbdt zbd1t zbd2t zbd3t
zuonr
FROM bsak INTO TABLE inrect
WHERE bukrs = p_bukrs
AND budat LE stida
AND augdt > stida
AND lifnr IN s_lifnr
AND gsber IN s_gsber
REFRESH inrec. CLEAR inrec.
LOOP AT inrect.
inrec-lifnr = inrect-lifnr.
inrec-belnr = inrect-belnr.
inrec-gjahr = inrect-gjahr.
inrec-bldat = inrect-bldat.
inrec-xblnr = inrect-xblnr.
inrec-blart = inrect-blart.
inrec-sgtxt = inrect-sgtxt.
inrec-shkzg = inrect-shkzg.
inrec-dmbtr = inrect-dmbtr.
CALL FUNCTION 'NJ_CAL_DATE_IN_INTERVAL'
EXPORTING
date = inrect-zfbdt
days = inrect-zbd1t
months = 00
signum = '+'
years = 00
IMPORTING
calc_date = inrec-zfbdt.
inrec-zbd1t = inrect-zbd1t.
inrec-zbd2t = inrect-zbd2t.
inrec-zbd3t = inrect-zbd3t.
inrec-zuonr = inrect-zuonr.
APPEND inrec.
CLEAR inrec.
ENDLOOP.
ELSE.
REFRESH inrec. CLEAR inrec.
SELECT lifnr belnr gjahr bldat xblnr blart sgtxt
shkzg dmbtr zfbdt zbd1t zbd2t zbd3t
zuonr
FROM bsak INTO TABLE inrec
WHERE bukrs = p_bukrs
AND budat LE stida
AND augdt > stida
AND lifnr IN s_lifnr
AND gsber IN s_gsber
ENDIF.
SORT inrec BY lifnr shkzg zfbdt .
LOOP AT inrec.
AT NEW lifnr.
ztotcre = 0.
ztotsal = 0.
ENDAT.
IF inrec-shkzg = 'H'.
inrec-dmbtr = inrec-dmbtr * -1.
ztotcre = ztotcre + inrec-dmbtr.
ELSE.
IF inrec-blart = 'RV'.
IF inrec-bldat GE fsdate.
ztotsal = ztotsal + inrec-dmbtr.
ENDIF.
ENDIF.
ztotcre = ztotcre + inrec-dmbtr.
endif.
IF p_debit EQ 'X'.
IF ztotcre > 0.
MOVE-CORRESPONDING inrec TO t_item. " 0001
PERFORM collect_invoice USING inrec-lifnr ztotcre
inrec-zfbdt inrec-zbd1t
inrec-zbd2t inrec-zbd3t
ztotsal.
APPEND t_item.
CLEAR t_item.
ztotcre = 0.
ztotsal = 0.
ENDIF.
ENDIF.
ENDIF.
IF p_credit EQ 'X'.
AT END OF lifnr.
IF ztotcre < 0.
MOVE-CORRESPONDING inrec TO t_item. " 0001
PERFORM collect_invoice USING inrec-lifnr ztotcre
inrec-zfbdt inrec-zbd1t
inrec-zbd2t inrec-zbd3t
ztotsal.
APPEND t_item.
CLEAR t_item.
ztotcre = 0.
ztotsal = 0.
APPEND t_item.
CLEAR t_item.
ENDIF.
ENDAT. " 0001
ENDIF.
ENDLOOP.
ENDFORM. " GET_CUSTOMER_INVOICES
*& Form COLLECT_INVOICE
text
-->P_bsik_lifnr text
-->P_bsik_DMBTR text
-->P_bsik_ZFBDT text
-->P_bsik_ZFBDT1 text
-->P_bsik_ZFBDT2 text
-->P_bsik_ZFBDT3 text
FORM collect_invoice USING pp_lifnr
pp_dmbtr
pp_zfbdt
pp_zbd1t
pp_zbd2t
pp_zbd3t
pp_ztotsal.
doc_month = pp_zfbdt+4(2).
doc_year = pp_zfbdt+0(4).
doc_mth_abs = ( doc_year * 12 ) + doc_month.
mth_result = ( targ_mth_abs - doc_mth_abs ).
logic given by Mr. Ashok Singhvi
doc_days = pp_zfbdt+6(2).
addl_days = ( doc_days - targ_days ).
IF addl_days <= 0.
ADD 1 TO mth_result.
ENDIF.
IF NOT pp_zbd3t IS INITIAL.
MOVE pp_zbd3t TO ext_days.
ELSEIF NOT pp_zbd2t IS INITIAL.
MOVE pp_zbd2t TO ext_days.
ELSEIF NOT pp_zbd1t IS INITIAL.
MOVE pp_zbd1t TO ext_days.
ELSE.
CLEAR ext_days.
ENDIF.
CHECK with Andrew whether this is working or not
if extended payment terms exist, subtract no of mths from mth_result
IF NOT ext_days IS INITIAL.
CASE ext_days.
WHEN 30.
SUBTRACT 1 FROM mth_result.
WHEN 60.
SUBTRACT 2 FROM mth_result.
WHEN 90.
SUBTRACT 3 FROM mth_result.
WHEN 120.
SUBTRACT 4 FROM mth_result.
ENDCASE.
ENDIF.
change to key date
IF pp_dmbtr > 0.
IF p_future = 'X'. " 0001
IF mth_result <= 0.
itab-zcurrent = pp_dmbtr.
t_item-days = 'CUR'.
ELSEIF mth_result = 1.
itab-30days = pp_dmbtr.
t_item-days = '30D'.
ELSEIF mth_result = 2.
itab-60days = pp_dmbtr.
t_item-days = '60D'.
ELSEIF mth_result = 3.
itab-90days = pp_dmbtr.
t_item-days = '90D'.
ELSEIF mth_result > 3 AND mth_result <= 4 .
itab-99days = pp_dmbtr.
t_item-days = '99D'.
ELSEIF mth_result > 4 AND mth_result <= 6 .
itab-120days = pp_dmbtr.
t_item-days = '120D'.
ELSEIF mth_result > 6 AND mth_result <= 12 .
itab-180days = pp_dmbtr.
t_item-days = '180D'.
ELSEIF mth_result > 12 .
itab-365days = pp_dmbtr.
t_item-days = '365D'.
ENDIF.
ELSE.
IF mth_result < 0.
itab-zfuture = pp_dmbtr.
t_item-days = 'FUT'.
ELSEIF mth_result = 0.
itab-zcurrent = pp_dmbtr.
t_item-days = 'CUR'.
ELSEIF mth_result = 1.
itab-30days = pp_dmbtr.
t_item-days = '30D'.
ELSEIF mth_result = 2.
itab-60days = pp_dmbtr.
t_item-days = '60D'.
ELSEIF mth_result = 3.
itab-90days = pp_dmbtr.
t_item-days = '90D'.
ELSEIF mth_result > 3 AND mth_result <= 4 .
itab-99days = pp_dmbtr.
t_item-days = '99D'.
ELSEIF mth_result > 4 AND mth_result <= 6 .
itab-120days = pp_dmbtr.
t_item-days = '120D'.
ELSEIF mth_result > 6 AND mth_result <= 12 .
itab-180days = pp_dmbtr.
t_item-days = '180D'.
ELSEIF mth_result > 12 .
itab-365days = pp_dmbtr.
t_item-days = '365D'.
ENDIF.
ENDIF. " 0001
itab-crbal = 0.
itab-total = pp_dmbtr.
ELSE.
IF p_future = 'X'. " 0001
IF mth_result <= 0.
itab-zcurrent = pp_dmbtr.
t_item-days = 'CUR'.
ELSEIF mth_result = 1.
itab-30days = pp_dmbtr.
t_item-days = '30D'.
ELSEIF mth_result = 2.
itab-60days = pp_dmbtr.
t_item-days = '60D'.
ELSEIF mth_result = 3.
itab-90days = pp_dmbtr.
t_item-days = '90D'.
ELSEIF mth_result > 3 AND mth_result <= 4 .
itab-99days = pp_dmbtr.
t_item-days = '99D'.
ELSEIF mth_result > 4 AND mth_result <= 6 .
itab-120days = pp_dmbtr.
t_item-days = '120D'.
ELSEIF mth_result > 6 AND mth_result <= 12 .
itab-180days = pp_dmbtr.
t_item-days = '180D'.
ELSEIF mth_result > 12 .
itab-365days = pp_dmbtr.
t_item-days = '365D'.
ENDIF.
ELSE.
IF mth_result < 0.
itab-zfuture = pp_dmbtr.
t_item-days = 'FUT'.
ELSEIF mth_result = 0.
itab-zcurrent = pp_dmbtr.
t_item-days = 'CUR'.
ELSEIF mth_result = 1.
itab-30days = pp_dmbtr.
t_item-days = '30D'.
ELSEIF mth_result = 2.
itab-60days = pp_dmbtr.
t_item-days = '60D'.
ELSEIF mth_result = 3.
itab-90days = pp_dmbtr.
t_item-days = '90D'.
ELSEIF mth_result > 3 AND mth_result <= 4 .
itab-99days = pp_dmbtr.
t_item-days = '99D'.
ELSEIF mth_result > 4 AND mth_result <= 6 .
itab-120days = pp_dmbtr.
t_item-days = '120D'.
ELSEIF mth_result > 6 AND mth_result <= 12 .
itab-180days = pp_dmbtr.
t_item-days = '180D'.
ELSEIF mth_result > 12 .
itab-365days = pp_dmbtr.
t_item-days = '365D'.
ENDIF.
ENDIF. " 0001
itab-total = pp_dmbtr.
itab-crbal = 0.
ENDIF.
itab-lifnr = pp_lifnr.
itab-totsal = pp_ztotsal.
COLLECT itab.
CLEAR itab.
ENDFORM. " COLLECT_INVOICE
*& Form ADD_SORT_FIELD
text
--> p1 text
<-- p2 text
FORM add_sort_field.
DATA: l_amount(9) TYPE n.
IF p_future = 'X'.
LOOP AT itab.
l_amount = 999999999.
IF itab-365days > 0.
l_amount = l_amount - itab-365days.
CONCATENATE 'A' l_amount INTO itab-psort.
ELSEIF itab-180days > 0.
l_amount = l_amount - itab-180days.
CONCATENATE 'B' l_amount INTO itab-psort.
ELSEIF itab-120days > 0.
l_amount = l_amount - itab-120days.
CONCATENATE 'C' l_amount INTO itab-psort.
ELSEIF itab-99days > 0.
l_amount = l_amount - itab-99days.
CONCATENATE 'D' l_amount INTO itab-psort.
ELSEIF itab-90days > 0.
l_amount = l_amount - itab-90days.
CONCATENATE 'E' l_amount INTO itab-psort.
ELSEIF itab-60days > 0.
l_amount = l_amount - itab-60days.
CONCATENATE 'F' l_amount INTO itab-psort.
ELSEIF itab-30days > 0.
l_amount = l_amount - itab-30days.
CONCATENATE 'G' l_amount INTO itab-psort.
ELSEIF itab-zcurrent > 0.
l_amount = l_amount - itab-zcurrent.
CONCATENATE 'H' l_amount INTO itab-psort.
ELSEif itab-zfuture > 0.
L_AMOUNT = L_AMOUNT - ITAB-zfuture.
CONCATENATE 'F' L_AMOUNT INTO ITAB-PSORT.
ELSE.
l_amount = ABS( itab-total ).
CONCATENATE 'I' l_amount INTO itab-psort.
ENDIF.
MODIFY itab.
ENDLOOP.
ELSE.
LOOP AT itab.
l_amount = 999999999.
IF itab-365days > 0.
l_amount = l_amount - itab-365days.
CONCATENATE 'A' l_amount INTO itab-psort.
ELSEIF itab-180days > 0.
l_amount = l_amount - itab-180days.
CONCATENATE 'B' l_amount INTO itab-psort.
ELSEIF itab-120days > 0.
l_amount = l_amount - itab-120days.
CONCATENATE 'C' l_amount INTO itab-psort.
ELSEIF itab-99days > 0.
l_amount = l_amount - itab-99days.
CONCATENATE 'D' l_amount INTO itab-psort.
ELSEIF itab-90days > 0.
l_amount = l_amount - itab-90days.
CONCATENATE 'E' l_amount INTO itab-psort.
ELSEIF itab-60days > 0.
l_amount = l_amount - itab-60days.
CONCATENATE 'F' l_amount INTO itab-psort.
ELSEIF itab-30days > 0.
l_amount = l_amount - itab-30days.
CONCATENATE 'G' l_amount INTO itab-psort.
ELSEIF itab-zcurrent > 0.
l_amount = l_amount - itab-zcurrent.
CONCATENATE 'H' l_amount INTO itab-psort.
ELSEIF itab-zfuture > 0.
l_amount = l_amount - itab-zfuture.
CONCATENATE 'I' l_amount INTO itab-psort.
ELSE.
l_amount = ABS( itab-total ).
CONCATENATE 'J' l_amount INTO itab-psort.
ENDIF.
MODIFY itab.
ENDLOOP.
ENDIF.
ENDFORM. " ADD_SORT_FIELD
*& Form WRITE_REPORT
text
--> p1 text
<-- p2 text
FORM write_report.
PERFORM build_fieldcat.
PERFORM build_sortcat.
PERFORM build_eventcat.
PERFORM build_layout.
PERFORM start_list_viewer.
ENDFORM. " WRITE_REPORT
*& Form BUILD_FIELDCAT
text
--> p1 text
<-- p2 text
FORM build_fieldcat.
lifnr
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'lfa1'.
fieldcat_ln-fieldname = 'LIFNR'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
APPEND fieldcat_ln TO fieldcat.
Name1
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'lfa1'.
fieldcat_ln-fieldname = 'NAME1'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-seltext_l = 'Name'.
APPEND fieldcat_ln TO fieldcat.
City Details
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'lfa1'.
fieldcat_ln-fieldname = 'ORT01'.
fieldcat_ln-seltext_l = 'City'.
fieldcat_ln-col_pos = col_pos.
APPEND fieldcat_ln TO fieldcat.
Credit Limit
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'KNKK'.
fieldcat_ln-fieldname = 'KLIMK'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-emphasize = 'C41'.
APPEND fieldcat_ln TO fieldcat.
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = 'CRBAL'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-seltext_l = 'Cr. Bal.'.
fieldcat_ln-seltext_m = 'Cr. Bal.'.
fieldcat_ln-seltext_s = 'Cr. Bal.'.
APPEND fieldcat_ln TO fieldcat.
Total Amount
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-fieldname = 'TOTAL'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-seltext_l = 'Out.St.Amt.'.
fieldcat_ln-seltext_m = 'Out.St.Amt.'.
fieldcat_ln-seltext_s = 'Out.St.Amt.'.
fieldcat_ln-ref_tabname = 'zbsik'.
fieldcat_ln-ref_fieldname = 'ZDMBTR'.
APPEND fieldcat_ln TO fieldcat.
IF p_future NE 'X'.
Future
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = 'ZFUTURE'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = 'Future Due'.
fieldcat_ln-seltext_m = 'Future Due'.
fieldcat_ln-seltext_s = 'Future Due'.
APPEND fieldcat_ln TO fieldcat.
ENDIF.
Current
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = 'ZCURRENT'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = 'Normal Due'.
fieldcat_ln-seltext_m = 'Normal Due'.
fieldcat_ln-seltext_s = 'Normal Due'.
APPEND fieldcat_ln TO fieldcat.
30 Days
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = '30DAYS'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = '0-30 Days'.
fieldcat_ln-seltext_m = '0-30 Days'.
fieldcat_ln-seltext_s = '0-30 Days'.
APPEND fieldcat_ln TO fieldcat.
60 Days
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = '60DAYS'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = '31-60 Days'.
fieldcat_ln-seltext_m = '31-60 Days'.
fieldcat_ln-seltext_s = '31-60 Days'.
APPEND fieldcat_ln TO fieldcat.
90 Days
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = '90DAYS'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = '61-90 Days'.
fieldcat_ln-seltext_m = '61-90 Days'.
fieldcat_ln-seltext_s = '61-90 Days'.
APPEND fieldcat_ln TO fieldcat.
99 Days
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = '99DAYS'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = '91-120 Days'.
fieldcat_ln-seltext_m = '91-120 Days'.
fieldcat_ln-seltext_s = '91-120 Days'.
APPEND fieldcat_ln TO fieldcat.
*120Days
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = '120DAYS'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = '121-180 Days'.
fieldcat_ln-seltext_m = '121-180 Days'.
fieldcat_ln-seltext_s = '121-180 Days'.
APPEND fieldcat_ln TO fieldcat.
*180 Days
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = '180DAYS'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = '181-365 Days'.
fieldcat_ln-seltext_m = '181-365 Days'.
fieldcat_ln-seltext_s = '181-365 Days'.
APPEND fieldcat_ln TO fieldcat.
*365 Days
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'bsik'.
fieldcat_ln-ref_fieldname = 'DMBTR'.
fieldcat_ln-fieldname = '365DAYS'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-do_sum = 'X'.
fieldcat_ln-hotspot = 'X'.
fieldcat_ln-emphasize = 'C41'.
fieldcat_ln-seltext_l = '>365 Days'.
fieldcat_ln-seltext_m = '>365 Days'.
fieldcat_ln-seltext_s = '>365 Days'.
APPEND fieldcat_ln TO fieldcat.
Last Payment Date
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'KNKK'.
fieldcat_ln-fieldname = 'CASHD'.
fieldcat_ln-col_pos = col_pos.
APPEND fieldcat_ln TO fieldcat.
Street Name
ADD 1 TO COL_POS.
CLEAR FIELDCAT_LN.
FIELDCAT_LN-REF_TABNAME = 'lfa1'.
FIELDCAT_LN-FIELDNAME = 'STRAS'.
FIELDCAT_LN-COL_POS = COL_POS.
APPEND FIELDCAT_LN TO FIELDCAT.
Telephone
ADD 1 TO COL_POS.
CLEAR FIELDCAT_LN.
FIELDCAT_LN-REF_TABNAME = 'lfa1'.
FIELDCAT_LN-FIELDNAME = 'TELF1'.
FIELDCAT_LN-COL_POS = COL_POS.
APPEND FIELDCAT_LN TO FIELDCAT.
Credit Group
ADD 1 TO COL_POS.
CLEAR FIELDCAT_LN.
FIELDCAT_LN-REF_TABNAME = 'KNKK'.
FIELDCAT_LN-FIELDNAME = 'GRUPP'.
FIELDCAT_LN-COL_POS = COL_POS.
APPEND FIELDCAT_LN TO FIELDCAT.
*Sales District
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'KNVV'.
fieldcat_ln-fieldname = 'BZIRK'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-seltext_l = 'S_Distt'.
fieldcat_ln-seltext_m = 'S_Distt'.
fieldcat_ln-seltext_s = 'S_Distt'.
APPEND fieldcat_ln TO fieldcat.
Sales Office
ADD 1 TO col_pos.
CLEAR fieldcat_ln.
fieldcat_ln-ref_tabname = 'KNVV'.
fieldcat_ln-fieldname = 'VKBUR'.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-seltext_l = 'S_Off'.
fieldcat_ln-seltext_m = 'S_Off'.
fieldcat_ln-seltext_s = 'S_Off'.
APPEND fieldcat_ln TO fieldcat.
Cust Creat Date
ADD 1 TO COL_POS.
CLEAR FIELDCAT_LN.
FIELDCAT_LN-REF_TABNAME = 'lfa1'.
FIELDCAT_LN-FIELDNAME = 'ERDAT'.
FIELDCAT_LN-COL_POS = COL_POS.
APPEND FIELDCAT_LN TO FIELDCAT. -
Product for presenting ABAP report output in Dashboard Presentation
<u>Background</u>
Monash University environment is SAP ERP ECC6 - no BW. The University has undertaken considerable analysis of spend as part of developing a strategic approach to procurement. The data used to undertake this analysis was extracted from SAP MM and FI using a developed ABAP report which collates, categorizes and consolidates all spend information from MM (for our Purchase Order based commitment and expenditure) and FI (for direct invoices and Corporate Credit Card expenditure). This information is then currently exported to MS-Excel to produce a report containing graphs, pie charts etc.
<u>Requirement</u>
To present output from our Spend Analysis Report in a more readable dashboard type presentation. This facility should allow easy manipulation (slice and dice) and drill down of the data.. Our requirement is to have something operating within a very short time-frame, say within a month or two. Although you might suggest Web Dynpro Business Graphic or SEM /BW (as the optimal solution) we understand the set up time for either of these solutions is prohibitive. Visual Composer has been suggested as another option but we have no in-house expertise to determine if this is a viable solution.
Some colleagues visited a conference a couple of weeks ago and saw a demonstration of a product call XenoCube http://www.inlogik.com/downloads/XenoCube_Brochure.pdf
which was proposed as a quick way to present SAP 'raw' report output in a more readable form. Other solutions in this space that have been suggested include:-
Zycus - Actionable Spend Analysis Zycus.com
Emptoris Spend Analysis - emptoris.com
ONIQUA Enterprise Analytics oniqua.com.au
Ariba Buyer ariba.com
SAS Spend Analysis sas.com
Etesius SpendGuardian etesius.com
Can anyone provide advice as to their experience of SAP solution, integrated partner products or any of the about products to satisfy a similar requirement to that which I have outlined? The main selection criteria will include a product which is:
a) quick & easy to implement,
b) presentation and manipulation of ABAP extracted data
c) is scalable and
d) is reasonably priced.
Grateful for any advice regarding a solution .
Thank-youHi,
This development writes to mapped network drive in Unix. The concept will be similar.
[http://wiki.sdn.sap.com/wiki/display/SCM/APOtoMappedNetworkDrive]
cheers
Aveek -
Format question for a ABAP report
Hi experts,
Exist a way to create or use a format to print an output of an ABAP report that adjust to the screen? I have a Abap report that in the output have some subtrees for the information displayed.... but if the user expand a lot the subtrees when he or she print the document they see the leters and numbers very small or whitout some columms.... How can I create a format to fix this or what is the way ?
Thanks for the help!Please.... I need help in this topic.... any suggestions?
Thanks! -
Create T.Code for a query (Report looks like VF05)
Hi,
I'm facing a problem right now.. I made a Query with SQVI, then I converted it with SQ01.. It is a report that lookes like VF05 but has the column EAN/UPC Code added on it.
Now I am trying to create a T.code to run this report, using SE93.
So, I called the T.Code ZVF05, and then I tried to Create it, but then I don't know what Start Object I should choose: I first choosed "Program and screen", I gave the field Program value "SAPMS38R" and Screen name "180" as seen in the my Query
, but when trying to test it, I receive the message: "Incorrect program type with Submit"
What would you suggest to make this TCode work?
PS. Please note that I am SD functional consultant, not a ABAPer...
Edited by: Cristiana Vasile on Oct 13, 2008 2:23 PMOk, I have runed the report with the name i wanted: (ZVF05).. Now, what I realised is that I don't really have a selection screen in order to run this report.. What have I been missing here??
Something in SQVI, or maybe in SE93??
I don't realy find the use of runing a report for all the existing data in SAP..a selection screen should be available..
Thank you!
Cristiana -
Hi All,
I am a beginner to OO Abap & Looking for some real examples like declaring Internal tables ,using classes as parameters for methods etc.
Can Some one Post some ABAP reports regarding MM as Examples using OO ABAP.
Regards,
Ravi SHi,
Check the following code:
TABLES : VBAK,VBAP.
TYPES : BEGIN OF ST_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
AUART TYPE VBAK-AUART,
END OF ST_VBAK.
TYPES : BEGIN OF ST_VBAP,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
MATKL TYPE VBAP-MATKL,
ARKTX TYPE VBAP-ARKTX,
PSTYV TYPE VBAP-PSTYV,
END OF ST_VBAP.
TYPES : BEGIN OF ST_FINAL,
VBELN TYPE VBAK-VBELN,
POSNR TYPE VBAP-POSNR,
ERDAT TYPE VBAK-ERDAT,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
AUART TYPE VBAK-AUART,
MATNR TYPE VBAP-MATNR,
MATKL TYPE VBAP-MATKL,
ARKTX TYPE VBAP-ARKTX,
PSTYV TYPE VBAP-PSTYV,
END OF ST_FINAL.
SELECT-OPTIONS : S_VBAK FOR VBAK-VBELN.
CLASS SALES1 DEFINITION.
PUBLIC SECTION.
METHODS : GET_DATA,
POPULATE_DATA,
DISPLAY_DATA.
DATA : IT_VBAK TYPE STANDARD TABLE OF ST_VBAK,
IT_VBAP TYPE STANDARD TABLE OF ST_VBAP,
IT_FINAL TYPE STANDARD TABLE OF ST_FINAL,
WA_VBAK LIKE LINE OF IT_VBAK,
WA_VBAP LIKE LINE OF IT_VBAP,
WA_FINAL LIKE LINE OF IT_FINAL.
ENDCLASS.
CLASS SALES1 IMPLEMENTATION.
METHOD GET_DATA.
SELECT VBELN ERDAT AUDAT VBTYP AUART FROM VBAK INTO
TABLE IT_VBAK WHERE VBELN in S_VBAK.
IF NOT IT_VBAK[] IS INITIAL.
SELECT VBELN POSNR MATNR MATKL ARKTX PSTYV FROM VBAP
INTO TABLE IT_VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
ENDIF.
ENDMETHOD.
METHOD POPULATE_DATA.
LOOP AT IT_VBAK INTO WA_VBAK.
READ TABLE IT_VBAP INTO WA_VBAP WITH KEY VBELN = WA_VBAK-VBELN.
IF SY-SUBRC = 0.
WA_FINAL-VBELN = WA_VBAK-VBELN.
WA_FINAL-POSNR = WA_VBAP-POSNR.
WA_FINAL-ERDAT = WA_VBAK-ERDAT.
WA_FINAL-AUDAT = WA_VBAK-AUDAT.
WA_FINAL-VBTYP = WA_VBAK-VBTYP.
WA_FINAL-AUART = WA_VBAK-AUART.
WA_FINAL-MATNR = WA_VBAP-MATNR.
WA_FINAL-MATKL = WA_VBAP-MATKL.
WA_FINAL-ARKTX = WA_VBAP-ARKTX.
WA_FINAL-PSTYV = WA_VBAP-PSTYV.
APPEND WA_FINAL TO IT_FINAL.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD DISPLAY_DATA.
LOOP AT IT_FINAL INTO WA_FINAL.
WRITE :/ WA_FINAL-VBELN ,
WA_FINAL-POSNR ,
WA_FINAL-ERDAT,
WA_FINAL-AUDAT ,
WA_FINAL-VBTYP ,
WA_FINAL-AUART ,
WA_FINAL-MATNR ,
WA_FINAL-MATKL ,
WA_FINAL-ARKTX ,
WA_FINAL-PSTYV .
ENDLOOP.
ENDMETHOD .
ENDCLASS.
START-OF-SELECTION.
DATA : OBJ TYPE REF TO SALES1.
CREATE OBJECT OBJ.
CALL METHOD OBJ->GET_DATA.
CALL METHOD OBJ->POPULATE_DATA.
CALL METHOD OBJ->DISPLAY_DATA.
Regards,
Bhaskar -
Smaple code for multiple interactive reports
hi experts,
Pls send me a sample code or link for creating muiltiple interactive reports.Hi
See the sample programs for interactive lists
REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
HEADING.
*TABLES DECLARATION
TABLES : KNA1, VBAK, VBAP.
*SELECT OPTIONS
SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
*INITIALIZATION
INITIALIZATION.
CUST_NO-LOW = '01'.
CUST_NO-HIGH = '5000'.
CUST_NO-SIGN = 'I'.
CUST_NO-OPTION = 'BT'.
APPEND CUST_NO.
*SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN ON CUST_NO.
LOOP AT SCREEN.
IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
MESSAGE E001(ZTJ1).
ENDIF.
ENDLOOP.
*BASIC LIST SELECTION
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1 INTO
(KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
FROM KNA1
WHERE KUNNR IN CUST_NO.
WRITE:/1 SY-VLINE,
KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
KNA1-NAME1 UNDER 'NAME',
61 SY-VLINE,
KNA1-ORT01 UNDER 'CITY',
86 SY-VLINE,
KNA1-LAND1 UNDER 'COUNTRY',
103 SY-VLINE.
HIDE: KNA1-KUNNR.
ENDSELECT.
ULINE.
*SECONDARY LIST ACCESS
AT user-command.
IF SY-UCOMM = 'IONE'.
PERFORM SALES_ORD.
ENDIF.
IF SY-UCOMM = 'ITWO'.
PERFORM ITEM_DET.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR 1.
WRITE : 'CUSTOMER DETAILS'.
FORMAT COLOR 1 OFF.
ULINE.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'NAME',
61 SY-VLINE,
63 'CITY',
86 SY-VLINE,
88 'COUNTRY',
103 SY-VLINE.
ULINE.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR SECONDARY LISTS
TOP-OF-PAGE DURING LINE-SELECTION.
*TOP OF PAGE FOR 1ST SECONDARY LIST
IF SY-UCOMM = 'IONE'.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'SALES ORDER NO.',
40 SY-VLINE,
42 'DATE',
60 SY-VLINE,
62 'CREATOR',
85 SY-VLINE,
87 'DOC DATE',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR 2ND SECONDARY LIST
IF SY-UCOMM = 'ITWO'.
ULINE.
FORMAT COLOR 1.
WRITE : 'ITEM DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'SALES ORDER NO.',
40 SY-VLINE,
42 'SALES ITEM NO.',
60 SY-VLINE,
62 'ORDER QUANTITY',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*END OF PAGE
END-OF-PAGE.
ULINE.
WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
SY-PAGNO.
SKIP.
*& Form SALES_ORD
*& FIRST SECONDARY LIST FORM
FORM SALES_ORD .
SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
(VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
FROM VBAK
WHERE KUNNR = KNA1-KUNNR.
WRITE:/1 SY-VLINE,
VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
40 SY-VLINE,
VBAK-ERDAT UNDER 'DATE',
60 SY-VLINE,
VBAK-ERNAM UNDER 'CREATOR',
85 SY-VLINE,
VBAK-AUDAT UNDER 'DOC DATE',
103 SY-VLINE.
HIDE : VBAK-VBELN.
ENDSELECT.
ULINE.
ENDFORM. " SALES_ORD
*& Form ITEM_DET
*& SECOND SECONDARY LIST FORM
FORM ITEM_DET .
SELECT VBELN POSNR KWMENG INTO
(VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
FROM VBAP
WHERE VBELN = VBAK-VBELN.
WRITE : /1 SY-VLINE,
VBAP-VBELN UNDER 'SALES ORDER NO.',
40 SY-VLINE,
VBAP-POSNR UNDER 'SALES ITEM NO.',
60 SY-VLINE,
VBAP-KWMENG UNDER 'ORDER QUANTITY',
103 SY-VLINE.
ENDSELECT.
ULINE.
ENDFORM. " ITEM_DET
REPORT demo_list_at_pf.
START-OF-SELECTION.
WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
AT pf5.
PERFORM out.
AT pf6.
PERFORM out.
AT pf7.
PERFORM out.
AT pf8.
PERFORM out.
FORM out.
WRITE: 'Secondary List by PF-Key Selection',
/ 'SY-LSIND =', sy-lsind,
/ 'SY-UCOMM =', sy-ucomm.
ENDFORM.
After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
Secondary List by PF-Key Selection
SY-LSIND = 14
SY-UCOMM = PF06
Example for AT USER-COMMAND.
REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.
When you run the program, the system displays the following basic list with a the page header defined in the program:
You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
Reward points if useful
Regards
Anji -
Transaction Code for Cost Center Report
Hi everyone,
using report painter I have created a cost center report which is a copy of a standard report. Now I would like to create a transaction code for this report which can be run from the menu.
Can anyone explain step-by-step how to do this? I have already tried creating a TC for GR55 but this seems not to be what I want. I want the TC to start the report directly.
Thanks in advance for your help!
Regards,
MartinHi,
Go to SE93 (create a new transaction), choose 'Transaction with parameters'. In the Transaction field put 'START_REPORT' and tick 'Skip Initial screen' flag. Tick all flags for GUI support and in the parameters section (below) type four parameters:
D_SREPOVARI-REPORTTYPE = RW
D_SREPOVARI-REPORT = (library of reports)
D_SREPOVARI-VARIANT
D_SREPOVARI-NOSELSCRN
Regards,
Eli
Maybe you are looking for
-
File can not be moved by drag and drop in the finder when not open Finder windows
With the operating system OSX Snow Leopard, it was possible, for example, a file from the desktop to pull drag and drop on the Finder icon, the page opened after a short and you could put the file in a folder. At this stage I must first open the Find
-
Error while Deploying application on localhost
Hi gurus, I try to deploy the application mainapp01, locally on the J2EE engine, but gives me the following error: Oct 9, 2006 4:26:40 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR: [0
-
New hard drive: iPod touch contacts to Outlook?
We use Windows Vista; my wife's iPod Touch was syncing just fine with Outlook (for Calendar and Contacts). Our hard drive died, so got a new one. I thought I had been regularly backing up the Outlook .pst files, but the ones that I found on my extern
-
Separate /var resiserfs partition on usb drive won't mount on boot
It has mounted successfully a few times. I set it up because I don't want /var on my Revodrive, and I've added a label (var) to the partition. I've tried mounting at first by UUID, then label, then strictly by dev (which isn't an option considering
-
Hi, I am unable to update SRID in Geoemetry. I am getting the following error on update. Update cad_2001 C set C.Geometry.SDO_SRID=2950; ora-29877 failed in the execution of the odciindexupdate routine Ora-13365 layer SRID does not match geometry SRI