2013 Jul 30 2:18 AM
My screen should looks like this
but it looks like this ...
Is there anyone who can tell me why?
----------------------------------Code Below-------------------------------------------
*&---------------------------------------------------------------------
*& Report ZBIP0013 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT zbip0013 .
TABLES: zbi13.
DATA : BEGIN OF it_upload_file OCCURS 0 ,
kmonth TYPE RSCALMONTH,
dmbtr LIKE zbi13-dmbtr,
waers LIKE zbi13-waers,
END OF it_upload_file.
DATA BEGIN OF itab OCCURS 1.
INCLUDE STRUCTURE zbi13.
DATA END OF itab.
TYPE-POOLS: truxs.
DATA: it_raw_data TYPE truxs_t_text_data.
TYPES: BEGIN OF ty_fcst_dlv_qty,
kmonth TYPE RSCALMONTH,
dmbtr LIKE zbi13-dmbtr,
waers LIKE zbi13-waers,
END OF ty_fcst_dlv_qty.
DATA: it_fcst_dlv_qty TYPE STANDARD TABLE OF ty_fcst_dlv_qty,
wa_fcst_dlv_qty TYPE ty_fcst_dlv_qty.
DATA: s_username TYPE string.
DATA: dmbtr LIKE zbi13-dmbtr.
PARAMETERS:p_file LIKE rlgrap-filename OBLIGATORY MEMORY ID fi1.
PARAMETERS:p_kmonth LIKE zbi13-kmonth OBLIGATORY MEMORY ID ym1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_kmonth .
PERFORM u_select_year_month USING p_kmonth.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file .
PERFORM u_select_file USING p_file.
INITIALIZATION.
START-OF-SELECTION.
CLEAR: itab,it_upload_file. "清除 internal table header
CLEAR: itab[],it_upload_file[]. "清除 internal table content
"=REFRESH:ITAB,UPLOAD_FILE.
IF p_file IS INITIAL.
"prompt 請選擇一個檔案
ELSE.
"有選擇一個Excel檔案的話
PERFORM u_upload_excel_data.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
"有成功讀取檔案內容到 internal table 的話
ENDIF.
LOOP AT it_fcst_dlv_qty INTO wa_fcst_dlv_qty.
CLEAR it_upload_file.
MOVE-CORRESPONDING wa_fcst_dlv_qty TO it_upload_file.
APPEND it_upload_file.
ENDLOOP.
PERFORM u_get_username USING s_username.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CALL METHOD cl_gui_cfw=>flush( ).
ENDIF.
ENDIF.
LOOP AT it_upload_file.
CLEAR itab.
MOVE-CORRESPONDING it_upload_file TO itab.
itab-meins = 'EA'.
itab-kmonth = p_kmonth.
itab-uname = sy-uname.
itab-datum = sy-datum.
itab-dmbtr = itab-dmbtr.
itab-terminal = s_username.
itab-waers = 'USD'.
APPEND itab.
ENDLOOP.
"將Ok的資料更新到資料庫
LOOP AT itab.
MODIFY zbi13 FROM itab.
IF sy-subrc = 0.
WRITE 😕 itab-kmonth,itab-dmbtr,itab-terminal,itab-uname,
itab-dmbtr CURRENCY itab-waers INPUT ON,
'Success'.
ELSE.
WRITE 😕 itab-kmonth,itab-dmbtr,itab-terminal,itab-uname,
itab-dmbtr CURRENCY itab-waers INPUT ON,
'Fail'.
ENDIF.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form U_SELECT_FILE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_PA_FILE text
*----------------------------------------------------------------------*
FORM u_select_file USING p_pa_file TYPE localfile.
DATA :
lv_subrc LIKE sy-subrc,
lt_it_tab TYPE filetable.
" Display File Open Dialog control/screen
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select Source Excel File'
default_filename = '*.xls'
multiselection = ' '
CHANGING
file_table = lt_it_tab
rc = lv_subrc.
" Write path on input area
LOOP AT lt_it_tab INTO p_pa_file.
ENDLOOP.
ENDFORM. " U_SELECT_FILE
*&---------------------------------------------------------------------*
*& Form u_select_year_month
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->p_year_month text
*----------------------------------------------------------------------*
FORM u_select_year_month USING p_year_month TYPE zbi13-kmonth.
DATA :
lv_subrc LIKE sy-subrc,
lv_year_month TYPE isellist-month.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH'
EXPORTING
actual_month = sy-datum(6)
language = sy-langu
start_column = 8
start_row = 5
IMPORTING
selected_month = lv_year_month
return_code = lv_subrc
EXCEPTIONS
factory_calendar_not_found = 1
holiday_calendar_not_found = 2
month_not_found = 3
OTHERS = 4.
p_year_month = lv_year_month.
ENDFORM. " u_select_year_month
*/UPLOADEXCELDATA
FORM u_upload_excel_data.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = 'X'
i_tab_raw_data = it_raw_data
i_filename = p_file
TABLES
i_tab_converted_data = it_fcst_dlv_qty[] " Data
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
ENDFORM. " U_UPLOADEXCELDATA
*&---------------------------------------------------------------------*
*& Form u_get_username
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->s_username text
*----------------------------------------------------------------------*
FORM u_get_username USING username TYPE string.
CALL METHOD cl_gui_frontend_services=>get_user_name
CHANGING
user_name = username
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
ENDFORM. "u_get_username
2013 Jul 30 12:00 PM
Hi,
when you display the code of your program, go in the menu : Goto -> Texts elements -> Selection texts
if you use the check box, SAP will take the information of the Data element
If you didn't use the check box, you could set your own text
regards
Fred
2013 Jul 30 6:00 PM
hello,
Apart from this you need to Goto --> Attributes and change or Add Title as Forecast delivery Qty Maintain/Upload
best regards,
swanand
2013 Jul 30 12:00 PM
Ninja,
Selection-screen is auto-generated. It takes the name of the variables you had declared.
Edit text elements for your needs.
Regards.
2013 Jul 30 5:46 PM
hi,
In menu click GOTO TAB----->TEXT ELEMENTS----->SELECTION TEXTS
there you will see the the parameters which you used
P_FILE
P_KMONTH.
Change the names their ...
Remove P_FILE and give File Name..
Remove P_KMONTH and give Month/year.
2013 Jul 30 6:08 PM
Hi Ninja Yang.
Go to ---> text elements--> selection texts --> try to add the your own text under the 'text' row for respective fields in your selection.
Save and and activate. now try to execute your program you will find the correct texts in selection screen,
Let me know if any issues.
Regards,
Gurunath
2013 Jul 30 7:02 PM
Hi Ninja
I assume, you are getting the Wrong screen when you are login as 'Non-English' language.
If so, please let me know.
I think, when you login as English user, you will get the correct screen, else you will get the wrong screen as you mentioned.
To fix, that you need to translate that text elements.
SE38
Open your program
Go to ---> text elements--> selection texts
Go to -->Choose Translate.
It will open up all your text elements and option to translate also. Type the appropriate translated text.
Then you will get the appropriate screen as per you login language.
Regards,
Venkat