on 07-12-2007 10:06 AM
Hi, has anyone worked on the following Function Module in APO System?
<b>/SAPAPO/CTM_TDSSAFTY_GET</b>
If so, please provide me the following details :-
1. What are the mandatory parameters that we should pass to this FM to execute this without error?
2. Any sample data for this?
Thanks and Regards
Selva
Hello Selvage,
There were declaration problems in ur interface.
I have corrected it. Pls check the below code.
DATA:LS_GEN_PARAMS TYPE /SAPAPO/OM_GEN_PARAMS,
LT_MATLOC_ID TYPE /SAPAPO/DM_MATLOC_ID_TAB,
LS_MATLOC_ID TYPE /SAPAPO/DM_MATLOC_ID,
GC_MINTIME TYPE /SAPAPO/STARTTI VALUE '20070723000000',
GC_MAXTIME TYPE /SAPAPO/STARTTI VALUE '20070729235959',
LV_NOW TYPE TIMESTAMP,
lt_tds TYPE /sapapo/ctm_tds_tab,
LV_CHK(1).
For version Id
DATA : GV_SIMS TYPE /SAPAPO/OM_SIMSESSION,
GV_PARAMS TYPE /SAPAPO/OM_GEN_PARAMS.
Get the current sim session
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_GET'
IMPORTING
EV_SIMSESSION = GV_SIMS
ES_GEN_PARAMS = GV_PARAMS.
Creat the sim session if not available
IF GV_SIMS IS INITIAL.
LV_CHK = 'X'.
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_CREATE'
IMPORTING
EV_SIMSESSION = GV_SIMS.
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_GET'
IMPORTING
EV_SIMSESSION = GV_SIMS
ES_GEN_PARAMS = GV_PARAMS.
ENDIF.
LS_MATLOC_ID-MATID = 'HcCEBe2a05y00000aH4oMG'.
LS_MATLOC_ID-LOCID = 'HSXYf68yG2800000aH4onW'.
APPEND LS_MATLOC_ID TO LT_MATLOC_ID.
CALL FUNCTION '/SAPAPO/CTM_TDSSAFTY_GET'
EXPORTING
IV_VRSIOID = LS_GEN_PARAMS-SIMVERSION
IT_MATLOC_ID = LT_MATLOC_ID
IV_TSTFR = GC_MINTIME
IV_TSTSST = LV_NOW
IV_TSTTO = GC_MAXTIME
IV_METHOD = '1'
IV_IGNOREBUFFER = 'X'
IV_TDSCONVSLT = SPACE
IV_TIMEZONES = 'X'
IMPORTING
ET_TDS = LT_TDS
EXCEPTIONS
CUSTOMIZING_ERROR = 1
OTHERS = 2.
Regards,
Siva.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Selva,
Check the below points.
1. Make sure u have the Safety Stock available in the given the date.
2. Don't execute directly the function module directly from the SE37. Instead create a program and check it.
The reason is that you are not creating any SIM Session in the function module.
Pls let me know if have any problem.
Regards,
Siva.
Message was edited by:
sivaprakash pandian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
I've checked for the Stock on the specified date and it is there. I've created a program with ur code as a template and tested it. When calling the Fn. Mod. '/SAPAPO/CTM_TDSSAFTY_GET' i am getting a dump saying that the internal table i supply to the parameter IT_MATLOC_ID is not compatible. I checked both and found they are compatible. I am not sure y i am getting the dump. Herewith i am attaching the code. Please go thro' it and see if u could help on this...
&----
*& Report YPPSAF_TEST
*&
&----
*&
*&
&----
REPORT yppsaf_test.
DATA:
ls_gen_params TYPE /sapapo/om_gen_params,
lt_matloc_id TYPE /sapapo/dm_matloc_id_tab,
ls_matloc_id TYPE /sapapo/dm_matlocid_tab,
gc_mintime TYPE /sapapo/startti VALUE '20070723000000',
gc_maxtime TYPE /sapapo/startti VALUE '20070729235959',
lv_now TYPE timestamp,
lt_tds TYPE /sapapo/ctm_tds_tab.
DATA : t_matloc_id LIKE LINE OF lt_matloc_id OCCURS 0 WITH HEADER LINE,
t_tds LIKE LINE OF lt_tds OCCURS 0 WITH HEADER LINE,
t_matloc LIKE LINE OF ls_matloc_id OCCURS 0 WITH HEADER LINE,
t_session LIKE TABLE OF ls_gen_params WITH HEADER LINE.
DATA : lv_chk(1).
For version Id
DATA : gv_sims TYPE /sapapo/om_simsession,
gv_params TYPE /sapapo/om_gen_params.
Get the current sim session
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_GET'
IMPORTING
ev_simsession = gv_sims
es_gen_params = gv_params.
Creat the sim session if not available
IF gv_sims IS INITIAL.
lv_chk = 'X'.
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_CREATE'
IMPORTING
ev_simsession = gv_sims.
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_GET'
IMPORTING
ev_simsession = gv_sims
es_gen_params = gv_params.
ENDIF.
IT_MATLOC_ID
t_matloc_id-matid = 'HcCEBe2a05y00000aH4oMG'. "lv_matid.
t_matloc_id-locid = 'HSXYf68yG2800000aH4onW'. "lv_locto.
APPEND t_matloc_id.
*CALL FUNCTION '/SAPAPO/DM_MAT_GET_MATLOCID'
EXPORTING
it_matid_locid = t_matloc_id[] "t_matloc[]
IMPORTING
et_matlocid = t_matloc[] "t_matloc_id[]
EXCEPTIONS
not_qualified = 1
OTHERS = 2.
*t_session-simversion = '000'.
*APPEND t_session.
*Get the matid by passing matnr to /sapapo/matkey table.
*Get the locid by location number to /sapapo/loc table.
IV_TSTFR and IV_TSTTO
*Pass the from table and to date this function module and get converted to the requried format.
*DATA : p_tmpst TYPE /sapapo/startti,
p_date LIKE sy-datum.
*
*CALL FUNCTION '/SAPAPO/DATE_CONVERT_TIMESTAMP'
EXPORTING
iv_date = p_date
iv_time = '000000' "235959
IMPORTING
ev_timestamp = p_tmpst.
*IF sy-subrc EQ 0.
CALL FUNCTION '/SAPAPO/CTM_TDSSAFTY_GET'
EXPORTING
iv_vrsioid = gv_params
it_matloc_id = t_matloc_id "lt_matloc_id
*it_lot_profile = it_lot_profile
iv_tstfr = gc_mintime
iv_tstsst = lv_now
iv_tstto = gc_maxtime
iv_method = '1'
iv_ignorebuffer = 'X'
iv_tdsconvslt = space
iv_timezones = 'X'
IMPORTING
et_tds = t_tds
EXCEPTIONS
customizing_error = 1
OTHERS = 2.
LOOP AT t_tds.
WRITE: / t_tds-matid, t_tds-locid, t_tds-tstfr,
t_tds-tstto, t_tds-svtty, t_tds-safty.
ENDLOOP.
*ENDIF.
Thanks and Regards
Selva
Hello Selva,
Find the details below.
<b>For version Id</b>
DATA : gv_sims TYPE /sapapo/om_simsession,
gv_params TYPE /sapapo/om_gen_params.
Get the current sim session
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_GET'
IMPORTING
ev_simsession = gv_sims
es_gen_params = gv_params.
Creat the sim session if not available
IF gv_sims IS INITIAL.
lv_chk = 'X'.
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_CREATE'
IMPORTING
ev_simsession = gv_sims.
CALL FUNCTION '/SAPAPO/RRP_SIMSESSION_GET'
IMPORTING
ev_simsession = gv_sims
es_gen_params = gv_params.
ENDIF.
<b>IT_MATLOC_ID</b>
lt_matloc-matid = lv_matid.
lt_matloc-locid = lv_locto.
APPEND lt_matloc.
CALL FUNCTION '/SAPAPO/DM_MAT_GET_MATLOCID'
EXPORTING
it_matid_locid = lt_matloc[]
IMPORTING
et_matlocid = lt_matlocid[]
et_matloc_ids =
EXCEPTIONS
not_qualified = 1
OTHERS = 2.
Get the matid by passing matnr to /sapapo/matkey table.
Get the locid by location number to /sapapo/loc table.
<b>IV_TSTFR and IV_TSTTO</b>
Pass the from table and to date this function module and get converted to the requried format.
data : P_TMPST TYPE /SAPAPO/STARTTI,
p_date like sy-datum.
CALL FUNCTION '/SAPAPO/DATE_CONVERT_TIMESTAMP'
EXPORTING
IV_DATE = P_DATE
IV_TIME = '000000' "235959
IMPORTING
EV_TIMESTAMP = P_TMPST.
Reward points if useful.
Regards,
Siva.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Selva,
Check below sample code and mandatory parameters for the function module.
Regards,
Siva.
Mandatory Parameters:
IV_VRSIOID
IT_MATLOC_ID
IV_TSTFR
IV_TSTTO
Sample Code:
DATA:
ls_gen_params TYPE /sapapo/om_gen_params,
lt_matloc_id TYPE /sapapo/dm_matloc_id_tab,
ls_matloc_id TYPE /sapapo/dm_matloc_id,
gc_mintime TYPE /sapapo/startti VALUE '19700101000020',
gc_maxtime TYPE /sapapo/startti VALUE '20371231235949',
lv_now TYPE timestamp,
lt_tds TYPE /sapapo/ctm_tds_tab.
CALL FUNCTION '/SAPAPO/CTM_TDSSAFTY_GET'
EXPORTING
iv_vrsioid = ls_gen_params-simversion
it_matloc_id = lt_matloc_id
it_lot_profile = it_lot_profile
iv_tstfr = gc_mintime
iv_tstsst = lv_now
iv_tstto = gc_maxtime
iv_method = '1'
iv_ignorebuffer = 'X'
iv_tdsconvslt = space
iv_timezones = 'X'
IMPORTING
et_tds = lt_tds
EXCEPTIONS
customizing_error = 1
OTHERS = 2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sivaprakash,
Thanks for the quick response.
But when i am passing the mandatory parameters i am not getting any entries for the table - ET_TDS. As of now i am just testing the Fn. Module.
If you could brief more on the mandatory fields - it_matloc_id, iv_tstfr and iv_tstto, it would be great.
Thanks and Regards
Selva
Hi Siva,
Thanks for the response. It is really helpful. Sorry for the delay i've made in replying you.
Actually, as of now i am just testing that Fn. Mod. separately. I've not started any coding. The requirement i am working on is a report to get the <b>Safety Stock</b>.
When i test the Fn. mod. the internal table ET_TDS is not getting populated. I am passing all the mandatory parameters. Please let me know as how should i pass the values for 'Date From' and 'Date To' parameters. For eg. i am pasing the following details:
1. IV_VRSIOID - '000'
2. MATID - 'HcCEBe2a05y00000aH4oMG'
3. LOCID - 'HSXYf68yG2800000aH4onW'
4. IV_TSTFR - ' 20070723000000 '
5. IV_TSTTO - ' 20070729000000 '
6. IV_IGNOREBUFFER - ' X '.
With these values still the internal table ET_TDS is not getting populated. Only if this gets populated, i can proceed with my coding.
It'd be great if u could help me in this regard...
Selva
User | Count |
---|---|
9 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.