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: 

WRITE_FORM is invalid, OPEN_FORM is missing

karuna_gangireddy
Contributor
0 Kudos

Hi All,

I am getting the error no. TD423 with the error message 'WRITE_FORM is invalid, OPEN_FORM is missing'. I checked most of the discussions but coudln't get an answer yet.

This is what i did:

1. NACE setting:

  MEDIUM          PROGRAM             FORM Routine   Form        PDF/Smartform Form     TYPE

External Send - <Program Name> - ENTRY -             BLANK - <SMARTFORM Name> - SMARTFORM

2. Open the order in VA02

   - Extras -> Output -> Header - > Edit -> Added a entry

     Output TYpe     Desc     Medium               Funtion    Partner   Lang

      ZAK1               Order     External Send        SP        XXXX     EN 

3.  Extras -> Output -> Header - > Print Preview -> Slected the above entry -> Clicked in Preview

I am getting the error here.

Checked:

1. The sold-to had the email in XD03.

2. I Debugged the Print program -

    - It stopped at NAST-NACHA EQ 5. The CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE' is returning SY-SUBRC = 5.


Can anyone please help me to find where the issue is?

Thanks in advance,

Karuna

16 REPLIES 16

Former Member
0 Kudos

Hi

It seems you're trying to create a pirnt (in your case for email) without to open it.

Check your print program where the OPEN_FORM fm is called.

Max

0 Kudos

Hi Max,

Thank you for your quick reply. That is correct. When i was debugging the found:

-  ENTRY form calling -> Processing Form calling -> RVADOPFO.

    In RVADOPFO, the OPEN_FORM is all the way at the end and the  'ADDR_GET_NEXT_COMM_TYPE'

    at the beginning.

    But as it is SAP code i thought this is how it should be. Because i did not code any custom code yet, i am   

    under impression that this should work.

 

   This is the part where i am confused.

Thanks again,

Karuna

0 Kudos

Hi Max,

I see what you are saying. As i mentioned the medium as 5 (EMail) and trying to print print preview that is was causing the error?

I just clicked OK instead of clicking on Print Preview. But still I do not see any emails sending out.

Thanks,

Karuna

0 Kudos

Hi

I've checked the include RVADOPFO, this is the std code to open a form, the fm  ADDR_GET_NEXT_COMM_TYPE is to format the address data, if this fm returns excpetion = 5, you should check which parameter is missing or is wrong.

As you can see in the following code RVADOPFO

IF NOT NAST-TCODE IS INITIAL AND NAST-NACHA EQ '5'.

*   ... use stratagy to get communication type

     CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'

          EXPORTING

               STRATEGY           = NAST-TCODE

*             ADDRESS_TYPE       =

*             ADDRESS_NUMBER     = VBDKA-ADRNR

*             PERSON_NUMBER      = VBDKA-ADRNP

               ADDRESS_NUMBER     = ADDR_KEY-ADDRNUMBER

               PERSON_NUMBER      = ADDR_KEY-PERSNUMBER

          IMPORTING

               COMM_TYPE          = LVS_COMM_TYPE

               COMM_VALUES        = LVS_COMM_VALUES

*        TABLES

*             STRATEGY_TABLE     =

          EXCEPTIONS

               ADDRESS_NOT_EXIST  = 1

               PERSON_NOT_EXIST   = 2

               NO_COMM_TYPE_FOUND = 3

               INTERNAL_ERROR     = 4

               PARAMETER_ERROR    = 5

               OTHERS             = 6.

     IF SY-SUBRC <> 0.

       retcode = sy-subrc.

       SYST-MSGTY = 'E'.

       perform protocol_update.

     ENDIF.

   ENDIF.

* convert communication data

   MOVE-CORRESPONDING NAST TO LVS_SNAST.

   MOVE SY-REPID           TO LVF_PROGRAM.

   CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'

        EXPORTING

             PI_COMM_TYPE              = LVS_COMM_TYPE

             PI_COMM_VALUES            = LVS_COMM_VALUES

             PI_SCREEN                 = US_SCREEN

