Skip to Content

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

SAP Script- problem in Scipt printing.

hi all,

I am facing problem in printing the field from table <b>IT_WA</b> i am getting records in internal table IT_WA but unable to print in the sap script. In debug i am see the values in the headerline and as well as body of IT_WA. But still it is not printing the values.

in SAP scritp i have declared as &IT_WA-INT_BASAMT(13)& all the records are comming fine but this records shows zero.

below is the source code of my program.

DATA: SYINDEX TYPE SY-INDEX.

DATA: BEGIN OF IT_WA OCCURS 0.

INCLUDE STRUCTURE INTITIT.

DATA: END OF IT_WA.

DATA: INV_AMT TYPE INTITIT-INT_SHKZG.

SELECT * FROM INTITIT INTO CORRESPONDING FIELDS OF TABLE IT_INTITIT WHERE GJAHR = BSEG-GJAHR AND BELNR_TO = BSEG-BELNR AND BUZEI = '2' OR BELNR = INTITIT-BELNR.

LOOP AT hbseg.

MOVE-CORRESPONDING hbseg TO bseg.

PERFORM sortierung USING 'P' '1' ' '.

hbseg-sortp1 = sortp1.

hbseg-sortp2 = sortp2.

hbseg-sortp3 = sortp3.

hbseg-sortp4 = sortp4.

hbseg-sortp5 = sortp5.

MODIFY hbseg.

ENDLOOP.

SORT hbseg BY bukrs sortp1 sortp2 sortp3 sortp4 sortp5

belnr gjahr buzei.

LOOP AT hbseg.

  • WHERE BUKRS = SAVE_BUKRS.

save_bukrs = hbseg-bukrs.

IF ( hbseg-kunnr = save_kunnr

AND NOT save_kunnr IS INITIAL )

OR ( hbseg-lifnr = save_lifnr

AND NOT save_lifnr IS INITIAL ).

CLEAR bseg.

  • CLEAR IT_INTITIT.

MOVE-CORRESPONDING hbseg TO bseg.

  • MOVE-CORRESPONDING HBSEG TO IT_INTITIT.

*bseg = bseg.

IF bkpf-waers NE *bkpf-waers.

PERFORM curr_document_convert_bseg

USING

bkpf-budat

*bkpf-waers

*bkpf-hwaer

bkpf-waers

CHANGING

bseg.

IF NOT bseg-pycur IS INITIAL.

alw_waers = bseg-pycur.

PERFORM currency_get_subsequent

USING

save_repid

bkpf-budat

bkpf-bukrs

CHANGING

alw_waers.

IF alw_waers NE bseg-pycur.

bseg-pycur = alw_waers.

PERFORM convert_foreign_to_foreign_cur

USING

bkpf-budat

*bkpf-waers

*bkpf-hwaer

bseg-pycur

CHANGING

bseg-pyamt.

ENDIF.

ENDIF.

ENDIF.

PERFORM fill_waehrungsfelder_bseg.

PERFORM fill_waehrungsfelder_bseg_2.

IF bseg-sgtxt(1) NE '*'.

bseg-sgtxt = space.

ELSE.

bseg-sgtxt = bseg-sgtxt+1.

ENDIF.

CLEAR save_bschl.

CLEAR save_umskz.

CLEAR tbslt.

save_bschl = bseg-bschl.

save_umskz = bseg-umskz.

PERFORM read_tbslt.

                                          • ADDING VARIBLE V_GSALDF BY SUNIL 5.11.07******

V_gsaldf = rf140-gsaldf + rf140-wrshb.

RF140-GSALDF = V_GSALDF.

CLEAR V_GSALDF.

                            • SUNIL *********************

*rf140-gsaldf = *rf140-gsaldf + *rf140-wrshb.

IF xmultk IS INITIAL

AND xactiv IS INITIAL

AND linecnt = '1'

AND NOT xumsst IS INITIAL

AND NOT save_xumstn IS INITIAL.

IF bkpf-bstat = 'V'.

PERFORM read_vbset.

ELSE.

PERFORM read_bset.

ENDIF.

DESCRIBE TABLE hbset LINES linecnt.

IF linecnt = '1'.

LOOP AT hbset.

MOVE-CORRESPONDING hbset TO bset.

*bset = bset.

IF bkpf-waers NE *bkpf-waers.

PERFORM curr_document_convert_bset

USING

bkpf-budat

*bkpf-waers

*bkpf-hwaer

bkpf-waers

CHANGING

bset.

ENDIF.

CLEAR rf140-msatz.

CLEAR rf140-vtext.

save_ktosl = bset-ktosl.

PERFORM read_t687t.

rf140-msatz = bset-kbetr / 10.

*rf140-msatz = rf140-msatz.

rf140-vtext = save_vtext.

*rf140-vtext = rf140-vtext.

IF bset-shkzg = 'H'.

rf140-mwshb = bset-fwste.

*rf140-mwshb = *bset-fwste.

rf140-mdshb = bset-hwste.

*rf140-mdshb = *bset-hwste.

ELSE.

rf140-mwshb = 0 - bset-fwste.

*rf140-mwshb = 0 - *bset-fwste.

rf140-mdshb = 0 - bset-hwste.

*rf140-mdshb = 0 - *bset-hwste.

ENDIF.

EXIT.

ENDLOOP.

rf140-wrshb = rf140-wrshb - rf140-mwshb.

*rf140-wrshb = *rf140-wrshb - *rf140-mwshb.

rf140-dmshb = rf140-dmshb - rf140-mdshb.

