‎2021 Aug 31 2:46 PM
Hello All,
I have a program which uploads excel data to database table.
Now I would like to split the program:
based on User decision whether it gets uploaded to internal table only or directly to database.
Can you please suggest the way how I could process this? I tried with radiobutton, I could not manage, though might be a solution.
So far I have written below:
REPORT ZBB_TEST01.
TYPE-POOLS truxs.
TABLES : wcamb.
PARAMETER p_file TYPE rlgrap-filename DEFAULT 'C:\Users\......XLSX'.
TYPES:
BEGIN OF t_tab,
userid TYPE wcamb-userid,
iwerk TYPE wcamb-iwerk,
worklist_variant type wcamb-worklist_variant,
END OF t_tab.
DATA :
t_upload TYPE STANDARD TABLE OF t_tab,
wa_upload TYPE t_tab,
it_type TYPE truxs_t_text_data.
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.
START-OF-SELECTION.
* Uploading the data in the file into internal table
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
* I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
i_filename = p_file
TABLES
i_tab_converted_data = t_upload[]
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid
TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
END-OF-SELECTION.
* Uploading the data into the database table
LOOP AT T_UPLOAD INTO WA_UPLOAD.
wcamb-userid = WA_UPLOAD-userid.
wcamb-iwerk = WA_UPLOAD-iwerk.
Wcamb-worklist_variant = WA_UPLOAD-worklist_variant. MODIFY wcamb.
ENDLOOP.
Thanks a lot.
Brg
‎2021 Aug 31 2:46 PM
Welcome to the SAP Community! We wanted to give you the opportunity to take the tutorial to get started in SAP Community: https://developers.sap.com/tutorials/community-qa.html, as it provides tips for preparing questions that draw responses from our members. Additionally, by adding a picture to your profile you encourage readers to respond to your question. Learn more about your profile here: https://developers.sap.com/tutorials/community-profile.html
‎2021 Aug 31 2:47 PM
‎2021 Aug 31 3:21 PM
Please edit your question, select your code and press the "CODE" button to make it correctly colorized/indented, so that it's easier for us to analyze it. Thank you.
‎2021 Sep 01 12:32 PM
put radiobutton with condition.
if rb1.
excel to internal table.
elseif rb2.
excel to db table.
endif.
‎2021 Sep 06 2:09 PM