2009 May 18 4:06 PM
Hi
I am using this code to submit report
submit ZM005REP
WITH S_BLEND IN R2
WITH S_GROUP IN R3
WITH S_WERKS IN r1
exporting list to memory and return.
I am using LIST_FROM_MEMORY to read the list.
I want to further use the values from this list for calculations , but when I saw the list its just an array of strings.
I want to read the opening bal field which is returned in this list.
Any advice on this ?
Thanks,
Shital
Hi
I am using this code to submit report
submit ZM005REP
WITH S_BLEND IN R2
WITH S_GROUP IN R3
WITH S_WERKS IN r1
exporting list to memory and return.
I am using LIST_FROM_MEMORY to read the list.
I want to further use the values from this list for calculations , but when I saw the list its just an array of strings.
I want to read the opening bal field which is returned in this list.
Any advice on this ?
Thanks,
Shital
2009 May 18 5:10 PM
Hi Shital,
You can make use of the Statement 'SEARCH FOR'.for more information see the syntax by checking F1.for performance issues,see the index where your string is starting and then use the above statement.
I hope this will solve your issue..
Cheers,
KK.
2009 May 18 5:24 PM
Hi,
After submit program, use following 2 FM's to get the output in internal table.
DATA: listobject LIKE abaplist OCCURS 5000 WITH HEADER LINE.
DATA: BEGIN OF listasci OCCURS 5000,
default(256) TYPE c,
END OF listasci.
* get the output from the submit
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
* convert it to text
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = listasci
listobject = listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
LOOP AT listasci.
"append listasci-default+position(offset) to another internal table
"listasci-default+position(offset) should be the position where desired field starts
ENDLOOP.
Cheers,
Vikram
2009 May 18 5:30 PM
Hi,
DATA BEGIN OF itab_list OCCURS 0.
INCLUDE STRUCTURE abaplist.
DATA END OF itab_list.
DATA: BEGIN OF vlist OCCURS 0,
filler1(01) TYPE c,
field1(06) TYPE c,
filler(08) TYPE c,
field2(10) TYPE c,
filler3(01) TYPE c,
field3(10) TYPE c,
filler4(01) TYPE c,
field4(3) TYPE c,
filler5(02) TYPE c,
field5(15) TYPE c,
filler6(02) TYPE c,
field6(30) TYPE c,
filler7(43) TYPE c,
field7(10) TYPE c,
END OF vlist.
SUBMIT zreport EXPORTING LIST TO MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = itab_list
EXCEPTIONS
not_found = 4
OTHERS = 8.
CALL FUNCTION 'LIST_TO_ASCI'
EXPORTING
list_index = -1
TABLES
listasci = vlist
listobject = itab_list
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
Then you can use the ITAB_LIST for caliculation which is having all the values.
Thanks
Sudheer
2009 May 18 7:35 PM
2009 May 18 9:02 PM
After the "LIST_FROM_MEMORY"
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = data_into_ascii
listobject = raw_data_from_list_from_memory
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.now, split the data into relevant fields.
2009 May 19 7:08 AM
Hi, try like this
sample code
TYPES: BEGIN OF ty_ascii,
text(256) TYPE c,
END OF ty_ascii.
data : it_listobj LIKE abaplist OCCURS 1 WITH HEADER LINE,
it_ascii TYPE STANDARD TABLE OF ty_ascii WITH HEADER LINE,
submit ZM005REP
WITH S_BLEND IN R2
WITH S_GROUP IN R3
WITH S_WERKS IN r1
EXPORTING LIST TO MEMORY AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = it_listobj.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = it_ascii
listobject = it_listobj.
LOOP AT it_ascii.
SEARCH it_ascii-text FOR '-----'.
IF sy-subrc EQ 0.
DELETE it_ascii. CLEAR it_ascii.
ENDIF.
ENDLOOP.
g_count = 0.
LOOP AT it_ascii.
IF g_count > 0.
wa_itab-werks = it_ascii-text+1(4).
**------Opening Bal.---------*
CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
EXPORTING
string = it_ascii-text+129(23)
decimal_separator = '.'
thousands_separator = ','
waers = ' '
IMPORTING
betrg = wa_itab-opn_bal.
APPEND wa_itab TO it_itab. CLEAR it_ascii.
ENDIF.
g_count = g_count + 1.
ENDLOOP.
2009 May 19 10:14 AM
example:-
SUBMIT rm07docs VIA SELECTION-SCREEN AND RETURN exporting list to memory.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_list
EXCEPTIONS
not_found = 1.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = o_list "
listobject = t_list
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
data : wa_olist like o_list .
data : t_olist type ty_list,
lt_olist type table of ty_list.
loop at o_list into wa_olist.
t_olist-MATNR = wa_olist+1(18).
Append t_olist to lt_olist.
endloop.
2009 May 19 10:17 AM
Hi,
After submitting the report, call these FM's
'LIST_FROM_MEMORY'
'LIST_TO_ASCI'
Regards,
Jyothi CH.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |