cancel
Showing results for 
Search instead for 
Did you mean: 

Call a function module from within a sapscript form

Former Member
0 Kudos

not being an ABAPer i have the task of changing the Invoice SAPScript form.

i have made the necessary changes - just about... but they have asked that i include the VAT Number on the Invoice....

not too bad apart from different company codes have different vat numbers...

not knowing a better way to retrieve data from table V_001_B - i am using the print program -RFKORD50, is there a better way of getting the VAT Number by company code? I figured if i could call the FM to return the value, all well and good.., they do not want the print program changed if possible so was looking at alternate methods....

or am i trying to reinvent the wheel here?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

thank you both! helpful answers! 🐵

anyway!

i have written the program which is called from the SAPScript:


    /:       PERFORM GET_VATNUMBER IN PROGRAM ZFI_F140_OPERATIONS
    /:       USING &BKPF-BUKRS&
    /:       CHANGING &VATNUMBER&
    CE       VAT Registration No : &VATNUMBER&


    REPORT zfi_f140_operations.

    FORM get_vatnumber TABLES in_par  STRUCTURE itcsy
                              out_par STRUCTURE itcsy.

      DATA: lv_co_code TYPE bukrs,
            lv_vat_no  TYPE stceg.

      READ TABLE in_par WITH KEY name = 'BKPF-BUKRS'.
      MOVE in_par-value TO lv_co_code.

      SELECT SINGLE stceg FROM t001
        INTO lv_vat_no WHERE bukrs = lv_co_code.

      out_par-name = 'VATNUMBER'.
      WRITE lv_vat_no TO out_par-value.
      CONDENSE out_par-value.

      MODIFY out_par INDEX 1.



    ENDFORM.               

it is not working and i cannot work out why...

i have not been ABAPing for very long but have had a go....

any thoughts as to what i have done wrong?

or point me where i should be looking? thank you!

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi ,

Place a bug point in

READ TABLE in_par

and also activate the debugger in se71, then run your program,

check whats happening inside the routine( whether your statements are executed successfully or not )

Former Member
0 Kudos

i have resolved it...

it was missing the ENDPERFORM! 🐵

kesavadas_thekkillath
Active Contributor
0 Kudos

You can create a subroutine pool and call a subroutine from a sap script.

Without modifying the print program this is the only way to call a fm from sap script.

But as you said you are not allowed to modify the print program, so there wont be any option provided to create a new program too i guess

Please search for 'sapscript subroutines' for more details

Former Member
0 Kudos

HI,

You can use a subroutine in the script and call the function module in a subroutine pool program instead of modifying the driver program.

Check the link to call subroutines in sap script

http://help.sap.com/saphelp_NW70EHP1/helpdata/en/d1/803279454211d189710000e8322d00/content.htm

Thanks & Regards

Sarves S

Edited by: Sarves Sombhatla on Mar 18, 2010 7:42 PM