2015 Aug 13 2:47 AM
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.
2015 Aug 13 3:13 AM
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
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.
2015 Aug 13 3:13 AM
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
2015 Aug 13 3:49 PM
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
2015 Aug 13 10:56 PM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |