Abap code for splitting date needed
Hi Experts,
I need ABAP code or a function module to split date into date, month and year. As I have very little knowledge in ABAP, I do not know how to do it. Kindly help me.
Thanks in advance,
With Kind Regards,
Kannan
Hello kannan,
I tried writing this program , it worked for me .
PARAMETERS : date(10) TYPE c default '24.12.2014',
dd(2) type c,
mm(2) type c,
yyyy(4) type c.
split date at '.' into dd mm yyyy.
WRITE : / 'Day: ', dd.
WRITE : / 'Month: ', mm.
WRITE : / 'Year: ', yyyy.
If you feel this program suits you try this as well.
Similar Messages
-
GRR2- 4FM-RepPaint(put ABAP code for convert data in field)
Hi,
If somebody know how possible add ABAP code for convert data in some column-field of report (by RepWriter,UserExit,BADI)?
Thanks a lot.Elaborate your question. Not clear ??
-
Needs sample ABAP code for field routine
Dear Expert,
There is a field "Pay Scale Group" in my DSO which stores the data in the format
AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
I need to write a field routine on the transformation between DSO and Cube.
Can any one please help me with the sample ABAP code for this scenario.
Some more examples for better understanding of the requirement:-
Data in DSO(Source) Data in Cube(Target)
=================== ===================
AA1/B1/CCC2/DD2/EEE1 EEE1
AAA1/BB2/CC1/DDD3/EE2 EE2
A2/BBB2/CC2/DDD3/EEE5 EEE5
AA2/BB1/C1/DDD3/EE3 EE3
A3/B1/CC2/DDD1/EE4 EE4
Many thanks in advance.
Regards,
Prakash
Please do not dump your code requirements in SDN
Edited by: Pravender on May 18, 2011 11:37 AMHi,
You can use the following code :
Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
My assumption is that there will always be 4 '/'.
In the field routine write the below code
data: V1(5) type c,
V2(5) type c,
V3(5) type c,
V4(5) type c,
V5(5) type c.
data : VAR1 TYPE /BIC/OIZPAY_SGRP.
split VAR 1 at '/' into V1 V2 V3 V4 V5.
result = V5.
V5 will be having the characters after the last '/' .That is V5 = EEE1.
Hope the above reply was helpful.
Kind Regards,
Ashutosh Singh
Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
Edited by: Ashutosh Singh on May 17, 2011 4:17 PM -
Hi All,
I have requirement to write code for date range.
Characterstic = Run-Out Date, it was created reference to 0Date.
Requirement is data should load depends on Run-Out Date 7 days old and 14 days future.
Logic is -7 days old >= Run_out date <= 14 days future.
please let me know how I need to proceed with ABAP code for this requirement.
Thanks.
Please do not ask for ABAP code here. Its not a training forum
Edited by: Pravender on Aug 18, 2011 1:46 AM>
Sree vignesh wrote:
> Hi,
> In the select option we have a field month range as
> SELECT-OPTION : FROM 01.2007 TO 01.2009 " Let say Ur Selection option is SO_MONTH
> but now i need to add the DMBTR field considering the month range in the SELECT OPTION i.e., only FROM 01.2007 TO 01.2009 i mean without 2006 data.
>
> LOOP AT LT_DATA WHERE month in SO_MONTH. " Here add a Where condition
> ls_output-matnr = lt_data-belnr.
> ls_output-werks = lt_data-bukrs.
> ls_output-lgort = lt_data-dmbtr.
>
> COLLECT ls_output INTO lt_output .
>
> ENDLOOP.
>
> please help with code .
>
> thanks in advance.
Regards,
Suneel G -
Need ABAP code for the below Services requirement
Hi,
We have a requirement to show all the services for a particular Purchase order number.For this I built a view on 2 tables ESLL and EKPO.Now based on the below logic I need to bring the services for the Purchase order..
1.Enter PO number,item no. and Doc category in EKPO and find the Pack no.
2.Now take the Pack no. of EKPO and give in ESLL and find the Sub pack no.
3.Now take this Subpack no. and Give this sub pack as Pack no. in ESLL
4.This will be the Service entry record for that PO number.
Can any one Please suggest me to how to write the ABAP code for the above logic.
Thanks & Regards,
DinakarHi Dinaker,
Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
Thanks,
SAPBWI -
Hi Friends,
I have created BI objects like infocubes, infoobjects, DTP, Datasource to transfer data from a flat file to BI system using SAP GUI... All data from flat file are transfered to BI successfully... i dont have any knowledge in ABAP... So i need to see the ABAP code for the BI objects i created above in my project... how can i see the coding for that?
thanks in advance
sasiHi Sasi,
All the objects which you create in BI will be stored in some standad tables,it only fetch details accordingly from those tables.For MasterData you can find the option as Display Routines in Extras.If you want to get more infomation about the STD Table and the Program involed in BI objects,just enter in (/h) mode.
Regards,
Prem -
ABAP Code for SAP exit varaibles?
Hi,
i) Where can I find the abap code for SAP exit variables
OP_KEYDT used for the net due date
OP_KEYD2 used for the posting date
OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
Based on the Net Due Date, which is key date(0NETDUEDATE), entered by the user at runtime, the posting date and celaring date are populated.
II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom Net Due Date(ZNETDUEDATE).And this date is populated to posting date and clearing date variables.
How do we acheive that.
Thanks.Hi Kumar,
Try this below mentioned example where default date is current date.
Step1: Create a variable(ex: cur_date) on requrired characteristic with Processing type "Customer Eixt" and check the check box for ready for input(if this variable need in selection screen).
Step 2: Goto T Code : CMOD and provide appropriate Project and choose components and click on display.
Step3: Double click on exit "EXIT_SAPLRRS0_001" you can see include "ZXRSRU01", double click on include.
Step4: Sample code to populate.
WHEN 'CUR_DATE'.
Data : l_p_range_SSS TYPE rrrangesid.
IF I_STEP = 1.
l_p_range_SSS-Low = sy-datum.
l_p_range_SSS-Sign = 'I'.
l_p_range_SSS-Opt = 'EQ'.
APPEND l_p_range_SSS TO e_t_range.
Endif.
The following values are valid for I_STEP:
· I_STEP = 1
Call up takes place directly before variable entry
· I_STEP = 2
Call up takes place directly after variable entry. This step is only started up when the same variable could not be filled at I_STEP=1.
· I_STEP = 3
In this call up, you can check the values of the variables. Triggering an exception (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called up again.
· I_STEP = 0
The enhancement is not called from the variable screen. The call up can come from the authorization check or from the Monitor.
Also, refer this link..
http://help.sap.com/saphelp_bw320/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm
Cheers,
Allen -
ABAP code for BI 7.0 transformations start routine
Hi all,
I am trying to update data from DSO1 (Source1: transaction data) to Infocube(TARGET)
In the transformations Start routine, I have to read DSO2(Source2: Master data) for some fields.
DSO1 has CUSTOMER as part of key
DSO2 has CUSTOMER (key) and other fields....FIELD1, FILED2, FIELD3
Infocube to be updated with FIELDS1,2 & 3 WHILE READING DSO2.
WHERE DSO1 CUSTOMER matches with DSO2 CUSTOMER.
Also, data NOT TO BE UPLOADED into Infocube if FIELD1 in DSO2= NULL
Please give me the abap code for the above logic.
Appreciate any help in this regard.
Thanks.This is a doc from this site:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
Ravi Thothadri -
How To Create ABAP Code For HR Context Sensitive Structural Authorization
Hello,
We have created a HR Custom Program which IS NOT built off the PCH or PNP Logical Database. As a result, we need to manually create ABAP code for HR Context Sensitive Structural Authorization Check in our custom HR program. Via HR Context Sensitive Structural Authorizations, we are restricting access to personnel numbers and the underlying HRP* tables.
Any assistance would be greatly appreciated with the identification of the SAP standard function modules (Ex. RH_STRU_AUTHORITY_CHECK, HR_CHECK_AUTHORITY_INFTY, HR_CHECK_AUTHORITY_INFTY , etc) used in HR Context Sensitive Structural Authorization Check, how they are used to control HR Structural authorization (P_ORGINCON), and some sample code.
Thank you in advance for all your assistance,
Ken BowersHello Ken
You can use the interface methods IF_EX_HRPAD00AUTH_CHECK to get the same structural authorization as you can see in PA20/PA30. You need to use the methods set_org_assignment and check_authorization for this purpose. For more information you can refer to include FP50PE21 from line 237 onwards till 270.
Regards
Ranganath -
ABAP code for wrting a file to application server
<Moderator Message: We are not here to do your job for you>
Hi All,
i have a requirement to get the data from some other ABAP program and this data has to be written in one of the files present in application server.
please provide me the exact ABAP code for this...
Edited by: Siegfried Szameitat on Dec 17, 2008 10:40 AMthis has to be done using a process chain
-
Abap code for sap exit variables?
Hi,
i) Where can I find the abap code for SAP exit variables
OP_KEYDT used for the net due date
OP_KEYD2 used for the posting date
OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
Based on the Net Due Date, which is key date(0NETDUEDATE), entered by the user at runtime, the posting date and celaring date are populated.
II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom Net Due Date(ZNETDUEDATE).And this date is populated to posting date and clearing date variables.
How do we acheive that.
Thanks.Please tell how u solved ur issue i have the same scenario to be do.
-
ABAP code for Hierarchy Loading from Flat File
Hi,
Can anyone give me some idea / ABAP code for generating parent - child relationships (NODEIDS) from a flat file and load into BW.
Best regards
Any insight into this development is highly appreciatedHi,
also have a look at this how to to get informations about the file structure:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
/manfred -
Need ABAP code for Datasource Enhancement
Hi All,
I need no Enhance the WBS Element(PS_PSP_PNR) to2 LIS_02_ITM Datasource
the table EKKN Having WBS element
From EKKN Table We have to take the filed Append to the2LIS_02_ITM datasource
Please any one give me ABAP code which is write in CMOD
Thanks........
Regards!
MalliHi,
See SAP Help
http://help.sap.com/saphelp_nw04s/helpdata/en/6e/fe6e420f00d242e10000000a1550b0/content.htm
See the simple example code, so follow the same.Take ABAPer help, don't use select and end select.
CASE i_datasource.
Data: l_s_data1 LIKE mc13vd0itm,
l_tabix LIKE sy-tabix,
WHEN '2LIS_13_VDITM'.
LOOP AT c_t_data INTO l_s_data1.
l_tabix = sy-tabix.
SELECT SINGLE auart INTO l_s_data1-zzprdtyp FROM vbak
WHERE vbeln = l_s_data1-aubel.
IF sy-subrc = 0.
MODIFY c_t_data FROM l_s_data1 INDEX l_tabix.
ENDIF.
ENDLOOP.
ENDCASE.
Data: l_s_data18 LIKE mc12vc0itm ,
l_tabix LIKE sy-tabix.
WHEN '2LIS_12_VCITM' .
LOOP AT c_t_data INTO l_s_data18.
l_tabix = sy-tabix.
SELECT SINGLE ernam FROM ekko
INTO (l_s_data18-ernam)
WHERE ebeln = l_s_data18-vgbel .
IF sy-subrc = 0.
MODIFY c_t_data FROM l_s_data18 INDEX l_tabix.
ENDIF.
ENDLOOP.
See article on Step by Step Guide to Enhance a Data Source:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00c1f726-1dc2-2c10-f891-ddfbffdb1a46?quicklink=index&overridelayout=true
Thanks
Reddy -
Error in the ABAP Code for Customer Exit Variable
Could you please update me what is the wrong with the below ABAP Code developed for Customer Exit Variable in BW
i created a Variable (ZVWKNO) of Customer Exit,Single Value ,Mandatory and Variable is ready for input
In CMOD i had written the below Code:
When 'ZVWKNO'.
DATA: WEEK(2) TYPE N,
WEEKNO(2) TYPE N.
IF i_step = 1.
l_st_date = SY-DATUM.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = l_st_date
IMPORTING
WEEK = l_fn_week.
CHECK sy-subrc = 0.
WEEK = l_fn_week+4(2).
If WEEK 0.
WEEKNO = WEEK - 1.
l_s_range-low = WEEKNO.
l_s_range-sign = k_sign_inclusive.
l_s_range-opt = k_option_equals.
APPEND l_s_range to e_t_range.
ENDIF.
ENDIF.
But when i execute the query the default value is not populated with Week-1 No in the variable screen
Please update me what went wrong
ThanksCase ZVWKNO. "write this with out comments
When '1'. "write the value that needs to equal with value in varaible ZVWKNO after when in sungle quotes
DATA: WEEK(2) TYPE N,
WEEKNO(2) TYPE N.
IF i_step = 1.
l_st_date = SY-DATUM.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = l_st_date
IMPORTING
WEEK = l_fn_week.
CHECK sy-subrc = 0.
WEEK = l_fn_week+4(2).
If WEEK 0. "check this Week Minimum is '01' and Maximum '52'
WEEKNO = WEEK - 1.
l_s_range-low = WEEKNO.
l_s_range-sign = k_sign_inclusive.
l_s_range-opt = k_option_equals.
APPEND l_s_range to e_t_range.
ENDIF.
ENDIF.
Prabhudas -
ABAP Code for summation of key figure
Hi Guys,
I am new to ABAP and my requirement is as follows-
I have an infocube containing data like
Location Item Amount Month
India TV 10 Jan
India DVD 10 Jan
India XBOX 10 Jan
US TV 10 Jan
US XBOX 15 Jan
US DVD 20 Jan
UK XBOX 30 Jan
UK TV 20 Jan
UK DVD 15 Jan
India TV 20 Feb
US DVD 20 Feb
UK XBOX 10 Feb
India TV 20 Mar
Now by using open hub, I want to extract a file which would display report as -
Output file
15-Oct-2010
Location Item Amount
India TV 50
India DVD 10
India XBOX 10
US TV 10
US DVD 40
US XBOX 15
UK TV 20
UK DVD 15
UK XBOX 40
which means it should sum based on combination of location and item and create one single row.
I need some ABAP code which could be written in expert routine so as to to calculate single rows of amount for all data packets of infocube.
Kindly suggest on how to proceed on it.
Thanks in advance
Moderator Message: Even if you are new-to-ABAP, it does not imply that you can expect others to do your work. If you are a BI consultant, take the help of an ABAP consultant or self-learn the basic concepts of ABAP. If you are an ABAPer, go back to the training center.
Edited by: kishan P on Oct 15, 2010 10:34 AMFollow this white paper .... called, "How to .... Calculate with Attributes":
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/72f4a790-0201-0010-5b89-a42a32223ffc
Brian
Maybe you are looking for
-
hi, i m new in web dynpro ABAP. i wants to create a popup for a button displaying some message. plz try to give some dummy program name also.
-
Since FX takes some time to load, I would like to start my demonstration in my office then put my portable into Sleep mode (this is computer sleep, not Java thread sleep) so that it is instantly available at the customer's premises. However, all I ge
-
Which camcorder for enterprising teen?
I've spent several weeks researching which camcorder to buy for my teenage son. He has had several years experience making short films at camps and schools, and now wishes to make his own shorts. On a limited budget, we want the best available option
-
How do i get google back as the search engine on the home page
I have upgraded my firefox browser. before i did google was the search engine in the center of the home page. Now there is only the firefox emblem above the search bar, and when I try a search frontier is the search engine. I would prefer google. How
-
To Jdev, Help Please...
Env OS Nt SP 4 ORACLE 8.1.6.0 Jdev 3.2 Oracle 8.1.7 Jdbc java.sql.SQLException: ORA-01722: invalid number void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int) (DBError.java:168) int oracle.jdbc.oci8.OCIDBAccess