03-10-2010 7:47 AM
Hi
I'm trying to do some coding on extraction of data from SAP ERP to BO BODI. I
I have a code that runs the abap program H99CWTR0 with a certain variant.
SUBMIT H99CWTR0
USING SELECTION-SET 'ANS-TIMER'
EXPORTING LIST TO MEMORY
AND RETURN.
this code runs the program exactly the way I want.
Then I call the functions:
List_from_memory and Write_List
When i debugg the function Write_List I can see all the fields in different tables that i need to map into my i_data table. But how do i get the tables in the write_list function available into my abap code? So i can do the mapping...?
Any help would be fantastic
På
03-10-2010 8:54 AM
Hi,
try like this:
DATA : BEGIN OF t_list OCCURS 0.
INCLUDE STRUCTURE abaplist.
DATA : END OF t_list.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_list
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'WRITE_LIST'
TABLES
listobject = t_list
EXCEPTIONS
empty_list = 1
OTHERS = 2.
Regards,
zashok
03-10-2010 9:14 AM
Thanks, I have tried this.
The function returns with this info:
Line RFCSIZE[I(4)] RFCRECORD[1000]
1 1- 000000000000000000000000000000000000000000000000000000000000000000000000........
2 1000 FF0602010202800034313033000000007D690000121F9D02BB7D73EB8D9B88E2F8B1D7D......
3 556 0ACDF0F5DC5AF2117C88F5BFC7D7C9D69D00734579E96F3FC3B1464B8C92E0E80047F9......
When debugging into Write_list i get all the tables i want.... but i need to map them in my abap code after the function has retured
The mapping should be done at the buttom of the code under, before "List_Free_memory" but after the function "write_list"....
This is my code:
&----
*& Report Z_RV_CLUST
*&
&----
*&
*&
&----
REPORT Z_RV_CLUST.
DATA LIST_TAB TYPE TABLE OF ABAPLIST.
SUBMIT H99CWTR0
USING SELECTION-SET 'ANS-TIMER'
EXPORTING LIST TO MEMORY
AND RETURN.
&----
*& Form GET_MEMORY_DATA
&----
text
----
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = LIST_TAB
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
CALL FUNCTION 'WRITE_LIST'
EXPORTING
WRITE_ONLY = 'X'
TABLES
LISTOBJECT = LIST_TAB
EXCEPTIONS
EMPTY_LIST = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
LISTOBJECT = LIST_TAB
.
ENDIF.
03-10-2010 12:04 PM
Hi,
insted of CALL FUNCTION 'WRITE_LIST' use CALL FUNCTION 'LIST_TO_ASCI'.
find below modified coding.
&----
*& Report Z_RV_CLUST
*&
&----
*&
*&
&----
REPORT Z_RV_CLUST.
DATA LIST_TAB TYPE TABLE OF ABAPLIST.
DATA: BEGIN OF ascilist OCCURS 100,
line LIKE bapitrform-line,
END OF ascilist.
SUBMIT H99CWTR0
USING SELECTION-SET 'ANS-TIMER'
EXPORTING LIST TO MEMORY
AND RETURN.
&----
*& Form GET_MEMORY_DATA
&----
text
-
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = LIST_TAB
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = ascilist
listobject = list_tab
EXCEPTIONS
empty_list = 1
list_index_invalid = 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.
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
LISTOBJECT = LIST_TAB.
ENDIF.
03-11-2010 8:25 AM
hmmm....
What i'm trying to do is to get some values which are located in the RV cluster.
The programm H99CWTR0 populates these values when running with a certain variant.
First i tried to do the coding as the example below only replacing ZL[] with RV[]
The problem in this code, there is no RV cluster
And i don't know where or which function tu use to get the correct values from the RV cluster. Maybe you do?
Then i tried to run the program in backround and map the fields from memory, like the code in the previous steps.
However the suggestions you have given med does not give me the table that pops up when running the program.
When i run the code using the Write List function the table that pops up at the end in GUI is this one.
FiKo Firmanavn PO Personalområdetekst Avr.gruppe FP Tekst lønnsavr.grp. PerPa Bet. periodeparam. For-per. Bet.dato AvrKat. FP Avr.-ID FP Land Lønnart Langtekst for lønnart Antall Beløp
NO14 G4S Aviation Security AS GARD Avdeling Gardemoen (HK) 3V Lønn 10. 31 Lønn 10. 200809 10.09.2008 20 0010 Ansienitetstimer Vakt 651,00 0,00
Shouldn't I be able to get the same list in the code so I can do the mapping?
Here is the prievious example i tried to use to get the fields....
*----
-
Custom ABAP logic block to extract data from
the ZL cluster in the PCL2 table.
*
Copyright 2000 Acta Technology Inc.
*----
-
FORM .
*----
-
Logic block to extract data from SAP.
*----
-
TABLES: PCL2.
DATA: TIM_B2 type HRF_TIM_B2.
*----
-
Key to CD Manager in PCL2
*----
-
DATA BEGIN OF CD-KEY.
INCLUDE STRUCTURE PURLK. "KEY TO PERSONAL CALENDAR
DATA END OF CD-KEY.
DATA: time_results TYPE standard table of ptm_time_results,
time_results_wa like line of time_results.
DATA: zes LIKE pc2b6 OCCURS 0 WITH HEADER LINE,
saldo LIKE pc2b5 OCCURS 0 WITH HEADER LINE,
zl LIKE pc2bf OCCURS 0 WITH HEADER LINE.
*----
-
SELECT keys from PCL2 and feed them to macro
*----
-
SELECT * FROM PCL2 WHERE RELID = 'CU'
AND SRTF2 = 0
AND AEDTM >= $PARAM1
AND AEDTM <= $PARAM2.
CD-KEY = PCL2-SRTFD.
*-----Import der Tabellen ZES, SALDO und ZL aus Cluster B2
CALL FUNCTION 'HR_TIME_RESULTS_IN_INTERVAL'
EXPORTING
int_pernr = cd-key-pernr
int_begda = $PARAM1
int_endda = $PARAM2
TABLES
int_time_results = time_results
EXCEPTIONS
wrong_cluster_version = 1
no_read_authority = 2
cluster_archived = 3
technical_error = 4
OTHERS = 5.
IF Sy-subrc = 0.
clear: zl[], saldo[], zes[].
clear: zl, saldo, zes.
loop at time_results into time_results_wa.
append lines of time_results_wa-zl to zl.
endloop.
ENDIF.
*-----Füllen der internen Datentabellen
CHECK
not zl[] is initial.
*----
-
Move data to output table <<<OTAB1>>> for
ActaWorks
*----
-
if sy-subrc = 0.
CLUSTER ZL
-AEDTM = PCL2-AEDTM.
LOOP AT ZL.
do the mapping
endloop
ENDIF.
03-11-2010 11:29 AM
Hi,
could you pls. elaborate your overall requirement with T-codes & test data.
Request you to change the subject line with suitable requirement.
Regards,
Ashok