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

script problem

Former Member
0 Likes
337

Hi experts,

i am trying do changes in existing program.

i have to print the data from script to application server.

this is the code i have written.

SORT itibd BY invoice_no consumer_no.

LOOP AT itibd.

count2 = sy-tabix.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

application = 'TX'

device = 'OTF_MEM'

form = 'ZBI_CR_13A'

language = sy-langu

EXCEPTIONS

canceled = 1

device = 2

form = 3

options = 4

unclosed = 5

mail_options = 6

archive_error = 7

invalid_fax_number = 8

more_params_needed_in_batch = 9

spool_error = 10

OTHERS = 11.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • if ITIBD-TOT_UNITS_BILLED = ''.

  • ITIBD-TOT_UNITS_BILLED = 0.

  • modify itibd.

  • endif.

*vinay

  • LOOP AT itibd.

  • count2 = sy-tabix.

*vinay

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'HED'

  • FUNCTION = 'SET'

type = 'BODY'

window = 'HEADER'

.

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 'WRITE_FORM'

EXPORTING

element = 'L4'

  • FUNCTION = 'SET'

type = 'BODY'

window = 'WINDOW4'

.

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 'WRITE_FORM'

EXPORTING

element = 'L3'

  • FUNCTION = 'SET'

type = 'BODY'

window = 'WINDOW3'

.

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 'WRITE_FORM'

EXPORTING

element = 'L1'

  • FUNCTION = 'SET'

type = 'BODY'

window = 'WINDOW1'

.

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 'WRITE_FORM'

EXPORTING

element = 'L2'

  • FUNCTION = 'SET'

type = 'BODY'

window = 'WINDOW2'

.

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 'WRITE_FORM'

EXPORTING

element = 'FTR'

  • FUNCTION = 'SET'

type = 'BODY'

window = 'FOOTER'

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*LOOP AT itibd.

  • count2 = sy-tabix.

**********ADDED BY NAVIN - 24/7/07

                  • CONVERT INTO CHAR TO AVIOD SINGLE SPACE IN OUTPUT

u1 = itibd-units_1.

u2 = itibd-units_2.

u3 = itibd-units_3.

u4 = itibd-units_4.

u5 = itibd-units_5.

u6 = itibd-units_6.

tot_fix_chrg = itibd-tot_fix_chrg.

tot_elec_chrg = itibd-tot_elec_chrg.

fac_chrg = itibd-fac_chrg.

govt_duty_amnt = itibd-govt_duty_amnt.

tos_amount = itibd-tos_amount.

disc_incn_on_pay = itibd-disc_incn_on_pay.

curr_mth_charges = itibd-curr_mth_charges.

prev_mth_bill_am = itibd-prev_mth_bill_am.

net_prev_bal = itibd-net_prev_bal.

dpc_levied_amnt = itibd-dpc_levied_amnt.

tot_bill_amt = itibd-tot_bill_amt.

rnd_payable = itibd-rnd_payable.

CONDENSE: u1, u2, u3, u4, u5, u6,

tot_fix_chrg,

tot_elec_chrg,

fac_chrg,

govt_duty_amnt,

tos_amount,

disc_incn_on_pay,

curr_mth_charges,

prev_mth_bill_am,

net_prev_bal,

dpc_levied_amnt,

tot_bill_amt,

rnd_payable,

pymt_recd_amnt,

adj_amnt.

*************END OF ADDITION - NAVIN - 24/7/07

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'E'

function = 'SET'

type = 'BODY'

window = 'MAIN'.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CLEAR: u1, u2, u3, u4, u5, u6,

tot_fix_chrg,

tot_elec_chrg,

fac_chrg,

govt_duty_amnt,

tos_amount,

disc_incn_on_pay,

curr_mth_charges,

prev_mth_bill_am,

net_prev_bal,

dpc_levied_amnt,

tot_bill_amt,

rnd_payable,

pymt_recd_amnt,

adj_amnt.

CALL FUNCTION 'CLOSE_FORM'.

CALL FUNCTION 'CONVERT_OTF_MEMORY'

EXPORTING

format = 'ASCII'

max_linewidth = 132

TABLES

lines = line

EXCEPTIONS

memory_empty = 1

err_max_linewidth = 2

err_format = 3

err_conv_not_possible = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT line.

REPLACE line-tdformat WITH space INTO line-tdformat.

MODIFY line.

ENDLOOP.

ENDLOOP.

commandname = 'ZMKDIR'.

v_pl_logpath = 'Z_IBRL'.

*first file

PERFORM f_get_phys_path USING v_pl_logpath "type PATHINTERN

CHANGING v_pl_phys_path. "type pathextern.

*CONCATENATE v_pl_phys_path SY-DATUM0(4) '_' SY-DATUM4(2) '_'

*SY-DATUM+6(2) '_r67_monthly_coll.txt' into v_dsn.

*

CONCATENATE v_pl_phys_path pdate6(2) pdate4(2) pdate+0(4) INTO

additional_parameters.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

commandname = commandname

additional_parameters = additional_parameters

TABLES

exec_protocol = exec_protocol

CONCATENATE v_pl_phys_path pdate6(2) pdate4(2) pdate+0(4) '/'

pdate6(2) pdate4(2) pdate+0(4) '_Braille.doc' INTO

afilepath1.

OPEN DATASET afilepath1 FOR OUTPUT IN TEXT MODE.

LOOP AT line.

TRANSFER line-tdline TO afilepath1.

ENDLOOP.

CLOSE DATASET afilepath1.

the problem is when are two records in the internal table itibd.

the first record is getting repeated twice while calling the function module CONVERT_OTF_MEMORY.

Regards,

alson

1 REPLY 1
Read only

Former Member
0 Likes
289

HI Alson,

When ur calling function module 'CONVERT_OTF_MEMORY', pass the parameter for tables lines = line[].

If the problem is not solved, try the function module 'CONVERT_OTF'.

Hope it will solve the problem.

Regards

Krishnendu