Application Development and Automation 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: 
Read only

Datasource enhancement

Former Member
0 Likes
955

Hi

I added the field ZZPRCTR to the extract structure and want to fill it with code. But when I go inot RSA3, I get the runtime error UC_OBJECTS_NOT_CONVERTIBLE. The error seems to be around the loop of C_T_DATA.

&----


*& Include ZXRSAU01

&----


data: l_s_bsid like BSID,

lv_prctr type PRCTR.

CASE i_datasource.

WHEN '0FI_AR_4'.

LOOP AT C_T_DATA INTO l_s_bsid.

SELECT PRCTR FROM BSID UP TO 1 ROWS

INTO lv_prctr.

MODIFY C_T_DATA FROM l_s_bsid.

ENDSELECT.

ENDLOOP.

ENDCASE.

What have I done wrong or do you have an alternative code I can use

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
765

0FI_AR_4 is transactional data so exit ZXRSAU01, the structure of CT_DATA is not BSIS but the structure associated to the DataSource , look at RSA6, here it is DTFIAR_3 (the same as DataSource 0FI_AR_3)

Did you extend the DataSource via RSA6, if not, you should have do it so.

Note 1 : CI_BSID is already in structure and all fields are already filled (MOVE-CORRESPONDING from BSID, BSAD and BSEG are performed in standard extractor)

Note 2 : Don't use any SELECT SINGLE in an extension of DataSource , put CT_DATA parameter in an internal table defined in a form, and use SELECT FOR ALL ENTRIES into a sorted internal table then LOOP at internal table and update using READ TABLE. (Else severe performance problems will arise in production system.)

Sample :

In source ZXRSAU01

CASE i_datasource.

WHEN '0FI_AR_3' OR '0FI_AR_4'.

PERFORM 0fi_ar_3 TABLES c_t_data.

WHEN '0FI_GL_4'.

PERFORM 0fi_gl_4 TABLES c_t_data.

ENDCASE.

In an include ZXRSAF01 or at the end of ZXRSAU01

FORM 0fi_ar_3 TABLES work.

DATA: bsid LIKE bsid, " Clients postes individuels

bsad LIKE bsad, " Clients postes individuels (rapprochés)

dtfiar_3 LIKE dtfiar_3. " Transfert de données : postes client

DATA: t_work LIKE dtfiar_3 OCCURS 0,

t_bsid LIKE bsid OCCURS 0,

t_bsad LIKE bsad OCCURS 0.

DATA w_gjahr LIKE bsid-gjahr. " Année

REFRESH t_work.

INSERT LINES OF work INTO TABLE t_work.

IF t_work[] IS INITIAL. EXIT. ENDIF.

REFRESH t_bsid.

SELECT * INTO TABLE t_bsid

FROM bsid

FOR ALL ENTRIES IN t_work

WHERE kunnr = t_work-kunnr

AND bukrs = t_work-bukrs

AND belnr = t_work-belnr

AND buzei = t_work-buzei.

SORT t_bsid BY kunnr bukrs gjahr belnr buzei.

REFRESH t_bsad.

SELECT * INTO TABLE t_bsad

FROM bsad

FOR ALL ENTRIES IN t_work

WHERE kunnr = t_work-kunnr

AND bukrs = t_work-bukrs

AND belnr = t_work-belnr

AND buzei = t_work-buzei.

SORT t_bsad BY kunnr bukrs gjahr belnr buzei.

LOOP AT t_work INTO dtfiar_3.

w_gjahr = dtfiar_3-fiscper(4).

IF dtfiar_3-augdt IS INITIAL.

READ TABLE t_bsid INTO bsid

WITH KEY kunnr = dtfiar_3-kunnr

bukrs = dtfiar_3-bukrs

gjahr = w_gjahr

belnr = dtfiar_3-belnr

buzei = dtfiar_3-buzei

BINARY SEARCH.

IF sy-subrc = 0.

dtfiar_3-zzgsber = bsid-gsber.

dtfiar_3-zzuonr = bsid-zuonr..

dtfiar_3-zzxzahl = bsid-xzahl.

ENDIF.

ELSE.

READ TABLE t_bsad INTO bsad

WITH KEY kunnr = dtfiar_3-kunnr

bukrs = dtfiar_3-bukrs

gjahr = w_gjahr

belnr = dtfiar_3-belnr

buzei = dtfiar_3-buzei

BINARY SEARCH.

IF sy-subrc = 0.

dtfiar_3-zzgsber = bsad-gsber.

dtfiar_3-zzuonr = bsad-zuonr..

dtfiar_3-zzxzahl = bsad-xzahl.

ENDIF.

ENDIF.

MODIFY t_work FROM dtfiar_3.

ENDLOOP.

REFRESH work.

INSERT LINES OF t_work INTO TABLE work.

ENDFORM.

Regards

5 REPLIES 5
Read only

Former Member
0 Likes
764

Hi jimi,

Use field-symbols.

for eg

field-symbols: <fs_ar> type DTFIAR_3.

WHEN '0FI_AR_4'.

LOOP AT C_T_DATA assgning <fs_ar>.

SELECT single PRCTR FROM BSID

INTO <FS_ar>-zzprctr

where ......

endloop.

endcase..

regards,

Santosh Thorat

ENDLOOP.

Read only

0 Likes
764

