Thursday, February 21, 2019

Update Z-Table through Editable AlV Grid in SAP ABAP

Update Z-Table through Editable AlV Grid in SAP ABAP.

Read More Customer Exit ..........


REPORT ZQAM_PP_01.

INCLUDE ZQAM_PP_01_TOP.
INCLUDE ZQAM_PP_01_SEL.
INCLUDE ZQAM_PP_01_SUB.

START-OF-SELECTION.

  PERFORM get_data.
  PERFORM alv_fieldcat.
  PERFORM get_events.
  PERFORM sub_comment_build USING t_list_top_of_page.
  PERFORM alv_display.
***************************************************************

TOP PAGE
********************************************
*&---------------------------------------------------------------------*
*&  Include           ZQAM_PP_01_TOP
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Type-Pool Declaration
*&---------------------------------------------------------------------*
TYPE-POOLS: slis.
*&---------------------------------------------------------------------*
*& ALV Data Declaration
*&---------------------------------------------------------------------*
DATA: it_fieldcat            TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat            LIKE LINE OF it_fieldcat.
DATA: t_list_top_of_page     TYPE slis_t_listheader.
DATA: it_events              TYPE slis_t_event WITH HEADER LINE.
DATA: g_save                 TYPE c VALUE 'A'.
DATA: gt_sort                TYPE slis_t_sortinfo_alv.
DATA: gx_save                TYPE c VALUE 'A'.
DATA: gx_variant             TYPE disvariant.
DATA: g_variant              TYPE disvariant.
DATA: gs_layout              TYPE slis_layout_alv.
DATA: t_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
DATA: t_i_event              TYPE slis_alv_event.
*&---------------------------------------------------------------------*
*& External Table Declaration                                          *
*&---------------------------------------------------------------------*
TABLES: zqampp01,mara,makt.

*&---------------------------------------------------------------------*
*& Internal Table Declaration                                          *
*&---------------------------------------------------------------------*
TYPES: BEGIN OF ty_zqampp01,
         matnr      TYPE matnr,
         maktx      TYPE maktx,
         user_def1  TYPE zuser_def1,
         user_def2  TYPE zuser_def2,
         user_def3  TYPE zuser_def3,
         user_def4  TYPE zuser_def4,
         user_def5  TYPE zuser_def5,
         user_def6  TYPE zuser_def6,
         user_def7  TYPE zuser_def7,
         user_def8  TYPE zuser_def8,
         user_def9  TYPE zuser_def9,
         user_def10 TYPE zuser_def10,
*         user_def11 TYPE zuser_def11,
       END OF ty_zqampp01.

TYPES:BEGIN OF ty_mara,
        matnr TYPE matnr,
        mtart TYPE mtart,
      END OF  ty_mara.

TYPES:BEGIN OF ty_makt,
        matnr TYPE matnr,
        maktx TYPE maktx,
      END OF  ty_makt.

TYPES:
  ty_document_list TYPE  sodocchgi1,
  ty_packing_list  TYPE  sopcklsti1,
  ty_attachment    TYPE  solisti1,
  ty_receiver      TYPE  somlreci1,
  ty_message       TYPE  solisti1.

*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Variables Declaration                                               *
*&---------------------------------------------------------------------*
DATA: it_stru  TYPE STANDARD TABLE OF ty_zqampp01,
      it_stru1  TYPE STANDARD TABLE OF ty_zqampp01,
      wa_stru1 TYPE ty_zqampp01,
      wa_stru  TYPE ty_zqampp01.

DATA: it_mara TYPE STANDARD TABLE OF ty_mara,
      wa_mara TYPE ty_mara.

DATA: it_makt TYPE STANDARD TABLE OF ty_makt,
      wa_makt TYPE ty_makt.

DATA: id_tabix TYPE sy-tabix.


DATA: it_packing_list  TYPE STANDARD TABLE OF ty_packing_list  WITH HEADER LINE,
      it_receiver      TYPE STANDARD TABLE OF ty_receiver      WITH HEADER LINE,
      it_body_msg      TYPE STANDARD TABLE OF ty_message       WITH HEADER LINE,
      it_attachment    TYPE STANDARD TABLE OF ty_attachment    WITH HEADER LINE,
      it_document_list TYPE STANDARD TABLE OF ty_document_list WITH HEADER LINE.

DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE,
      it_attach  TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE.

DATA: mailtext TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
      mailrec  TYPE STANDARD TABLE OF somlreci1 WITH HEADER LINE.

DATA: wa_packing_list  TYPE ty_packing_list,
      wa_receiver      TYPE ty_receiver,
      wa_body_msg      TYPE ty_message,
      wa_attachment    TYPE ty_attachment,
      wa_document_list TYPE ty_document_list.
*CONSTANTS: c_check(1) VALUE 'X'.

DATA: ls_ans TYPE string.

