SELECT-OPTION to internal table
Hi,
I need to convert the select-option values into an internal table.
For example, if there is a select-option S_WERKS... i need all the values entered for S_WERKS into the internal table. The internal table structure contains only WERKS.
My actual requirement is, for the given plant values as select-option, i need to fetch all details of the plants. And I should not use any SELECT statements at any stage. Only through function module/ BAPI/BADI/Class methods.
I found one function module T001W_READ, but i need to pass the plant for that.
Please suggest.
Thanks in advance.
kishore
Hi Kishore
Why can't you use any SELECTs? If it is so required why not writing your own FM to select them? You can pass your select-option via a generic parameter and assign it to a range at the beginning of your FM. Or you can assign it to a select-option-like table (you can find structure names of similar type from DDIC)
<i><b>e.g.</b></i>
TABLES t001w .
RANGES s_werks for t001w-werks .
DATA: BEGIN OF lt_werks ,
werks LIKE t001w-werks ,
END OF lt_werks .
s_werks[] = it_werks_so[] .
SELECT werks FROM t001w
INTO lt_werks
WHERE werks IN s_werks .
As another thing, let me introduce you the SDN Forums pointing system: You can assign points to posts which you find helpful while solving your problem. You can reward points by pressing the yellow star icon at header of each post. You can assign;
- one 10 points (solved)
- two 6 points (very helpful answer)
- many 2 points (helpful answer)
*--Serdar
Similar Messages
-
Passing SELECT-OPTIONS and Internal Tables to SUBROUTINES
Hi Guys
In the code below my colleague has created her own table types in order to pass a select option and internal tables to her subroutine. Is there an easier way of making them known to the subroutine.
data : v_vbeln type vbeln_vf,
it_bdoc type table of vbrp,
it_t006 type table of t006a,
wa_bdoc type vbrp,
wa_t006 type t006a,
it_bdoc2 type table of zsswathi_st_vbeln,
wa_bdoc2 type zsswathi_st_vbeln
select-options s_vbeln for v_vbeln matchcode object zswathi_vbeln obligatory.
start-of-selection.
perform bdoc using s_vbeln[]
changing it_bdoc
it_bdoc2
it_t006.
loop at it_bdoc2 into wa_bdoc2.
form bdoc using f_s_vbeln type ZSWATHI_ST_SELECT_OPTION_TA_TY " all these are table types. for select options, a structure is created and then a table type for it is created.
changing f_it_bdoc type zswathi_vbrp_ty_ta
f_it_bdoc2 type zswathi_vbeln_ty_ta
f_it_t006 type ZSWATHI_T006_TA_TY.
select * from vbrp into table f_it_bdoc where vbeln in f_s_vbeln.
if f_it_bdoc is not initial.
select vbeln sum( netwr ) prsdt from vbrp into table f_it_bdoc2 where vbeln in f_s_vbeln group by vbeln prsdt.
sort f_it_bdoc2 by vbeln.
"select * from t006a into table it_t006 for all entries in it_bdoc where msehi = it_bdoc-vrkme.
select * from t006a into table f_it_t006 for all entries in f_it_bdoc where msehi = f_it_bdoc-vrkme.
endif.
endform.Hi Brett,
1. you can use a select-options-range in a FORM subroutine also without passing it as a parameter because parameters and select-option range tables are global fields in their program.
2. If you need a parameter, declare it as type table or type standard table or type any table. You do not need any special table type.
Regards
Clemens -
Move the data in select options to internal table
I have the code as in the fillowing
SELECT-OPTION:S_MATNR FOR MARA-MATNR.
DATA:BEGIN OF IT_MATNTR OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF IT-MATNR.
NOW HOW CAN I ADD THE MATNER VALUES IN THE SELECT-OPTIONS IN INTERNAL TABLEHi Vamsikrishna,
Yes. You can move the values from S_MATNR to IT_MATNR.
you can try either it_matnr[] = s_matnr[].
if not then you can loop in to the select-options as follows.
Define LS_MATNR as a structure type of s_matnr.
Define LS_IT_MATNR as a structure type of it_matnr.
LOOP S_MATNR INTO LS_MATNR.
MOVE LS_MATNR to LS_IT_MATNR.
APPEND LS_IT_MATNR to IT_MATNR.
CLEAR: LS_MATNR, LS_IT_MATNR.
ENDLOOP.
<b>Reward points for helpful answers.</b>
Best Regards,
Ram. -
How to get all values in the range of select option into internal table?
Hi,
I need to capture all entries coming in the range of select option into one internal table.
How to do get that?
For E.g
select-options: matnr for mara-matnr.(select option)
IF I enter G0100013507892 as lower value of matnr and G0100014873947 as higher value
and if there are 10,000 materials in the above range, then I want to capture all theses 10000 materails in one internal table. How to do that?
Regards,
MrunalHello Mrunal Mhaskar ,
What i understand you can do one thing go in debug mode
Try this code : -
LOOP AT s_matnr_ex.
IF s_matnr_ex-low IS NOT INITIAL.
i_matnr-matnr = s_matnr_ex-low.
i_matnr-option = s_matnr_ex-option.
APPEND i_matnr.
CLEAR : i_matnr.
ENDIF.
ENDLOOP.
LOOP AT s_matnr_ex.
IF s_matnr_ex-high IS NOT INITIAL.
i_matnr-matnr = s_matnr_ex-high.
i_matnr-option = s_matnr_ex-option.
APPEND i_matnr.
CLEAR : i_matnr.
ENDIF.
ENDLOOP.
In the i_matnr table high and low values are there.
Regards,
Vandana. -
Select options to internal table
i have selected some values in the range say 100 to 200 using select options....is there any way to get these values in an internal table?
also does select option work with alpha numeric values
eg : if i want to select between a100 and b200?>
VR ARVIND wrote:
> i mean to say if i have 100 to 200.. i need 101 102 103 etc..continuosly till 200
Select-options are really only useful for selecting data that matches the select-options from some other dataset. They don "expand out" into a set of values.
If you are always specifying a range in the selection screen, use two parameters - p_low, p_high.
You then will need to build your itab entry by entry. So
l_count = p_low.
WHILE l_count LE p_high.
INSERT l_count INTO t_itab.
ADD 1 to l_count.
ENDWHILE.
For a100 to a200, you'd have to do some string slicing and concatenation to get the desired result. -
Create select-options using internal table
Hello,
I have number of table-fields in one internal table.
I need to create select-options on screen for each of the table field in that internal table.
Can anybody please provide a code for it ?
Thanks.hi,
you can create in this way :
select-options: <name> for itab-<field name>.
example code:
TABLES: vbak. " standard table
TYPE-POOLS: slis.
*-- Structure to hold data from table
TYPES: BEGIN OF tp_itab1,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
werks LIKE vbap-werks,
lgort LIKE vbap-lgort,
END OF tp_itab1.
*-- Data Declaration
DATA: t_itab1 TYPE TABLE OF tp_itab1.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
* Selection Screen *
*--Sales document-block
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_posnr FOR vbap-posnr,
s_werks FOR vbap-werks,
s_lgort FOR vbap-lgort.*
SELECTION-SCREEN END OF BLOCK b1.
hope it will help you
regards
Rahul sharma
Edited by: RAHUL SHARMA on Sep 19, 2008 8:25 AM -
Select options and internal table
Hi,
I have requirement for which I was coding...
On the selction screen, I have an object field... say I have multiple values like 101, 102, 103
select-options: s_3 for hrp1000-objid.
i_1001 type standard table of HRP1001 with header line
i_temp_1001 type standard table of HRP1001 occurs 0.
Need to create an hrp1001 record for these based on a template record available in hrp1001.
I need to read all the records of the template record (say 100) from hrp1001 and need to create the same set for the objects 101, 102 and 103. How to do that? ofcourse I need to replace the object id 100 with 101, 102 and so on for the complte set..
How can I accomplish without using nested loops.
tried something like this..
select * from HRP1001 into corresponding fields of i_1001 where otype = '51' and objid = '100' and endda = '99991231'.
if sy-subrc = 0.
clear i_hrp1000-objid.
append i_1001.
endselect.
loop at s_3.
loop at i_1001.
move-corresponding i_1001 to i_temp_1001.
endloop.
i_temp_1001-objid = s_brd3-low.
append i_temp_1001.
endloop..
Looking to avoid nested loops... Any thoughts?
Thanks,
VGModerator message -
When closing old threads, there is no need to add a comment. Adding a pasted answer like "Resolved myself " only brings old threads to the top of the forum list and pushes current ones down. If you do add a comment, please indicate just how the problem was resolved.
And please use code tags to format code.
Rob -
Can we apply select statement on internal table.
can we apply select statement on internal table.if yes thrn let me know how to do.
Dear Sachin,
You cannot use SELECT statement on internal table.
If you want to select some rows from internal table you can LOOP the table or you can READ the table.
<u>Please check the following links for your kind reference:</u>
<b>http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm
http://www.sap-img.com/ab009.htm
http://www.itsmarc.com/crs/Clas0302.htm
http://www.sapdevelopment.co.uk/tips/tips_itab.htm
http://searchsap.techtarget.com/search/1,293876,sid21,00.html?query=whatisinternaltable&bucket=ALL</b>
Cheers !
Moqeeth. -
I realize that you can't do a select on an internal table but I need to do something identical to that. I need to replicate the following code:
SELECT * FROM it_detail INTO it_temp WHERE matnr = wa_detail-matnr.
it_detail is of type ty_detail which joins field from three different tables. Right now it_detail holds information about many different material numbers with all material numbers being repeated. I am attempting to fill it_temp with all entries from it_detail that has the same material type. I did a search but I couldn't find anything that seemed to work in this situation.
Regards,
Davis.You must READ it, or LOOP at it.
Loop at it_detail into wa_detail where matnr = p_matnr.
move-corresponding wa_detail to wa_temp.
append wa_temp t0 it_temp.
endloop.
Regards,
RIch Heilman -
How will use Select-Options in Read table Concept.
Hi All,
How will use Select-Options in Read table. For example,
Select-Options : test for bseg-prctr.
Select * from bseg into table ITAB.
Read table ITAB with key prctr in test.
Last line is showing error. If any way to read ITAB as conditions given per select options.
Thankx Advance,,,HI,
you cannot use " IN " with read statement , read statement is used as:
READ TABLE it_collect ASSIGNING <fs_collect>
WITH KEY rbpl = <fs_wkdet>-arbpl
ufnr = <fs_wkdet>-aufnr.
anyways you can use loop at statement before read to use " into " statement as:
LOOP AT it_master INTO l_master
WHERE werks = l_werks
hope it will help you
regards
rahul
Edited by: RAHUL SHARMA on Dec 30, 2008 9:14 AM -
How to select columns from internal table using 'GUI_DOWNLOAD' ?
Hi,
i am running a report & the fields for output is saved in an internal table which has as many as 10 fields. But I want to select only a few fields for output. There is a option COL_SELECT in function 'GUI_DOWNLOAD'. How to use it. If possible with example.Hai VijayKumar
Try with the following code
tables : mara.
data : begin of it_mara occurs 0,
matnr like mara-matnr,
mbrsh like mara-mbrsh,
mtart like mara-mtart,
meins like mara-meins,
end of it_mara.
parameters : P_mtart like mara-mtart default 'ROH'.
start-of-selection.
perform select_data.
perform download_data.
*& Form select_data
text
--> p1 text
<-- p2 text
FORM select_data .
select
matnr
mbrsh
mtart
meins
from mara into table it_mara
where mtart = p_mtart.
ENDFORM. " select_data
*& Form download_data
text
--> p1 text
<-- p2 text
FORM download_data .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'c:\down.txt'
FILETYPE = 'ASC'
COL_SELECT = 'X'
COL_SELECT_MASK = 'X XX'
TABLES
DATA_TAB = it_mara.
IF SY-SUBRC = 0.
SORT IT_MARA BY MATNR.
ENDIF.
ENDFORM. " download_data
Thanks & Regards
Sreenivasulu P -
Select (join) into internal table with nested structures
Hello Experts,
i wonder about the correct notation of a select statement.
I have an internal table it_zoll including two structures as defined below.
The select is a join on the two tables zollp and zolls. As coded below the select is syntactically correct, but the fields
in the nested structures are not filled ....
Any ideas how to write the select statement ? (The internal table it_zoll must have the nested structures for other reasons ..)
Declaration:
TYPES: BEGIN OF ty_zollp,
belnr TYPE zollp-belnr,
werks TYPE zollp-werks,
gebnr TYPE zollp-gebnr,
END OF ty_zollp.
TYPES: BEGIN OF ty_zolls,
grnum type zolls-grnum,
werks type zolls-werks,
name1 TYPE zolls-name1,
END OF ty_zolls.
DATA: BEGIN OF wa_zoll.
DATA: zollp type ty_zollp.
DATA: zolls type ty_zolls.
DATA: END OF wa_zoll.
DATA: it_zoll LIKE TABLE OF wa_zoll.
Select:
SELECT
zollp~belnr zollp~werks zollp~gebnr
zolls~grnum zolls~werks zolls~name1
FROM zollp
JOIN zolls ON zolls~werks = zollp~werks
AND zolls~grnum = zollp~grnum
INTO CORRESPONDING FIELDS OF TABLE it_zoll
WHERE zollp~werks = werks
AND zollp~gebnr IN s-gebnr
AND ...
Thank you !DATA: BEGIN OF ty_zollp,
belnr TYPE zollp-belnr,
werks TYPE zollp-werks,
gebnr TYPE zollp-gebnr,
END OF ty_zollp.
DATA: BEGIN OF ty_zolls,
grnum type zolls-grnum,
werks type zolls-werks,
name1 TYPE zolls-name1,
END OF ty_zolls.
DATA: BEGIN OF wa_zoll.
Include structure ty_zollp.
Include structure ty_zolls.
DATA: END OF wa_zoll.
The above declaration had worked. Please try.
Regards,
Satish Kanteti -
Selecting into an internal table with deep structure
Hi,
I am working in ECC 6.0 now and it is giving me a syntax error for the following code.
types: tt_bdc type standard table of bdcmsgcoll
with default key.
data: begin of t_test occurs 0,
vbeln like vbak-vbeln,
tab type tt_bdc,
end of t_test.
select vbeln from vbak into table t_test
where aedat > '20081101'.
The error is:
+The work area (or internal table) "T_TEST" is not flat, or contains
reference or internal tables as components . components. components.
components. components.+
I've done this in countless other programs in the past. How can I use a deep structure this way? What am I missing?
Thanks very much!Will this solve ur requirement -
types: tt_bdc type standard table of bdcmsgcoll
with default key.
data: begin of t_test occurs 0,
vbeln like vbak-vbeln,
tab type tt_bdc,
end of t_test.
select vbeln from vbak into
CORRESPONDING FIELDS OF TABLE t_test
where aedat > '20081101'. -
How to make a row as selected in output internal table in oops ALV
Hi All,
I have ALV grid output using oops ALV concept, in my output i have a checkbox as first column when i select this checkbox and press a push button 'Print' which is there above ALV grid that particular line in output table should get selected and i need to code some logic for printing selected row.
how to make the particluar row in the output internal table to be selected and where to write the logic for print once it is pressed?
Thanks in advance
Srilakshmi.but the checkbox is not getting set in internal table when i select some checkboxes.
can anybody explain y the checkbox in internal table not set?
Hi Srilakshmi,
As explained by Uwe, when we change a field ( say check box ) in ALV grid, the view (frontend) changes (showing the tick mark) but the changed data ( normally ) is not transfered to the backend.
We can initiate this data transfer by just registering the cl_gui_alv_grid=>mc_evt_modified edit event
go_grid->set_table_for_first_display( CHANGING it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab ).
go_grid->set_ready_for_input( 1 ).
go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
Now as soon as we check a checkbox, the data_changed event is triggered.
This initiates data transfer to the backend and the checkbox field in internal table is updated.
check the below code for example.
DATA: go_cont TYPE REF TO cl_gui_custom_container,
go_grid TYPE REF TO cl_gui_alv_grid,
gt_fieldcat TYPE lvc_t_fcat,
gv_language TYPE spras VALUE 'E',
gt_outtab TYPE TABLE OF bus_loca_demo WITH HEADER LINE.
START-OF-SELECTION.
CALL SCREEN 100.
* MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'BASIC'.
SET TITLEBAR '001'.
PERFORM create_and_init_alv CHANGING gt_outtab[]
gt_fieldcat.
ENDMODULE. "pbo OUTPUT
* MODULE PAI INPUT *
MODULE pai INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'PRINT'.
BREAK-POINT.
ENDCASE.
ENDMODULE. "pai INPUT
FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
pt_fieldcat TYPE lvc_t_fcat.
CHECK go_cont IS NOT BOUND.
CREATE OBJECT go_cont
EXPORTING
container_name = 'CUSTOM'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_cont.
PERFORM build_display_table.
PERFORM build_fieldcat CHANGING pt_fieldcat.
go_grid->set_table_for_first_display( CHANGING it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab ).
go_grid->set_ready_for_input( 1 ).
go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
ENDFORM. "CREATE_AND_INIT_ALV
FORM build_display_table.
FREE gt_outtab.
DO 10 TIMES.
gt_outtab-creation_partner = sy-index.
gt_outtab-date_field = sy-datum.
APPEND gt_outtab.
ENDDO.
ENDFORM. "build_display_table
FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'BUS_LOCA_DEMO'
CHANGING
ct_fieldcat = pt_fieldcat.
LOOP AT pt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'CHECKBOX'.
ls_fcat-checkbox = 'X'.
ls_fcat-edit = abap_true.
MODIFY pt_fieldcat FROM ls_fcat.
WHEN 'ENTER_FIELD' OR 'DBLCLICK_FIELD'.
ls_fcat-no_out = abap_true.
MODIFY pt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. "build_fieldcat
Cheers,
Jose. -
ALV - How to set selected rows into internal table
Hi all,
I am tying to set with an 'X' flag the selected rows in my ALV using an internal table that contains all rows showed.
More exactly I have tried to follow these steps.
1) I have added the filed SEL (type SEL) to my ALV structure zrt_bo_slabsend and I defined my internal table in this way
DATA: gt_report TYPE STANDARD TABLE OF zrt_bo_slabsend,
gw_report TYPE zrt_bo_slabsend.
2) I have set gw_layo-box_fname = 'SEL' to gw_layo (ALV layout)
Pressing the "delete button" that I have insert on the top of the ALV, I intercept correctly my user command and I call a form (named "delete_lines") where I have this abap code
FORM delete_lines.
DATA: l_subrc LIKE sy-subrc,
lw_grid_settings LIKE lvc_s_glay.
gw_layo-box_fname = 'SEL'.
"set field name to store row selection
gw_layo-edit = 'X'. "makes whole ALV table editable
gw_layo-zebra = 'X'.
gv_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY_LVC'
exporting
i_callback_program = gv_repid
i_callback_pf_status_set = gc_status
i_callback_user_command = gc_user_command
is_layout_lvc = gw_layo
it_fieldcat_lvc = gw_fkat
i_grid_settings = lw_grid_settings
i_save = 'X'
is_variant = variant
it_events = gt_events
TABLES
t_outtab = gt_report
EXCEPTIONS
program_error = 1
OTHERS = 2.
LOOP AT gt_report ASSIGNING <report> WHERE SEL = 'X'.
DELETE gt_report.
ENDLOOP.
ENDFORM.
I'd like to select many rows in my ALV report, than by pressing the delete button I'd like to see a refresh of my ALV, without the selected rows. I want to save it only at the end of my action, only by pressing the save button.
Any suggestion about the abap code will be well appreciated.
Thanks in advance for your kind help.
Regards.
GiovanniHi Giovanni,
I am using the method:-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
I_CALLBACK_PROGRAM = gd_REPID
I_CALLBACK_PF_STATUS_SET = 'UDIT'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'Mainatin cell entry'
* I_GRID_SETTINGS =
IS_LAYOUT_LVC = GS_LAYOUT
IT_FIELDCAT_LVC = I_FIELDCAT[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS_LVC =
* IT_SORT_LVC =
* IT_FILTER_LVC =
* IT_HYPERLINK =
* IS_SEL_HIDE =
I_DEFAULT = 'X'
* I_SAVE = 'X'
* IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
* IS_PRINT_LVC =
* IS_REPREP_ID_LVC =
I_SCREEN_START_COLUMN = 30
I_SCREEN_START_LINE = 14
I_SCREEN_END_COLUMN = 120
I_SCREEN_END_LINE = 25
* IT_EXCEPT_QINFO_LVC =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_ZCP_DEMAND_SYS1
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I have made five buttons on my toolbar (add, delete, save, back, exit).
Kindly tell me how can I catch the sy-ucomm of these buttons.
NOTE: this FM is written inside an user-exit, so I cannot make forms.
Thanks in advance.
Maybe you are looking for
-
Hi all, We have come across a problem when the ADRC ADDRNUMBER counter in ERP got full (the standard max limit is 49 999 999). Analysis shows that most of those are empty address rows and created by one-time vendor. In our case the mass of addresses
-
I have created a document in word and sent it to my recipients in pdf format so they would receive it just as I had formatted it. I used an unusual font. But my recipients tell me they cannot open it. Can you help me understand what I am doing wrong.
-
Hi, I am starting my PhD this fall in Chemistry, and am trying to decide between the Macbook Air and the Macbook Pro. I'll need it for writing my dissertation, research, and other academic-related uses; not movies or games. I hear the flash memory in
-
Hi, i want to block the clearing of some documents, is there any way to do that ? Please Advise Regards.
-
Coverting Date.toString() back to a new Date object
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html#toString() After reading this, I am able to see the output format: dow mon dd hh:mm:ss zzz yyyy However, my questions is, what if you want to convert this String back into a new Date object