Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can i get THE VALUE of one field in a select-options?

Former Member
0 Kudos

HI friends!!

I need a hand,

I want to rescue the value input of one field in select options. I build a correct path to upload/download a file in a correct path ( /interfaces/B2B/OUT/ +filename+time+extension). When the user ejecuted the report, i build the correct path in the inizialization and  check the input and  manage the message  errors.

In the beginng of start of selection I make another check ( reason--> a user can change manually the correct PATH). If the user change the correct PATH, the report show all the message errors .

Now is when i have the problem. The next step, the report returns to the beginning (select-options) but the parameter P_FILE has the incorrect PATH.

I want to show the correct PATH AGAIN ( the same value that i get in the INIZIALIZATION secuence).

Thanks for all. Sorry for my  poor english my friends!!

This is the implementation of the report. I have another includes but i only have problems with these.

REPORT yerpb2b01_attr_config_material.

"Data

INCLUDE yerpb2b01top.

*INCLUDE zerpb2b01top.

INCLUDE : zgcr0102_in001_msg_management .

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: s_ersda FOR mara-ersda, "Created On

                 s_matnr FOR mara-matnr, "Material Number

                 s_werks FOR marc-werks. "Plant (logistic center)

*PARAMETERS: file TYPE text256 OBLIGATORY. "File

PARAMETERS: p_file TYPE dirname OBLIGATORY. "File

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN: COMMENT (5) text.

PARAMETERS: test AS CHECKBOX.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

*Initial date (actual - 1)

   s_ersda-low = sy-datum - 1.

   APPEND s_ersda.

*Comment text

   text = 'Test'.

*File name

   GET TIME STAMP FIELD gv_timestamp. "Get timestamp

   gv_timestring = gv_timestamp. "Change timestamp to char14

*******************************************************************************************

*  CONCATENATE '/interfaces/ptp/out/ERPB2B01_' gv_timestring '.TXT' INTO file.

*******************************************************************************************

*Build correct path.

*************************************************************************************

   PERFORM zf_get_initial_path USING c_system  c_ffolder

                               CHANGING gv_file2

                                        gt_return

                                        sy-subrc.

   IF sy-subrc NE 0.

     EXIT.

   ENDIF.

************************************************************************************

   CONCATENATE gv_file2 '/' 'ERPB2B01_'  gv_timestring '.TXT' INTO p_file.

   SPLIT p_file AT '/' INTO gs_path_initial-aux_folder_path gs_path_initial-folder_path gs_path_initial-systemtolink gs_path_initial-finalfolder gs_path_initial-file_name.

at selection-screen.

break-point.

at user-command.

break-point.

START-OF-SELECTION.

**********************************************************************************************

   SPLIT p_file AT '/' INTO lv_path-aux_folder_path lv_path-folder_path lv_path-systemtolink lv_path-finalfolder lv_path-file_name.

   REFRESH gt_return.

* Now we need to compare user input path and the correct path that we have built.

   IF gs_path_initial-folder_path NE lv_path-folder_path.

     gv_type_msg = c_msg_error.

     gv_par1 = lv_path-folder_path.

     gv_cl_msg = c_classmsg.

     PERFORM zf_generate_msg_to_table USING    'X'  gv_type_msg  gv_cl_msg  '004'

                                          CHANGING gv_par1  gv_par2  gv_par3 gv_par4

                                                   gt_return.

   ENDIF.

   PERFORM zf_get_initial_path USING lv_path-systemtolink

                                     lv_path-finalfolder

                               CHANGING   p_file

                                          gt_return

                                          sy-subrc.

   IF sy-subrc NE 0.

     DATA: lt_dynpfield TYPE dynpread_tty.

     FREE: lt_dynpfield.

     PERFORM zf_append_dynprofield_change USING    'p_file'

                                                   'BBB'

                                          CHANGING lt_dynpfield.

*------------------------------------------------------------------------

     PERFORM zf_set_dynprofield_changes USING lt_dynpfield.

*------------------------------------------------------------------------

*    p_file = 'aaa'.

*    cl_gui_cfw=>flush( ).

*    return.

*    EXIT.

     p_file = 'aaa'.

     message s001(00) display like 'E'.

     return.

   ENDIF.

*********************************************************************************************

   "Search database

   INCLUDE yerpb2b01_workspace.

*  INCLUDE zerpb2b01_workspace.

END-OF-SELECTION.

   "Send file

   INCLUDE yerpb2b01_sendfile.

*  INCLUDE zerpb2b01_sendfile.

*&---------------------------------------------------------------------*

*&      Form  ZF_GET_INITIAL_PATH

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_C_SYSTEM  text

*      -->P_C_FFOLDER  text

*      <--P_P_FILE  text

*      <--P_GT_RETURN  text