*rf140-dmshb = *rf140-dmshb - *rf140-mdshb.

ENDIF.

ENDIF.

*****************Begin of Change by Karthikeyan J********************

i_count = i_count + 1.

CLEAR rf140-element.

CLEAR: it_bseg, i_wrbtr,i_totday,i_tempday,i_day,i_bday.

            • comparing with fields belnr aand gjahr added by sunil 3.11.07*********

SELECT SINGLE * FROM bseg INTO

CORRESPONDING FIELDS OF it_bseg WHERE BELNR = BSEG-REBZG AND GJAHR = BSEG-GJAHR.

*

  • SELECT * FROM INTITIT INTO CORRESPONDING FIELDS OF TABLE IT_INTITIT WHERE GJAHR = BSEG-GJAHR AND BELNR_TO = BSEG-BELNR AND BUZEI = '2' OR BELNR = INTITIT-BELNR.

    • added by Jayshree on 09/01/2007

MOVE ' ' TO it_kna1-name1.

SELECT SINGLE name1

INTO CORRESPONDING FIELDS OF it_kna1

FROM ( vbpa AS a INNER JOIN kna1 AS b ON akunnr = bkunnr )

WHERE a~vbeln = it_bseg-vbeln

AND a~parvw = 'ZD'.

SELECT SINGLE fkdat

INTO CORRESPONDING FIELDS OF it_kna1

FROM vbrk

WHERE vbrk~vbeln = it_bseg-vbeln.

    • added by Jayshree on 01/02/2007

CONCATENATE it_kna1-fkdat6(2) it_kna1-fkdat4(2) it_kna1-fkdat+2(2)

INTO vfkdat SEPARATED BY '.'.

CONCATENATE it_bseg-augdt6(2) it_bseg-augdt4(2) it_bseg-augdt+2(2)

INTO vaugdt SEPARATED BY '.'.

**

i_wrbtr = i_wrbtr + it_bseg-wrbtr.

    • added as on 29.06.2007 by jayshree again transport on 21.07.2007

tot_wrbtr = tot_wrbtr + i_wrbtr.

i_totday = it_bseg-zbd1t + it_bseg-zbd2t + it_bseg-zbd3t.

CALL FUNCTION 'FIMA_DATE_CREATE'

EXPORTING

i_date = it_bseg-zfbdt

  • I_FLG_END_OF_MONTH = ' '

  • I_YEARS = 0

  • I_MONTHS = 0

i_days = i_totday

  • I_CALENDAR_DAYS = 0

  • I_SET_LAST_DAY_OF_MONTH = ' '

IMPORTING

e_date = i_bday

  • E_FLG_END_OF_MONTH =

  • E_DAYS_OF_I_DATE =

.

    • added by JAYSHREE 01.02.2007

CONCATENATE i_bday6(2) i_bday4(2) i_bday+2(2)

INTO vbday SEPARATED BY '.'.

**

i_day = it_bseg-augdt - i_bday.

*

  • CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'

  • EXPORTING

  • date1 = it_bseg-zfbdt

  • date2 = it_bseg-augdt

    • OUTPUT_FORMAT = '01'

  • IMPORTING

    • YEARS =

    • MONTHS =

  • DAYS = i_day

    • EXCEPTIONS

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

*added by sunil 7.11.07 ***********

syindex = sy-tabix.

READ TABLE IT_INTITIT INDEX SYINDEX INTO IT_WA.

APPEND IT_WA TO IT_WA.

rf140-element = '521'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'MAIN'

element = '521'

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc = 1.

window = 'MAIN'.

PERFORM message_window.

ENDIF.

IF sy-subrc = 2.

window = 'MAIN'.

ereignis = '521'.

PERFORM message_element.

ENDIF.

IF save_xumstn IS INITIAL.

*-------Umsatzsteuer -


IF xactiv IS INITIAL.

save_waers = rf140-waers.

PERFORM tax_data.

CLEAR taxlines.

DESCRIBE TABLE atax LINES taxlines.

IF NOT taxlines IS INITIAL.

LOOP AT atax.

CLEAR ereignis.

CLEAR rf140-msatz.

CLEAR rf140-vtext.

rf140-msatz = atax-msatz.

*rf140-msatz = atax-msatz.

rf140-vtext = atax-vtext.

*rf140-vtext = atax-vtext.

*******begin of change by karthikeyan on 10.03.06*********************

IF sy-tabix = '1'.

ereignis = '522'.

v_stax = rf140-msatz * rf140-gsaldf / 100.

ELSE.

ereignis = '523'.

v_ecs = rf140-msatz * v_stax / 100.

v_total = rf140-gsaldf + v_stax + v_ecs.

ENDIF.

CALL FUNCTION 'HR_IN_CHG_INR_WRDS'

EXPORTING

amt_in_num = v_total

IMPORTING

amt_in_words = v_spell

  • EXCEPTIONS

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

***************************end of change******************************

CLEAR rf140-element.

rf140-element = ereignis.

IF NOT ereignis IS INITIAL.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'MAIN'

element = ereignis

EXCEPTIONS

window = 1

element = 2.

IF sy-subrc = 1.

window = 'MAIN'.

PERFORM message_window.

ENDIF.

IF sy-subrc = 2.

window = 'MAIN'.

PERFORM message_element.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

  • ENDLOOP.

ENDIF.

ENDLOOP.

  • ENDLOOP.

clear syindex.

Please help me i am unable to find the solution.

<b>useful ansers surely rewarded</b>.

regards,

sunil kumar.

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