Quantcast
Channel: SCN: Message List - SAP ERP Financials - Treasury Applications
Viewing all articles
Browse latest Browse all 5623

Re: NPV Upload through Flat File for T. Code : JBNPV

$
0
0

Hello Anil.

 

Sometimes i use this program to upload data into tabel.

 

Use table VTVBAR

 

*&---------------------------------------------------------------------*
*& Report  Z_EXP_IMP_TABLE
*&
*&---------------------------------------------------------------------*
REPORT z_exp_imp_table MESSAGE-ID z171.
DATA:       vr  TYPE REF TO data,            vrl TYPE REF TO data.
PARAMETERS: d_export RADIOBUTTON GROUP r1,            d_import RADIOBUTTON GROUP r1.
PARAMETERS: tabnam(16) MATCHCODE OBJECT dd_dbtb_16.
PARAMETERS: filename   LIKE rlgrap-filename DEFAULT 'C:\TABLE.TXT',            filtyp(10) DEFAULT 'DAT' OBLIGATORY,            usl(60),            delz       AS CHECKBOX.
DATA: filen TYPE string.
FIELD-SYMBOLS: <wa>, <p> TYPE STANDARD TABLE.
TABLES: dd02l.
START-OF-SELECTION.  AUTHORITY-CHECK     OBJECT    'S_TABU_DIS'                        ID        'DICBERCLS'   FIELD 'XXXX'                        ID        'ACTVT'       FIELD '02'.  IF sy-subrc <> 0.    LEAVE PROGRAM.  ENDIF.  CLEAR dd02l.  SELECT SINGLE * FROM dd02l WHERE tabname = tabnam.  filen = filename.  IF  NOT dd02l-tabname IS INITIAL.    CREATE DATA vr TYPE STANDARD TABLE OF (tabnam).    ASSIGN vr->* TO <p>.    IF d_export = 'X'.      PERFORM export.    ELSE.      PERFORM import.    ENDIF.  ELSE.    WRITE:/ 'Wrong table name'.  ENDIF.
*&--------------------------------------------------------------------*
*&      Form  EXPORT
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM export.  CLEAR <p>. REFRESH <p>.  SELECT * FROM (tabnam) APPENDING TABLE <p>      WHERE (usl).  CALL FUNCTION 'GUI_DOWNLOAD'    EXPORTING      filename = filen      filetype = filtyp      codepage = '1504'    TABLES      data_tab = <p>    EXCEPTIONS      OTHERS   = 1.  IF sy-subrc = 0.    WRITE:/ 'Upload success into table ',filename.  ELSE.    WRITE:/ 'Upload error'.  ENDIF.
ENDFORM.                    "EXPORT
*&--------------------------------------------------------------------*
*&      Form  IMPORT
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM import.  CLEAR <p>. REFRESH <p>.  CALL FUNCTION 'WS_UPLOAD'    EXPORTING      filename = filename      filetype = 'DAT'    TABLES      data_tab = <p>    EXCEPTIONS      OTHERS   = 1.  IF sy-subrc = 0.    IF delz = 'X'.      DELETE FROM (tabnam).    ENDIF.    LOOP AT <p> ASSIGNING <wa>.      INSERT (tabnam) FROM <wa>.    ENDLOOP.    COMMIT WORK AND WAIT.    WRITE:/ 'Upload success from local file'.  ELSE.    WRITE:/ 'Upload error'.  ENDIF.
ENDFORM.                    "IMPORT

scr.jpg

 

You have possiblity to export data into file, change data you need, then upload data with full reset of table data.


Viewing all articles
Browse latest Browse all 5623

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>