DATA: l_resize  TYPE i,
      tab_line  TYPE i,
      l_snt_all TYPE c LENGTH 1.
*DATA: mail_data TYPE sodocchgi1.

*******************************************************************************
SELECTION PAGE
*******************************************************************************
*&---------------------------------------------------------------------*
*&  Include           ZQAM_PP_01_SEL
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_matnr FOR wa_mara-matnr. "material no input
SELECTION-SCREEN END OF BLOCK b1.
******************************************************************************
SUB PAGE
******************************************************************************
*&---------------------------------------------------------------------*
*&  Include           ZQAM_PP_01_SUB
*&---------------------------------------------------------------------*
*START-OF-SELECTION.

FORM get_data.

  SELECT matnr
         maktx
         user_def1
         user_def2
         user_def3
         user_def4
         user_def5
         user_def6
         user_def7
         user_def8
         user_def9
         user_def10
*         user_def11
    FROM zqampp01
    INTO TABLE it_stru
    WHERE matnr IN s_matnr.
  IF it_stru[] IS INITIAL.
    SELECT matnr
           mtart
      FROM mara
      INTO TABLE it_mara
      WHERE matnr IN s_matnr
      AND  mtart = 'YFGR'.
    IF it_mara[] IS NOT INITIAL.
      SELECT matnr
             maktx
    FROM makt
    INTO TABLE it_makt
     FOR ALL ENTRIES IN it_mara
    WHERE matnr = it_mara-matnr.

      LOOP AT it_mara INTO wa_mara.
        wa_stru-matnr = wa_mara-matnr.
        READ TABLE it_makt INTO wa_makt WITH KEY matnr = wa_mara-matnr.
        IF sy-subrc = 0.
          wa_stru-maktx = wa_makt-maktx.
        ENDIF.
        APPEND wa_stru TO it_stru.
        CLEAR:wa_stru.
        CLEAR:wa_makt.
      ENDLOOP.
    ENDIF.
  ENDIF.
ENDFORM.



FORM alv_fieldcat .
  DATA: counter TYPE i.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'MATNR'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Em_Name'.
  wa_fieldcat-no_zero   = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'MAKTX'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Em_Name'.
  wa_fieldcat-no_zero   = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF1'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 1'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF2'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 2'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF3'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 3'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.


  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF4'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 34'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF5'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 5'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF6'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 6'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF7'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 3'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF8'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 8'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF9'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 9'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

  counter = counter + 1.
  wa_fieldcat-col_pos    = counter.
  wa_fieldcat-fieldname  = 'USER_DEF10'.
  wa_fieldcat-tabname    = 'IT_STRU'.
  wa_fieldcat-seltext_l  = 'Col 10'.
  wa_fieldcat-no_zero    = 'X'.
  wa_fieldcat-edit        = 'X'.
  APPEND wa_fieldcat TO it_fieldcat.
  CLEAR wa_fieldcat.

*  counter = counter + 1.
*  wa_fieldcat-col_pos    = counter.
*  wa_fieldcat-fieldname  = 'USER_DEF11'.
*  wa_fieldcat-tabname    = 'IT_STRU'.
*  wa_fieldcat-seltext_l  = 'Col 11'.
*  wa_fieldcat-no_zero    = 'X'.
*  wa_fieldcat-edit        = 'X'.
*  APPEND wa_fieldcat TO it_fieldcat.
*  CLEAR wa_fieldcat.
ENDFORM.

FORM get_events .
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type     = 0
    IMPORTING
      et_events       = it_events[]
    EXCEPTIONS
      list_type_wrong = 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.

  READ TABLE it_events WITH KEY name = slis_ev_top_of_page
                                INTO it_events.
  IF sy-subrc = 0.
    MOVE t_formname_top_of_page TO it_events-form.
    APPEND it_events.
  ENDIF.
ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  SUB_COMMENT_BUILD
*&---------------------------------------------------------------------*
FORM sub_comment_build  USING  i_top_of_page TYPE slis_t_listheader.
  DATA: ls_line TYPE slis_listheader.
  DATA: wrk_name     TYPE string.

*  wrk_name = 'Squirrel Softech Pvt. Ltd.'.

  CLEAR ls_line.

  ls_line-typ  = 'H'.
*  ls_line-info = wrk_name.
  APPEND ls_line TO i_top_of_page.
  ls_line-typ  = 'H'.
  ls_line-info = 'Details Report'.
  APPEND ls_line TO i_top_of_page.
ENDFORM.                    " SUB_COMMENT_BUILD

