2020 Sep 15 11:29 AM
hi,
I am using APO System, I may not use other FMs. To get the holidays list.
I am using FM : HOLIDAY_GET
I need to pass From and to date. in the Format of dd.mm.year.
but in the FM it is referring Dats 8 .
but if i want to convert yearmonthdate to dd.mm.year. i Need 10 length of space.
i create char also . that char i was passed to FM. It is not working.
Any suggestion how could i solve the issue.
I need to get next month first working day. . i have feature month. like 10th and 11th or 12th. it will come dynaially.
2020 Sep 15 12:48 PM
newb, please make yourself familar with internal ABAP data representation vs external GUI data representation. The SAP DDIC domain types define mostly the internal data representation but when necessary also the GUI data representation.
All you need to do, is use a variable that has a TYPE data element with domain DATS, or at least the TYPE d which is the internal ABAP data type DATS. When this variable is exposed to GUI input, e.g. by being a Report Selection Parameter or by being a Function Module Import Parameter and used with the Function module Test Environment, ABAP will automatically take care of the conversion between internal and external representation in both ways.
REPORT ztest_holiday_get.
PARAMETERS p_from TYPE dats DEFAULT '20200101'.
PARAMETERS p_to TYPE dats DEFAULT '20201231'.
DATA holidays TYPE TABLE OF iscal_day.
cl_demo_output=>write_text( 'External GUI Representation of date type DATS' ).
cl_demo_output=>write( p_from ).
cl_demo_output=>write( p_to ).
cl_demo_output=>write_text( 'Internal ABAP Representation of date type DATS' ).
cl_demo_output=>write_text( 'P_FROM' ).
cl_demo_output=>write_text( p_from ).
cl_demo_output=>write_text( 'P_TO' ).
cl_demo_output=>write_text( p_to ).
CALL FUNCTION 'HOLIDAY_GET'
EXPORTING
holiday_calendar = '01'
date_from = p_from
date_to = p_to
TABLES
holidays = holidays
EXCEPTIONS
OTHERS = 5.
cl_demo_output=>write_text( 'External GUI Representation of table attributs for holidays' ).
cl_demo_output=>write( holidays ).
cl_demo_output=>write_text( 'Internal ABAP Representation of table attributs for holidays' ).
LOOP AT holidays ASSIGNING FIELD-SYMBOL(<holiday>).
cl_demo_output=>write_text( <holiday> ).
ENDLOOP.
cl_demo_output=>display( ).
2020 Sep 15 2:12 PM
Why do you want to call an API with format other than the internal format YYYYMMDD ? (external format like dd.mm.yyyy, etc.)
All API use the internal format only ! (there must be some exceptions of course like language code in BAPIs, etc.)
Before and after calling an API, you may of course convert the format of a date (valid also for others types of variables):