Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8734

Re: how to create pr using bapi through file upload.

$
0
0

hi nishant,

 

                       i get the value in string table. after that wat to do. i ll paste my code plz suggest how to do this.

 

ypes: begin of itab,
       reg_no(10) TYPE c,
         name(20) TYPE c,

       end of itab.
data: wa type itab.


*DATA: LV_DATA1 TYPE string.
DATA: GV_FILE TYPE RLGRAP-filename.

*DATA:LV_STRING TYPE TABLE OF st.
data:lv_data type itab.
PARAMETERS:P_FILE TYPE SAPB-sappfad.

* parameters: d_FILE  type sapb-sappfad DEFAULT '.demo.csv'.
*PARAMETERS: z_FILE type  SAPB-SAPPFAD OBLIGATORY..

    data:g_file type   ibipparms-path.

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           = g_file
             .
   P_FILE = G_FILE.
   START-OF-SELECTION.
*  CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
*    EXPORTING
*      path             = p_file
*     TARGETPATH       = 'T_FILE'
*   EXCEPTIONS
*     ERROR_FILE       = 1
*     OTHERS           = 2
*            .
*  IF sy-subrc <> 0.
**    TRANSFER P1_FILE TO P_FILE.
** Implement suitable error handling here
*    MESSAGE 'UPLOAD SUCCESS' TYPE 'I'.
   CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'
     EXPORTING
       path             = P_FILE
      TARGETPATH       = '.\SAAAM.CSV'
    EXCEPTIONS
      ERROR_FILE       = 1
      OTHERS           = 2
             .
   IF sy-subrc <> 0.

* Implement suitable error handling here

   ENDIF.

GV_FILE = 'SAAAM.CSV'.
IF GV_FILE IS NOT INITIAL.


   open dataset GV_FILE for input in text mode ENCODING DEFAULT.
   if sy-subrc = 0.
     do.
*      read dataset d1 into wa.
*
       if sy-subrc <> 0.
         exit.
       endif.
*      split wa at ',' into itab-reg_no itab-name itab-addr.
*      append itab.
       read DATASET GV_FILE into wa.
       write:/ wa-name , ',', wa-reg_no.
     enddo.
   endif.
   close dataset GV_FILE.
   endif.

          

in above the value is coming to the it or in wa table. thats fine . after this wat i want to do.

 

 

Regards,

Gopi


Viewing all articles
Browse latest Browse all 8734

Trending Articles



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