*           PI_NEWID                  =

             PI_COUNTRY                = US_COUNTRY

             PI_REPID                  = LVF_PROGRAM

             PI_SNAST                  = LVS_SNAST

        IMPORTING

             PE_ITCPO                  = LVS_ITCPO

             PE_DEVICE                 = LVF_DEVICE

             PE_MAIL_RECIPIENT         = LVS_RECIPIENT

             PE_MAIL_SENDER            = LVS_SENDER

        EXCEPTIONS

             COMM_TYPE_NOT_SUPPORTED   = 1

             RECIPIENT_CREATION_FAILED = 2

             SENDER_CREATION_FAILED    = 3

             OTHERS                    = 4.

   IF SY-SUBRC <> 0.

     RETCODE = SY-SUBRC.

     SYST-MSGTY = 'E'.

     PERFORM PROTOCOL_UPDATE.

   ENDIF.

   check retcode eq 0.                     <--------------------------------------


The progam stops the running if RETCODE (so the sy.subrc ) is not equal 0


That means if the fm  ADDR_GET_NEXT_COMM_TYPE fails, the fm OPEN_FORMS is not called.


Now the problem is to know the rest of you code, because the include RVADOPFO should be placed in the routine like this:


FORM FORM_OPEN USING US_SCREEN US_COUNTRY.

   INCLUDE RVADOPFO.

ENDFORM.



and that routine should be called in your print program, like this:


PERFORM FORM_OPEN USING PROC_SCREEN VBDKL-LAND1.

CHECK RETCODE = 0.



It's very import the check after the form, because if the form raises an error, the print program is stopped without any error.


Max

0 Kudos

Hi

Just as I said before the problem is in fm ADDR_GET_NEXT_COMM_TYPE, this fm fails and so the fm OPEN_FORM is not called....now I can't understand why your program is not stopped, but it still goes on and so you have the error.

I suppose you have no mail because your program doesn't move the correct device, in my release the code of RVADOPFO is:

    CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'

         EXPORTING

              STRATEGY           = NAST-TCODE

*             ADDRESS_TYPE       =

*             ADDRESS_NUMBER     = VBDKA-ADRNR

*             PERSON_NUMBER      = VBDKA-ADRNP

              ADDRESS_NUMBER     = ADDR_KEY-ADDRNUMBER

              PERSON_NUMBER      = ADDR_KEY-PERSNUMBER

         IMPORTING

              COMM_TYPE          = LVS_COMM_TYPE

              COMM_VALUES        = LVS_COMM_VALUES

*        TABLES

*             STRATEGY_TABLE     =

         EXCEPTIONS

              ADDRESS_NOT_EXIST  = 1

              PERSON_NOT_EXIST   = 2

              NO_COMM_TYPE_FOUND = 3

              INTERNAL_ERROR     = 4

              PARAMETER_ERROR    = 5

              OTHERS             = 6.

    IF SY-SUBRC <> 0.

      retcode = sy-subrc.

      SYST-MSGTY = 'E'.

      perform protocol_update.

    ENDIF.

  ENDIF.

* convert communication data

  MOVE-CORRESPONDING NAST TO LVS_SNAST.

  MOVE SY-REPID           TO LVF_PROGRAM.

  CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'

       EXPORTING

            PI_COMM_TYPE              = LVS_COMM_TYPE

            PI_COMM_VALUES            = LVS_COMM_VALUES

            PI_SCREEN                 = US_SCREEN

*           PI_NEWID                  =

            PI_COUNTRY                = US_COUNTRY

            PI_REPID                  = LVF_PROGRAM

            PI_SNAST                  = LVS_SNAST

       IMPORTING

            PE_ITCPO                  = LVS_ITCPO

            PE_DEVICE                 = LVF_DEVICE

            PE_MAIL_RECIPIENT         = LVS_RECIPIENT

            PE_MAIL_SENDER            = LVS_SENDER

       EXCEPTIONS

            COMM_TYPE_NOT_SUPPORTED   = 1

            RECIPIENT_CREATION_FAILED = 2

            SENDER_CREATION_FAILED    = 3

            OTHERS                    = 4.

  IF SY-SUBRC <> 0.

    RETCODE = SY-SUBRC.

    SYST-MSGTY = 'E'.

    PERFORM PROTOCOL_UPDATE.

  ENDIF.

  check retcode eq 0.

