Skip to Content

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

SAPscript problem: my window gets wrong values

Hello experts,

This has been bugging me for quite some time. In my window(in sapscript) there is a window called KOPF that's supposed to show ship to party info but I am confused as to why its getting wrong values. my WRITE_FORMS for the windows are basically simple so I am wondering why it still gets wrong values.

Also, the window KOPF and my MAIN window has the SAME logic to get the ship to party name and address so its really confusing. Anyway, I will paste below my code for further details.Again, thank you guys!

IF mseg-bwart = '631'.

LOOP AT traptab.

MOVE-CORRESPONDING traptab TO traptab2.

APPEND traptab2.

CLEAR traptab.

ENDLOOP.

SORT traptab2 BY ls_lines1 ls_lines2 ls_lines3 zeile.

LOOP AT traptab2.

new = traptab2-ls_lines1.

IF old <> new AND NOT old IS INITIAL.

v_flag = 1.

ENDIF.

old = new.

  • AT NEW ls_lines1.

  • CLEAR xkopfdr.

  • ENDAT.

MOVE-CORRESPONDING traptab2 TO mkpf.

MOVE-CORRESPONDING traptab2 TO mseg.

PERFORM tab156_lesen2.

CHECK NOT t156-kzdru IS INITIAL.

IF mkpf-tcode2 EQ 'MB01' OR mkpf-tcode2 EQ 'MB1A' OR

mkpf-tcode2 EQ 'MIGO_GR' OR mkpf-tcode2 EQ 'MIGO_GI'.

v_revrs = 'N'.

PERFORM check_reversal2.

ENDIF.

xskkz = t156-rstyp.

PERFORM tab001w_lesen_22.

IF NOT traptab2-matnr IS INITIAL.

PERFORM material_lesen2.

ELSE.

SELECT SINGLE * FROM ekpo WHERE ebeln = mseg-ebeln AND

ebelp = mseg-ebelp AND

loekz = space.

IF sy-subrc = 0.

mabdr-maktx = ekpo-txz01.

ENDIF.

ENDIF.

PERFORM get_serial_nos2.

PERFORM tab156t_lesen2. " Get Movement Description

PERFORM helpdata1.

PERFORM wa03_ausgabe2.

PERFORM helpdata2.

ENDLOOP.

ENDIF.

**this is the routine that write the data to the window*

FORM wa03_ausgabe2.

DATA: l_lines TYPE i.

  • IF xkopfdr IS INITIAL.

  • xkopfdr = x.

  • IF new_page = x.

  • CALL FUNCTION 'CONTROL_FORM'

  • EXPORTING

  • command = 'NEW-PAGE'.

  • ENDIF.

  • ENDIF.

IF v_flag = 1.

clear v_flag.

IF new_page = x.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'.

ENDIF.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'KOPF'

window = 'KOPF'.

new_page = x.

*----


Drucken WA-Positionen----


*

CLEAR: am07m-kontierung.

am07m-rstyp = xskkz.

CASE xskkz. "Kontierungsarten ?

WHEN xfert. "Fertigungsauftrag

am07m-kontierung = mseg-aufnr.

WHEN xanlage. "auf Anlage kontiert?

MOVE space TO anlage.

anlage-anln1 = mseg-anln1.

anlage-anln2 = mseg-anln2.

MOVE space TO am07m-kontierung.

CONDENSE anlage NO-GAPS.

am07m-kontierung = anlage. "Anlagennummer

WHEN xvbelg. "Kundenauftrag ?

MOVE space TO kunde.

kunde-kdauf = mseg-kdauf.

kunde-kdpos = mseg-kdpos.

kunde-kdein = mseg-kdein.

MOVE space TO am07m-kontierung.

CONDENSE kunde NO-GAPS.

am07m-kontierung = kunde. "Kundennummer

WHEN xkostl. "auf Kostenstelle kontiert?

am07m-kontierung = mseg-kostl. "Anlagennummer

WHEN xprojn OR xnplan. "auf Projekt/Netzplan?

IF mseg-nplnr IS INITIAL.

PERFORM psp_convert USING mseg-ps_psp_pnr.

ELSE.

am07m-kontierung = mseg-nplnr.

PERFORM nw_vorgang_lesen USING mseg-aufpl mseg-aplzl.

IF NOT n_vornr IS INITIAL.

MOVE '/' TO am07m-kontierung+12.

MOVE n_vornr TO am07m-kontierung+13.

ENDIF.

ENDIF.

WHEN xumlag. "Umlagerung

IF mseg-matnr NE mseg-ummat.

MOVE mseg-ummat TO am07m-kontierung.

ELSE.

MOVE mseg-umwrk TO am07m-kontierung.

MOVE '/' TO am07m-kontierung+4.

MOVE mseg-umlgo TO am07m-kontierung+5.

ENDIF.

WHEN OTHERS. "keine Kontierung ?

IF NOT mseg-ummat IS INITIAL.

IF mseg-matnr NE mseg-ummat.

MOVE mseg-ummat TO am07m-kontierung.

ELSEIF mseg-werks NE mseg-umwrk.

MOVE mseg-umwrk TO am07m-kontierung.

MOVE '/' TO am07m-kontierung+4.

MOVE mseg-umlgo TO am07m-kontierung+5.

ELSEIF mseg-lgort NE mseg-umlgo.

MOVE mseg-umwrk TO am07m-kontierung.

MOVE '/' TO am07m-kontierung+4.

MOVE mseg-umlgo TO am07m-kontierung+5.

ENDIF.

ENDIF.

ENDCASE.

  • user-exit ├╝ber erweiterung mbcf0005

CALL CUSTOMER-FUNCTION '001'

EXPORTING

i_mkpf = mkpf

i_mseg = mseg

i_nast = nast

i_tnapr = tnapr

CHANGING

c_am07m = am07m

EXCEPTIONS

OTHERS = 0.

*---ASA--


12/10/99----

-


ADD 1 TO v_zeile.

*----

-


CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'POS_ZEILE'

window = 'MAIN'.

*---ASA--


7/22/99----

-


v_first_num = 'Y'.

v_finish = 'N'.

DESCRIBE TABLE serial_tab LINES l_lines.

LOOP AT serial_tab.

IF sy-tabix EQ l_lines.

v_finish = 'Y'.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'SERNUM'

window = 'MAIN'.

v_first_num = 'N'.

ENDLOOP.

PERFORM print_footer.

Tags:
Former Member

Helpful Answer

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