Application Development 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: 

error while testing

Former Member
0 Kudos

hi everybody,

plz help me to solve this problem

when i tried to test the following code i am getting error like

<b>'open_form missing and write_form invalid'</b>

i tried all the ways i know but not able to solve the problem.

*----


  • Tables (RFKORI00)

*----


TABLES: T049L, "Lockboxes at our House Banks

VBPA, "Sales Document: Partner

RFPOSXEXT, "## AUTOMATICALLY GENERATED. DO NOT CHANGE OR RE-USE ! ##

VBRP, "Billing Document: Item Data

TVAUT. "Sales Documents: Order Reasons: Texts

*----


  • TYPES

*----


TYPES: BEGIN OF TY_FINALTAB ,

KUNNR TYPE KNA1-KUNNR,

NAME1 TYPE KNA1-NAME1,

BLART TYPE BSID-BLART,

BELNR TYPE BSID-BELNR,

BLDAT TYPE BSID-BLDAT,

WRBTR TYPE BSID-WRBTR,

FAEDT TYPE RFPOSXEXT-FAEDT,

REBZG TYPE BSID-REBZG,

XBLNR TYPE BSID-XBLNR,

AUGRU TYPE TVAUT-AUGRU,

RSTGR TYPE BSID-RSTGR,

END OF TY_FINALTAB.

TYPES: BEGIN OF TY_BSID ,

BUKRS TYPE BSID-BUKRS,

KUNNR TYPE BSID-KUNNR,

BSCHL TYPE BSID-BSCHL,

UMSKZ TYPE BSID-UMSKZ,

BLART TYPE BSID-BLART,

BELNR TYPE BSID-BELNR,

BLDAT TYPE BSID-BLDAT,

REBZG TYPE BSID-REBZG,

XBLNR TYPE BSID-XBLNR,

RSTGR TYPE BSID-RSTGR,

SHKZG TYPE BSID-SHKZG,

WRBTR TYPE BSID-WRBTR,

END OF TY_BSID.

TYPES: BEGIN OF TY_TVAUT,

AUGRU TYPE TVAUT-AUGRU,

END OF TY_TVAUT.

*----


  • Internal Tables (RFKORI00)

*----


DATA: GT_FINALTAB TYPE TY_FINALTAB OCCURS 0.

DATA: GT_BSID TYPE TY_BSID OCCURS 0.

DATA: GT_TVAUT TYPE TY_TVAUT OCCURS 0.

DATA: BEGIN OF GT_NAME1 OCCURS 0,

NAME1 LIKE KNA1-NAME1,

KUNNR LIKE KNA1-KUNNR,

END OF GT_NAME1.

*----


  • Work Areas (RFKORI00)

*----


DATA: BEGIN OF WA_KNA1,

NAME1 LIKE KNA1-NAME1,

STRAS LIKE KNA1-STRAS,

ORT01 LIKE KNA1-ORT01,

PSTLZ LIKE KNA1-PSTLZ,

REGIO LIKE KNA1-REGIO,

LAND1 LIKE KNA1-LAND1,

END OF WA_KNA1.

DATA: BEGIN OF WA_BSEG1,

VBELN LIKE BSEG-VBELN,

KUNNR LIKE BSEG-KUNNR,

END OF WA_BSEG1.

DATA: BEGIN OF WA_BSID,

BUKRS TYPE BSID-BUKRS,

KUNNR TYPE BSID-KUNNR,

BSCHL TYPE BSID-BSCHL,

UMSKZ TYPE BSID-UMSKZ,

BLART TYPE BSID-BLART,

BELNR TYPE BSID-BELNR,

BLDAT TYPE BSID-BLDAT,

REBZG TYPE BSID-REBZG,

XBLNR TYPE BSID-XBLNR,

RSTGR TYPE BSID-RSTGR,

SHKZG TYPE BSID-SHKZG,

WRBTR TYPE BSID-WRBTR,

END OF WA_BSID.

DATA: WA_FINALTAB TYPE TY_FINALTAB.

DATA: WA_TVAUT TYPE TY_TVAUT.

DATA: BEGIN OF WA_ADRC,

ADDRNUMBER LIKE ADRC-ADDRNUMBER,

TITLE LIKE ADRC-TITLE,

NAME1 LIKE ADRC-NAME1,

STREET LIKE ADRC-STREET,

CITY1 LIKE ADRC-CITY1,

COUNTRY LIKE ADRC-COUNTRY,

REGION LIKE ADRC-REGION,

END OF WA_ADRC.

DATA:BEGIN OF WA_NAME1,

NAME1 LIKE KNA1-NAME1,

KUNNR LIKE KNA1-KUNNR,

END OF WA_NAME1.

*----


  • Global Variables (RFKORI00)

*----


DATA: G_ADRNR1 LIKE T049L-ADRNR.

DATA: G_LOCKB LIKE KNB1-LOCKB.

DATA: G_VBELN LIKE VBPA-VBELN.

DATA: G_AUGRU LIKE TVAUT-AUGRU.

DATA: G_AUGRU_AUFT LIKE VBRP-AUGRU_AUFT.

DATA: G_NAME1 LIKE KNA1-NAME1.

FORM RETRIVE_CUSTDET.

  • for customer address

SELECT SINGLE NAME1

STRAS

ORT01

PSTLZ

REGIO

LAND1

FROM KNA1

INTO WA_KNA1

WHERE KUNNR = SAVE_KUNNR.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'CUST_ADDRESS'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'ADDRESS'.

.

*TO RETRIVE THE VALUES FROM BSID

SELECT SINGLE BUKRS

KUNNR

BSCHL

UMSKZ

BLART

BELNR

BLDAT

WRBTR

BSCHL

SHKZG

REBZG

XBLNR

