2014 Nov 12 10:03 AM
TYPES : BEGIN OF TY_PO_DETAILS,
EBELN TYPE EBELN,
AEDAT TYPE SY-DATUM,
ERNAM TYPE EKKO-ERNAM,
END OF TY_PO_DETAILS.
DATA:GT_PO_DETAILS TYPE STANDARD TABLE OF TY_PO_DETAILS,
GW_PO_DETAILS TYPE TY_PO_DETAILS.
SELECT SINGLE EBELN AEDAT ERNAM
FROM EKKO
INTO CORRESPONDING FIELDS OF GW_PO_DETAILS
WHERE EBELN EQ NAST-OBJKY.
MOVE GW_PO_DETAILS-AEDAT TO GV_DATE.
CONCATENATE GV_DATE+6(2)'/'GV_DATE+4(2)'/'GV_DATE+0(4) INTO GV_AEDAT.
GW_PO_DETAILS-AEDAT = GV_AEDAT.
APPEND GW_PO_DETAILS TO GT_PO_DETAILS.
Hi guruz,,
I need help in this issue.
I wish to append the value of GV_AEDAT in the internal table GT_PO_DETAILS.
but the length of sy-datum is 8 due to which only 11/03/20 content is getting appended in GW_PO_DETAILS-AEDAT .
please suggest what should I do???..
thanx ,
darshan panchal
2014 Nov 12 10:11 AM
To format date types you can use WRITE statement like this:
data gv_date type c length 10.
write aedat to gv_date dd/mm/yyyy.
Regards,
Alberto.
2014 Nov 12 10:05 AM
Hi,
Please declare AEDAT as char10 in TY_PO_DETAILS structure.
Thanks,
Sree
2014 Nov 12 10:10 AM
hi sreedevi,
I deed the same but it is not working,
error DBIF_RSQL_INVALID_RSQL is coming.
2014 Nov 12 10:07 AM
The format of AEDAT is YYYYMMDD, you can try this:
SELECT SINGLE EBELN AEDAT ERNAM
FROM EKKO
INTO CORRESPONDING FIELDS OF GW_PO_DETAILS
WHERE EBELN EQ NAST-OBJKY.
APPEND GW_PO_DETAILS TO GT_PO_DETAILS.
It's a date in input format.
Regards,
Alberto.
2014 Nov 12 10:12 AM
2014 Nov 12 10:11 AM
To format date types you can use WRITE statement like this:
data gv_date type c length 10.
write aedat to gv_date dd/mm/yyyy.
Regards,
Alberto.
2014 Nov 12 10:14 AM
i want to again append that gv_date dd/mm/yyyy format into AEDAT field of gt_po_details table.
2014 Nov 12 10:18 AM
You have two options:
1) Give more length to the field of your structure
TYPES : BEGIN OF TY_PO_DETAILS,
EBELN TYPE EBELN,
AEDAT TYPE c length 10,
ERNAM TYPE EKKO-ERNAM,
END OF TY_PO_DETAILS.
2) Use AEDAT and input format YYYYMMDD
Why do you need in output format? It transform in output format from input format (YYYYMMDD->DD/MM/YYYY) automaticly in SAP.
Regards,
Alberto
2014 Nov 12 10:20 AM
2014 Nov 12 10:22 AM
2014 Nov 12 10:22 AM
I gave type of aedat as c length 10, but I encountered error as DBIF_RSQL_INVALID_RSQL..
2014 Nov 12 10:25 AM
2014 Nov 12 10:25 AM
yes, because the lengths not are the same. In that case you have to use two structs (one with aedat type sy-datum and the other with aedat type c length 10) and do the conversion after the SELECT.
2014 Nov 12 10:29 AM
2014 Nov 12 10:33 AM
2014 Nov 12 10:29 AM
hi Darshan,
you can also use the AEDAT as type string.above mentioned data types are also apt .
2014 Nov 12 10:30 AM
Well first of all use FM CONVERT_DATE_TO_EXTERNAL instead of your concatenation. This will keep you from problems once users in europe for example are running your program, as they will get the date in the format they are used to.
Then extend your structure with a new field CONV_DATE char type 10 where you will store the converted date. This will be preventing the dump due to type mismatch while selecting.
Reagrds,
Dominik
2014 Nov 12 10:36 AM
Hi,
Add one more field of char length 10 to the line type and use it to store date in the required format.
Fields of type DATS cannot store date with separator characters.
But why do you need to store the date in that format ? If that is for display purpose, you can simply change display mask while displaying instead of storing the date in internal table in the format.
Regards,
Ashish