cancel
Showing results for 
Search instead for 
Did you mean: 

Badi's problem

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chandu,

What are you doing in the BAdi... only trnsformation like pading with zero's or removing leading zero or adding any new fields aswell....

Copy paste your code so i can help....

Chandu give reply to this post only, dont create another post...:)

Hope this Helps.

Srini

Former Member
0 Kudos

Hi Srini,

Please give me your mail id then i can send you the details, then you will know.

Thanks.

Chandu.

Former Member
0 Kudos

Hi Srini,

I am pasting the existing BAdi's code...

Please have look at it.

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.

  • 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.

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.

ENDIF.

ENDLOOP.

ENDMETHOD.

The extraction running on monthly process chain.

The problem is it's taking long time to extract data.

I need to modify the code to run properly..

Please go through it ....

Thanks in Advance..

Regards.

Chandu.

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks a lot for fast reply Srini.

I will try with that details.

If i get any queries i will let you know.

Thanks a lot.

Chandu.

Former Member
0 Kudos

Hi Srini,

I am new to the BAdi's.

Can you just explain me the data flow and parameter's used and what is the significance?

Thanks.

Chandu.

Answers (1)

Answers (1)

Former Member
0 Kudos

Replied your query in your previous post.

Ashish