Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Upload one file with static header and multiple line items into table

Former Member
0 Kudos

how to Upload one file with static header and multiple line items into internal table ABAP .

could anybody plesae guide me .

Later i need to use the file data for processing

this is the file structure

HIBKPFADP FINSYST000ZBATCHIASNQW00042010210520102105201021052010SAADPI

I00000000001000006005700004 20100522 SA 05 2010 Z0011MUTYI056789 item-nomaterialCXPUDITR 000000013150000009012367000000123456789thu

D00000000001USD 999999999.99

Thanks

Trina

2 REPLIES 2

Former Member
0 Kudos

Hello Trina,

I´m here again!

So, the first part of load the file into table i_text is ok?

The second part is to process the file (now in memory / i_text 😞

First question: All records of "type" I are placed in two lines ?

DATA: BEGIN OF I_TEXT OCCURS 0,
        line(1000)   type c,
      END OF I_TEXT.
 
DATA: BEGIN OF I_TAB_H OCCURS 0,
        recind(1)   type c,
        space01(1)  type c,
        objtype(5)  type c,
         ...
      END OF I_TAB_H.
 
DATA: BEGIN OF I_TAB_I OCCURS 0,
        recind(1)   type c,
        space01(1)  type c,
        objtype(5)  type c,
         ...
      END OF I_TAB_I.
 
DATA: BEGIN OF I_TAB_D OCCURS 0,
        recind(1)   type c,
        space01(1)  type c,
        objtype(3)  type c,
         ...
      END OF I_TAB_D.
 
DATA: W_IDX TYPE I.

DATA: W_LINE(1000) TYPE C.

call function 'GUI_UPLOAD'
     exporting
        filename = p_file
        filetype = 'ASC'
     tables
        data_tab = i_text.

W_IDX = 0.
 
LOOP AT i_text.

  IF W_IDX > 0.
      W_IDX = 0.
     CONTINUE.
  ENDIF.

  IF I_TEXT(1) = 'H'.
     I_TAB_H = I_TEXT.
     APPEND I_TAB_H.
  ELSE IF I_TEXT(1) = 'I'.

     W_IDX = SY-TABIX + 1.
     READ TABLE I_TEXT INTO W_LINE INDEX W_IDX.

    I_TEXT+89(500) = W_LINE(500).

* adjust the positions if necessary !!!

     I_TAB_I = I_TEXT.
     APPEND I_TAB_I.

  ELSE IF I_TEXT(1) = 'D'.
     I_TAB_D = I_TEXT.
     APPEND I_TAB_D.
  ENDIF.
END.

Best regards,

Leandro Mengue

Former Member
0 Kudos

Moderator message - duplicate post locked I also notice that you have eight open questions. In fact you haven't assigned any points to any of them. A "thank you" is pretty rare too. Rob

Edited by: Rob Burbank on May 22, 2010 6:14 PM