Form routines in scripts...

hi everybody,
               can any one tell me the procedure how to use form routiens in scripts.
                  thnx in advance,
                        santosh.

Hi
See the sample routines
How to call a subroutine form SAPscripts
The Form :
/:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
/:USING &EKKO-EBELN&
/:CHANGING &CDECENT&
/:ENDPERFORM
The report :
REPORT zkrpmm_perform_z1medruck .
DATA : BEGIN OF it_input_table OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_input_table.
déclaration de la table output_table contenant les
variables exportées
DATA : BEGIN OF it_output_table OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_output_table.
DATA : w_ebeln LIKE ekko-ebeln,
w_vbeln LIKE vbak-vbeln,
w_zcdffa LIKE vbak-zcdffa.
FORM CDE_CENT
FORM cde_cent TABLES input output.
it_input_table[] = input[].
it_output_table[] = output[].
READ TABLE it_input_table INDEX 1.
MOVE it_input_table-value TO w_ebeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_ebeln
IMPORTING
output = w_ebeln.
SELECT SINGLE zcdffa FROM ekko
INTO w_zcdffa
WHERE ebeln = w_ebeln.
it_output_table-name = 'CDECENT'.
MOVE w_zcdffa TO it_output_table-value.
MODIFY it_output_table INDEX 1.
output[] = it_output_table[].
ENDFORM.
REPORT ZMPO1 .
form get_freight tables in_par structure itcsy out_par structure itcsy.
tables: ekko,konv,t685t.
data: begin of itab occurs 0,
         ebeln like ekko-ebeln,
         knumv like ekko-knumv,
       end of itab.
data: begin of itab1 occurs 0,
         knumv like konv-knumv,
         kposn like konv-kposn,
         kschl like konv-kschl,
         kbetr like konv-kbetr,
         waers like konv-waers,
         kwert like konv-kwert,
       end of itab1.
data: begin of iout occurs 0,
         kschl like konv-kschl,
         vtext like t685t-vtext,
         kbetr like konv-kbetr,
         kwert like konv-kwert,
       end of iout.
data v_po like ekko-ebeln.
read table in_par with key 'EKKO-EBELN'.
if sy-subrc = 0.
   v_po = in_par-value.
   select
     ebeln
     knumv
  from ekko
  into table itab
  where ebeln = v_po.
  if sy-subrc = 0.
    loop at itab.
      select
        knumv
        kposn
        kschl
        kbetr
        waers
        kwert
      into table itab1
      from konv
      where knumv = itab-knumv and
            kappl = 'M'.
    endloop.
    loop at itab1.
      if itab1-kposn <> 0.
        select single * from t685t
                          where kschl = itab1-kschl
                            and kappl = 'M'
                            and spras = 'EN'.
        iout-vtext = t685t-vtext.
        iout-kschl = itab1-kschl.
        iout-kbetr = itab1-kbetr.
        iout-kwert = itab1-kwert.
        append iout.
        clear iout.
      endif.
    endloop.
    sort itab1 by kposn.
    loop at iout.
      sort iout by kschl.
      if ( iout-kschl eq 'GSDC' OR
           iout-kschl eq 'GSFR' OR
           iout-kschl eq 'GSIR' ).
        at end of kschl.
          read table iout index sy-tabix.
          sum.
         write:/ iout-kschl,iout-vtext,iout-kwert.
      out_par-name = 'A1'.
      out_par-value = iout-vtext.
      append out_par.
      out_par-name = 'A2'.
      out_par-value = iout-kwert.
      append out_par.
          endat.
        endif.
      endloop.
    endif.
  endif.
