Skip to Content
-1

Data Retraction - Time dimension

Hi,

We build a process to retract data from Revenue model to BW. Now we found an issue when the file updated in AL11, it posting wrong values for some of the entries. My transnational data for current cycle loaded fiscal year 2020 i.e 2020.APR to 2021.MAR. And the time dimension MD maintained correctly as 2020001 to 2020012.

But when we checked the AL11 file, the entries for 2021.JAN, 2021.FEB, 2021.MAR are coming as 2021010, 2021011 and 2021012 which as actually incorrect. We tried to de-bug the BADI, the input data coming as 2021010 and so on.

We also have the retraction process for other models and there we don't have any issues with TIME. We tried to replicated the scenario in quality system and posted data for fiscyear 2020 and ran the retraction, surprisingly the AL11 file contains correct data (2020010, 2020011 and 2020012).

Can anyone pls suggest what could be wrong?

We re on BPC 10.1 and SP16.

Thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 22, 2020 at 05:04 AM

    Sorry, but you are talking about custom badi! And not providing the code and other details...

    How is it possible to help you???

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 22, 2020 at 06:20 AM

    Hi Vadim,

    Below is my code.

    METHOD if_ujd_retract~retract.
    TYPES: BEGIN OF ty_input,
    fp_account(30) TYPE c,
    fp_category(30) TYPE c,
    fp_customer(30) TYPE c,
    fp_datasrc(30) TYPE c,
    fp_entity(30) TYPE c,
    fp_orderstatus(30) TYPE c,
    fp_profit_ctr(30) TYPE c,
    fp_rptcurrency(30) TYPE c,
    fp_time(30) TYPE c,
    signeddata(30) TYPE c,END OF ty_input.
    DATA: lt_input_data TYPE STANDARD TABLE OF ty_input,
    ls_input_data TYPE ty_input.
    TYPES: BEGIN OF ty_output,
    chrt_accts(30) TYPE c,
    gl_account(30) TYPE c,
    zversion(30) TYPE c,
    zvers_yr(30) TYPE c,
    fiscper(30) TYPE c,
    vtype(30) TYPE c,
    curtype(30) TYPE c,currency(30) TYPE c,
    fiscvarnt(30) TYPE c,
    COMP_CODE(30) TYPE c,
    distr_chan(30) TYPE c,
    division(30) TYPE c,
    salesorg(30) TYPE c,
    zcust_sal(30) TYPE c,
    co_area(30) TYPE c,
    profit_ctr(30) TYPE c,
    orderstatus(30) TYPE c,
    keyfigure(30) TYPE c,END OF ty_output.
    DATA: ls_output_data TYPE ty_output.
    DATA: lv_tmp(30) TYPE c.
    DATA: lv_directory TYPE dirname_al11,
    lv_target_path TYPE c LENGTH 255.
    DATA: lr_conversion TYPE REF TO cl_abap_conv_uc_number,
    lv_codepage TYPE cpnormcp,
    lv_output_data(9999) TYPE c,
    lv_output_string TYPE string,
    lv_output_stream TYPE xstring,
    lv_stream_length TYPE i,
    lv_paypct TYPE uj_signeddata,
    lv_month TYPE char3,
    lv_2_decimal TYPE p DECIMALS 2.
    FIELD-SYMBOLS: <lt_data> TYPE ANY TABLE,
    <ls_data> TYPE any,
    <lv_string> TYPE any.
    CONSTANTS: lc_directory TYPE dirname_al11 VALUE '/BPC_REVENUE_RETRACTION',
    lc_delim1 TYPE c VALUE ',',
    lc_delim2 TYPE c VALUE ','.
    CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_HOME'ID 'VALUE' FIELD lv_directory.
    "construct the target file name (including path)CONCATENATE lv_directory
    lc_directory'.csv'INTO lv_target_path.
    ASSIGN ir_data->* TO <lt_data>.
    IF sy-subrc NE 0.RETURN.ENDIF.
    LOOP AT <lt_data> ASSIGNING <ls_data>.
    CHECK sy-tabix NE 1.CLEAR lv_paypct.ASSIGN <ls_data> TO <lv_string> CASTING TYPE string.
    IF sy-subrc EQ 0.CLEAR ls_input_data.SPLIT <lv_string> AT lc_delim1INTO ls_input_data-fp_account
    ls_input_data-fp_category
    ls_input_data-fp_customer
    ls_input_data-fp_datasrc
    ls_input_data-fp_entity
    ls_input_data-fp_orderstatus
    ls_input_data-fp_profit_ctr
    ls_input_data-fp_rptcurrency
    ls_input_data-fp_time
    ls_input_data-signeddata.CONDENSE ls_input_data-signeddata.APPEND ls_input_data TO lt_input_data.
    ENDIF.ENDLOOP.
    CHECK lt_input_data IS NOT INITIAL.
    "Get System CodepageCALL FUNCTION 'SYSTEM_CODEPAGE'IMPORTING
    codepage = lv_codepage.
    CREATE OBJECT lr_conversionEXPORTING
    im_source_codepage = lv_codepageEXCEPTIONS
    converter_creation_failed = 1OTHERS = 2.
    IF sy-subrc NE 0.RETURN.ENDIF.
    CLEAR ls_output_data.
    ls_output_data-chrt_accts = '0CHRT_ACCTS'."1
    ls_output_data-gl_account = '0GL_ACCOUNT'."2
    ls_output_data-zversion = 'ZVERSION'."3
    ls_output_data-zvers_yr = 'ZVERS_YR'."4
    ls_output_data-fiscper = 'FISCPER'. "5
    ls_output_data-vtype = '0VTYPE'. "6
    ls_output_data-curtype = '0CURTYPE'. "7
    ls_output_data-currency = '0CURRENCY'. "8
    ls_output_data-fiscvarnt = '0FISCVARNT'. "9
    ls_output_data-COMP_CODE = '0COMP_CODE'."11
    ls_output_data-distr_chan = '0DISTR_CHAN'."12
    ls_output_data-division = '0DIVISION'."13
    ls_output_data-salesorg = '0SALESORG'."14
    ls_output_data-zcust_sal = '0CUST_SALES'."15
    ls_output_data-co_area = '0CO_AREA'."16
    ls_output_data-profit_ctr = '0PROFIT_CTR'."17
    ls_output_data-orderstatus = 'ORDERSTATUS'."18
    ls_output_data-keyfigure = 'KEYFIGURE'."19

    CONCATENATE
    ls_output_data-chrt_accts
    ls_output_data-gl_account
    ls_output_data-zversion
    ls_output_data-zvers_yr
    ls_output_data-fiscper
    ls_output_data-vtype
    ls_output_data-curtype
    ls_output_data-currency
    ls_output_data-fiscvarnt
    ls_output_data-COMP_CODE
    ls_output_data-distr_chan
    ls_output_data-division
    ls_output_data-salesorg
    ls_output_data-zcust_sal
    ls_output_data-co_area
    ls_output_data-profit_ctr
    ls_output_data-orderstatus
    ls_output_data-keyfigureINTO lv_output_data SEPARATED BY lc_delim2.
    CONCATENATE lv_output_data
    cl_abap_char_utilities=>cr_lfINTO lv_output_data.
    CONCATENATE lv_output_string
    lv_output_dataINTO lv_output_string.


    LOOP AT lt_input_data INTO ls_input_data.
    CLEAR: ls_output_data,
    lv_output_data,
    lv_tmp,
    lv_2_decimal.
    ls_output_data-chrt_accts = ls_input_data-fp_account(4).
    ls_output_data-gl_account = ls_input_data-fp_account+4.
    ls_output_data-zversion = ls_input_data-fp_category(3).
    ls_output_data-zvers_yr = ls_input_data-fp_category+4.
    ls_output_data-fiscper = ls_input_data-fp_time.

    ls_output_data-vtype = '20'.
    IF ls_input_data-fp_rptcurrency = 'LC'.CASE ls_input_data-fp_entity.WHEN 'FAL'.
    ls_output_data-currency = 'AUD'.WHEN 'FNZ'.
    ls_output_data-currency = 'NZD'.WHEN 'FPG'.
    ls_output_data-currency = 'PGK'.ENDCASE.
    ls_output_data-curtype = '10'.ELSEIF ls_input_data-fp_rptcurrency = 'AUD'.
    ls_output_data-currency = 'AUD'.
    ls_output_data-curtype = '30'.ENDIF.
    ls_output_data-fiscvarnt = 'V3'.
    ls_output_data-COMP_CODE = ls_input_data-fp_entity.
    ls_output_data-distr_chan = ls_input_data-fp_customer(2).
    ls_output_data-division = ls_input_data-fp_customer+2(2).
    ls_output_data-salesorg = ls_input_data-fp_customer+4(4).
    ls_output_data-zcust_sal = ls_input_data-fp_customer+8.
    ls_output_data-co_area = ls_input_data-fp_profit_ctr(4).
    ls_output_data-profit_ctr = ls_input_data-fp_profit_ctr+4.
    ls_output_data-orderstatus = ls_input_data-fp_orderstatus.

    lv_2_decimal = ls_input_data-signeddata.
    ls_output_data-keyfigure = lv_2_decimal.CONDENSE ls_output_data-keyfigure NO-GAPS.
    CONCATENATE
    ls_output_data-chrt_accts
    ls_output_data-gl_account
    ls_output_data-zversion
    ls_output_data-zvers_yr
    ls_output_data-fiscper
    ls_output_data-vtype
    ls_output_data-curtype
    ls_output_data-currency
    ls_output_data-fiscvarnt
    ls_output_data-COMP_CODE
    ls_output_data-distr_chan
    ls_output_data-division
    ls_output_data-salesorg
    ls_output_data-zcust_sal
    ls_output_data-co_area
    ls_output_data-profit_ctr
    ls_output_data-orderstatus
    ls_output_data-keyfigureINTO lv_output_data SEPARATED BY lc_delim2.
    CONCATENATE lv_output_data
    cl_abap_char_utilities=>cr_lfINTO lv_output_data.
    CONCATENATE lv_output_string
    lv_output_dataINTO lv_output_string.ENDLOOP.
    "Convert the character data formatCALL METHOD lr_conversion->convert_char_streamEXPORTING
    im_stream = lv_output_stringIMPORTING
    ex_stream = lv_output_stream
    ex_stream_len = lv_stream_lengthEXCEPTIONS
    conversion_error = 1OTHERS = 2.
    IF sy-subrc EQ 0.
    "write the data in the target path (application server)OPEN DATASET lv_target_path FOR OUTPUT IN BINARY MODE.
    IF sy-subrc EQ 0.TRANSFER lv_output_stream TO lv_target_path.ENDIF.
    CLOSE DATASET lv_target_path.
    ELSE.
    RETURN.
    ENDIF.** "raise required event* CALL FUNCTION 'BP_EVENT_RAISE'* EXPORTING* eventid = 'ZBPC_HCM_FTE'* EXCEPTIONS* bad_eventid = 1* eventid_does_not_exist = 2* eventid_missing = 3* raise_failed = 4* OTHERS = 5.
    IF sy-subrc NE 0.RETURN.ENDIF.

    ENDMETHOD.

    Model data

    ile After retraction

    Dimension

    Thanks


    al11.jpg (25.9 kB)
    rev-model-data.jpg (45.2 kB)
    dim.jpg (66.6 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.