Need example
Hi,
I want clear example of both dimension and line item dimension.
How it works in both the case ?
How we know that no of row in dimension table and fact table without showing the records?
Regards,
Rajesh
In Line item dimension you can have only one characteristic. In fact table, we have DIM IDs and Key Figures.
For normal dimensions, DIM ID is created for a combination of characteristic values used in that dimension. For example, if we have company code, Sales Org and Distribution Channel in one dimension;
Company Code Sales Org Distribution Channel DIM ID
C1 S1 01 101
C1 S1 IC 102
C1 S2 01 103
In DIM table, instead of values, SID for a characteristics is used. This DIM ID then used in a FACT table.
In case of line item dimension, no DIM table is created. SID is directly used in the FACT table.
If you wants to know the number of entries in a DIM table for FACT table; Go to SE11 > type *cube name: > F4 > you will get the list of all tables associated with that cube. Table starting with /BIC/D is a dimension table, and /BIC/F will be the fact table.
Then you can check the number of entries in a particular table.
Regards,
Gaurav
Similar Messages
-
Need example report program using PNPCE LDB in SAP HR
Need example report program using PNPCE LDB in SAP HR.
and how to create a report category in sap hr for using it as cutomised selection screen.Hi,
Go through the following links, i hope it will help you.....
/people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/893908#
A sample prog with LDB PNP
*& Report ZH_REPT_PAYMENT *
report zh_rept_payment line-size 80 no standard page
heading.
tables: pernr, " Standard Selections for HR Master Data Reporting
pcl1, " HR Cluster 1
pcl2, " HR Cluster 2
pa0009,
PA9001,
PA9006,
pa0002,
pc260 , " Cluster Directory for Payroll Results
bnka .
Infotypes
infotypes: 0001. " Organizational Assignment
Declaration of Internal Tables
data : bnka1 like bnka occurs 0 with header line .
data: begin of t_int_rep occurs 100,
bankl like pc209-bankl, " Bank Number
zlsch like pc209-zlsch, " Payment method
pernr like pernr-pernr, " Employee Number
ename like pernr-ename, " Employee Name
bankn like pc209-bankn, " Bank Account Number
betrg like pc209-betrg, " Amount to be transfered
zweck like pa0009-zweck, " Purpose
end of t_int_rep.
data: begin of int_rep occurs 100,
bankl like pc209-bankl, " Bank Number
zlsch like pc209-zlsch, " Payment method
pernr like pernr-pernr, " Employee Number
ename like pernr-ename, " Employee Name
bankn like pc209-bankn, " Bank Account Number
betrg like pc209-betrg, " Amount to be transfered
zweck like pa0009-zweck, " Purpose
begda like pa0009-begda, "Begin date
end of int_rep.
Declaration of Data Variables
data: ws_betrg like pc209-betrg, " BT Amount
w_val like spell occurs 0 with header line,
int_rep1(6), " TYPE I, " Employee Number
cnt type i value 0, " Counter
calcmolga like t500l-molga value '40', " Country Grouping
v_id(15),
calc_currency like t001-waers value 'INR'. " Currency
data : ctr type i,
dt_merge like pa0009-begda.
data: ws_totemp(6) type c,
ws_totamt(20) type c,
r_mth(9) type c,
ws_fpbeg(6) type c,
ws_fpend(6) type c,
ws_mthyr(6) type c,
ws_mthyr_r(14) type c,
r_mth_t(3) type c,
ws_amt(8) type c,
ws_bankl(14) type c,
ws_date(6) type c,
amount_word(500),
total_page type i,
pages type i,
remain type i.
data begin of i_spell.
include structure spell .
data end of i_spell .
data : c_molga type t500l-molga value '40',
c_banks type bnka-banks value 'IN'.
Standard Includes
include rpc2cd09. "Cluster CD data definition
include pc2rxin0.
include rpc2rx09.
include rpppxd00. " Data Definition buffer PCL1/PCL2
include rpppxd10. " Common Part buffer PCL1/PCL2
include rpppxm00. " Buffer Handling RoutinePCL1/PCL2
include zrpc2rox2. " Data Definition POCLSTERS (not J,K,U)
Selection Screen
selection-screen begin of block b1 with frame title text-001.
parameter: pa_mth(2) type c default sy-datum+4(2) obligatory,
pa_year(4) type c default sy-datum(4) obligatory,
p_bankl like pc209-bankl, " Bank Number
p_zlsch like pc209-zlsch. " Payment method
selection-screen end of block b1.
save_calc_currency = calc_currency.
count_top = 0.
get_pernr_flag = 0.
Top-Of-Page
top-of-page.
perform convert_month using pa_mth(2) r_mth.
ws_mthyr_r = r_mth.
concatenate ws_mthyr_r pa_year into ws_mthyr_r separated by space.
SKIP 5.
skip 1.
skip 4.
if int_rep-bankl eq ' '.
if int_rep-zlsch eq 'C' or int_rep-zlsch eq 'E' or
int_rep-zlsch eq ' '.
write: /1(85) 'CHEQUE PAYMENT STATEMENT'(047) centered.
elseif int_rep-zlsch eq 'L'.
write: /1(85) 'DEMAND DRAFT STATEMENT'(047) centered.
endif.
else.
write: /1(85) 'BANK TRANSFER STATEMENT'(002) centered.
endif.
skip.
write: /34 ws_mthyr_r,
62 'Page :'(008),69(2) sy-pagno intensified off,
' Of ',78(2) pages intensified off.
clear pages.
read table bnka1 with key bankl = int_rep-bankl .
if sy-subrc = 0.
if int_rep-zlsch eq 'T'.
write:/03(10) 'Bank Name : ', bnka1-banka.
write:/03(10) 'Branch : ', bnka1-brnch.
write:/03(10) 'Address : ', bnka1-stras.
endif.
endif.
skip.
write:/1(80) sy-uline.
write: /1 sy-vline, 2(5) 'Sl.No'(002),
7 sy-vline, 8(8) 'Emp.No.'(003),
16 sy-vline,17(35) 'Employee Name'(004).
*--added for Demand Draft
if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
write : 47 sy-vline, 48(15) 'Payable at'(005).
else.
write : 47 sy-vline,48(15) 'Account No.'(005).
endif.
write: 63 sy-vline,64(16) 'Amount'(006),
80 sy-vline.
write:/1(80) sy-uline.
end-of-page.
write:/1(80) sy-uline.
write:/2 'Printed on ', sy-datum.
Start-of-selection.
start-of-selection.
*perform h_headr.
ctr = 0.
set margin 5.
call function 'RP_GET_CURRENCY'
exporting
molga = calcmolga
importing
waers = calc_currency
exceptions
others.
if sy-subrc ne 0.
calc_currency = 'DEM'.
calc_currency = save_calc_currency.
endif.
get pernr.
cd-key-pernr = pernr-pernr.
perform import_cluster.
get_pernr_flag = 1.
check : ocd-version-molga eq calcmolga.
The table 'tabpernr' is filled with the personnel numbers
and is used after selection is finished.
move-corresponding pernr to tabpernr.
append tabpernr.
The table 'tab_rgdir' is filled
loop at rgdir.
rx-key-pernr = pernr-pernr.
unpack rgdir-seqnr to rx-key-seqno.
perform int_tab. "fill tab_rgdir
perform import_bt.
perform validate.
endloop.
End of Selection
end-of-selection.
*perform h_headr.
perform convert_date_a using pa_mth r_mth_t.
sort int_rep by bankl zlsch pernr betrg descending.
delete adjacent duplicates from int_rep
comparing bankl zlsch pernr .
sort int_rep by bankl zlsch bankn . "PERNR.
loop at int_rep.
at new bankl.
select single * into bnka1 from bnka
where banks = c_banks and
bankl = int_rep-bankl .
append bnka1.
clear bnka1.
endat.
endloop.
for Demand Draft - purpose added
loop at int_rep.
concatenate pa_year(4) pa_mth(2) '01' into dt_merge.
select single * "zweck into int_rep-zweck
from pa0009 where
pernr = int_rep-pernr and
bankl = int_rep-bankl and
zlsch = int_rep-zlsch
and begda <= dt_merge and
endda >= dt_merge .
if sy-subrc = 0.
int_rep-zweck = pa0009-zweck.
modify int_rep.
endif.
endloop.
*-for DD and Chq sorted by PAyable at and EMPNO wise
if p_zlsch = 'T' .
sort int_rep by bankl zlsch bankn . "PERNR.
else. "added for "payable at" for DD/Chq
else.
sort int_rep by zweck pernr . "PERNR.
endif.
*delete adjacent duplicates from int_rep.
t_int_rep] = int_rep[.
loop at int_rep.
*-for page of page no.
total_page = 0.
loop at t_int_rep where bankl = int_rep-bankl
and zlsch = int_rep-zlsch.
total_page = total_page + 1.
endloop.
pages = total_page div 25.
remain = total_page mod 25.
comment bcoz its adding one extra page no.
done as on 29/11/2004
if remain > 0.
pages = pages + 1.
endif.
**-end
at new bankl.
ctr = 0 .
new-page.
endat.
at new zlsch.
ctr = 0 .
new-page.
endat.
clear v_id.
select single natio
into pa0002-natio
from pa0002
where pernr eq int_rep-pernr.
*-testing......for soma
if ctr > 24.
ctr = 0 .
write:/1(80) sy-uline.
new-page .
endif.
ctr = ctr + 1 .
cnt = cnt + 1.
pack int_rep-pernr to int_rep1.
write:/1 sy-vline, 2(3) cnt intensified off,
7 sy-vline, 9(6) int_rep1 intensified off,
16 sy-vline,17(35) int_rep-ename intensified off .
if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
write : 47 sy-vline,48(15) int_rep-zweck intensified off.
else.
write:
47 sy-vline,48(15) int_rep-bankn intensified off .
endif.
write: 63 sy-vline,64(16) int_rep-betrg
intensified off currency 'INR',
80 sy-vline.
ws_betrg = ws_betrg + int_rep-betrg.
*-testing......for soma
skip.
write :
/1 sy-vline, 7 sy-vline ,16 sy-vline ,47 sy-vline,63 sy-vline,80
sy-vline .
*-end testing......for soma
at end of zlsch.
if int_rep-bankl = ' '.
call function 'HR_IN_CHG_INR_WRDS'
exporting
amt_in_num = ws_betrg
importing
amt_in_words = amount_word
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2
w_val-word = amount_word.
concatenate 'INR.' w_val-word into w_val-word
separated by space.
write:/1(80) sy-uline.
write: /1 sy-vline, 7 'Total transfer:'(009),
64(16) ws_betrg intensified off currency 'INR',
80 sy-vline.
write:/1(80) sy-uline.
write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
80 sy-vline.
write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
80 sy-vline.
write:/1(80) sy-uline.
clear: ws_betrg,cnt.
skip 2.
write: /2 'Prepared by :'(010), '_______________'(013),
45 'Checked by :'(011),'_______________'(013).
skip 2.
write: /2 'Printed On ', sy-datum,
45 'Approved by :'(012),'_______________'(013).
clear sy-pagno.
endif.
endat.
at end of bankl.
if int_rep-bankl ' '.
call function 'HR_IN_CHG_INR_WRDS'
exporting
amt_in_num = ws_betrg
importing
amt_in_words = amount_word
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2
w_val-word = amount_word.
concatenate 'INR.' w_val-word into w_val-word
separated by space.
write:/1(80) sy-uline.
write: /1 sy-vline, 7 'Total transfer:'(009),
64(16) ws_betrg intensified off currency 'INR',
80 sy-vline.
write:/1(80) sy-uline.
write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
80 sy-vline.
write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
80 sy-vline.
write:/1(80) sy-uline.
clear: ws_betrg,cnt.
skip 2.
write: /2 'Prepared by :'(010), '_______________'(013),
45 'Checked by :'(011),'_______________'(013).
skip 2.
write: /2 'Printed on ', sy-datum,
45 'Approved by :'(012),'_______________'(013).
clear sy-pagno.
NEW-PAGE.
endif.
endat.
endloop.
End of Page
end-of-page.
write: /2 'Prepared by :'(010), '_______________',
45 'Checked by :'(011),'_______________'.
*& Form IMPORT_CLUSTER
Importing Data from Cluster *
form import_cluster.
sy-subrc = 0.
rp-imp-c2-cd.
if sy-subrc eq 0.
if cd-version-number ne ocd-version-number.
endif.
endif. " SY-SUBRC EQ 0
endform. " IMPORT_CLUSTER
*& Form INT_TAB
Filling internal table tab_rgdir form int_tab.
*Fill internal table tab_rgdir.
move-corresponding rgdir to tab_rgdir.
tab_rgdir-pernr = pernr-pernr.
append tab_rgdir.
endform. " INT_TAB
*& Form IMPORT_bt
Import Values from Bank Transactions Table (BT) form import_bt.
rp-init-buffer.
RP-IMP-C2-RX.
rp-imp-c2-in.
if rp-imp-in-subrc eq 0.
if in-version-number ne oin-version-number.
write: / 'Schlüssel des Clusters RX:'(015),
rx-key-pernr, rx-key-seqno.
write: / 'The imported version of the cluster'(016), 'RX',
'is not current'(017).
write: / 'Imported version :'(018),
oin-version-number.
write: / 'Current version of cluster :'(019),
in-version-number.
stop.
else.
sy-subrc = 0.
endif.
else.
sy-subrc = 8.
write: /
'Inconsistencies between cluster directory and directory for'(020).
write: /
'No payroll results found for data in cluster directory'(021).
write : /
'Please contact hotline to solve the current problem'(022).
endif.
ws_fpbeg(2) = versc-fpbeg+4(2).
ws_fpbeg+2(4) = versc-fpbeg(4).
ws_fpend(2) = versc-fpend+4(2).
ws_fpend+2(4) = versc-fpend(4).
ws_mthyr(2) = pa_mth.
ws_mthyr+2(4) = pa_year.
check ws_mthyr = ws_fpbeg.
check ws_mthyr = ws_fpend.
loop at bt. "from pc209
int_rep-pernr = pernr-pernr.
int_rep-ename = pernr-ename.
int_rep-bankl = bt-bankl.
int_rep-bankn = bt-bankn.
int_rep-betrg = bt-betrg.
int_rep-zlsch = bt-zlsch.
append int_rep.
endloop.
IF P_BANKL ' ' AND P_ZLSCH ' '.
DELETE INT_REP WHERE BANKL P_BANKL.
ELSEIF P_BANKL = ' ' AND P_ZLSCH ' '.
DELETE INT_REP WHERE ZLSCH P_ZLSCH.
ELSEIF P_BANKL ' ' AND P_ZLSCH = ' '.
DELETE INT_REP WHERE BANKL P_BANKL.
ENDIF.
endform. " IMPORT_BT
*& Form CONVERT_MONTH
Fetching Month Text form convert_month using mth t_mth.
case mth.
when '01'.
t_mth = 'January'(023).
when '02'.
t_mth = 'February'(024).
when '03'.
t_mth = 'March'(025).
when '04'.
t_mth = 'April'(026).
when '05'.
t_mth = 'May'(027).
when '06'.
t_mth = 'June'(028).
when '07'.
t_mth = 'July'(029).
when '08'.
t_mth = 'August'(030).
when '09'.
t_mth = 'September'(031).
when '10'.
t_mth = 'October'(032).
when '11'.
t_mth = 'November'(033).
when '12'.
t_mth = 'December'(034).
endcase.
endform. " CONVERT_MONTH
*& Form CONVERT_DATE_A
Fetching Month Text * form convert_date_a using mth_t t_mth_t.
case mth_t.
when '01'.
t_mth_t = 'Jan.'(035).
when '02'.
t_mth_t = 'Feb.'(036).
when '03'.
t_mth_t = 'Mar.'(037).
when '04'.
t_mth_t = 'Apr.'(038).
when '05'.
t_mth_t = 'May.'(039).
when '06'.
t_mth_t = 'Jun.'(040).
when '07'.
t_mth_t = 'Jul.'(041).
when '08'.
t_mth_t = 'Aug.'(042).
when '09'.
t_mth_t = 'Sep.'(043).
when '10'.
t_mth_t = 'Oct.'(044).
when '11'.
t_mth_t = 'Nov.'(045).
when '12'.
t_mth_t = 'Dec.'(046).
endcase.
endform. " CONVERT_DATE_A
*& Form VALIDATE
text
--> p1 text
<-- p2 text form validate .
if p_bankl <> ' ' and p_zlsch ' '.
delete int_rep where bankl p_bankl.
elseif p_bankl = ' ' and p_zlsch ' '.
delete int_rep where zlsch p_zlsch.
elseif p_bankl ' ' and p_zlsch = ' '.
delete int_rep where bankl p_bankl.
endif.
endform. " VALIDATE
check this weblog.....
/people/dj.adams/blog/2003/11/13/food-for-thought-ldbs-and-abap-objects
Also , check the following link too.
http://www.datamanagementgroup.com/Resources/Articles/Article_1005_2.asp
Regards,
Harish -
HOW TO CREATE A DRILLDOWN PROGRAM NEED EXAMPLE
HAI FRIENDS
1 I WANT TO KNOW HOW TO CREATE A DRILLDOWN PROGRAM NEED EXAMPLE IN ABAP
2 NEED ABAP PROGRAM EBOOK
PLZ DO ITCHECK THIS ALV DRILL DOWN REPORT
*& Report ZHAI_SD_CUSTOMER_DETAILS_ALV
REPORT ZHAI_SD_CUSTOMER_DETAILS_ALV.
TYPE-POOLS: SLIS.
TYPES DECLARATIONS
TABLES : KNA1.
DATA : BEGIN OF IT_CUST OCCURS 0,
KUNNR LIKE KNA1-KUNNR,
NAME1 LIKE KNA1-NAME1,
LAND1 LIKE KNA1-LAND1,
ORT01 LIKE KNA1-ORT01,
STRAS LIKE KNA1-STRAS,
PSTLZ LIKE KNA1-PSTLZ,
END OF IT_CUST.
DATA:BEGIN OF IT_SALE OCCURS 0,
VBELN LIKE VBAK-VBELN,"SALES DOC NO
AUDAT LIKE VBAK-AUDAT,"DATE RECIEVED AND SENT
AUART LIKE VBAK-AUART,"SALES DOC LIKE
NETWR LIKE VBAK-NETWR,"NET VALUE IN DOC CURRENCY
KUNNR LIKE VBAK-KUNNR,
END OF IT_sale.
TYPES: BEGIN OF TY_ITEM,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,"ITEM NO
MATNR TYPE VBAP-MATNR,"MATERIAL NO
CHARG TYPE VBAP-CHARG,"BATCH
MATKL TYPE VBAP-MATKL,"MATERIAL GROUP
MEINS TYPE VBAP-MEINS,"BASE UNIT OF MEASURE
END OF TY_ITEM.
SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR.
INTERNAL TABLES
DATA:
IT_CUST TYPE TABLE OF TY_CUST,
IT_SALE TYPE TABLE OF TY_SALE,
IT_ITEM TYPE TABLE OF TY_ITEM.
INTERNAL TABLES FOR ALV
DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FCAT1 TYPE SLIS_T_FIELDCAT_ALV,
IT_FCAT3 TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_EVENTS TYPE TABLE OF slis_alv_event,
IT_EVENTS1 TYPE TABLE OF SLIS_ALV_EVENT,
IT_EVENTS2 TYPE TABLE OF SLIS_ALV_EVENT.
DATA: IT_LISTHEADER1 TYPE SLIS_T_LISTHEADER,
IT_LISTHEADER TYPE TABLE OF slis_listheader,
IT_LISTHEADER3 TYPE TABLE OF SLIS_LISTHEADER,
IT_FOOTER TYPE TABLE OF SLIS_LISTHEADER.
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT LIKE LINE OF IT_SORT.
WORK AREAS FOR ALV
DATA: WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
WA_LAYOUT1 TYPE SLIS_LAYOUT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT,
WA_FCAT1 LIKE LINE OF IT_FCAT1,
WA_FCAT3 LIKE LINE OF IT_FCAT3,
WA_EVENTS LIKE LINE OF IT_EVENTS,
WA_EVENTS1 LIKE LINE OF IT_EVENTS,
WA_EVENTS2 LIKE LINE OF IT_EVENTS.
WORK VARIABLES
DATA: W_REPID TYPE SY-REPID,
W_KUNNR TYPE KNA1-KUNNR.
$$**----
WORK AREAS
MACROS
DEFINE ADD_FCAT1..
WA_FCAT1-COL_POS = &1.
WA_FCAT1-FIELDNAME = &2.
WA_FCAT1-TABNAME = &3.
WA_FCAT1-REF_TABNAME = &4.
WA_FCAT1-KEY = &5.
WA_FCAT1-DO_SUM = &6.
WA_FCAT1-HOTSPOT = &7.
WA_FCAT1-EMPHASIZE = &8.
APPEND WA_FCAT1 TO IT_FCAT1.
END-OF-DEFINITION.
START-OF-SELECTION.
PERFORM F_GET_DATA.
PERFORM F_BUILD_FCAT.
PERFORM F_GET_EVENTS.
PERFORM F_BUILD_LAYOUT USING WA_LAYOUT.
PERFORM F_GET_DISPLAY.
*& Form F_GET_DATA
FORM F_GET_DATA .
SELECT KUNNR
NAME1
LAND1
ORT01
STRAS
PSTLZ FROM KNA1
INTO TABLE
IT_CUST WHERE KUNNR IN S_KUNNR.
ENDFORM. " F_GET_DATA
*& Form F_GET_DISPLAY
text
--> p1 text
<-- p2 text
FORM F_GET_DISPLAY .
CLEAR W_REPID.
MOVE SY-REPID TO W_REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = w_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = 'F_TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = 'DUCK'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = 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_CUST
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. " F_GET_DISPLAY
*& Form F_GET_EVENTS
text
--> p1 text
<-- p2 text
FORM F_GET_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT IT_EVENTS.
READ TABLE IT_EVENTS INTO WA_EVENTS
WITH KEY NAME = 'TOP_OF_PAGE' BINARY SEARCH.
IF SY-SUBRC EQ 0.
WA_EVENTS-FORM = 'F_TOP_OF_PAGE'.
MODIFY IT_EVENTS INDEX SY-TABIX FROM
WA_EVENTS TRANSPORTING FORM.
ENDIF.
READ TABLE IT_EVENTS INTO WA_EVENTS
WITH KEY NAME = 'USER_COMMAND' BINARY SEARCH.
IF SY-SUBRC EQ 0.
WA_EVENTS-FORM = 'F_USER_COMMAND'.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX
SY-TABIX TRANSPORTING FORM.
READ TABLE IT_EVENTS INTO WA_EVENTS
WITH KEY NAME = 'USER_COMMAND' BINARY SEARCH.
ENDIF.
READ TABLE IT_EVENTS INTO WA_EVENTS WITH
KEY NAME = 'END_OF_PAGE' BINARY SEARCH.
IF SY-SUBRC EQ 0.
WA_EVENTS-FORM = 'F_END_OF_PAGE'.
MODIFY IT_EVENTS FROM WA_EVENTS
INDEX SY-TABIX TRANSPORTING FORM.
ENDIF.
ENDFORM. "F_GET_EVENTS
*& Form F_BUILD_LAYOUT
FORM F_BUILD_LAYOUT USING P_WA_LAYOUT LIKE WA_LAYOUT .
CLEAR P_WA_LAYOUT.
P_WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
*P_WA_LAYOUT-F2CODE = '&ETA'.
*p_wa_layout-detail_popup = 'X'.
P_WA_LAYOUT-DETAIL_TITLEBAR = 'ALV REPORT'.
*P_WA_LAYOUT-CONFIRMATION_PROMPT = 'X'.
ENDFORM. " F_BUILD_LAYOUT
*& Form F_TOP_OF_PAGE
FORM F_TOP_OF_PAGE .
refresh it_listheader.
DATA: LS_LIST TYPE SLIS_LISTHEADER.
LS_LIST-TYP = 'H'.
LS_LIST-INFO = TEXT-004.
APPEND LS_LIST TO IT_LISTHEADER.
LS_LIST-typ = 'S'.
LS_LIST-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO LS_LIST-info. "todays date
append LS_LIST to IT_LISTHEADER.
clear: LS_LIST.
LS_LIST-TYP = 'S'.
LS_LIST-KEY = 'DEVELOPED:'.
LS_LIST-INFO = SY-UNAME.
APPEND LS_LIST TO IT_LISTHEADER.
CLEAR LS_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
I_LOGO = 'GLOBAL'.
ENDFORM. " F_TOP_OF_PAGE
*& Form F_BUILD_FCAT
FORM F_BUILD_FCAT .
CLEAR: W_REPID,
IT_FCAT.
MOVE SY-REPID TO W_REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = W_REPID
I_INTERNAL_TABNAME = 'IT_CUST'
I_INCLNAME = W_REPID
CHANGING
CT_FIELDCAT = IT_FCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " F_BUILD_FCAT
*& Form F_USER_COMMAND
FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
IF RS_SELFIELD-FIELDNAME = 'KUNNR'.
READ TABLE IT_CUST
INDEX RS_SELFIELD-TABINDEX.
MOVE rs_selfield-value TO W_KUNNR.
IF IT_CUST IS NOT INITIAL.
PERFORM F_GET_SECONDARY_DATA.
PERFORM F_BUILD_FCAT1.
PERFORM F_BUILD_EVENTS.
PERFORM F_GET_SORT.
PERFORM F_BUILD_LAYOUT1.
PERFORM F_GET_DISPLAY1.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM. " F_USER_COMMAND
*& Form F_GET_SECONDARY_DATA
FORM F_GET_SECONDARY_DATA .
data:v_data.
SELECT VBELN
AUDAT
AUART
NETWR
KUNNR FROM VBAK INTO TABLE IT_SALE
WHERE KUNNR EQ IT_CUST-KUNNR.
IF IT_SALE[] IS INITIAL .
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = SY-REPID
DIAGNOSE_OBJECT = ' '
TEXT_QUESTION = 'NO SALES FOR THIS CUSTOMER'
TEXT_BUTTON_1 = 'Ja'(001)
ICON_BUTTON_1 = ' '
TEXT_BUTTON_2 = 'Nein'(002)
ICON_BUTTON_2 = ' '
DEFAULT_BUTTON = '1'
DISPLAY_CANCEL_BUTTON = 'X'
USERDEFINED_F1_HELP = ' '
START_COLUMN = 25
START_ROW = 6
POPUP_TYPE =
IV_QUICKINFO_BUTTON_1 = ' '
IV_QUICKINFO_BUTTON_2 = ' '
IMPORTING
ANSWER = v_data
TABLES
PARAMETER =
EXCEPTIONS
TEXT_NOT_FOUND = 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.
case v_data.
when '2'.
leave screen.
when 'A'.
leave to screen '0'.
endcase.
ENDIF.
ENDFORM. " F_GET_SECONDARY_DATA
*& Form F_BUILD_FCAT1
FORM F_BUILD_FCAT1 .
REFRESH IT_FCAT1.
CLEAR WA_FCAT1.
ADD_FCAT1:
'1' 'VBELN' 'VBAK' 'VBAK' 'X' ' ' 'X' 'C500',
'2' 'AUDAT' 'VBAK' 'VBAK' ' ' ' ' ' ' 'C400',
'3' 'AUART' 'VBAK' 'VBAK' ' ' ' ' ' ' 'C100',
'4' 'NETWR' 'VBAK' 'VBAK' ' ' 'X' ' ' 'C300'.
ENDFORM. " F_BUILD_FCAT1
*& Form F_GET_DISPLAY1
text
--> p1 text
<-- p2 text
FORM F_GET_DISPLAY1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND1'
I_CALLBACK_TOP_OF_PAGE = 'F_TOP_OF_PAGE1'
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 =
IT_FIELDCAT = IT_FCAT1
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENTS1
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_SALE
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. " F_GET_DISPLAY1
*& Form F_BUILD_EVENTS
FORM F_BUILD_EVENTS .
clear wa_events1.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS1.
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SORT IT_EVENTS1.
read table It_events1 with key name = 'TOP_OF_PAGE'
into WA_eventS1.
if sy-subrc = 0.
move 'F_TOP_OF_PAGE1' to WA_EventS1-form.
append WA_eventS1 to it_events1.
endif.
READ TABLE IT_EVENTS WITH KEY NAME = 'USER_COMMAND'
INTO WA_EVENTS1.
IF SY-SUBRC = 0.
MOVE 'F_USER_COMMAND1' TO WA_EVENTS1-FORM.
APPEND WA_EVENTS1 TO IT_EVENTS1.
ENDIF.
*READ TABLE IT_EVENTS WITH KEY NAME = 'SUBTOTAL_TEXT'
INTO WA_EVENTS1.
IF SY-SUBRC = 0.
MOVE 'F_SUBTOTAL_TEXT' TO WA_EVENTS1-FORM.
APPEND WA_EVENTS1 TO IT_EVENTS1.
ENDIF.
ENDFORM. " F_BUILD_EVENTS
*& Form F_TOP_OF_PAGE1
FORM F_TOP_OF_PAGE1 .
DATA: LS_HEADER TYPE SLIS_LISTHEADER.
REFRESH : IT_LISTHEADER1.
LS_HEADER-TYP = 'H'.
LS_HEADER-INFO = 'SALES ORDER DETAILS FOR CUSTOMER'.
APPEND LS_HEADER TO it_listheader1.
CLEAR LS_HEADER.
LS_HEADER-TYP = 'S'.
LS_HEADER-KEY = 'CUSTOMER NO:'.
LS_HEADER-INFO = W_KUNNR.
APPEND LS_HEADER TO IT_LISTHEADER1.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER1
I_LOGO = 'DUCK'
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. " F_TOP_OF_PAGE
*& Form F_END_OF_PAGE
text
--> p1 text
<-- p2 text
FORM F_END_OF_PAGE .
DATA:LS_FOOTER TYPE SLIS_LISTHEADER.
LS_FOOTER-TYP = 'S'.
LS_FOOTER-KEY = SY-UNAME.
LS_FOOTER-INFO = 'DEVELOPED BY:'.
APPEND LS_FOOTER TO IT_FOOTER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_FOOTER
ENDFORM. " F_END_OF_PAG
*& Form F_USER_COMMAND1
text
--> p1 text
<-- p2 text
FORM F_USER_COMMAND1 USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
READ TABLE IT_SALE INDEX RS_SELFIELD-TABINDEX.
PERFORM F_GET_SECONDARY2.
PERFORM F_GET_FCAT3 USING:
'VBELN' '1' 'C' '12' 'SALES_DOC' 'M' 'VBAP' 'X' 'C51' ' ',
'POSNR' '2' ' ' '5' 'ITEM_NO' 'M' 'VBAP' ' ' 'C61' ' ',
'MATNR' '3' ' ' '12' 'MATERIAL_NO' 'M' 'VBAP' ' ' 'C71' ' ',
'CHARG' '4' ' ' '10' 'BATCH_NO' 'M' 'VBAP' ' ' 'C41' ' ',
'MATKL' '5' ' ' '10' 'MAT_GROUP' 'M' 'VBAP' ' ' 'C31' ' ',
'MEINS' '6' ' ' '12' 'BASE_UNIT' 'M' 'VBAP' ' ' 'C21' 'X' .
PERFORM F_GET_EVENTS2 USING WA_EVENTS2
CHANGING IT_EVENTS2.
PERFORM F_GET_DISPLAY3.
REFRESH IT_FCAT3.
ENDCASE.
ENDFORM. " F_USER_COMMAND1
*& Form F_GET_SECONDARY2
text
--> p1 text
<-- p2 text
FORM F_GET_SECONDARY2 .
SELECT VBELN
POSNR
MATNR
MATKL
MEINS
FROM VBAP INTO
TABLE IT_ITEM WHERE
VBELN EQ IT_SALE-VBELN.
IF SY-DBCNT EQ 0.
MESSAGE E000(ZHAI) WITH TEXT-KO1.
ENDIF.
ENDFORM. " F_GET_SECONDARY2
*& Form F_GET_DISPLAY3
text
--> p1 text
<-- p2 text
FORM F_GET_DISPLAY3 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'F_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = 'F_TOP_OF_PAGE3'
I_CALLBACK_HTML_TOP_OF_PAGE = 'F_TOP_OF_PAGE3'
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = WA_LAYOUT1
IT_FIELDCAT = IT_FCAT3
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = IT_EVENTS2
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_ITEM
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. " F_GET_DISPLAY3
*& Form F_GET_FCAT3
FORM F_GET_FCAT3 USING VALUE(P1)
VALUE(P2)
VALUE(P3)
VALUE(P4)
VALUE(P5)
VALUE(P6)
VALUE(P7)
VALUE(P8)
VALUE(P9)
VALUE(P10).
CLEAR WA_FCAT3.
WA_FCAT3-FIELDNAME = P1.
WA_FCAT3-COL_POS = P2.
WA_FCAT3-JUST = P3.
WA_FCAT3-OUTPUTLEN = P4.
WA_FCAT3-SELTEXT_M = P5.
WA_FCAT3-DDICTXT = P6.
WA_FCAT3-REF_TABNAME = P7.
WA_FCAT3-HOTSPOT = P8.
WA_FCAT3-EMPHASIZE = P9.
WA_FCAT3-DO_SUM = P10.
APPEND WA_FCAT3 TO IT_FCAT3.
ENDFORM. " F_GET_FCAT3
*& Form F_BUILD_LAYOUT1
text
--> p1 text
<-- p2 text
FORM F_BUILD_LAYOUT1 .
WA_LAYOUT1-totals_text = 'TOTAL'.
wa_layout1-detail_popup = 'X'.
ENDFORM. " F_BUILD_LAYO
*& Form F_GET_EVENTS2
text
-->P_IT_EVENTS2 text
<--P_WA_EVENTS2 text
FORM F_GET_EVENTS2 USING VALUE(P_WA_EVENTS2) LIKE WA_EVENTS2
CHANGING P_IT_EVENTS2 LIKE IT_EVENTS2.
P_WA_EVENTS2-NAME = 'HTML_TOP_OF_PAGE'.
P_WA_EVENTS2-FORM = 'F_TOP_OF_PAGE3'.
APPEND P_WA_EVENTS2 TO P_IT_EVENTS2.
CLEAR P_WA_EVENTS2.
P_WA_EVENTS2-NAME = 'PF_STATUS'.
P_WA_EVENTS2-FORM = 'F_PF_STATUS'.
APPEND P_WA_EVENTS2 TO P_IT_EVENTS2.
CLEAR P_WA_EVENTS2.
P_WA_EVENTS2-NAME = 'USER_COMMAND'.
P_WA_EVENTS2-FORM = 'F_USER_COMMAND3'.
APPEND P_WA_EVENTS2 TO P_IT_EVENTS2.
CLEAR P_WA_EVENTS2.
p_wa_events2-name = 'HTML_END_OF_LIST'.
P_WA_EVENTS2-FORM = 'F_HTML_END_OF_LIST'.
APPEND P_WA_EVENTS2 TO P_IT_EVENTS2.
CLEAR p_wa_events2.
ENDFORM. " F_GET_EVENTS2
*& Form F_TOP_OF_PAGE3
text
--> p1 text
<-- p2 text
FORM F_TOP_OF_PAGE3 USING DOCUMENT TYPE REF TO cl_dd_document .
data : link_area type ref to cl_dd_area,
picture_area type ref to cl_dd_area.
CALL METHOD DOCUMENT->ADD_TEXT
EXPORTING
TEXT = 'ALV REPORT'
TEXT_TABLE =
FIX_LINES =
SAP_STYLE =
SAP_COLOR = cl_dd_area=>list_background_int
SAP_FONTSIZE = 'LARGE'
SAP_FONTSTYLE = 'TIMES'
SAP_EMPHASIS = 'STRONG'
STYLE_CLASS =
CHANGING
DOCUMENT =
CALL METHOD DOCUMENT->NEW_LINE.
CALL METHOD DOCUMENT->ADD_PICTURE
EXPORTING
PICTURE_ID = 'LOGO1'
WIDTH = '10%'
ENDFORM. " F_TOP_OF_PAGE3
*& Form F_GET_SORT
text
--> p1 text
<-- p2 text
FORM F_GET_SORT .
WA_SORT-FIELDNAME = 'NETWR'.
WA_SORT-SPOS = 4.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
ENDFORM. " F_GET_SORT
*& Form F_PF_STATUS
text
--> p1 text
<-- p2 text
FORM F_PF_STATUS USING RS_EXTAB TYPE SLIS_T_EXTAB .
SET PF-STATUS 'ZHAIALV' EXCLUDING RS_EXTAB.
ENDFORM. " F_PF_STATUS
*& Form F_USER_COMMAND3
text
--> p1 text
<-- p2 text
FORM F_USER_COMMAND3 USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&SALE'.
IF RS_SELFIELD-FIELDNAME = 'VBELN'.
SET parameter ID 'AUN' FIELD rs_selfield-value.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
ENDIF.
WHEN '&MAT'.
IF RS_SELFIELD-FIELDNAME = 'MATNR'.
SET PARAMETER ID 'MAT' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. " F_USER_COMMAND3
*& Form F_HTML_END_OF_LIST
text
--> p1 text
<-- p2 text
FORM F_HTML_END_OF_LIST USING DOCUMENT TYPE REF TO CL_DD_DOCUMENT.
DATA : PAGE TYPE SDYDO_TEXT_ELEMENT.
MOVE SY-PAGNO TO PAGE.
CALL METHOD DOCUMENT->ADD_TEXT
EXPORTING
TEXT = PAGE
TEXT_TABLE =
FIX_LINES =
SAP_STYLE =
SAP_COLOR =
SAP_FONTSIZE =
SAP_FONTSTYLE =
SAP_EMPHASIS =
STYLE_CLASS =
CHANGING
DOCUMENT =
ENDFORM. " F_HTML_END_OF_LIS -
Needed example working code for FM"LAST_DAY_IN_PERIOD_GET"
needed example working code for FM"LAST_DAY_IN_PERIOD_GET"
Hi,
Go through this code
*& Report Z_FICO_REP_SHIPMENTS
REPORT z_fico_rep_shipments MESSAGE-ID sd.
TYPE-POOLS : slis.
TABLES : vbak,
kna1,
likp,
vbfa.
*>> DEFINE global Types
TYPES : BEGIN OF gt_vbak,
vbeln TYPE vbeln,
kunnr TYPE kunnr ,
spart TYPE spart,
audat TYPE audat,
END OF gt_vbak,
BEGIN OF gt_kna1,
kunnr TYPE kunnr,
name1 TYPE name1,
END OF gt_kna1,
BEGIN OF gt_likp,
vbeln TYPE vbeln,
wadat_ist TYPE wadat_ist,
END OF gt_likp,
BEGIN OF gt_vbfa,
vbelv TYPE vbelv,
erdat TYPE erdat,
rfwrt TYPE rfwrt,
END OF gt_vbfa,
BEGIN OF gt_final,
kunnr TYPE kunnr,
name1 TYPE name1,
cumon TYPE monat,
trcum TYPE rfwrt,
trcuy TYPE rfwrt,
perce TYPE rfwrt,
fiscy TYPE gjahr,
ftrcum TYPE rfwrt,
ftrcuy TYPE rfwrt,
fperce TYPE rfwrt,
END OF gt_final.
DATA : gwa_vbak TYPE gt_vbak,
gwa_kna1 TYPE gt_kna1,
gwa_likp TYPE gt_likp,
gwa_vbfa TYPE gt_vbfa,
gwa_final TYPE gt_final,
gwa_sort TYPE slis_sortinfo_alv,
gwa_layout TYPE slis_layout_alv. "ALV Layout
DATA : gi_vbak TYPE STANDARD TABLE OF gt_vbak,
gi_kna1 TYPE STANDARD TABLE OF gt_kna1,
gi_likp TYPE STANDARD TABLE OF gt_likp,
gi_vbfa TYPE STANDARD TABLE OF gt_vbfa,
gi_likp1 TYPE STANDARD TABLE OF gt_likp,
gi_vbfa1 TYPE STANDARD TABLE OF gt_vbfa,
gi_final TYPE STANDARD TABLE OF gt_final WITH HEADER LINE,
gi_final1 TYPE STANDARD TABLE OF gt_final WITH HEADER LINE.
*>> DEFINE INTERNAL TABLE
DATA : gi_fieldcat TYPE slis_t_fieldcat_alv, "ALV Fieldcatalog
gi_events TYPE slis_t_event, "ALV EventS
gi_sort TYPE slis_t_sortinfo_alv ,
gi_top_of_page TYPE slis_t_listheader. "ALV LIST HEADER
DATA : gv_month(2) TYPE n.
*>> GLOBAL CONSTANTS
CONSTANTS: gc_day(2) TYPE n VALUE 01,
gc_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
gc_x TYPE c VALUE 'X'.
SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_monat TYPE monat OBLIGATORY,
p_gjahr TYPE gjahr OBLIGATORY.
SELECT-OPTIONS : s_bukrs FOR vbak-bukrs_vf OBLIGATORY,
s_vkorg FOR vbak-vkorg,
s_spart FOR vbak-spart OBLIGATORY,
s_audat FOR vbak-audat NO-DISPLAY.
SELECTION-SCREEN:END OF BLOCK b1.
SELECTION-SCREEN:BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
PARAMETERS: p_det RADIOBUTTON GROUP grp DEFAULT 'X' ,
p_sum RADIOBUTTON GROUP grp.
SELECTION-SCREEN:END OF BLOCK b2.
START-OF-SELECTION.
*>> Take Period And year and find starting and ending date
PERFORM fiscal_date.
PERFORM collect_data.
PERFORM manipulation_collect_data.
END-OF-SELECTION.
*>> Sort
PERFORM gi_sort_table.
*>> MEARGE FIELD CATALOG USING INTERNAL TABLE
PERFORM mearge_field_catalog.
*>> SET EVENTS
PERFORM set_event.
*>> FOR ALV HEADER
PERFORM n_top_of_page USING gi_top_of_page[].
*>>For ALV Layout
PERFORM build_layout.
*>>For output display
PERFORM alv_grid_display.
*& Form fiscal_date
FORM fiscal_date.
TYPES : BEGIN OF lt_fisc,
bukrs TYPE bukrs,
periv TYPE periv,
bumon TYPE bumon,
butag TYPE butag,
END OF lt_fisc,
BEGIN OF lt_t009b,
periv TYPE periv,
bumon TYPE bumon,
butag TYPE butag,
poper TYPE poper,
END OF lt_t009b.
DATA : lwa_fisc TYPE lt_fisc,
lwa_t009b TYPE lt_t009b.
DATA : li_fisc TYPE STANDARD TABLE OF lt_fisc,
li_t009b TYPE STANDARD TABLE OF lt_t009b.
DATA : lv_date(2) TYPE c,
lv_mont(2) TYPE c,
lv_year(4) TYPE c.
SELECT bukrs periv FROM t001
INTO TABLE li_fisc
WHERE bukrs IN s_bukrs.
IF sy-subrc EQ 0.
SELECT * FROM t009b
INTO CORRESPONDING FIELDS OF TABLE li_t009b
FOR ALL ENTRIES IN li_fisc
WHERE periv EQ li_fisc-periv .
IF sy-subrc NE 0.
CLEAR li_t009b.
ENDIF.
ELSE.
CLEAR li_fisc.
ENDIF.
SORT li_t009b BY periv poper.
LOOP AT li_fisc INTO lwa_fisc.
READ TABLE li_t009b INTO lwa_t009b WITH KEY periv = lwa_fisc-periv
poper = '001'
BINARY SEARCH.
IF sy-subrc = 0.
s_audat-option = 'EQ'.
s_audat-sign = 'I'.
CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = p_gjahr
i_periv = lwa_t009b-periv
i_poper = lwa_t009b-poper
IMPORTING
e_date = s_audat-low.
ENDIF.
CLEAR lwa_t009b.
READ TABLE li_t009b INTO lwa_t009b WITH KEY periv = lwa_fisc-periv
poper = '012'
BINARY SEARCH.
IF sy-subrc = 0.
CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
EXPORTING
i_gjahr = p_gjahr
i_periv = lwa_t009b-periv
i_poper = lwa_t009b-poper
IMPORTING
e_date = s_audat-high.
ENDIF.
CLEAR lwa_t009b.
READ TABLE li_t009b INTO lwa_t009b WITH KEY periv = lwa_fisc-periv
poper = p_monat
BINARY SEARCH.
IF sy-subrc = 0.
lv_date = s_audat-high+6(2).
lv_mont = s_audat-high+4(2).
lv_year = s_audat-high(4).
lv_mont = lwa_t009b-bumon.
lv_date = lwa_t009b-butag.
CONCATENATE lv_year lv_mont lv_date INTO s_audat-high.
APPEND s_audat.
CLEAR: lwa_fisc,lwa_t009b,lv_date,lv_mont,lv_year.
ENDIF.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM s_audat.
ENDFORM. "fiscal_date
*& Form collect_data
FORM collect_data .
SELECT vbeln kunnr spart audat
FROM vbak
INTO TABLE gi_vbak
WHERE audat GE s_audat-low AND
audat LT s_audat-high AND
vkorg IN s_vkorg AND
spart IN s_spart AND
bukrs_vf IN s_bukrs.
IF sy-subrc EQ 0.
SELECT kunnr name1
FROM kna1
INTO TABLE gi_kna1
FOR ALL ENTRIES IN gi_vbak
WHERE kunnr EQ gi_vbak-kunnr.
IF sy-subrc NE 0.
CLEAR gi_kna1.
ENDIF.
SELECT vbeln wadat_ist
FROM likp
INTO TABLE gi_likp
WHERE wadat_ist GE s_audat-low AND
wadat_ist LT s_audat-high .
IF sy-subrc EQ 0.
SELECT vbelv erdat rfwrt
FROM vbfa
INTO TABLE gi_vbfa
FOR ALL ENTRIES IN gi_likp
WHERE vbeln = gi_likp-vbeln AND
( vbtyp_n = 'M' OR
vbtyp_n = 'H' ) .
IF sy-subrc NE 0.
CLEAR gi_vbfa.
ENDIF.
ELSE.
CLEAR gi_likp.
ENDIF.
PERFORM change_date.
SELECT vbeln wadat_ist
FROM likp
INTO TABLE gi_likp1
WHERE wadat_ist GE s_audat-low AND
wadat_ist LT s_audat-high .
IF sy-subrc EQ 0.
SELECT vbelv erdat rfwrt
FROM vbfa
INTO TABLE gi_vbfa1
FOR ALL ENTRIES IN gi_likp1
WHERE vbeln = gi_likp1-vbeln AND
( vbtyp_n = 'M' OR
vbtyp_n = 'H' ) .
IF sy-subrc NE 0.
CLEAR gi_vbfa.
ENDIF.
ELSE.
CLEAR gi_likp.
ENDIF.
ELSE.
MESSAGE i261.
LEAVE SCREEN.
ENDIF.
ENDFORM. "collect_data
*& Form Manipulation_collect_data
FORM manipulation_collect_data.
SORT gi_vbak BY vbeln.
SORT gi_kna1 BY kunnr.
LOOP AT gi_vbak INTO gwa_vbak.
MOVE-CORRESPONDING gwa_vbak TO gwa_final.
READ TABLE gi_kna1 INTO gwa_kna1 WITH KEY kunnr = gwa_vbak-kunnr
BINARY SEARCH.
IF sy-subrc EQ 0.
gwa_final-name1 = gwa_kna1-name1.
ENDIF.
ENDLOOP.
* v_month = gwa_vbak-audat+4(2).
* gwa_final-cumon = p_monat.
* gwa_final-fiscy = p_gjahr.
* IF v_month = p_monat.
* CLEAR wa_ckmlhd.
* READ TABLE i_ckmlhd INTO wa_ckmlhd WITH KEY matnr = wa_vbap-matnr
* bwkey = wa_vbap-werks
* BINARY SEARCH.
* IF sy-subrc EQ 0.
* CLEAR i_nckmlcr.
* READ TABLE i_nckmlcr INTO wa_nckmlcr
* WITH KEY kalnr = wa_ckmlhd-kalnr
* BINARY SEARCH.
* IF sy-subrc EQ 0.
* gwa_final-peinh = wa_nckmlcr-peinh.
* gwa_final-kzwi6 = wa_vbap-kzwi6 - wa_vbap-kzwi5.
* gwa_final-kzwi5 = wa_vbap-kzwi5.
* gwa_final-totre = gwa_final-kzwi6 + gwa_final-kzwi5.
* gwa_final-actco = ( wa_nckmlcr-pvprs / wa_nckmlcr-peinh ) *
* wa_vbap-kwmeng.
* gwa_final-profit = gwa_final-totre - gwa_final-actco.
* gwa_final-prows = ( gwa_final-profit - gwa_final-kzwi6 ) *
*100.
* ENDIF.
* ENDIF.
* ELSE.
* CLEAR wa_ckmlhd.
* READ TABLE i_ckmlhd INTO wa_ckmlhd WITH KEY matnr = wa_vbap-matnr
* bwkey = wa_vbap-werks
* BINARY SEARCH.
* IF sy-subrc EQ 0.
* READ TABLE i_ckmlcr INTO wa_ckmlcr
* WITH KEY kalnr = wa_ckmlhd-kalnr
* BINARY SEARCH.
* IF sy-subrc NE 0.
* CLEAR wa_ckmlcr.
* ENDIF.
* CLEAR wa_nckmlcr.
* READ TABLE i_nckmlcr INTO wa_nckmlcr
* WITH KEY kalnr = wa_ckmlhd-kalnr
* BINARY SEARCH.
* IF sy-subrc EQ 0.
* gwa_final-fkzwi6 = wa_vbap-kzwi6 - wa_vbap-kzwi5.
* gwa_final-fkzwi5 = wa_vbap-kzwi5.
* gwa_final-ftotre = gwa_final-fkzwi6 + gwa_final-fkzwi5.
* gwa_final-factco = ( ( wa_nckmlcr-pvprs / wa_ckmlcr-peinh )
* * wa_vbap-kwmeng ) / wa_nckmlcr-count.
* gwa_final-fprofit = gwa_final-ftotre - gwa_final-factco.
* gwa_final-fprows = ( gwa_final-fprofit - gwa_final-kzwi6 ) *
*100
* ENDIF.
* ENDIF.
* ENDIF.
* APPEND gwa_final TO gi_final.
* CLEAR : gwa_final,wa_nckmlcr,wa_ckmlcr,wa_ckmlhd,
* gwa_vbak,wa_vbap,gwa_kna1.
* ENDLOOP.
* gwa_final-matnr = space.gwa_final-vbeln = space.
* MODIFY gi_final FROM gwa_final TRANSPORTING vbeln matnr
* WHERE matnr NE space.
* SORT gi_final BY kunnr vbeln matnr.
* IF p_sum = gc_x.
* LOOP AT gi_final INTO gwa_final.
* COLLECT gwa_final INTO gi_final1.
* ENDLOOP.
* CLEAR gwa_final.REFRESH gi_final.
* gi_final[] = gi_final1[].
* ENDIF.
ENDFORM. "manipulation_collect_data
*& Form change_date
FORM change_date.
DATA : lv_date(2) TYPE c,
lv_mont(2) TYPE c,
lv_year(4) TYPE n.
lv_date = s_audat-low+6(2).
lv_mont = s_audat-low+4(2).
lv_year = s_audat-low(4).
lv_year = lv_year - 1.
CONCATENATE lv_year lv_mont lv_date INTO s_audat-low.
CLEAR : lv_date ,lv_mont,lv_year.
lv_date = s_audat-high+6(2).
lv_mont = s_audat-high+4(2).
lv_year = s_audat-high(4).
lv_year = lv_year - 1.
CONCATENATE lv_year lv_mont lv_date INTO s_audat-high.
CLEAR : lv_date ,lv_mont,lv_year.
ENDFORM. " change_date
*& Form gi_sort_table
FORM gi_sort_table.
IF p_det = gc_x.
gwa_sort-spos = '1'.
gwa_sort-fieldname = 'KUNNR'.
gwa_sort-tabname = 'gi_final'.
gwa_sort-up = gc_x.
gwa_sort-subtot = gc_x.
APPEND gwa_sort TO gi_sort.
CLEAR gwa_sort.
gwa_sort-spos = '2'.
gwa_sort-fieldname = 'NAME1'.
gwa_sort-tabname = 'gi_final'.
gwa_sort-up = gc_x.
APPEND gwa_sort TO gi_sort.
* ELSE.
* gwa_sort-spos = '1'.
* gwa_sort-fieldname = 'KUNNR'.
* gwa_sort-tabname = 'gi_final'.
* gwa_sort-up = gc_x.
* APPEND gwa_sort TO gi_sort.
* CLEAR gwa_sort.
* gwa_sort-spos = '2'.
* gwa_sort-fieldname = 'NAME1'.
* gwa_sort-tabname = 'gi_final'.
* gwa_sort-up = gc_x.
* gwa_sort-group = gc_x.
* gwa_sort-subtot = gc_x.
* APPEND gwa_sort TO gi_sort.
ENDIF.
ENDFORM. "gi_sort_table
*& Form mearge_field_catalog
FORM mearge_field_catalog .
*>> LOCAL WORK AREA FOR FIELDCATALOG
DATA : lwa_fieldcata TYPE slis_fieldcat_alv.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'KUNNR'.
* lwa_fieldcata-col_pos = 1.
lwa_fieldcata-key = 'X'.
lwa_fieldcata-key_sel = 'X'.
lwa_fieldcata-ref_tabname = 'KNA1'.
lwa_fieldcata-seltext_l = 'Customer No.'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'NAME1'.
* lwa_fieldcata-col_pos = 2.
lwa_fieldcata-ref_tabname = 'KNA1'.
lwa_fieldcata-seltext_l = 'Customer Name'.
APPEND lwa_fieldcata TO gi_fieldcat.
IF p_det = gc_x.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'VBELN'.
* lwa_fieldcata-col_pos = 3.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Sales Order Number'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'MATNR'.
* lwa_fieldcata-col_pos = 4.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Material No.'.
APPEND lwa_fieldcata TO gi_fieldcat.
ENDIF.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'KWMENG'.
lwa_fieldcata-col_pos = 5.
lwa_fieldcata-ref_tabname = 'VBAP'.
lwa_fieldcata-do_sum = 'X'.
lwa_fieldcata-seltext_l = 'Order Quantity'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'PEINH'.
lwa_fieldcata-col_pos = 6.
lwa_fieldcata-ref_tabname = 'CKMLCR'.
lwa_fieldcata-text_fieldname = 'PEINH'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'CUMON'.
lwa_fieldcata-col_pos = 7.
lwa_fieldcata-ref_tabname = 'VBKPF'.
lwa_fieldcata-seltext_l = 'Month'.
lwa_fieldcata-no_sum = gc_x.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'KZWI6'.
lwa_fieldcata-col_pos = 8.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Costed Sales'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'KZWI5'.
lwa_fieldcata-col_pos = 9.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Surcharges'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'TOTRE'.
lwa_fieldcata-col_pos = 10.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Total Revenues'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'ACTCO'.
lwa_fieldcata-col_pos = 11.
lwa_fieldcata-ref_tabname = 'VBAP'.
lwa_fieldcata-seltext_l = 'Actual Cost for Period'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'PROFIT'.
lwa_fieldcata-col_pos = 12.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Profit'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'PROWS'.
lwa_fieldcata-col_pos = 13.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Profit % w/surcharge'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'FISCY'.
lwa_fieldcata-col_pos = 14.
* lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Fiscal Year'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'FKZWI6'.
lwa_fieldcata-col_pos = 15.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Costed Sales'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'FKZWI5'.
lwa_fieldcata-col_pos = 16.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Surcharges'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'FTOTRE'.
lwa_fieldcata-col_pos = 17.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Total Revenues'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'FACTCO'.
lwa_fieldcata-col_pos = 18.
lwa_fieldcata-ref_tabname = 'VBAP'.
lwa_fieldcata-seltext_l = 'Actual Cost for Period'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'FPROFIT'.
lwa_fieldcata-col_pos = 19.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Profit'.
APPEND lwa_fieldcata TO gi_fieldcat.
CLEAR lwa_fieldcata.
lwa_fieldcata-fieldname = 'FPROWS'.
lwa_fieldcata-col_pos = 20.
lwa_fieldcata-ref_tabname = 'VBAK'.
lwa_fieldcata-seltext_l = 'Profit % w/surcharge'.
APPEND lwa_fieldcata TO gi_fieldcat.
ENDFORM. " mearge_field_catalog
*& Form set_event
FORM set_event .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 1
IMPORTING
et_events = gi_events.
SORT gi_events BY name.
*-- To read Top of Page event
PERFORM read_events USING slis_ev_top_of_page gc_top_of_page.
ENDFORM. " set_event
*& Form top_of_page
FORM n_top_of_page USING lp_top_of_page TYPE slis_t_listheader.
DATA: lwa_listhead TYPE slis_listheader,
lv_ccode TYPE string,
lv_sales TYPE string,
lv_divis TYPE string.
CONCATENATE 'From : ' s_bukrs-low ' To: ' s_bukrs-high INTO lv_ccode.
CONCATENATE 'From: ' s_vkorg-low ' To: ' s_vkorg-high INTO lv_sales.
CONCATENATE 'From: ' s_spart-low ' To: ' s_spart-high INTO lv_divis.
CLEAR lwa_listhead.
lwa_listhead-typ = 'H'.
lwa_listhead-info = text-003.
APPEND lwa_listhead TO lp_top_of_page.
CLEAR lwa_listhead.
lwa_listhead-typ = 'S'.
lwa_listhead-key = 'Month'.
lwa_listhead-info = p_monat.
APPEND lwa_listhead TO lp_top_of_page.
CLEAR lwa_listhead.
lwa_listhead-typ = 'S'.
lwa_listhead-key = 'Year'.
lwa_listhead-info = p_gjahr.
APPEND lwa_listhead TO lp_top_of_page.
CLEAR lwa_listhead.
lwa_listhead-typ = 'S'.
lwa_listhead-key = 'Company Code'.
lwa_listhead-info = lv_ccode.
APPEND lwa_listhead TO lp_top_of_page.
CLEAR lwa_listhead.
lwa_listhead-typ = 'S'.
lwa_listhead-key = 'Sales Org'.
lwa_listhead-info = lv_sales.
APPEND lwa_listhead TO lp_top_of_page.
CLEAR lwa_listhead.
lwa_listhead-typ = 'S'.
lwa_listhead-key = 'Division'.
lwa_listhead-info = lv_divis.
APPEND lwa_listhead TO lp_top_of_page.
IF p_det = gc_x.
CLEAR lwa_listhead.
lwa_listhead-typ = 'A'.
lwa_listhead-info = text-004.
APPEND lwa_listhead TO lp_top_of_page.
ELSE.
CLEAR lwa_listhead.
lwa_listhead-typ = 'A'.
lwa_listhead-info = text-005.
APPEND lwa_listhead TO lp_top_of_page.
ENDIF.
ENDFORM. "top_of_page
*& Form TOP_OF_PAGE
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = gi_top_of_page.
ENDFORM. "TOP_OF_PAGE
*& Form build_layout
FORM build_layout .
gwa_layout-no_input = gc_x.
gwa_layout-colwidth_optimize = gc_x.
gwa_layout-zebra = gc_x.
ENDFORM. "build_layout
*& Form alv_grid_display
FORM alv_grid_display .
* Function module to display ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = gwa_layout
it_fieldcat = gi_fieldcat[]
it_sort = gi_sort
i_save = 'A'
it_events = gi_events[]
TABLES
t_outtab = gi_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.
ENDFORM. " alv_grid_display
*& Form read_events
FORM read_events USING pr_events TYPE slis_alv_event-name
pr_eventname TYPE slis_formname.
DATA: lwa_event TYPE slis_alv_event.
CLEAR lwa_event.
READ TABLE gi_events INTO lwa_event
WITH KEY name = pr_events BINARY SEARCH.
IF sy-subrc = 0.
MOVE pr_eventname TO lwa_event-form.
MODIFY gi_events FROM lwa_event
TRANSPORTING form
WHERE name = pr_events.
ENDIF.
ENDFORM. " read_events
Regards
Sandipan -
Need example BDC reports in HR ABAP
hi all,
I need example BDC reports in HR-ABAP .both download and upload reports..
I was tried but I'm not getting it , so please, any one send sample reports .
Rewarded for helpful answers.Hi,
Check these links
BDC for infotype 0008
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/erphcm/employee%2bphoto%2bupload
Search using "bdc" in this forum you will get lot of examples -
Need example on Java Sections.....
Hi
I need example senario on java sections and how we use both java sections and user defined funtions... can u give me any blog on that..... and i need information about packages used in java for sapxi.... and which class is used for what purpose.... please help me
Thanks & Regards
Ravi shankar BHi,
Refer this blog:
/people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
and the thread:
Re: Sequence Number in XI Mapping
Regards
suraj -
Need Example on Integartion of BEx application into EP
Hi
I need example on Integration of BEx application into EP and Display Data on EP from BW without using BEx web application.
Best Regards
Ravi ShankarHi Ravi,
have a look into the <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/88/3c1640d4642402e10000000a1550b0/frameset.htm">SAP Library</a>. There you will find descriptions of various options how to display BI content in the SAP NetWeaver Portal.
Best regards,
Martin -
Hi, I need example read whole DataBase
Hi
I have component table and field type checkbox.
I need example. Click in the button and read the whole Database
in the VWP
Thank'sI have code, buts not read last record
sociosDataProvider1.cursorFirst();
while(sociosDataProvider1.cursorNext())
}; -
I need example for VARIABLES with Customer Exit.
hi every body i need example for Variable for Customer Exit.
Hi,
You can define 'Formula' variables in your customer exit..for example..
you need to calculate no of machine running hours per month, in order to
caculate the machine total utilization time..in this context.. you need to know
how may hours are there in an month by month..
you can define a variable and write the code in the customer exit for deriving the total no. of hours available for that month and get that value into a variable for further calution like deducting the down time and set up time so on..in your
calculated KF..
Hope this helps..
Assign points if useful..
Cheers,
Pattan. -
Need example vi using AT commands for dialing the modem at the remote end
Can any one give example vi for dialing up a modem and sending data to remote end
Hi sindhu6,
Presuming that you are connected to your modem via a serial connection:
I did find a forum related to your enquiry: http://forums.ni.com/t5/LabVIEW/AT-commands-in-labview/td-p/1213335
And I did find an example from ni.com: http://zone.ni.com/devzone/cda/epd/p/id/2577
Basically, what you need to do is to find out what are the AT commands used for your modem and send the command over using VISA related functions (e.g. VISA Read VI). You can send the command in a sequantial method. You can do this by using the method found in the first link. The best would be that you can create a state machine where by each case/state will consists of commands that you need to run in a sequence (let's say a sequence of AT commands for sending a message via TCP/IP communication).
You can also use a sequence structure but I would not suggest that since you cannot stop the sequence half way and if your command is very long, this may look pretty messy for your code.
The main question is:
What is the version of your LabVIEW?
What is the modem that you are using and how is your hardware setup is going to be (e.g. how did you communicate with your modem)?
Thank you
Warmest regards,
Lennard.C
Learning new things everyday... -
Need example with write to DATA log file programmatically?
Hi all,
I would like to request for an example of writing a datalog (*.DAT) file which could do this.
Datalog file.
NAME: AGE: SEX: (header)
john 16 M (data)
marie 55 F
Dolah 34 M
The program can also let me to add in new data and then store in the same file.dat. The data (hopefully) can be written to the bottom of the last saved entry of data. (eg. after the row Dolah).
I need to do this so that I can open and read back the datalog file and use the data for other purpose.
Please help,
juniYou've got some examples in Fundamentals>File Input and Output but one of the easiest things to do is to modify Write Strings to Spreadsheet File.vi to write strings as detailed at the bottom of the diagram and then save it to a different place and with a different name.
Attachments:
Spreadsheet_File_Write.jpg 17 KB -
Need example of the use of AQ Streams with JMS and no JNDI
This question may be a stretch, but help me if you can.
I do not have Oracle Internet Directory, but I do have 10g database and queues created.
I would like to use plain JMS 1.1 wherever is that possible, but I understand that I will need to use Oracle AQjmsFactory to get to the connection and queue objects.
Does anyone has any examples on how to do this. When I use patches of examples that oracle provides I get NullPointerException.
Thank you,
EdmonWe started with the sample encoder and receiver available
here:
http://www.adobe.com/devnet/flashcom/articles/broadcast_receiver.html
Great article and sample apps!
We were broadcasting and receiving within an hour.
Then we integrated the necessary AS into our own custom
encoders and players.
Good luck! -
Need example of properties file use
I'm writing a text based adventure game to get some practice with the Java language. The only thing that's proving to be difficult is saving the game. I need an example of a class for basic properties operations. I've found various tutorials that all have some helpful information, but putting it all together isn't working for me. Here is what I have.
import java.io.BufferedWriter;
import java.io.FileWriter;
public class SaveGame{
public static void CreateSave(String name){//create the save file
try{
FileWriter fstream = new FileWriter(name+".properties");
BufferedWriter out = new BufferedWriter(fstream);
out.write("*-=Character Information=-*");
out.write("name= \ngender= \n");
out.write("*-=Basic Stats=-*");
out.write("str= \nagl= \nend= \nchr= \nitl= \nlck= \n");
out.close();
}catch(Exception e){System.err.println("Error: " + e.getMessage());}
}//CreateSave
public static void SaveStatus/*save all variables to the file*/
(double str, double agl, double end, double chr, double itl,
double lck, String name, char gender){
// I don't know how to edit values
}//SaveStatus
public static void ReadSave(){//reads the file and sends the variable back to main class
}//ReadSave
}//class The big thing is, I don't know how to edit the values in the properties file. I can handle reading them but i don't know how to convert the string values to int, double, etc. Thanks in advance.Dillon_91 wrote:
Thanks for those.
Can you link to a decent tutorial on the properties class? Most of what I've found is a little more technical than I'm ready for, and they don't have examples.Suns own Java tutorial has some code snippets, that should get you going - [Properties tutorial|http://java.sun.com/docs/books/tutorial/essential/environment/properties.html] -
UPDATE_PERSON_ADDRESS API errors – spec differs! Need Example!
Hi all,
I’ve tried loading a hard-coded example of following 4 API’s but have not succeeded with any of them. I need an example of how these are supposed to work. Eventually, I want to have 1 PLSQL script that includes:
1 of..
update_person_address or
update_gb_person_address or
cre_or_upd_person_address or
update_pers_addr_with_style together with..
Hr_Assignment_Api.update_emp_asg and
Hr_Assignment_Api.update_emp_asg_criteria
(which both work because I’ve already got a working process setup..)
What I’ve found is the spec I’m using..
(taken from CREATE OR REPLACE PACKAGE Hr_Person_Address_Api AUTHID CURRENT_USER AS/* $Header: peaddapi.pkh 115.27 2004/04/04 20:24:19 tpapired ship $ */ )
..has notes that don’t make sense with the comments section (eg. update_person_address) does not contain all the fields that you use in the actual procedure – no wonder Im getting a ‘PLS-00306: wrong number or types of arguments in call to 'UPDATE_PERSON_ADDRESS'’ error message!
Another example is that ‘p_style’ relates somehow to regions but in abosve API there’s no ‘p_style’ parameter which makes me think do you have to use the update_pers_addr_with_style API with it?
My non-working example looks like:
/* Formatted on 2009/03/26 15:39 (Formatter Plus v4.8.7) */
SET serveroutput ON SIZE 1000000 FORMAT WRAPPED
SET verify OFF
SET feedback OFF
DECLARE
l_validate BOOLEAN DEFAULT FALSE;
l_effective_date DATE := TO_DATE ('16-MAR-2009', 'DD-MON-YYYY');
l_validate_county BOOLEAN DEFAULT FALSE;
ip_p_address_id NUMBER := 28626;
l_obj NUMBER;
l_date_from DATE := TO_DATE ('17-FEB-2009', 'DD-MON-YYYY');
l_date_to DATE := TO_DATE ('17-FEB-2059', 'DD-MON-YYYY');
l_person_id NUMBER := 29588;
l_address_line1 VARCHAR2 (100) := '2 FeatherHill Drive';
l_address_line2 VARCHAR2 (100) := 'East Clackton';
l_address_line3 VARCHAR2 (100) := 'Shrops.';
l_address_line4 VARCHAR2 (100) := 'Inverness';
l_postcode VARCHAR2 (30) := 'SL3 3RT';
-- l_country VARCHAR2 (100) := 'GB';
l_telephone_number VARCHAR2 (25) := '0191 111 3478';
l_party_id NUMBER;
l_region_1 VARCHAR2 (25) := 'DUR';
l_no_managers_warning BOOLEAN;
l_other_manager_warning BOOLEAN;
l_assignment_id NUMBER := 29547;
l_supervisor_id NUMBER := 27928;
l_default_code_comb_id NUMBER := 61635;
-- l_default_code_comb_id NUMBER := 217509;
l_datetrack_update_mode VARCHAR2 (30) := 'UPDATE';
-- l_datetrack_update_mode VARCHAR2 (30) := 'CORRECTION';
l_organization_id NUMBER := 0;
l_concatenated_segments VARCHAR2 (240);
l_soft_coding_keyflex_id NUMBER;
l_comment_id NUMBER;
l_people_group_id NUMBER;
l_special_ceiling_step_id NUMBER;
l_location_id NUMBER := 175;
l_job_id NUMBER := 7;
l_position_id NUMBER := 252;
l_group_name VARCHAR2 (30);
l_org_now_no_manager_warning BOOLEAN;
l_spp_delete_warning BOOLEAN;
l_entries_changed_warning VARCHAR2 (30);
l_tax_district_changed_warning BOOLEAN;
l_style VARCHAR2 (4) := 'GB';
CURSOR csr_ovn
IS
SELECT MAX (padd.object_version_number)
FROM per_addresses padd, per_all_people_f per
WHERE padd.person_id = per.person_id AND per.person_id = '29588';
BEGIN
DBMS_OUTPUT.PUT_LINE ('######################################');
DBMS_OUTPUT.PUT_LINE ('UPDATE of EXISTING Employees Details..');
DBMS_OUTPUT.PUT_LINE ('#######################################');
OPEN csr_ovn;
FETCH csr_ovn
INTO l_obj;
CLOSE csr_ovn;
Hr_Person_Address_Api.update_person_address
(p_validate => l_validate,
p_effective_date => l_effective_date,
p_validate_county => l_validate_county,
p_address_id => ip_p_address_id,
p_object_version_number => l_obj,
p_date_from => l_date_from,
p_date_to => l_date_to,
p_person_id => l_person_id,
-- p_primary_flag => 'N',
p_address_type => NULL,
p_comments => NULL,
p_address_line1 => l_address_line1,
p_address_line2 => l_address_line2,
p_address_line3 => l_address_line3,
p_town_or_city => NULL,
p_region_1 => l_region_1, --NULL,
p_region_2 => NULL,
p_region_3 => NULL,
p_postal_code => l_postcode,
p_country => l_address_line4,
p_telephone_number_1 => l_telephone_number,
p_telephone_number_2 => NULL,
-- p_telephone_number_3 => NULL,
,p_addr_attribute_category IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute1 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute2 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute3 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute4 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute5 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute6 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute7 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute8 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute9 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute10 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute11 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute12 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute13 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute14 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute15 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute16 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute17 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute18 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute19 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_addr_attribute20 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_add_information13 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_add_information14 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_add_information15 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_add_information16 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_add_information17 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_add_information18 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_add_information19 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2
,p_add_information20 IN VARCHAR2 DEFAULT Hr_Api.g_varchar2 */
p_party_id => l_party_id
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
RAISE NO_DATA_FOUND;
-- DBMS_OUTPUT.PUT_LINE ( '..and failure looks like..: ' || SQLERRM );
END;
COMMIT ;
EXIT;Please provide a working example of how this API is used.
Many thanks
Stevenhi,
Ran your code with some minor tweaks on my instance and it works !! Find below the code that I ran.
Cheers
DECLARE
l_validate BOOLEAN DEFAULT FALSE;
l_effective_date DATE;-- := TO_DATE ('16-MAR-2009', 'DD-MON-YYYY');
l_validate_county BOOLEAN DEFAULT TRUE;
ip_p_address_id NUMBER := 19990;
l_obj NUMBER;
l_date_from DATE;-- := TO_DATE ('17-FEB-2009', 'DD-MON-YYYY');
l_date_to DATE;-- := TO_DATE ('17-FEB-2059', 'DD-MON-YYYY');
l_person_id NUMBER := 2257;
l_address_line1 VARCHAR2 (100) := '2 FeatherHill Drive';
l_address_line2 VARCHAR2 (100) := 'East Clackton';
l_address_line3 VARCHAR2 (100) := 'Shrops.';
l_address_line4 VARCHAR2 (100) := 'Inverness';
l_postcode VARCHAR2 (30) := 'SL3 3RT';
l_country VARCHAR2 (100) := 'GB';
l_telephone_number VARCHAR2 (25) := '0191 111 3478';
l_party_id NUMBER;
l_region_1 VARCHAR2 (25) := 'DUR';
l_no_managers_warning BOOLEAN;
l_other_manager_warning BOOLEAN;
l_assignment_id NUMBER := 2297;
l_supervisor_id NUMBER := 47470;
l_default_code_comb_id NUMBER := 248531;
-- l_default_code_comb_id NUMBER := 217509;
l_datetrack_update_mode VARCHAR2 (30) := 'UPDATE';
-- l_datetrack_update_mode VARCHAR2 (30) := 'CORRECTION';
l_organization_id NUMBER := 81;
l_concatenated_segments VARCHAR2 (240);
l_soft_coding_keyflex_id NUMBER;
l_comment_id NUMBER;
l_people_group_id NUMBER;
l_special_ceiling_step_id NUMBER;
l_location_id NUMBER := 9527;
l_job_id NUMBER := 2035;
l_position_id NUMBER := null;
l_group_name VARCHAR2 (30);
l_org_now_no_manager_warning BOOLEAN;
l_spp_delete_warning BOOLEAN;
l_entries_changed_warning VARCHAR2 (30);
l_tax_district_changed_warning BOOLEAN;*/
l_style VARCHAR2 (4) := 'GB';
CURSOR csr_ovn
IS
SELECT MAX (padd.object_version_number)
FROM per_addresses padd, per_all_people_f per
WHERE padd.person_id = per.person_id AND per.person_id = 2257;
BEGIN
DBMS_OUTPUT.PUT_LINE ('######################################');
DBMS_OUTPUT.PUT_LINE ('UPDATE of EXISTING Employees Details..');
DBMS_OUTPUT.PUT_LINE ('#######################################');
OPEN csr_ovn;
FETCH csr_ovn
INTO l_obj;
CLOSE csr_ovn;
Hr_Person_Address_Api.update_person_address
(p_validate => l_validate,
p_effective_date => sysdate,
p_validate_county => l_validate_county,
p_address_id => ip_p_address_id,
p_object_version_number => l_obj,
p_date_from => sysdate,
p_date_to => l_date_to,
/*p_person_id => l_person_id,
p_primary_flag => 'Y',
p_address_type => 'PHCA',
p_comments => NULL,*/
p_address_line1 => l_address_line1,
p_address_line2 => l_address_line2,
p_address_line3 => l_address_line3,
p_town_or_city => NULL,
p_region_1 => l_region_1, --NULL,
p_region_2 => NULL,
p_region_3 => NULL,
p_postal_code => l_postcode,
p_country => l_address_line4,
p_telephone_number_1 => l_telephone_number,
p_telephone_number_2 => NULL,
p_telephone_number_3 => NULL
/* ,p_addr_attribute_category => NULL
,p_addr_attribute1 => NULL
,p_addr_attribute2 => NULL
,p_addr_attribute3 => NULL
,p_addr_attribute4 => NULL
,p_addr_attribute5 => NULL
,p_addr_attribute6 => NULL
,p_addr_attribute7 => NULL
,p_addr_attribute8 => NULL
,p_addr_attribute9 => NULL
,p_addr_attribute10 => NULL
,p_addr_attribute11 => NULL
,p_addr_attribute12 => NULL
,p_addr_attribute13 => NULL
,p_addr_attribute14 => NULL
,p_addr_attribute15 => NULL
,p_addr_attribute16 => NULL
,p_addr_attribute17 => NULL
,p_addr_attribute18 => NULL
,p_addr_attribute19 => NULL
,p_addr_attribute20 => NULL
,p_add_information13 => NULL
,p_add_information14 => NULL
,p_add_information15 => NULL
,p_add_information16 => NULL
,p_add_information17 => NULL
,p_add_information18 => NULL
,p_add_information19 => NULL
,p_add_information20 => NULL*/
-- ,p_party_id => 8246
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
RAISE NO_DATA_FOUND;
DBMS_OUTPUT.PUT_LINE ( '..and failure looks like..: ' || SQLERRM );
END;
COMMIT ;
EXIT; -
Need example to create File names dynamically using File adapter
hello,
I am mapping an IDOC to a flat file using XI and a file adapter. I need to be able to output a file name dynamically depending on the data in the IDOC. For example if the IDOC has 310 as the company code, the file name should be xyz.310 and if the IDOC has 600 as the company code, the file name created by the file adapter should be xyz.600. Please some body provide me with an example of the XSLT code that I will have to write in the dispatcher User Exit.
Any help will be greatly appreciated.Nope
But you could add a dummy row to your source to include column headers and then use options column headers in first row in flat file connection manager.
So suppose you've three columns column0,coulmn1,column2 and you want to make it as ID,Name,Datethen make source query as
SELECT 'ID' AS Col1,'Name' AS Col2,'Date' AS Col3, 0 AS ord
UNION ALL
SELECT Column1,Column2,Column3,1
FROM YourTable
ORDER BY Ord
then choose column headers in first row option
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
SQL08 Need example of creating AND using a Fact (degenerate) dimension
Can someone post a link to some examples of setting up and using a Fact (degenerate) dimension. Ive got the SSAS 2008R2 Adventureworks DW project setup and I see a few Fact dimensions in there, but id like some descriptions to go along with this or
something similar.
My scenario:
Orders - attributes include : Order#, OrderStartDate, SalesPerson, BusinessType, MarketType
OrderTransactions - attributes include: OrderKey , TransactionAmount, TransactionType, TransactionDate, AccountKey
Description:
Its more or less the typical Order > Order Detail type scenario, with the addition of Orders have some additional attributes.
So I want to be able to measure on for example:
Order counts - broken down by BusinessType and MarketType , and then within a date range
Revenue - which will be totals of transaction amounts, again grouped by BusinessType and MarketType, but also be able to drill down to see the related Order#Hi Shiftbit,
According to your description, you need some examples about create and use degenerate dimensions, right?
Degenerate dimensions, also called fact dimensions, are standard dimensions that are constructed from attribute columns in fact tables instead of from attribute columns in dimension tables. Here is document that describes how to create and use degenerate
dimensions step by step, please refer to the links below.
https://msdn.microsoft.com/en-us/library/ms167409(v=sql.100).aspx
http://www.jamesserra.com/archive/2011/11/degenerate-dimensions/
Regards,
Charlie Liao
TechNet Community Support
Maybe you are looking for
-
Ipod not being recognized in Itunes
Ever since I upgraded to latest Itunes version, but Ipod mini is not recognized in Itunes. I know I've seen other postings, but I've tried everything that has been suggested that nothing seems to work. There is nothing wrong with the Ipod mini or cab
-
Can't create portal application project with netweaver development studio
Hi All, I want to follow the toturial (http://help.sap.com/saphelp_nw04/helpdata/en/9e/7d96f7087311d7b84600047582c9f7/frameset.htm) to create a portal application with netweaver , but I am failed at the first step, I can not found "Portal Application
-
Having bluetooth connection problem after using Yosemite for a week
After installing and using Yosemite for a week, I experienced bluetooth connection problems with my magic mouse and headphone, my model is macbook pro retina early 2013, hope to fix this soon
-
Drag and drop interaction not previewing
I have a drag and drop question within my project and when I try to preview it or publish the next 5 slides it doesn't work...blank screen while it tries to load. Please help.
-
Hi All, I using replace in my package and facing this issue. In my code i have temp fields 1 to 15. so when i use replace function to replace :temp1 value it also replaces value of :temp11. :temp1 = some checks :temp2 = some checks :te