*&---------------------------------------------------------------------*
*&      Form  top_of_page
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM top_of_page.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = t_list_top_of_page.
ENDFORM.                    "top_of_page
*&---------------------------------------------------------------------*
*&      Form  ALV_DISPLAY
*&---------------------------------------------------------------------*
FORM alv_display .
  gs_layout-zebra                = 'X'.
  gs_layout-detail_popup         = 'X'.
  gs_layout-detail_initial_lines = 'X'.
  gs_layout-colwidth_optimize    = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      it_fieldcat              = it_fieldcat
      it_events                = it_events[]
      i_callback_program       = sy-repid
      is_layout                = gs_layout
      it_sort                  = gt_sort[]
      i_save                   = g_save
      is_variant               = gx_variant
      i_callback_pf_status_set = 'ZSAVE'
      i_callback_user_command  = 'USER_COMMAND'
    TABLES
      t_outtab                 = it_stru[].
  .
ENDFORM.                    " ALV_DISPLAY
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->RT_EXTAB   text
*----------------------------------------------------------------------*
FORM zsave USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'ZSAVE'.
*  SET PF-STATUS 'START'.
ENDFORM.                    "text


*&---------------------------------------------------------------------*
*&      form  user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->ucomm      text
*      -->selfield   text
*----------------------------------------------------------------------*
FORM user_command USING ucomm  TYPE sy-ucomm
                        selfield TYPE slis_selfield.

  DATA: gd_repid LIKE sy-repid,
        ref_grid TYPE REF TO cl_gui_alv_grid.

  IF ref_grid IS INITIAL.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
        e_grid = ref_grid.
  ENDIF.
  IF NOT ref_grid IS INITIAL.
    CALL METHOD ref_grid->check_changed_data.
  ENDIF.
  CASE sy-ucomm.
    WHEN 'SAVE'.
      LOOP AT it_stru INTO wa_stru.
        SELECT matnr
               maktx
               user_def1
               user_def2
               user_def3
               user_def4
               user_def5
               user_def6
               user_def7
               user_def8
               user_def9
               user_def10
*               user_def11
          FROM zqampp01
          INTO TABLE it_stru
          WHERE matnr = wa_stru-matnr.
        IF sy-subrc = 0.
          UPDATE zqampp01
            SET matnr        = wa_stru-matnr
                maktx        = wa_stru-maktx
                user_def1    = wa_stru-user_def1
                user_def2    = wa_stru-user_def2
                user_def3    = wa_stru-user_def3
                user_def4    = wa_stru-user_def4
                user_def5    = wa_stru-user_def5
                user_def6    = wa_stru-user_def6
                user_def7    = wa_stru-user_def7
                user_def8    = wa_stru-user_def8
                user_def9    = wa_stru-user_def9
                user_def10   = wa_stru-user_def10
*                user_def11   = wa_stru-user_def11
                WHERE  matnr = wa_stru-matnr.
          IF sy-subrc = 0.
            COMMIT WORK AND WAIT.
          ENDIF.
        ELSE.
          zqampp01-matnr =   wa_stru-matnr.
          zqampp01-maktx =   wa_stru-maktx.
          zqampp01-user_def1 =  wa_stru-user_def1.
          zqampp01-user_def2 =  wa_stru-user_def2.
          zqampp01-user_def3 =  wa_stru-user_def3.
          zqampp01-user_def4 =  wa_stru-user_def4.
          zqampp01-user_def5 =  wa_stru-user_def5.
          zqampp01-user_def6 =  wa_stru-user_def6.
          zqampp01-user_def7 =  wa_stru-user_def7.
          zqampp01-user_def8 =  wa_stru-user_def8.
          zqampp01-user_def9 =  wa_stru-user_def9.
          zqampp01-user_def10 = wa_stru-user_def10.
*          zqampp01-user_def11 = wa_stru-user_def11.
          INSERT  zqampp01.
          IF sy-subrc = 0.
            COMMIT WORK AND WAIT.
          ENDIF.
        ENDIF.
      ENDLOOP.
  ENDCASE.
ENDFORM.

Read More Customer Exit ..........

Friday, December 28, 2018

Field Symbol - Dynamic Programming in ABAP.


Field Symbol - Dynamic Programming in ABAP.



A. How to declare field symbol in sap abap.
DATA :new_val TYPE i VALUE 4.
FIELD-SYMBOLS:<lv_var> TYPE i.
ASSIGN new_val to <lv_var>.
   
WRITE/ <lv_var>.
     <lv_var> 
8.
   
WRITE/ new_val.
***End how to declare field symbol

B. Field symbol as a replacement of Work area in sap abap:
DATA:IT_SPFLI TYPE STANDARD TABLE OF SPFLI.
FIELD-SYMBOLS:<FS_SPFLI> TYPE SPFLI.
START-OF-SELECTION.
SELECT *
  
FROM SPFLI
  
INTO TABLE IT_SPFLI
  
UP TO 10 ROWS.
END-OF-SELECTION.
****Loop declare
  
LOOP AT IT_SPFLI ASSIGNING <FS_SPFLI>.
     <FS_SPFLI>