Points assigned but can you help further? I would appreciate if you could provide the whole code i should use as I am quite new to ABAP.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
766

0FI_AR_4 is transactional data so exit ZXRSAU01, the structure of CT_DATA is not BSIS but the structure associated to the DataSource , look at RSA6, here it is DTFIAR_3 (the same as DataSource 0FI_AR_3)

Did you extend the DataSource via RSA6, if not, you should have do it so.

Note 1 : CI_BSID is already in structure and all fields are already filled (MOVE-CORRESPONDING from BSID, BSAD and BSEG are performed in standard extractor)

Note 2 : Don't use any SELECT SINGLE in an extension of DataSource , put CT_DATA parameter in an internal table defined in a form, and use SELECT FOR ALL ENTRIES into a sorted internal table then LOOP at internal table and update using READ TABLE. (Else severe performance problems will arise in production system.)

Sample :

In source ZXRSAU01

CASE i_datasource.

WHEN '0FI_AR_3' OR '0FI_AR_4'.

PERFORM 0fi_ar_3 TABLES c_t_data.

WHEN '0FI_GL_4'.

PERFORM 0fi_gl_4 TABLES c_t_data.

ENDCASE.

In an include ZXRSAF01 or at the end of ZXRSAU01

FORM 0fi_ar_3 TABLES work.

DATA: bsid LIKE bsid, " Clients postes individuels

bsad LIKE bsad, " Clients postes individuels (rapprochés)

dtfiar_3 LIKE dtfiar_3. " Transfert de données : postes client

DATA: t_work LIKE dtfiar_3 OCCURS 0,

t_bsid LIKE bsid OCCURS 0,

t_bsad LIKE bsad OCCURS 0.

DATA w_gjahr LIKE bsid-gjahr. " Année

REFRESH t_work.

INSERT LINES OF work INTO TABLE t_work.

IF t_work[] IS INITIAL. EXIT. ENDIF.

REFRESH t_bsid.

SELECT * INTO TABLE t_bsid

FROM bsid

FOR ALL ENTRIES IN t_work

WHERE kunnr = t_work-kunnr

AND bukrs = t_work-bukrs

AND belnr = t_work-belnr

AND buzei = t_work-buzei.

SORT t_bsid BY kunnr bukrs gjahr belnr buzei.

REFRESH t_bsad.

SELECT * INTO TABLE t_bsad

FROM bsad

FOR ALL ENTRIES IN t_work

WHERE kunnr = t_work-kunnr

AND bukrs = t_work-bukrs

AND belnr = t_work-belnr

AND buzei = t_work-buzei.

SORT t_bsad BY kunnr bukrs gjahr belnr buzei.

LOOP AT t_work INTO dtfiar_3.

w_gjahr = dtfiar_3-fiscper(4).

IF dtfiar_3-augdt IS INITIAL.

READ TABLE t_bsid INTO bsid

WITH KEY kunnr = dtfiar_3-kunnr

bukrs = dtfiar_3-bukrs

gjahr = w_gjahr

belnr = dtfiar_3-belnr

buzei = dtfiar_3-buzei

BINARY SEARCH.

IF sy-subrc = 0.

dtfiar_3-zzgsber = bsid-gsber.

dtfiar_3-zzuonr = bsid-zuonr..

dtfiar_3-zzxzahl = bsid-xzahl.

ENDIF.

ELSE.

READ TABLE t_bsad INTO bsad

WITH KEY kunnr = dtfiar_3-kunnr

bukrs = dtfiar_3-bukrs

gjahr = w_gjahr

belnr = dtfiar_3-belnr

buzei = dtfiar_3-buzei

BINARY SEARCH.

IF sy-subrc = 0.

dtfiar_3-zzgsber = bsad-gsber.

dtfiar_3-zzuonr = bsad-zuonr..

dtfiar_3-zzxzahl = bsad-xzahl.

ENDIF.

ENDIF.

MODIFY t_work FROM dtfiar_3.

ENDLOOP.

REFRESH work.

INSERT LINES OF t_work INTO TABLE work.

ENDFORM.

Regards

Read only

0 Likes
764

Also thanks Raymond. let me explain what I am trying to achieve.

I want to add BSID-PRCTR to the 0FI_AR_4 datasource. I added component ZZPRCTR with component type PRCTR to the extract structure CI_BSID. When I run transaction RSA3, the field ZZPRCTR was blank.

I've also read about the MOVE-CORRESPONDING within logistics.

I then tried to add PRCTR (not ZZPRCTR) to CI_BSID and this gave me errors.

I am thus confused. Woud you advise me to add PRCTR directly in the structure DTFIAR_3 in SE11?

Please assist as this is quite urgent

Read only

0 Likes
764

Don't change DTFIAR_3 directly.

Call RSA6, select 0FI_AR_4 (or _3) and click on menu pushbutton "Enhance Extract Structure" it will create an append to the structure, activate it.

Then reselect DataSource and click on change icon, new fields are deactivated by default, activate them and save. (Else implicit move-corresponding doesn't work)

Then if you don't have already do it, create a project via transaction CMOD and assign Enhancement RSAP0001 "BW Data Extraction: Customer Function Calls"

Then copy the source i provided to you in the include ZXRSAU01 of EXIT_SAPLRSAP_001 and adjust it to your need.

Then activate the project and call RSA3 to check the extractor.

Regards