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: 

A question about sets

former_member202733
Participant
0 Kudos

Hi guys!

I'm writing this post just to ask you something about sets.

I have a program with some constants and I would like to remove then and replace then for something more flexible... Those constants are storing data like :

c_user TYPE char30 VALUE 'SAP',

c_host TYPE char64 VALUE '12.49.35.77',

c_dest TYPE rfcdes-rfcdest VALUE 'SAPFTPA',

c_pwd TYPE char25 VALUE 'ZXDEP4T3C'.

I was thinking in create a table to store this data but a friend tell me about sets, but for me sets doesn't looks like a good choice for this specific case.

So I'm asking you guys a opinion. What's the better choice for something like that?

thanks in advance

Ronaldo.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Ronaldo

Rather than using sets, built for other purposes like report systems in the SAP ERP, I'd suggest to use table TVARV. This was designed to provide variants for ABAP reports, but it can be easily used to store ranges and fixed values for programs.

Values can be set in transaction STVARV and a sample code to retrieve values can be found here:

http://www.abapzombie.com/guias/2011/01/20/codigos-pequenos-e-uteis-parte-1-tvarv/

Regards

Luis Becker

3 REPLIES 3

Former Member
0 Kudos

Hello Ronaldo

Rather than using sets, built for other purposes like report systems in the SAP ERP, I'd suggest to use table TVARV. This was designed to provide variants for ABAP reports, but it can be easily used to store ranges and fixed values for programs.

Values can be set in transaction STVARV and a sample code to retrieve values can be found here:

http://www.abapzombie.com/guias/2011/01/20/codigos-pequenos-e-uteis-parte-1-tvarv/

Regards

Luis Becker

raymond_giuseppi
Active Contributor
0 Kudos

As written use TVARVC (TVARV is now only intended for variant not client dependent, system variant)

Then attach a variant to the transaction that will use those.

Hints:

Regards,

Raymond

Former Member
0 Kudos

Ronaldo,

We use sets a lot. I see no reason why this would not be a good use of sets. If you do use sets,  you have to consider who is going to maintain them and how do you keep all the people aware  of the sets that are being used.  Also, sets should be created and changed individually in each of the systems: development, QAC, and production.

The following is an example of some comments we put in all of our ABAP programs that use a set.  Also, we have a naming conventions  for any sets we create. Prefixs differs in ABAP programs versus validations or substitutions.

*************************************************************************
*  External Parameters: sets, distribution lists, ZRUNPARMS, etc.
************************************************************************
*
*  >>  SETS  <<
*
*  "ZABA_BUKRS_0000000000001"
*
*  Co Codes for Split Docs-ZFGLI003- NO Intercompany documents
*


Bruce