cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BPC Export DM Package - Change output file header

Former Member
0 Kudos
795

Hello,

We are using the standart DM Package "Export transaction data" with the header option activated. But I´m wondering if we can change the standard header of the file (model, user, date, time) to fill it with different data.

Thank you in advance,

Regards,

Alex

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member186338
Active Contributor

You are talking about prompt "Add other information..."?

No, you can't change it!

But you can write you own badi to export data to text file with any info you want!

It can be badi used in "Export to badi - /CPMB/EXPORT_TD_TO_BADI" or custom logic badi...

former_member186338
Active Contributor
0 Kudos

P.S. By the way, what do you want to achieve? How do you use exported data?

Former Member
0 Kudos

I just removed my name.

I´m extracting master data but changing format and the name of the file so retraction badis doesn´t work for this task. For custom logic badis I have to make a selection of the data from tables while in ujd_routine i just receive data in ir_data table mapped and converted.

Regards!

former_member186338
Active Contributor
0 Kudos

Sorry, but you will not get help as "Former Member" from me. I do not support anonymous users...

Former Member
0 Kudos

Hello Vadim,

Type UJD_ROUTINE

The full code is:

METHOD if_ujd_routine~runroutine.

TYPES:
BEGIN OF ty_ascta,
cod_ctacargabal(30) TYPE c,
descr_ctacargabal(45) TYPE c,
cod_tipocta(2) TYPE c,
cod_ctacargabal_p(30) TYPE c,
END OF ty_ascta.

DATA: lo_dataref TYPE REF TO data,
lv_docname TYPE ujf_doc-docname,
imess TYPE uj0_t_message,
xmess LIKE LINE OF imess,
lv_str TYPE string,
ruta TYPE string,
is_user TYPE uj0_s_user,
gcl_objeto TYPE REF TO cl_ujf_file_service_mgr,
lo_file_service_mgr TYPE REF TO cl_ujf_file_service_mgr,
lo_exception TYPE REF TO cx_ujf_file_service_error,
lt_content TYPE ujf_t_recline,
ls_content TYPE ujf_s_recline,
lt_ascta TYPE STANDARD TABLE OF ty_ascta,
ls_ascta TYPE ty_ascta.

DATA: lv_dia(2) TYPE n,
lv_mes(2) TYPE n,
lv_ano(4) TYPE n,
lv_fecha_info(10) TYPE n,
lv_timestamp TYPE string,
tsl TYPE timestampl,
lv_3seg(3) TYPE n.

FIELD-SYMBOLS: <lt_data_im> TYPE STANDARD TABLE,
<ls_data> TYPE any.

CONSTANTS: lc_environment_id TYPE uj_appset_id VALUE 'PROJECT',
lc_application_id TYPE uj_appl_id VALUE 'Accounting',
lc_root_webfolders(17) TYPE c VALUE '\ROOT\WEBFOLDERS\',
lc_datamanager_datafiles_ascta(36) TYPE c VALUE '\DATAMANAGER\DATAFILES\FILE.',
lc_formato(4) TYPE c VALUE '.txt',
lc_sep(1) TYPE c VALUE ';'.

ASSIGN ir_data->* TO <lt_data_im>.
CREATE DATA lo_dataref LIKE LINE OF <lt_data_im>.
ASSIGN lo_dataref->* TO <ls_data>.

MOVE-CORRESPONDING <lt_data_im> TO lt_ascta.

lv_ano = sy-datum(4).
lv_mes = sy-datum+4(2).
lv_dia = sy-datum+6(2).
CONCATENATE lv_ano '/' lv_mes '/' lv_dia INTO lv_fecha_info.

LOOP AT lt_ascta INTO ls_ascta.
IF sy-tabix = 1.
lv_str =
lv_fecha_info && lc_sep && ""Fecha de envío
sy-uzeit. ""Hora de envío
ls_content-line = lv_str.
APPEND ls_content TO lt_content.
ENDIF.

TRANSLATE ls_ascta-cod_ctacargabal USING ' &'.
TRANSLATE ls_ascta-descr_ctacargabal USING ' &'.
TRANSLATE ls_ascta-cod_tipocta USING ' &'.
TRANSLATE ls_ascta-cod_ctacargabal_p USING ' &'.
lv_str =
ls_ascta-cod_ctacargabal && lc_sep &&
ls_ascta-descr_ctacargabal && lc_sep &&
ls_ascta-cod_tipocta && lc_sep &&
ls_ascta-cod_ctacargabal_p.
ls_content-line = lv_str.
APPEND ls_content TO lt_content.
ENDLOOP.

CONCATENATE lc_root_webfolders lc_environment_id '\' lc_application_id lc_datamanager_datafiles_ascta sy-datum lc_formato INTO ruta.
is_user-user_id = sy-uname.

lv_docname = ruta.

cl_ujf_file_service_mgr=>factory(
EXPORTING
is_user = is_user
i_appset = lc_environment_id
RECEIVING
r_manager = gcl_objeto ).

TRY.
gcl_objeto->delete_document(
EXPORTING i_docname = lv_docname ).
CATCH cx_ujf_file_service_error INTO lo_exception.
ENDTRY.

TRY.
CALL METHOD gcl_objeto->put_document_data_mgr
EXPORTING
i_docname = lv_docname
i_append = abap_true
i_doc_content = lt_content.
CATCH cx_ujf_file_service_error INTO lo_exception.
imess = convert_ex_to_message( lo_exception ).
IF imess IS NOT INITIAL.
READ TABLE imess INTO xmess INDEX 1.
MESSAGE e001(00) WITH xmess-message.
ENDIF.
ENDTRY.

ENDMETHOD.

former_member186338
Active Contributor
0 Kudos

Sorry, but you decided to stop participation in the Community - I see "Former Member"!

What's the reason to comment????

former_member186338
Active Contributor
0 Kudos

P.S. And sorry, how ROUTINE badi is related to your requirements????

Former Member
0 Kudos

cl_ujf_file_service_mgr=>factory(
EXPORTING
is_user = is_user
i_appset = lc_environment_id
RECEIVING
r_manager = gcl_objeto ).

TRY.
gcl_objeto->delete_document(
EXPORTING i_docname = lv_docname ).
CATCH cx_ujf_file_service_error INTO lo_exception.
ENDTRY.

TRY.
CALL METHOD gcl_objeto->put_document_data_mgr
EXPORTING
i_docname = lv_docname
i_append = abap_true
i_doc_content = lt_content.
CATCH cx_ujf_file_service_error INTO lo_exception.
imess = convert_ex_to_message( lo_exception ).
IF imess IS NOT INITIAL.
READ TABLE imess INTO xmess INDEX 1.
MESSAGE e001(00) WITH xmess-message.
ENDIF.
ENDTRY.

With lv_docname = document route and lt_content = exit table
former_member186338
Active Contributor
0 Kudos

Sorry, but full badi code is required! And what type of badi is created?

Former Member
0 Kudos

Thank you for your reply Vadim.

Yes I did it using method put_document_data_mgr in the badi, but the status log ends with warning. Is there any way to change the status to success or failed? I tried to use cl_ujk_logger but it isn´t working.

Thank you in advance,

Regards