Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Usage of Function Module'SUBTRACT_TIME_FROM_DATE'

Former Member
0 Likes
729

Hi,

Please give me an idea for using of FUNCTIONMODULE 'SUBTRACT_TIME_FROM_DATE'.

following are the parameters used in FM...

CALL FUNCTION 'SUBTRACT_TIME_FROM_DATE'

EXPORTING

i_idate =

i_time =

i_iprkz =

  • I_RDMHD =

IMPORTING

o_idate = date_for_dele

EXCEPTIONS

invalid_period = 1

invalid_round_up_rule = 2

internal_error = 3

OTHERS = 4

Hi,

Please give me an idea for using of FUNCTIONMODULE 'SUBTRACT_TIME_FROM_DATE'.

following are the parameters used in FM...

CALL FUNCTION 'SUBTRACT_TIME_FROM_DATE'

EXPORTING

i_idate =

i_time =

i_iprkz =

  • I_RDMHD =

IMPORTING

o_idate = date_for_dele

EXCEPTIONS

invalid_period = 1

invalid_round_up_rule = 2

internal_error = 3

OTHERS = 4

2 REPLIES 2
Read only

Former Member
0 Likes
568

hi

good

check this code

*&----


*

*& Report Z_AGH_CALL

*&

*&----


*

*& Tres ejemplos para llamar a una transacción.

*& Se usará de ejemplo la transacción WE05 y se le pasará el

*& Número de idoc

*&----


*

*& Alberto García de Haro

*& http://misprogramasabap.blogspot.com/

*&----


*

*& Textos de selección:

  • P_BDC Call Transacion y bdcdata

  • P_PAR Call Transaction y parámetros

  • P_SUB Submit

*& Símbolos de texto

  • 001 Opciones de ejecución

*&----


*

report z_agh_call.

*&----


*

*& TOP: variables, tablas internas, etc.

*&----


*

data: obj like edidc-docnum.

data: begin of i_bdc_data occurs 10.

include structure bdcdata.

data: end of i_bdc_data.

data: begin of i_rspar occurs 10.

include structure rsparams.

data: end of i_rspar.

tables:

usr02.

data: begin of i_users occurs 10.

include structure usr02.

data: end of i_users.

*&----


*

*& PANTALLA DE SELECCIÓN

*&----


*

selection-screen begin of block bl1 with frame title text-001.

parameters:

p_sub radiobutton group gr1,

p_par radiobutton group gr1,

p_bdc radiobutton group gr1.

selection-screen end of block bl1.

*&----


*

*& EVENTOS

*&----


*

start-of-selection.

perform seleccionar_idoc changing obj.

if p_sub eq 'X'.

perform llamada_submit.

elseif p_par eq 'X'.

perform llamada_parametros.

else. "debe ser p_bdc eq 'X'

perform llamada_bdcdata.

endif.

*&----


*

*& SUBRUTINAS

*&----


*

*&----


*

*& Form seleccionar_idoc

*&----


*

  • Selecciona un número de idoc

*----


*

  • <--P_OBJ nº de idoc

*----


*

form seleccionar_idoc changing p_obj.

data: fecha like sy-datum, d_cont type i. "Para usar la fecha

fecha = sy-datum.

clear d_cont.

do.

select single docnum into p_obj from edidc

where credat eq sy-datum.

if sy-subrc eq 0 or d_cont = 30.

"encontró un idoc O llegó a 30 días sin encontrar nada

exit.

endif.

****RESTAMOS UN DÍA

call function 'SUBTRACT_TIME_FROM_DATE'

exporting

i_idate = fecha

i_time = 1

i_iprkz = 'D'

importing

o_idate = fecha.

add 1 to d_cont.

enddo.

endform. " seleccionar_idoc

*&----


*&

*& Form llamada_submit

*&----

-


**& Llamada con la sentencia submit

*----


*

form llamada_submit .

ranges ndocc for edidc-docnum.

clear: ndocc.

move:

'I' to ndocc-sign,

'EQ' to ndocc-option,

obj to ndocc-low.

append ndocc.

submit rseidoc2 with docnum in ndocc

and return.

endform. " llamada_submit

*&----


*

*& Form llamada_parametros

*&----


*

Llamada con call transaction y parámetros

*----


*

form llamada_parametros .

set parameter id 'DCN' field obj.

call transaction 'WE05'.

endform. " llamada_parametros

*&----


*

*& Form llamada_bdcdata

*&----


*

Llamada con call transaction y bdc_data

*----


*

form llamada_bdcdata .

*Llenamos la tabla

refresh i_bdc_data.

i_bdc_data-program = 'RSEIDOC2'.

i_bdc_data-dynpro = '1000'.

i_bdc_data-dynbegin = 'X'.

append i_bdc_data. clear i_bdc_data.

i_bdc_data-fnam = 'DOCNUM-LOW'.

i_bdc_data-fval = obj.

append i_bdc_data. clear i_bdc_data.

call transaction 'WE05' using i_bdc_data.

endform. " llamada_bdcdata

thanks

mrutyun^

Read only

Former Member
0 Likes
568

Hi,

CALL FUNCTION 'SUBTRACT_TIME_FROM_DATE'

EXPORTING

i_idate = sy-datum

i_time = w_int

i_iprkz = '='----> no need for rounding.

IMPORTING

o_idate = date_for_dele

EXCEPTIONS

invalid_period = 1

invalid_round_up_rule = 2

internal_error = 3

OTHERS = 4

Plzz reward points if it helps.