endform.
IN THE FORM I AM WRITING THIS CODE.
/:DEFINE &A1& = ' '
/:DEFINE &A2& = ' '
/:PERFORM GET_FREIGHT IN PROGRAM ZMFORM_PO1
/:USING &EKKO-EBELN&
/:CHANGING &A1&
/:CHANGING &A2&
/:ENDPERFORM
&A1&
&A2&
This Code is to be written in the PO form under ADDRESS window.
/:DEFINE &A1& = ' '
/:DEFINE &A2& = ' '
/:DEFINE &A3& = ' '
/:DEFINE &A4& = ' '
/:DEFINE &A5& = ' '
/:DEFINE &A6& = ' '
/:PERFORM GET_VENDOR IN PROGRAM ZMFORM_PO
/:USING &EKKO-EBELN&
/:CHANGING &A1&
/:CHANGING &A2&
/:CHANGING &A3&
/:CHANGING &A4&
/:CHANGING &A5&
/:CHANGING &A6&
/:ENDPERFORM
&A1&
&A2&
&A3&
&A4&
&A5&
&A6&
Reward points for useful Answers
Regards
Anji

Similar Messages

  • Perform a form routine within a sap script form

    Hi!
    How can I
    perform a form routine within a sap script form.
    Regards
    sas

    OK,
    many thanks for your kindly reply.
    But basically there is a matter which I don't understand.
    Which way is the better way to loop at internal table:
    Solution1:
    FORM xxx.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
       DEVICE                           = 'PRINTER'
       FORM                             = 'ZSD_PACKING_LIST'
       LANGUAGE                     =  SY-LANGU   .
    LOOP AT gt_versand_plan INTO gw_versand_plan.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'SHELEM'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'MAIN' .
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'.
    ENDFORM.
    Solution 2:
    Having the LOOP within the  sapscript form -> 'ZSD_PACKING_LIST'
    Regards
    sas

  • Form routine problem

    what is the exact use of the form routine assigned in nace?
    eg:
    o/p type                                     script drv prog   form routine  formname
    NEU        (Purchase order)     SAPFM06P     ENTRY_NEU     MEDRUCK
    if i create any modifications in the form routine using itcsy then will i have to write all the code within this form routine?
    eg:
    perform <form routine name> in program zprog1.
    using
    changing
    endperform.
    i have searched sdn but cudnt find a suitable answer. pls explain with an example.

    Hi,
    The routine mentioned in the Nace will have the logic to Get the data required to ptint on the form and also it call the Form using the function modules lije Open_Form Start_form Write_form. If it is a smartform it calls the Smart form generated FM.
    Ex NACE--> ENTRY_NEU
    Driver Program in NACE is ZSAPFM06P
    This prgram contains the form  ENTRY_NEU
    Form ENTRY_NEU.
    *get the data
    *Call the form
    Endform.
    I hope it is clear.

  • Form routine for sales order adobe forms

    Hi Friends,
    I have a requirement to create z adobe forms for sales order for customized output type.
    When i checked, there is no form routine designed for calling the adobe forms.
    So, i am planning to copy the standard print program which is available for script and smartforms and creating a z form routine to include the function modules for calling the adobe form.
    Can any one please let me know whether have you worked in any of the same kind of situations and my apporach is ok or anything else can be done.
    Thanks & Regards,
    Prabu

    Hello,
    Plz check your caller program for the same and just find out the output type. for that purpose use the Tcode: NACE for finding the output type than proceed accordingly.
    Regards,
    Akg

  • Form rotuine for script

    Hi Gurus,
    How to attch or code form routine into driver program for Script?
    Plz reply fast its very urgent
    Martin

    Hi Martin,
    Lets suppose if u want to fetch the payment due for an invoice.
    Code this form routine in your script.
    /:   PERFORM GET_PYMT_DUE_IN IN PROGRAM ZSROINVOICE  
    /:       USING &VBDKR-VBELN&                         
    /:       USING &VBDKR-FKDAT&                         
    /:       USING &VBDKR-ZTERM&                         
    /:       CHANGING &PYMNTDUE&                         
    code it in ur driver program to fetch the details.
    FORM get_pymt_due TABLES i_intpar STRUCTURE itcsy
                             i_outpar STRUCTURE itcsy.
      DATA : wa_fkdat LIKE sy-datum,
             wa_ztag2 LIKE t052-ztag2,
             wa_pymnt LIKE sy-datum.
      READ TABLE i_intpar WITH KEY name = 'VBDKR-FKDAT'.
      IF sy-subrc = 0.
        CONCATENATE i_intpar-value6(4) i_intpar-value3(2)
        i_intpar-value+0(2)
               INTO wa_fkdat.
      ENDIF.
      READ TABLE i_intpar WITH KEY name = 'VBDKR-ZTERM'.
      IF sy-subrc = 0.
    Payment Terms
        SELECT SINGLE ztag2
                 INTO wa_ztag2
                 FROM t052
                WHERE zterm = i_intpar-value.
      ENDIF.
      wa_pymnt = wa_fkdat + wa_ztag2.
      MOVE 'PYMNTDUE' TO i_outpar-name.
      CONCATENATE wa_pymnt6(2) '.' wa_pymnt4(2) '.' wa_pymnt+0(4) INTO
                                                        i_outpar-value.
      APPEND i_outpar.
      CLEAR i_outpar.
    ENDFORM.      
    Hope this will help you.
    Revert back for furthe rassistance

  • Use of us_screen in the form routine :  FORM entry USING retcode us_screen

    Hello All,
    I have one print program entry routine as below.
    FORM entry USING retcode us_screen.
    Some code to print the form data...
    EndForm.
    When i Check the value of us_screen in the debuging, its value is coming as blank.
    When i checked the other form routine the value of us_screen is coming as 'X.
    I am my getting why in my case value of us_screen is coming as blank.
    What is significant of this field.
    Thanks & Regards
    Sachin Yadav

    Cusomization might be missing for that output type in transaction NACE.
    us_screen is blank because below query fails due to missing entry in table TNAPR.
    SELECT SINGLE * FROM TNAPR WHERE KSCHL = P_KSCHL
                               AND   NACHA = P_NACHA
                               AND   KAPPL = P_KAPPL.
    First assign the output type with a Transmission medium, Program, Form Routine, Form in transaction NACE
    Take the help of your functional consultant.

  • Form routines in CRM down loaded from R/3 for pricing

    Hi all,
    we have the following scenario:
    1) We have created an access sequence for tax condition in R/3 using standard form routines / requirements 7 (domestic) and 8 (export).
    2) The cutsomizing and conditions are down loaded to CRM (4.0) and the prices are calculated using the IPC.
    In R/3 the tax is determined correctly:
    check: komk-aland = komk-land1 -> domestic tax is determined.
    check: komk-aland ne komk-land1-> export tax is determined.
    In VOFM (R/3) it is possible to see the ABAP code of the requirement and set break points to check how the access is fullfilled.
    _Problem
    In CRM domestic tax is determined even though sold-to and ship-to party have different country codes. The same scenario that determines export tax in R/3 determines domestic tax in CRM.
    The pricing analysis in the transaction in CRM displays that the access is found and that requirement 7 is fullfilled which makes no sense.
    Does any one know where to find the code of the requirement in CRM and make a similar analysis with break points as in R/3 to see how the fields of the access are filled and the requirements are checked ? In customizing and the IPC only the form routine number is displayed but the code is not visisble.
    Thanks in advance,
    /Annette

    Hi Annette,
    I do not know what version of CRM you are running but I assume it is > 4.0. In all circumstances we are talking Java IPC developments which are not as easy to debug as ABAP. I will refer you to OSS note 809820 for further info.
    You can upload and download the Java devlopments to the CRM server in transaction /N/SAPCND/UE_DEV.
    Debugging is unfortunately not as easy as in R/3. I have not done it myself but I think you have to install Eclipse or NWDS on your machine. And then it should be possible to link it to CRM.
    There is some additional information here:
    http://help.sap.com/saphelp_nw04s/helpdata/en/f7/928f9e77da4588b9bf5e65d73bd674/content.htm
    But you definately need Java knowledge to do this
    Br,
    Anders

  • TRANSMISSION MEDIUM AND FORM ROUTINE IN CASE OF NACE TRANSACTION

    While saving a invoice, I have created a routine which will pick an output type when a certain condition is met.
    A custom report (Zprogram) needs to be triggered automatically during this invoice save. So we need to attach this Zprogram to output type.
    Could anybody tell me the transmission medium to be selected and also what needs to be entered in the field Form routine for this program which I have created in the transaction NACE->V3(Billing)->Output types->Processing routines?
    Thanks in advance.

    HI Shah,
    Form routine is nothing but a sub routine in your Z program (Driver Program). Simply one driver program can be used in multiple Layouts by using Form routines. If you are using the driver program only for one layout, then the routine declaration is not necessary.
    Simply select the transmission medium as Print out in case of print. Special function means whether you want trigger this form for only Bill-to-party or Ship-to-party etc.. I hope you need to maintain as SH or BP, check with your functional people once.
    You can check the below link for further customization reference.
    Link: [output type configuration;
    You can check the below link to know the exact meaning for Form routine.
    Link: [https://forums.sdn.sap.com/click.jspa?searchID=13772541&messageID=5319599]
    Regards,
    Raghu..

  • How to print " Duplicate " in FORM ( either Sap Script or Smart Forms )

    hi,
       How to print  " Duplicate " in FORM ( either Sap Script or Smart Forms ) if trying to take second Print Out and the FORM is already Printed.
    Please let me know the condition that we should go for.If possible let me know the SAMPLE code since this will be used in most of the FORMS.
    Regards
    Avi

    Hi
    It depends on which print you're working.
    If it's a print of standard document you can check the NAST (VSTAT field) table in order to know if the document was printed.
    If a message is created you can find the hit in NAST table:
    VSTAT = 0, document not printed;
    VSTAT = 1, documment printed
    VSTAT = 2, print is failed
    If you mean a custom print I believe you need to create a log like NAST table.
    Max

  • Error-handling in form routines to be called from maintenance  view

    hello,
    i have created a table maint. dialog. Under 'enviroment->modification->events' you can create form-routines for your own coding.
    I have the maint.event '01 - Before saving the data in the database'. Here i do some checks if entered values in some fields are okay or not etc.....
    When the users enters 'wrong' data i do a "message e000 with 'text' " So i got a error-message and the user is not able to save the data before changing it.
    BUT: i get the right error-message in the status-line, but i got an EMPTY screen, all the fields disapear. I have to go back with enter or the red cancel button. But then i 'fall back' to the selection screen of the maint. view. Thats not very user-friendly.
    Any ideas ?

    hi,
    think you have place your module not correct:
    try that: (without event)
    PROCESS AFTER INPUT.
      LOOP AT EXTRACT.
        FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
        CHAIN.
          FIELD Y789.
          FIELD Y012.
          MODULE LISTE_UPDATE_LISTE.
        ENDCHAIN.
    *begin of insertation
        CHAIN.
          FIELD Y123.
          FIELD Y456.
          module check_field  ON CHAIN-input.
        ENDCHAIN.
    *end of insertation
      ENDLOOP.
    Andreas

  • How to delete a Form Routine in Table Maintenance?

    Hello,
    Very Good Morning!
    How to delete a Form Routine in Table Maintenance?
    I had created a Form Routine at Environment>Modifcation>Events.
    I want to delete a Form Routine that I had created. Can any one please explain me the way I can delete it.
    Any suggestions are appreciated!
    Thanks & Regards
    Kittu

    Hello Rudra,
    Very Good morning!
    I am in Environment>Modification>Events.
    Here is had created a form routine ie...
    01   From_entry    Editor Icon
    In Editor Icon we will write the code.
    This will create a Include in the Function group.
    I had already comented that Include from the Function group. I can even delete it. But, I want to delete the Form Routine that I had created....
    01   From_entry    Editor Icon
    Can any one hepl me please...
    Thanks & Regards,
    Kittu

  • Global variable declaration in form routines

    Hi All,
    i am new of the smartforms, i have a small problem in smartforms.
    i need to display the one text based on the condtions, already i have putted the condtions in the condition tab for the text, i need to compare the one more condtion, the condtion is TB_INFORMATION IS NOT INITIAL.
    the code was devaloped in the formroutines , i need to implement the one condtion in the form routines,
    the condition is if TB_INFORMATION IS NOT INITIAL is not initial
                                  va_information = x.
                                endif.
    already i declared the variable in the global defination ,but i am getting the error.
    where can i declare the global variable in form routines.
    Please help me,
    Thanks & Regards
    charan

    declare in global data and it will be visible and available in form routines too.

  • Regarding form routines IN ECC 6.0

    Hi Abapers,
                       I am currently working in ECC 6.0. I have come through an error as
    se old_entry_xxx as a form routine if you use an own print program
    I have a form routine in my include program as follows...
    FORM ENTRY_NEU USING ENT_RETCO ENT_SCREEN.
      XSCREEN = ENT_SCREEN.
      IF NAST-AENDE EQ SPACE.
        XDRUVO = '1'.
      ELSE.
        XDRUVO = '2'.
      ENDIF.
      CLEAR: XFZ, XOFFEN, XLMAHN, XLPET.
      CLEAR ENT_RETCO.
      PERFORM LESEN USING NAST.
      MOVE RETCO TO ENT_RETCO.
    ENDFORM.   
    Can anyone give any hints regarding how to come out of this error, i guess its a unicode error but not sure.
    Frnds looking for ur help.
    thanks
    & regards,
    kamal

    Hi ,
           I have'nt come up with any solutions yet. But wht i consider is the perform doesnt exist for that form routine.I m wondering , Is that a form routine has any "perform". Frnds if anyone is having any clues plzz provide.
    Its basically a Upgrade task.
    thanking u all.
    regards,
    kamal

  • Form Routine in User Exit

    Hi
    I would like to include a form routine in user exit inlcude ZXTXWU01 but I guess that is not possible, so I created a new include ZXTXWZZZ in which I have developed the code for the form routines...
    But I still get the error in the main user exit ZXTXWU01 stating that the Form... End Form can be only after the End Function which obviously refers to the function module containing the main user exit..
    Please let me know how to over come this ....

    Hi,
    You cannot create another Form...EndForm if the first include ZXTXWU01 is already inside a Form..Endform.
    Meaning following structure is invalid:
                 Form first_form.
                       Include  zzzz
                 Endform.
    In  Include zzzz.
         Form  second_form.
         Endform.
    Instead of a Form..Endform subroutine...directly have the statements in the Include program and remove the Form..Endform.
    Regards,
    Subramanian

  • Form routines in smartforms

    how to use form routines in smartforms??..there is a option for using it in the global definition..plz explain the proper sequence of using it

    Hi Arun,
    In Form routines tab you enter routines that you want to use in the form via the program lines node. Within these form routines you cannot access any global data unless you explicitly pass them to the form routine interface.
    i hope this will be helpfull to u,
    Regards,
    swapnil

Maybe you are looking for

  • Music pauses for a second

    When I have music playing and I either click the lock button or enter or exit the Music app, the music will stop playing for a second, then start again. This isn't a problem per se, but it is rather annoying. It hadn't done this with iOS 3.

  • Connection lost and slow gtk apps

    Hi, I have a wireless connection (zd1211 chip). I am always connected to the router, but when it losts internet connection (telecom italia sucks), gtk apps (not qt) freeze for about 20 seconds before they start.(seems like a connection timed out) I h

  • Querying Multi-Record XML

    Hi, I have inserted the following XML document in to a table with an XMLType column: <?xml version="1.0" encoding="UTF-8"?> <PhotoImaging xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/xdb

  • Air Update Framework Issue... Help please!

    The following code is from the Air Employee Directory example to which I have added an Update Object, the app installs and updates with no problem, but as soon as the update is done and it's time for the app to start, the app just doesn't come up. It

  • Entry point for copying room content

    Hi ,   We are having a lot of collaboration rooms ,and am thinking if there is an easy way of transferring content from one room document folder to another room's document folder. Copying shows some entry points like public documents, personal docume