* if there is no communication type

  IF  LVS_COMM_TYPE IS INITIAL.

*   set device

    CASE NAST-NACHA.

      WHEN '1'.

        LVF_DEVICE = 'PRINTER'.

      WHEN '2'.

        LVF_DEVICE = 'TELEFAX'.

        LVS_ITCPO-TDTELENUM = NAST-TELFX.

        IF NAST-TLAND IS INITIAL.

          LVS_ITCPO-TDTELELAND = US_COUNTRY.

        ELSE.

          LVS_ITCPO-TDTELELAND = NAST-TLAND.

        ENDIF.

        LVS_ITCPO-TDSENDDATE = NAST-VSDAT.

        LVS_ITCPO-TDSENDTIME = NAST-VSURA.

        LVS_ITCPO-TDFAXUSER  = NAST-USNAM.

      WHEN '3'.

        LVF_DEVICE = 'TELETEX'.

        LVS_ITCPO-TDTELENUM = NAST-TELTX.

        IF NAST-TLAND IS INITIAL.

          LVS_ITCPO-TDTELELAND = US_COUNTRY.

        ELSE.

          LVS_ITCPO-TDTELELAND = NAST-TLAND.

        ENDIF.

        LVS_ITCPO-TDSENDDATE = NAST-VSDAT.

        LVS_ITCPO-TDSENDTIME = NAST-VSURA.

     WHEN '4'.

        LVF_DEVICE = 'TELEX'.

        LVS_ITCPO-TDTELENUM = NAST-TELX1.

        IF NAST-TLAND IS INITIAL.

          LVS_ITCPO-TDTELELAND = US_COUNTRY.

        ELSE.

          LVS_ITCPO-TDTELELAND = NAST-TLAND.

        ENDIF.

        LVS_ITCPO-TDSENDDATE = NAST-VSDAT.

        LVS_ITCPO-TDSENDTIME = NAST-VSURA.

      WHEN OTHERS.

        LVF_DEVICE = 'PRINTER'.

    ENDCASE.

  ENDIF.

LVF_DEVICE has to be equal to MAIL, this value should be returned by fm CONVERT_COMM_TYPE_DATA, which is your value?

But (of course) I don't know if your system is available for sending mail....have you checked it?

Max

0 Kudos

Hi Max,

Yes, the system is all set to send out emails. I check SCOT and SOST. I found the problem. The reason it was saying OPEN_FORM was missing was for some reason it did not have values for
ADDR_KEY-ADDRNUMBER and ADDR_KEY-PERSNUMBER.

I wrote a snippet:

  addr_key-addrnumber = vbdka-adrnr.
  addr_key-persnumber = vbdka-adrnp.
  addr_key-addr_type = vbdka-address_type.

just before calling include 'rvadopfo'. This is how i was able to cross that huddle. But stuck into another:

write_form is invalid, START_form is missing

I found out that the OPEN_FORM parameter FORM is not being set in case of medium 5. which is why rstxc-tdclose would set to 'X' and thus the error.

Trying to figure why FORM parameter is set with PRINT option and not with email? Any Idea?

Thanks for all your time,

Karuna

0 Kudos

Hi

Try to check the result of fm CONVERT_COMM_TYPE_DATA: it should return the device, if device is initial then it's setted to PRINT by default:

* if there is no communication type

  IF  LVS_COMM_TYPE IS INITIAL.

