REPORT RSAQDVP_TEMPLATE .
*
*---------------------------------------------------------------------*
* declarations
* (insert your declarations in this section)
*---------------------------------------------------------------------*
data:
/BIC/PCPL_MN_TX type /BIC/PCPL_MN_TX ,
it_data type standard table of /BIC/PCPL_MN_TX .
field-symbols: <struc> type /BIC/PCPL_MN_TX .
*-------------------------------------------------------------------*
* selection screen statements
*-------------------------------------------------------------------*
* (define your selection-screen here)
* !! the following comment MUST NOT BE CHANGED !!
*<QUERY_HEAD>
*-------------------------------------------------------------------*
* read data into IT_DATA
*-------------------------------------------------------------------*
* (select your data here into internal table IT_DATA)
DATA(w_date) =
COND dats( WHEN sy-sysid = 'DEV' OR sy-sysid = 'TST'
THEN ( CONV dats( |{ sy-datum+0(4) - 2 }{ sy-datum+4(2) }01| ) - 1 )
WHEN sy-sysid = 'PRD' THEN CONV dats( |{ sy-datum+0(6) }01| ) - 1 ).
* Fiscal Year
APPEND VALUE #(
/bic/cpl_mn_fr = |{ COND numc4( WHEN w_date+4(2) BETWEEN '01' AND '03'
THEN w_date+0(4) - 2
ELSE w_date+0(4) - 1 ) }04|
/bic/cpl_mn_to = |{ COND numc4( WHEN w_date+4(2) BETWEEN '01' AND '03'
THEN w_date+0(4) - 1
ELSE w_date+0(4) ) }03|
/bic/cpl_mn_sq = CONV numc2( LINES( it_data ) ) "00
/bic/cpl_mn_tx = |FY { COND numc4( WHEN w_date+4(2) BETWEEN '01' AND '03'
THEN w_date+0(4) - 2
ELSE w_date+0(4) - 1 ) } | ) TO it_data.
TRY.
APPEND VALUE #(
/bic/cpl_mn_fr = |{ it_data[ 1 ]-/bic/cpl_mn_fr+0(4) - 1 }{ it_data[ 1 ]-/bic/cpl_mn_fr+4(2) }|
/bic/cpl_mn_to = |{ it_data[ 1 ]-/bic/cpl_mn_to+0(4) - 1 }{ it_data[ 1 ]-/bic/cpl_mn_to+4(2) }|
/bic/cpl_mn_sq = CONV numc2( LINES( it_data ) ) "01
/bic/cpl_mn_tx = |FY { it_data[ 1 ]-/bic/cpl_mn_tx+3(4) - 1 } | ) TO it_data.
CATCH cx_sy_itab_line_not_found.
ENDTRY.
* FTLM
APPEND VALUE #(
/bic/cpl_mn_fr = |{ COND numc4( WHEN w_date+4(2) BETWEEN '01' AND '03'
THEN w_date+0(4) - 1
ELSE w_date+0(4) ) }04|
/bic/cpl_mn_to = |{ w_date+0(6) }|
/bic/cpl_mn_sq = CONV numc2( LINES( it_data ) ) "02
/bic/cpl_mn_tx = |FTLM { COND numc4( WHEN w_date+4(2) BETWEEN '01' AND '03'
THEN w_date+0(4) - 1
ELSE w_date+0(4) ) } | ) TO it_data.
TRY.
APPEND VALUE #(
/bic/cpl_mn_fr = |{ it_data[ 3 ]-/bic/cpl_mn_fr+0(4) - 1 }{ it_data[ 3 ]-/bic/cpl_mn_fr+4(2) }|
/bic/cpl_mn_to = |{ it_data[ 3 ]-/bic/cpl_mn_to+0(4) - 1 }{ it_data[ 3 ]-/bic/cpl_mn_to+4(2) }|
/bic/cpl_mn_sq = CONV numc2( LINES( it_data ) ) "03
/bic/cpl_mn_tx = |FTLM { it_data[ 3 ]-/bic/cpl_mn_tx+5(4) - 1 } | ) TO it_data.
CATCH cx_sy_itab_line_not_found.
ENDTRY.
* Quarter
DATA(w_month_fr) = CONV /bi0/oicalmonth( it_data[ 2 ]-/bic/cpl_mn_fr ).
DATA(w_month_to) = COND /bi0/oicalmonth( WHEN w_date+4(2) BETWEEN '01' AND '02'
THEN |{ w_date+0(4) - 1 }12|
WHEN w_date+4(2) BETWEEN '04' AND '05'
THEN |{ w_date+0(4) }03|
WHEN w_date+4(2) BETWEEN '07' AND '08'
THEN |{ w_date+0(4) }06|
WHEN w_date+4(2) BETWEEN '10' AND '11'
THEN |{ w_date+0(4) }09|
ELSE w_date+4(2) ).
TRY.
WHILE w_month_fr < w_month_to.
APPEND VALUE #(
/bic/cpl_mn_fr = CONV /bi0/oicalmonth( |{ w_month_to+0(4) }{ CONV numc2( w_month_to+4(2) - 2 ) }| )
/bic/cpl_mn_to = w_month_to
/bic/cpl_mn_sq = CONV numc2( LINES( it_data ) )
/bic/cpl_mn_tx = SWITCH #( w_month_to+4(2)
WHEN '03' THEN |FQ4 { w_month_to+0(4) - 1 }|
WHEN '12' THEN |FQ3 { w_month_to+0(4) }|
WHEN '09' THEN |FQ2 { w_month_to+0(4) }|
WHEN '06' THEN |FQ1 { w_month_to+0(4) }| ) ) TO it_data.
w_month_to = COND #( WHEN w_month_to+4(2) = '03'
THEN |{ w_month_to+0(4) - 1 }12|
ELSE |{ w_month_to+0(4) }{ CONV num2( w_month_to+4(2) - 3 ) }| ).
ENDWHILE.
CATCH cx_sy_itab_line_not_found.
ENDTRY.
* Month
w_month_to = CONV /bi0/oicalmonth( w_date+0(6) ).
TRY.
WHILE w_month_fr =< w_month_to.
APPEND VALUE #(
/bic/cpl_mn_fr = w_month_to
/bic/cpl_mn_to = w_month_to
/bic/cpl_mn_sq = CONV numc2( LINES( it_data ) )
/bic/cpl_mn_tx = |{ SWITCH #( w_month_to+4(2)
WHEN '01' THEN 'Jan'
WHEN '02' THEN 'Feb'
WHEN '03' THEN 'Mar'
WHEN '04' THEN 'Apr'
WHEN '05' THEN 'May'
WHEN '06' THEN 'Jun'
WHEN '07' THEN 'Jul'
WHEN '08' THEN 'Aug'
WHEN '09' THEN 'Sep'
WHEN '10' THEN 'Oct'
WHEN '11' THEN 'Nov'
WHEN '12' THEN 'Dec' ) } { w_month_to+0(4) }| ) TO it_data.
w_month_to = COND #( WHEN w_month_to+4(2) = '01'
THEN |{ w_month_to+0(4) - 1 }12|
ELSE |{ w_month_to+0(4) }{ CONV num2( w_month_to+4(2) - 1 ) }| ).
ENDWHILE.
CATCH cx_sy_itab_line_not_found.
ENDTRY.
*------------------------------------------------------------*
* output of the data
* (this section can be left unchanged)
*------------------------------------------------------------*
loop at it_data assigning <struc>.
move-corresponding <struc> to /BIC/PCPL_MN_TX .
* !! the following comment MUST NOT BE CHANGED !!
*<QUERY_BODY>
endloop.
//Month
var value = "";
var value_selected = "";
DS_MONTH.getMembers("CPL_MN_TX",999).forEach(function(element1, index1) {
DS_MONTH.getMembers("CPL_MN_TX",999).forEach(function(element2, index2) {
if ( index1 == Convert.stringToInt(element2.externalKey.substring(16,18)) ) {
if ( index1 == 0 || index1 == 1 ) {
value = element2.externalKey.substring(0,7) + " - " + element2.externalKey.substring(8,15);
DROPDOWN_MONTH.addItem(value, element2.internalKey.substring(14), index1 );
} else {
if ( index1 == 2 || index1 == 3 ) {
value = Convert.replaceAll(Convert.replaceAll(Convert.replaceAll(element2.externalKey.substring(0,7), "-", ""),".",""),"/","") + " - " + element2.externalKey.substring(8,15);
DROPDOWN_MONTH.addItem(value, element2.internalKey.substring(14), index1 );
if ( index1 == 2 ) {
value_selected = value;
}
} else {
value = element2.externalKey.substring(0,7) + " - " + Convert.replaceAll(Convert.replaceAll(Convert.replaceAll(element2.externalKey.substring(8,15), "-", ""),".",""),"/","");
DROPDOWN_MONTH.addItem(value, element2.internalKey.substring(14), index1 );
}
}
}
});
});
g_month = value_selected;
DROPDOWN_MONTH.setSelectedValue(value_selected);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |