cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a sapscript form from a function module through OData Services

0 Kudos

Hello Experts,

I have created a Gateway project and under Create_Entity method calling a RFC. Through RFC I am passing the data to 'OPEN_FORM', 'WRITE_FORM', 'CLOSE_FORM' for getting the SAP Script form. In response I am getting a mail having Sap Script form as attachment but all the fields value are coming as blank.

I have gone through some of the earlier threads and have defined ITCPO field on TOP Include of RFC but still getting the blank form. Can somebody please help me regarding the same. What could be the possible issue.

Thanks for the help in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Florian
Active Contributor
0 Kudos

Hi Asad,


the most common issue you might have, is that through the RFC-Call the main-program of the form is different as the main-program from your global variables.

To solve it, you can pass the main-program (where your global vars are filled) during the open_form call with function start_form.

Put a break-point at open_form and have a look. Pretty sure this is the issue...

0 Kudos

Hi Florian,

Thanks for the suggestion.

As you said i tried to pass it. Actually I am updating a table and once it is updated automatically the data will be transferred to the form. Below you can see i am giving my code for clear understanding. I am putting the debugger in SE71 on the form name but it is not getting stopped whereas when i am calling it through report,debugger is getting stopped and can see the value and form with all the variables same I am getting back as mail. But in case of FM I am getting back the form in mail but empty variables.

INSERT INTO zstage VALUES gwa_zstage. "// GWA_ZSTAGE is declared globally and values are selected using select queries on various tables.

COMMIT WORK.

CLEAR: gwa_itcpo.

gwa_itcpo-tdimmed = gv_yes."'X'. "//GWA_ITCPO is also globally declared

gwa_itcpo-tdprogram = sy-repid.

gwa_itcpo-tdnewid = gv_no."' '.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

device = 'PRINTER'

dialog = ' '

form = 'ZSTAGE'

language = 'E'

options = gwa_itcpo

EXCEPTIONS

canceled = 1

device = 2

form = 3

options = 4

unclosed = 5

mail_options = 6

archive_error = 7

invalid_fax_number = 8

more_params_needed_in_batch = 9

spool_error = 10

codepage = 11

OTHERS = 12.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'MAIN'

element = 'HEADER_TEXT'

EXCEPTIONS element = 1

window = 2.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'MAIN'

element = 'BOX_SECTION'

EXCEPTIONS

element = 1

window = 2.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

window = 'MAIN'

element = 'MAIN_TEXT'

EXCEPTIONS

element = 1

window = 2.

CALL FUNCTION 'CLOSE_FORM'.

Please let me know if there is any changes required.

Florian
Active Contributor
0 Kudos

Hi Asad,

what do you try to print? gwa_zstage? and where do you run the coding? Inside the class ending with DPC_EXT?

If so, the reason is for sure the main-program, which you can solve by adding the start_form function module right behind the open_form.

Another option could be to run the program seperate. I mean put it into a function group and call it via an own function.

0 Kudos

what do you try to print? gwa_zstage? - I am trying to print ZSTAGE form and gwa_zstage is the work area holding the value through which I am updating table ZSTAGE.

and where do you run the coding? Inside the class ending with DPC_EXT? - Correct, I have used all this code in my RFC and calling this RFC through CREATE_ENTITY method from DPC_EXT class.

I have implemented the same START_FORM as told by you but still no luck. Debugger is also not stopping on that form but form I am getting through mail that means it is being called but debugger is not getting stopped 😞