*      <--P_SY_SUBRC  text

*----------------------------------------------------------------------*

FORM zf_get_initial_path  USING    p_c_system

                                    p_c_ffolder

                           CHANGING p_p_file

                                    p_gt_return TYPE bapiret2_t

                                    p_sy_subrc.

   DATA: lv_command TYPE bal_s_excm.

   CALL FUNCTION 'ZCR0103_GET_PATH_INTERFACE'

     EXPORTING

       im_system       = p_c_system

       im_final_folder = p_c_ffolder

     IMPORTING

       ex_path         = p_p_file

       ex_tt_return    = p_gt_return.

   IF p_gt_return[] IS NOT INITIAL.

     PERFORM zf_popup_msg_table

             USING    cv_title 'X'  space

             CHANGING p_gt_return  lv_command.

     p_sy_subrc = 1.

   ENDIF.

ENDFORM.                    " ZF_GET_INITIAL_PATH

*&---------------------------------------------------------------------*

*&      Form  ZF_APPEND_DYNPROFIELD_CHANGE

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_0130   text

*      -->P_GS_BRAND_CONCATENATION  text

*----------------------------------------------------------------------*

FORM zf_append_dynprofield_change  USING pv_field

                                          pv_val

                                          pt_dynpfield TYPE dynpread_tty.

   DATA: ls_dynpfield  TYPE dynpread.

   CLEAR: ls_dynpfield.

*-------------------------------------------

   ls_dynpfield-fieldname  = pv_field.

   ls_dynpfield-fieldvalue = pv_val.

   ls_dynpfield-fieldinp   = 'X'.

   APPEND ls_dynpfield TO pt_dynpfield.

ENDFORM.                    " ZF_APPEND_DYNPROFIELD_CHANGE

*&---------------------------------------------------------------------*

*&      Form  ZF_SET_DYNPROFIELD_CHANGES

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_LT_DYNPFIELD  text

*----------------------------------------------------------------------*

FORM zf_set_dynprofield_changes  USING pt_dynpfield TYPE dynpread_tty.

   CALL FUNCTION 'DYNP_VALUES_UPDATE'

     EXPORTING

       dyname               = sy-repid

       dynumb               = sy-dynnr

     TABLES

       dynpfields           = pt_dynpfield

     EXCEPTIONS

       invalid_abapworkarea = 1

       invalid_dynprofield  = 2

       invalid_dynproname   = 3

       invalid_dynpronummer = 4

       invalid_request      = 5

       no_fielddescription  = 6

       undefind_error       = 7

       OTHERS               = 8.

   IF sy-subrc <> 0.

* Implement suitable error handling here

   ENDIF.

ENDFORM.    



Thanks for all!!  

4 REPLIES 4

narendar_naidu
Active Participant
0 Kudos

hi,

I could not get your problem, but any ways what i suggest you is , restrict the user at selection screen itself until he fills the correct path, instead of moving ahead to start of selection.

regards,

0 Kudos

Hi,

I don't get your problem correctly, But I'll suggest you to do like this

In the parameter declaration, try like this,

PARAMETERS: p_file TYPE dirname DEFAULT 'FILE_NAME' OBLIGATORY.


Regards,

Riju Thomas.

former_member199214
Participant
0 Kudos

Hi EMILIO PEDREIRA VIDAL,

     As far as i understand your requirement is:    

                              Parameter p_file will have the correct path,

                              User will select a Path if the path is Wrong the Error messages wil be displayed and then p_file has the wrong path which was selected.

                              Here u need the right path.

    

I have done a simple code where the default path will be displayed when the user selects the wrog path (from E Directory ) then the error message will be displayed an then again the right path will be displayed.

parameter:

       p_file type rlgrap-filename DEFAULT 'C:\ABCD.TXT'.

       data : lv_path type string value 'C:\ABCD.TXT'.

at selection-screen on value-request for p_file.

   call function 'F4_FILENAME'

     exporting

       program_name  = syst-cprog

       dynpro_number = syst-dynnr

       field_name    = 'P_FILE'

     importing

       file_name     = p_file

     exceptions

       mask_too_long = 1

       others        = 2.

   if sy-subrc <> 0.

   endif.

at selection-screen.

   IF p_file cs 'E:'.

     p_file = lv_path.

     MESSAGE 'Check' type 'E'.

   ENDIF.

Regards,

Sindhuja

Former Member
0 Kudos

Thanks for all!!

Finally i find the solution. I used the the sentence SUBMIT Z_program VIA SELECTION SCREEN.

I wrote the soluction.

REPORT yerpb2b01_attr_config_material.

"Data

INCLUDE yerpb2b01top.

*INCLUDE zerpb2b01top.