*   set device

    CASE NAST-NACHA.

      WHEN '1'.

        LVF_DEVICE = 'PRINTER'.

      WHEN '2'.

        LVF_DEVICE = 'TELEFAX'.

        LVS_ITCPO-TDTELENUM = NAST-TELFX.

        IF NAST-TLAND IS INITIAL.

          LVS_ITCPO-TDTELELAND = US_COUNTRY.

        ELSE.

          LVS_ITCPO-TDTELELAND = NAST-TLAND.

        ENDIF.

        LVS_ITCPO-TDSENDDATE = NAST-VSDAT.

        LVS_ITCPO-TDSENDTIME = NAST-VSURA.

        LVS_ITCPO-TDFAXUSER  = NAST-USNAM.

      WHEN '3'.

        LVF_DEVICE = 'TELETEX'.

        LVS_ITCPO-TDTELENUM = NAST-TELTX.

        IF NAST-TLAND IS INITIAL.

          LVS_ITCPO-TDTELELAND = US_COUNTRY.

        ELSE.

          LVS_ITCPO-TDTELELAND = NAST-TLAND.

        ENDIF.

        LVS_ITCPO-TDSENDDATE = NAST-VSDAT.

        LVS_ITCPO-TDSENDTIME = NAST-VSURA.

     WHEN '4'.

        LVF_DEVICE = 'TELEX'.

        LVS_ITCPO-TDTELENUM = NAST-TELX1.

        IF NAST-TLAND IS INITIAL.

          LVS_ITCPO-TDTELELAND = US_COUNTRY.

        ELSE.

          LVS_ITCPO-TDTELELAND = NAST-TLAND.

        ENDIF.

        LVS_ITCPO-TDSENDDATE = NAST-VSDAT.

        LVS_ITCPO-TDSENDTIME = NAST-VSURA.

      WHEN OTHERS.

        LVF_DEVICE = 'PRINTER'.

    ENDCASE.

  ENDIF.

Max

0 Kudos

Thanks Max. The device is coming as MAIL. But the value for TNAPR-FONAM is EMPTY. I tried giving the SMARTFORM name in the debug mode but it still fails in the READ_FORM.

OPEN FORM calling ->LOAD_FORM calling-> GENERATE _FORM calling -> READ_FORM in which FOUND is returned as FALSE and thus the error.

Issue1: The TNAPR-FONAM is not assigned the SMARTFORM name.

Issue2: Even if i give the name SF - R2RBL_SDORC_L in debugging it is ending in error as this entry is not in STXH table.

I am not able to figure out these. Please let me know if anyone has any ideas?

Thanks in advance,

Karuna

0 Kudos

Hi

But your program needs to use a sapscript or a smartform?

TNAPR-FONAM should have the name of the sapscript

TNAPR-SFORM should have the name of the smartform

But if you need to use the smartform instead of the sapscript I suppose the ruotine to be called should be different.

You are running the routine for sapscript, so it can't works for smartform

Max

0 Kudos

Oh? I need to use SMARTFORM and not SAPSCRIPT. So RVADOR1 is not for SMARTFORMS? How do i know what routine to use for SMARTFORMS Max?

Thanks,

Karuna

0 Kudos

Max,

I was just checking the table TNAPR with SFORM = R2RBL_SDORC_L (SMARTFORM name). I see that PGNAM = ZRVADOR1.

Thanks,

Karuna

0 Kudos

Hi

So have you found the mistake?

Max

0 Kudos

Yes Max. Thanks for all your inputs. I was able to find the print program for smartforms. The print program is: R2RRVADOR01. I did not do much in here. It worked as it is.

Thanks,

Karuna

0 Kudos

Hello dears, I've just faced with "WRITE_FORM is invalid, OPEN_FORM is missing" during printing with Snatcher. And i have no idea about what this is "Check your print program where the OPEN_FORM fm is called". I don't know start from where. Can you guys help me ?

karuna.gangireddy :Hi Karuna, I am also facing same issue could you please help me regarding this issue. Same issue .Please help me with this. 7981141315. nast-nascha = 5 - email.

WRITE_FORM is invalid, OPEN_FORM is missing

karuna.gangireddy :Hi Karuna, I am also facing same issue could you please help me regarding this issue. Same issue .Please help me with this. 7981141315. nast-nascha = 5 - email.

WRITE_FORM is invalid, OPEN_FORM is missing