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: 

Is it possible to eliminate hard coding in Sapscript Form?

walkerist
Participant
0 Kudos

So I have a SAPSCRIPT FORM named Z_FORM which as a logic of:

IF &VBRP-WERKS& = '1234' OR &VBRP-VSTEL& = '8888'.
"Logic here
ENDIF.

The print program of the Z_FORM is named Z_PROG. Assuming that the values WERKS and VSTEL is contained in a set named Z_SET. How do I apply in the SAPSCRIPT to check if the values of WERKS and VSTEL is in Z_SET? I assume that it can only be done in the print program.

3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos

I don't know if I understand "set" well. Try to search the forum: G_SET_GET_ALL_VALUES.

DominikTylczyn
Active Contributor
0 Kudos

Hello walkerist

In my opinion putting such logic into a SAP Script form and make it dependent on hardcoded values is a bad practice. What is so special about the plant 1234 and the shipping point 8888 that the form needs to be printed differently? What are you going to do if a new plant is created that needs the same printout, or you going to modify the form?

I would suggest:

  • either to have a dedicated form for the plant 1234 and the shipping point 8888 and have it determined with output determination settings. This way the values of plants and shipping points using this dedicated form are maintained in the configuration
  • or move the logic to the print program, remove hardcoded values and put them into a configuration table.

Best regards

Dominik Tylczynski

raymond_giuseppi
Active Contributor
0 Kudos

I would move this logic in the driver program not in the form. Fill a small set of variables in the driver and check the result in the form.