Skip to Content
0
Former Member
Mar 30, 2006 at 11:45 AM

kindly help (buisness object types)

19 Views

hi all,

I would be extremely gratefull for your help.

This program uploads data from excel into internal table IT_RECORD.Now i want to post this data in transaction

f-02 using LSMW & bapi.please tell me the buisness object type & how would it be achieved .

thanking in advance.

data: itab like alsmex_tabline occurs 0 with header line.

Types: begin of t_record ,

order LIKE ITAB-VALUE,

EMPLOYEE like itab-value,

costcenter like itab-value,

END OF T_RECORD.

DATA: IT_RECORD TYPE STANDARD TABLE OF T_RECORD INITIAL SIZE 0,

WA_RECORD TYPE T_RECORD.

DATA: GD_CURRENTROW TYPE I.

PARAMETER P_INFILE LIKE RLGRAP-FILENAME.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = P_INFILE

i_begin_col = '1'

i_begin_row = '2'

i_end_col = '14'

i_end_row = '31'

tables

intern = ITAB

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

SORT ITAB BY ROW COL.

READ TABLE ITAB INDEX 1.

GD_CURRENTROW = ITAB-ROW.

LOOP AT ITAB .

IF ITAB-ROW NE GD_CURRENTROW.

APPEND WA_RECORD TO IT_RECORD.

CLEAR WA_RECORD.

GD_CURRENTROW = ITAB-ROW.

ENDIF.

case itab-col.

WHEN '0001'.

WA_RECORD-ORDER = ITAB-VALUE.

WHEN '0002'.

WA_RECORD-EMPLOYEE = ITAB-VALUE.

WHEN '0003'.

WA_RECORD-COSTCENTER = ITAB-VALUE.

ENDCASE.

ENDLOOP.

APPEND WA_RECORD TO IT_RECORD.

LOOP AT IT_RECORD INTO WA_RECORD.

WRITE:/(10) WA_RECORD-ORDER, SY-VLINE,

(10) WA_RECORD-EMPLOYEE, SY-VLINE,

(10) WA_RECORD-COSTCENTER , SY-VLINE.

ENDLOOP.