-COUNTRYFR 'COUNTRYFR'.
  
ENDLOOP.
****End field symbol as a replacement of Work area:
***************************************************
*                      3                          *
***************************************************
C. Appending to internal table in sap abap:
DATA:IT_SPFLI1 TYPE STANDARD TABLE OF SPFLI.
FIELD-SYMBOLS:<FS_SPFLI1> TYPE SPFLI.
APPEND INITIAL LINE TO IT_SPFLI1 ASSIGNING <FS_SPFLI1>.
  
IF <FS_SPFLI1> is ASSIGNED.
    <Fs_spfLi1>
-COUNTRYFR 'TEST'.
    <Fs_spfli1>
-CITYFROM 'TEST'.
    UNASSIGN <FS_SPFLI1>
.
  
ENDIF.

APPEND INITIAL LINE TO IT_SPFLI1 ASSIGNING <FS_SPFLI1>.
  
IF <FS_SPFLI1> is ASSIGNED.
    <Fs_spfLi1>
-COUNTRYFR 'TEST1'.
    <Fs_spfli1>
-CITYFROM 'TEST1'.
    UNASSIGN <FS_SPFLI1>
.
ENDIF.
*******************End appending to internal table:
**************************************************
*                      5                          *
***************************************************

D. Reading internal table using generic field symbol in sap abap:

FIELD-SYMBOLS<fs_tab> TYPE SPFLI.
FIELD-SYMBOLS<fs_str> TYPE SPFLI.
DATAlt_ SPFLI TYPE STANDARD TABLE OF SPFLI.

ASSIGN lt_SPFLI TO <fs_tab>.
SELECT FROM SPFLI INTO TABLE lt_SPFLI UP TO 10 ROWS.

READ TABLE <fs_tab> ASSIGNING <fs_str> WITH KEY ('CARRID') = 'TESTDATA'.

**************************************************
*                      6                          *
***************************************************
E. Simple Object In fields symbols
*REPORT ZSW_FIELD_SYMBOLS.
***Type declare
TYPES:BEGIN OF TY_SPFLI,
        CARRID 
TYPE  S_CARR_ID,
        CONNID 
TYPE  S_CONN_ID,
  
END OF TY_SPFLI.
**Internal Table Declare.
  
DATA:it_SPFLI_1 TYPE STANDARD TABLE OF TY_SPFLI.

  
DATAgd_index TYPE string,
        gd_rfp0 
TYPE string.
**field Symbol  Declare
  
FIELD-SYMBOLS :<fs_SPFLI_1> TYPE TY_SPFLI.
** Start selection screen
  
START-OF-SELECTION.
**** Select query for fetch data
  
SELECT CARRID
         CONNID
    
FROM SPFLI
    
INTO TABLE it_SPFLI_1
    
UP TO 50 ROWS.
  
END-OF-SELECTION.
**  End selection screen
*** Loop With field Symbol
  
LOOP AT it_SPFLI1 ASSIGNING <fs_SPFLI>.
    
IF <fs_SPFLI_1> is ASSIGNED.
       
WRITE<fs_SPFLI_1>-CARRID,<fs_SPFLI_1>-CONNID.
    
ENDIF.
  
ENDLOOP.
********--------------------------------------

Wednesday, December 26, 2018

Upload program in z-table in SAP ABAP.


Upload program in ztable.
This is Table

FILE FORMAT IN (xlsx).
ID
NAME
EMPDES
EMPPHONE
53
Alex
9874563215
54
Ponting
8745632103

*&---------------------------------------------------------------------*
*& Report  ZSW_UPLOAD_TABLE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZSW_UPLOAD_TABLE.

TYPE-POOLS truxs.
TABLES ZEMP03.
PARAMETER p_file TYPE rlgrap-filename DEFAULT 'C:\Users\swadesh\Desktop\Book1_1.xlsx'.

TYPES:BEGIN OF t_tab,
         EMPID 
TYPE ZEMP03-EMPID,
         EMPNAME 
TYPE ZEMP03-EMPNAME,
         EMPDES 
TYPE ZEMP03-EMPDES,
         EMPPHONE 
TYPE ZEMP03-EMPPHONE,
      
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.
  
else.
    
MESSAGE 'Dada Upload sucessfull' TYPE 'I'.
  
endif.

END-OF-SELECTION.

*  Uploading the data into the database table

  
LOOP AT T_UPLOAD INTO WA_UPLOAD.
    ZEMP03
-EMPID    WA_UPLOAD-EMPID.
    ZEMP03
-EMPNAME  WA_UPLOAD-EMPNAME.
    ZEMP03
-EMPDES   WA_UPLOAD-EMPDES.
    ZEMP03
-EMPPHONE WA_UPLOAD-EMPPHONE.
    
MODIFY ZEMP03.
  
ENDLOOP.



After Updating Result.