2015 Jul 16 10:02 AM
Hi,
I need to fetch the value from BI - TVARVC table ( bi variable table) to get the values for one flag - document type. DOC_TYPE. This value will be maintained in the TVARV table. I need to get the value through an ABAP routine written in the infopackage. Can you please advise.
infopackage - is to extract data from SAP ECC. Its a BI terminology.
Thank You
2015 Jul 16 10:22 AM
Hi Daniel,
Please go to the data selection tab on the infopackage . For the field DOC_TYPE select type variable as '6' and press enter, system will ask you to enter the name for your routine, upon completion you will get an ABAP editor where you will be able to enter the code.
Once you have completed the coding , save the infopackage, on the data selection tab, down you will see the routine check option, which can be used to verify your code.
Hope it helps.
Thanks,
Jino.
2015 Jul 16 10:22 AM
Hi Daniel,
Please go to the data selection tab on the infopackage . For the field DOC_TYPE select type variable as '6' and press enter, system will ask you to enter the name for your routine, upon completion you will get an ABAP editor where you will be able to enter the code.
Once you have completed the coding , save the infopackage, on the data selection tab, down you will see the routine check option, which can be used to verify your code.
Hope it helps.
Thanks,
Jino.
2015 Jul 16 11:05 AM
Jino, I am aware of the process and the method you have described. thanks for the info. But i am looking for the code which will be written in the infopackage to read the value from the TVARVC table. I am not good in ABAP and asking the abap code which i can use it in the infopackage.
Please help with the code if you knwo abap.
thank you
2015 Jul 16 2:22 PM
Hi Daniel,
I thought you were looking for the process, anyway you can try below code,
DATA: L_IDX LIKE SY-TABIX.
READ TABLE L_T_RANGE WITH KEY
FIELDNAME = 'DOC_TYPE'.
L_IDX = SY-TABIX.
DATA : wa_tvarvc type tvarvc.
SELECT SINGLE * FROM tvarvc INTO wa_tvarvc WHERE name = ' Please specify the variant name'
L_T_RANGE-LOW = wa_tvarvc-low.
L_T_RANGE-SIGN = wa_tvarvc-sign.
L_T_RANGE-OPTION = wa_tvarvc-opti.
L_T_RANGE-HIGH = wa_tvarvc-high.
APPEND L_T_RANGE.
MODIFY L_T_RANGE INDEX L_IDX.
P_SUBRC = 0.
Thanks,
Jino.
2015 Jul 16 4:09 PM
Hi Jino,
Thanks a lot for the code. I will try this out in the D box and update you tomorrow. Please find my below initial doubts, not sure if these are valid. Please advise.
1) for exmaple if maintain a variable zdoc_type in the TVARVC table, then I need to put this statement in the IP code.
SELECT SINGLE * FROM tvarvc INTO wa_tvarvc WHERE name = ' zdoc_type'.
for example if in future if we maintain doc_type value's as SB, BP, CC in the TVARVC table. Will the infopackage extract all the data in regards to the doc_type values. My requirement is we need to extract only 1 document type from the TVARVC table currently, but in future we might need to extract or maintain more values from the TVARVC table like AB., CD, DE etc for DOC_TYPE...then can we maintain all these values with the same variable ZDOC_TYPE in the tvarvc table ? Please modify the above select statement to extract whatever values given in the TVARVC table in future. Please update if I am not clear.
2) should I used the tech name of the IOBJ here in the below statement.
READ TABLE L_T_RANGE WITH KEY
FIELDNAME = '0DOC_TYPE' or it should be zdoc_type.( IOBJ name is 0DOC_TYPE).
3) Do I need to declarate zdoc_type in the data declaration.
4) if for example if I want to check another field in the same infopackage, then do I need a separate abap code by adding '6' in that field or I can add the code for that field as well in your given code after the modify statement..
Thanks again for the code.
Regards
DR
2015 Jul 16 5:35 PM
Hi Daniel,
The select is written under the assumption that you will be maintaining only one value , if you have multiple value try below code
DATA :IT_TVARVC TYPE TABLE OF TVARVC,
WA_TVARVC LIKE LINE OF IT_TVARVC.
SELECT * FROM TVARVC INTO TABLE IT_TVARVC WHERE NAME = 'zdoc_type'.
LOOP AT IT_TVARVC INTO WA_TVARVC.
L_T_RANGE-LOW = WA_TVARVC-LOW.
L_T_RANGE-SIGN = WA_TVARVC-SIGN.
L_T_RANGE-OPTION = WA_TVARVC-OPTI.
L_T_RANGE-HIGH = WA_TVARVC-HIGH.
APPEND L_T_RANGE.
ENDLOOP.
MODIFY L_T_RANGE INDEX L_IDX.
P_SUBRC = 0.
2) should I used the tech name of the IOBJ here in the below statement.
READ TABLE L_T_RANGE WITH KEY
FIELDNAME = '0DOC_TYPE' or it should be zdoc_type.( IOBJ name is 0DOC_TYPE).
Please use the infoobject name- 0DOC_TYPE
3) Do I need to declarate zdoc_type in the data declaration.
Not required
4) if for example if I want to check another field in the same infopackage, then do I need a separate abap code by adding '6' in that field or I can add the code for that field as well in your given code after the modify statement..
You may need to add separate ABAP code for each object.
Thanks,
Jino
2015 Jul 16 6:13 PM
Thank You so much Jose. really appreciate your help and for your prompt reply. Will put this in my code and update you asap. I also need your advise on the endroutine which is taking around 35 minutes to complete. Will post another thread for the same. Please advise. Thank again.
Good Night.
Regards
DR
2015 Jul 17 2:30 PM
Worked like a charm. You are awesome Jose. Thanks for your help. Awarded you full points.
Cheers
DR