RSTGR

INTO WA_BSID

FROM BSID

WHERE BUKRS IN UBUKRS

AND KUNNR = SAVE_KUNNR

AND BSCHL IN HBSCHL

AND UMSKZ IN HUMSKZ.

SELECT SINGLE LOCKB

FROM KNB1

INTO G_LOCKB

WHERE BUKRS = WA_BSID-BUKRS.

IF WA_BSID-BUKRS EQ '1100' OR WA_BSID-BUKRS EQ '7100'.

SELECT SINGLE ADRNR

FROM T049L

INTO G_ADRNR1

WHERE BUKRS = WA_BSID-BUKRS

AND LOCKB = G_LOCKB.

ENDIF.

  • FOR REMITT ADDRESS

IF G_ADRNR1 IS NOT INITIAL.

SELECT SINGLE ADDRNUMBER

TITLE

NAME1

STREET

CITY1

COUNTRY

REGION

FROM ADRC

INTO WA_ADRC

WHERE ADDRNUMBER = G_ADRNR1.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'REMIT_ADDRESS'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'ADDRESS3'.

*FOR DISPLAYING LINE ITEMS

*for ship-to number

SELECT SINGLE VBELN

FROM VBPA

INTO G_VBELN

WHERE PARVW = 'WE'.

SELECT SINGLE KUNNR

FROM BSEG

INTO WA_BSEG1

WHERE BUKRS = SAVE_BUKRS

AND BELNR = SAVE_BELNR

AND GJAHR = SAVE_GJAHR

AND BUZEI = SAVE_BUZEI.

SELECT SINGLE NAME1

FROM KNA1

INTO GT_NAME1

WHERE KUNNR = WA_BSEG1-KUNNR.

*for Detail document amount

*Fill one range with required posting keys.

RANGES: R_BSCHL FOR BSID-BSCHL.

R_BSCHL-SIGN = 'I'.

R_BSCHL-OPTION = 'BT'.

R_BSCHL-LOW = '01'.

R_BSCHL-HIGH = '09'.

APPEND R_BSCHL.

LOOP AT GT_BSID INTO WA_BSID.

IF WA_BSID-SHKZG = 'H'.

WA_BSID-WRBTR = WA_BSID-WRBTR * -1.

MODIFY GT_BSID INDEX SY-TABIX FROM WA_BSID.

ENDIF.

ENDLOOP.

*shift -ve sighn to front of amont using fm

CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'

CHANGING

VALUE = WA_BSID-WRBTR.

*For retrival of Order Reason

SELECT SINGLE AUGRU_AUFT

INTO G_AUGRU_AUFT

FROM VBRP

WHERE VBELN = G_VBELN.

SELECT SINGLE AUGRU

INTO WA_TVAUT

FROM TVAUT

WHERE AUGRU = G_AUGRU_AUFT

AND SPRAS = SY-LANGU.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'LINE_ITEMS'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'.

LOOP AT GT_BSID INTO WA_BSID.

READ TABLE GT_TVAUT INTO WA_TVAUT WITH KEY AUGRU = G_AUGRU_AUFT.

READ TABLE GT_NAME1 INTO WA_NAME1 WITH KEY KUNNR = SAVE_KUNNR.

IF SY-SUBRC LT 4.

MOVE: WA_BSEG1-KUNNR TO WA_FINALTAB-KUNNR,

G_NAME1 TO WA_FINALTAB-NAME1,

WA_BSID-BLART TO WA_FINALTAB-BLART,

WA_BSID-BELNR TO WA_FINALTAB-BELNR,

WA_BSID-BLDAT TO WA_FINALTAB-BLDAT,

WA_BSID-WRBTR TO WA_FINALTAB-WRBTR,

SAVE_FAEDT TO WA_FINALTAB-FAEDT,

WA_BSID-REBZG TO WA_FINALTAB-REBZG,

WA_BSID-XBLNR TO WA_FINALTAB-XBLNR,

WA_TVAUT-AUGRU TO WA_FINALTAB-AUGRU,

WA_BSID-RSTGR TO WA_FINALTAB-RSTGR.

APPEND WA_FINALTAB TO GT_FINALTAB.

CLEAR GT_FINALTAB.

ENDIF.

ENDLOOP.

ENDFORM. "RETRIVE_CUSTDET

thanx,

hridhayanjili.

8 REPLIES 8

Former Member
0 Kudos

Hi hridhyanjili,

1. While using WRITE_FORM,

we give the ELEMENT NAME

2. That element name

should be present in the sapscript layout

eg.

/E MYELEMENT

(other wise it will give error)

3. Moreover it should be present in the same window,

as specified in WRITE_FORM.

regards,

amit m.

0 Kudos

i have done the way as told by Amit and dieter

but still it showing the same error

someone guide me how to solve this prob

regards

Hridhayanjili

0 Kudos

The basic logic is to first open the form, start the form and than use the write forms followed by end and close form.

Open form

start form

write form

end form

close form.

Regards

Anurag

0 Kudos

hi Anurag

i did the same way followed the same order

still showing the same error

regards

hridhayanjili

0 Kudos

HI Anurag

i did the same way as u said but still my code is showing the same error

could u suggest me what to do

regards

hridhayanjili

0 Kudos

Please check it can be possible that you are closing the form before it encounters the WRITE_FORM.

Please paste the relevant logic for the ABAP

Regards

Anurag

Former Member
0 Kudos

Hi,

before can do CALL 'WRITE_FORM' you

have to CALL 'OPEN_FORM' with your Formular.

Regards, Dieter

Former Member
0 Kudos

Hi,

try to debug your code and test if the sy-subrc = 0

especial after 'OPEN_FORM'.

You can post your new Code here and i can look.

Regards, Dieter