Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Badi's problem

Hi Srini,

Thanks for reply.

Already i have some existing code to transfer data.

It's working on weekly basis on process chains,but it's taking long time to transfer data.

So i need to check that code and modify if possible.

Please assist me in that regarding...

Thanks.

Chandu.

Former Member
Former Member replied

Hi Chandu,

See my answers in BOLD.

METHOD if_ex_openhub_transform~transform .

DATA: l_s_data_in TYPE /bic/cyzocculus,

l_s_data_out TYPE /bic/czzocculus,

wa_zcontract TYPE /bic/pzcontract,

wa_bpartner TYPE /bi0/pbpartner,

lt_contract TYPE STANDARD TABLE OF /bic/pzcontract.

  • DATA: ztestflag(1) TYPE c.

SELECT * FROM /bic/pzcontract

INTO TABLE lt_contract

WHERE objvers = 'A'

AND /bic/zcontract BETWEEN '0000020000000' AND '0000039999999'.

SORT lt_contract BY /bic/zborrower.

CLEAR e_t_data_out.

<b>User Refresh, not clear, clear clears only header, refresh clears entire table. Check once.</b>

  • l_s_data_out-/BIC/ZCONTRACT = 'ACCOUNT'.

  • l_s_data_out-COMP_CODE = 'COCD'.

  • l_s_data_out-/BIC/ZBPNAME = 'NAME'.

  • l_s_data_out-/BIC/ZBR_OFFCE = 'BRCH'.

  • l_s_data_out-TXTSH = 'BRANCH NAME LON'.

  • l_s_data_out-TXTLG = 'BRANCH NAME SHORT'.

  • l_s_data_out-BPARTNER = 'BP'.

  • l_s_data_out-/BIC/ZFACILITY = 'FACILITY'.

  • l_s_data_out-/BIC/ZEND_TERM = 'TERM END'.

  • l_s_data_out-/BIC/ZLOPROCES = 'PI'.

  • l_s_data_out-/BIC/ZSTATUS = 'ST'.

LOOP AT i_t_data_in INTO l_s_data_in.

REPLACE ALL OCCURRENCES OF ';' IN l_s_data_in-txtlg WITH ','.

  • Initialise the Flag

  • ztestflag = 'N'.

  • SELECT * FROM /bic/pzcontract

  • INTO wa_zcontract

  • WHERE /bic/zborrower = l_s_data_in-bpartner

  • AND objvers = 'A'

  • AND /bic/zcontract BETWEEN '0000020000000' AND '0000039999999'.

LOOP AT lt_contract INTO wa_zcontract WHERE /bic/zborrower = l_s_data_in-bpartner.

l_s_data_out-bpartner = l_s_data_in-bpartner.

l_s_data_out-txtlg = l_s_data_in-txtlg.

  • MOVE-CORRESPONDING l_s_data_in TO l_s_data_out.

  • ztestflag = 'Y'.

  • This means that a contract was found

IF wa_zcontract-/bic/zcontract+5(1) = '2'.

l_s_data_out-/bic/zcontract = ''.

l_s_data_out-/bic/zfacility = wa_zcontract-/bic/zcontract.

ELSE.

l_s_data_out-/bic/zfacility = wa_zcontract-/bic/zfacility.

l_s_data_out-/bic/zcontract = wa_zcontract-/bic/zcontract.

ENDIF.

l_s_data_out-/bic/zend_term = wa_zcontract-/bic/zend_term.

l_s_data_out-/bic/zloproces = wa_zcontract-/bic/zloproces.

l_s_data_out-/bic/zstatus = wa_zcontract-/bic/zstatus.

l_s_data_out-comp_code = wa_zcontract-comp_code.

INSERT l_s_data_out INTO TABLE e_t_data_out.

<b>Create one more internal table same as e_t_data_out and append all the data into that table & after loop insert into e_t_data_out.</b>

ENDLOOP.

  • ENDSELECT.

*Check that Flag is not switched on as it means that no contract was

*found

  • IF ztestflag = 'N'.

IF sy-subrc NE 0.

CLEAR l_s_data_out.

l_s_data_out-bpartner = l_s_data_in-bpartner.

l_s_data_out-txtlg = l_s_data_in-txtlg.

  • MOVE-CORRESPONDING l_s_data_in TO l_s_data_out.

  • l_s_data_out-/bic/zfacility = ''.

  • l_s_data_out-/bic/zend_term = ''.

  • l_s_data_out-/bic/zloproces = ''.

  • l_s_data_out-/bic/zstatus = ''.

  • l_s_data_out-/bic/zcontract = ''.

  • l_s_data_out-comp_code = ''.

INSERT l_s_data_out INTO TABLE e_t_data_out.

<b>Here again you used the insert, it will add one more record. For example if you have 2 records in i_t_data_in table finally after these 2 insert statements it will be 4 records. Why cant you use Modify... and fill the blank fields in the row. I think You not generating data out of it. So it shold be 2 records only output.</b>

ENDIF.

ENDLOOP.

<b>Insert the contents of your new internal table into the e_t_data_out here finally.</b>

ENDMETHOD.

Hope this Helps

Srini

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question