21.03.2013 Views

Object Oriented ABAP

Object Oriented ABAP

Object Oriented ABAP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DATA: locint_fields TYPE TABLE OF rfc_fields.<br />

* Create a range to insert data<br />

PERFORM f_create_range USING 9 "Begin on 9th row<br />

3 "Begin on 3rd col<br />

wf_entries "No of rows reqd<br />

3 "No of cols reqd<br />

'AGENTS'. "Range name<br />

*-> Set Frame to the range<br />

*# Calculation of TYP parameter<br />

* The parameter has 8 bits<br />

*0 Sets the left margin<br />

*1 Sets the top margin<br />

*2 Sets the bottom margin<br />

*3 Sets the right margin<br />

*4 Horizontal line<br />

*5 Sets the left margin<br />

*6 Thickness<br />

*7 Thickness<br />

* My figure will be 7 6 5 4 3 2 1 0<br />

* 1 0 1 1 1 1 1 1<br />

* Binary 1011 1111 stands for 191 in decimal<br />

* Check SAP help for more info.....<br />

* http://help.sap.com/saphelp_NW04s/helpdata/en/<br />

" 21/b531bfe1ba11d2bdbe080009b4534c/frameset.htm<br />

CALL METHOD r_excel->set_frame<br />

EXPORTING<br />

rangename = 'AGENTS'<br />

typ = 191<br />

color = 21<br />

IMPORTING<br />

error = r_error<br />

retcode = wf_retcode.<br />

IF r_error->has_failed = abap_true.<br />

CALL METHOD r_error->raise_message<br />

EXPORTING<br />

type = 'E'.<br />

ENDIF.<br />

* Get field attributes of the table to be displayed<br />

CALL FUNCTION 'DP_GET_FIELDS_FROM_TABLE'<br />

TABLES<br />

data = int_agents<br />

fields = locint_fields<br />

EXCEPTIONS<br />

dp_invalid_table = 1<br />

OTHERS = 2.<br />

IF sy-subrc 0.<br />

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno<br />

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.<br />

ENDIF.<br />

* Insert the table entries into Excel<br />

CALL METHOD r_excel->insert_one_table

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!