INCLUDE : zgcr0102_in001_msg_management .

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: s_ersda FOR mara-ersda, "Created On

                 s_matnr FOR mara-matnr, "Material Number

                 s_werks FOR marc-werks. "Plant (logistic center)

*PARAMETERS: file TYPE text256 OBLIGATORY. "File

PARAMETERS: p_file TYPE text256 OBLIGATORY VALUE CHECK. "File

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN: COMMENT (5) text.

PARAMETERS: test AS CHECKBOX.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

*Initial date (actual - 1)

   s_ersda-low = sy-datum - 1.

   APPEND s_ersda.

*Comment text

   text = 'Test'.

*File name

   GET TIME STAMP FIELD gv_timestamp. "Get timestamp

   gv_timestring = gv_timestamp. "Change timestamp to char14

*******************************************************************************************

*  CONCATENATE '/interfaces/ptp/out/ERPB2B01_' gv_timestring '.TXT' INTO file.

*******************************************************************************************

*Build correct path.

*************************************************************************************

   PERFORM zf_get_initial_path USING c_system

                                     c_ffolder

                               CHANGING gv_file2

                                        gt_return

                                        sy-subrc.

   IF sy-subrc NE 0.

     EXIT.

   ENDIF.

************************************************************************************

  CONCATENATE gv_file2 '/' 'ERPB2B01_'  gv_timestring '.TXT' INTO lv_file2.

  SPLIT lv_file2 AT '/' INTO gs_path_initial-aux_folder_path gs_path_initial-folder_path gs_path_initial-systemtolink gs_path_initial-finalfolder gs_path_initial-file_name.

  MOVE lv_file2 TO p_file.

*    LOOP AT SCREEN.

*      if screen-name = 'p_file'.

*        p_file = lv_file.

*        MODIFY SCREEN.

*      endif.

*    ENDLOOP.

*    CALL SELECTION-SCREEN '1000' USING SELECTION-SET p_file.

*at selection-screen.

*break-point.

*

*at user-command.

*break-point.

START-OF-SELECTION.

**********************************************************************************************

   SPLIT p_file AT '/' INTO lv_path-aux_folder_path lv_path-folder_path lv_path-systemtolink lv_path-finalfolder lv_path-file_name.

   REFRESH gt_return.

* Now we need to compare user input path and the correct path that we have built.

   IF gs_path_initial-folder_path NE lv_path-folder_path.

     gv_type_msg = c_msg_error.

     gv_par1 = lv_path-folder_path.

     gv_cl_msg = c_classmsg.

     PERFORM zf_generate_msg_to_table USING    'X'  gv_type_msg  gv_cl_msg  '004'

                                          CHANGING gv_par1  gv_par2  gv_par3 gv_par4

                                                   gt_return.

   ENDIF.

   lv_file = p_file.

   PERFORM zf_get_initial_path USING lv_path-systemtolink

                                     lv_path-finalfolder

                               CHANGING   lv_file

                                          gt_return

                                          sy-subrc.

   IF sy-subrc NE 0.

SUBMIT YERPB2B01_ATTR_CONFIG_MATERIAL VIA SELECTION-SCREEN .    " and RETURN.

ENDIF.

*********************************************************************************************

   "Search database

   INCLUDE yerpb2b01_workspace.

*  INCLUDE zerpb2b01_workspace.

END-OF-SELECTION.

   "Send file

   INCLUDE yerpb2b01_sendfile.

*  INCLUDE zerpb2b01_sendfile.

*&---------------------------------------------------------------------*

*&      Form  ZF_GET_INITIAL_PATH

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_C_SYSTEM  text

*      -->P_C_FFOLDER  text

*      <--P_P_FILE  text

*      <--P_GT_RETURN  text

*      <--P_SY_SUBRC  text

*----------------------------------------------------------------------*

FORM zf_get_initial_path  USING    p_c_system type ZCR0103_SYSTEM

                                    p_c_ffolder type ZCR0103_FFOLDER

                           CHANGING p_p_file TYPE DIRNAME

                                    p_gt_return TYPE bapiret2_t

                                    p_sy_subrc.

   DATA: lv_command TYPE bal_s_excm.

   CALL FUNCTION 'ZCR0103_GET_PATH_INTERFACE'

     EXPORTING

       im_system       = p_c_system

       im_final_folder = p_c_ffolder

     IMPORTING

       ex_path         = p_p_file

       ex_tt_return    = p_gt_return.

   IF p_gt_return[] IS NOT INITIAL.

     PERFORM zf_popup_msg_table

             USING    cv_title 'X'  space

             CHANGING p_gt_return  lv_command.

     p_sy_subrc = 1.

   ENDIF.

ENDFORM.                    " ZF_GET_INITIAL_PATH

Thanks for help. Sorry for not show the rest includes...