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: 

How to Retrieve data from Variant Table

Former Member
0 Kudos

Can anyone help me by telling how to retrieve data from variant table which was created by user. I am able to see data of variant table only thru cu60 transaction but not se11. I s there any function module to do this?

1 ACCEPTED SOLUTION

athavanraja
Active Contributor
0 Kudos

use FM

RS_VARIANT_CONTENTS

Raja

10 REPLIES 10

athavanraja
Active Contributor
0 Kudos

use FM

RS_VARIANT_CONTENTS

Raja

0 Kudos

Durairaj Athavan Raja

Thank you for your reply, but the thing is the Functionally they have created a variant table for charecteristics of material in VA22 transaction.when ever I press F4 the data in F4 help should be populated from the variant table which is already populted in the table.This is my requirment. can you help me by telling how to do do this?

0 Kudos

Hello Mohan,

if u already have data and u want to populate it in F4 help then use below code -

u Have to make use of FM - 'F4IF_INT_TABLE_VALUE_REQUEST'

REPORT ZGILL_VALUE_REQUEST .

data: begin of lt_all occurs 0.

include structure DYNPREAD.

data end of lt_all.

data: begin of lt_selected occurs 0.

include structure DDSHRETVAL.

data: end of lt_selected.

DATA: BEGIN OF lt_code OCCURS 0,

code LIKE zgill_main-PERNR,

END OF lt_code.

data no_dyn like sy-dynnr.

Parameters : ECODE like zgill_main-PERNR.

*parameters: pernr like pa0001-pernr .

no_dyn = sy-dynnr. "give the scren no directly or sy-dynnr in case of report.

At selection-screen on value-request for ECODE.

select PERNR into table lt_code from zgill_main.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'ECODE'

dynpprog = sy-repid

dynpnr = no_dyn

dynprofield = 'ECODE'

window_title = 'Employee Details'

value_org = 'S'

DISPLAY = 'F'

TABLES

value_tab = lt_code

RETURN_TAB = lt_selected.

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 2

  • OTHERS = 3

*if sy-subrc eq '0' .

  • write: 'success'.

*endif.

read table lt_selected index sy-tabix.

move lt_selected-fieldval to ECODE.

0 Kudos

Hai Amit,

Thanks for replying me, My requirment is When we got to VA22 T-Code for material in line items there is button for charecteristics at bottom. As and when we go to charecteristics in T-Code itself if user presses F4 I need to retrieve data from variant table(not se11 object or parameters it is table which was created by FS people)for This I need to create a Function module which will be again assigned to charecteristics by FS people.The FM contains : retrieving data from variant table and populating in internal table and then displaying data as per your previuos code we can use the function module which was told by you. I want to populate the internal table that is my doubt so can you help me by telling how to get data from existing variant table (eg: YVARIANT_MAT :- table created by FS and it can be viewed only in t-code cu60 and not thru se11)

0 Kudos

Use FM CUTA_HEADER_TABLE_STRUC_READ to read ur variant details from the table as follwos -

CALL FUNCTION 'CUTA_HEADER_TABLE_STRUC_READ'

EXPORTING

CUTA_TABLE_NAME = VTNAM

IMPORTING

CUTA_TABLE_HEADER = CUVTAB.

and then use code for F4 help.

Amit

0 Kudos

Amit

Thank you but the function module is not able to take my variant table table name and leading to dump but i can see the variant table and data in it in t-cdoe cu60.The error message Iam facing is 'No variant table available' .

0 Kudos

Amit,

Hai even though the function module is not working for my program the tables names you specified in Function module were very helpfule to me and my requirment is solved. Thanks a lot.

pankaj_mittal
Explorer
0 Kudos

Hi Mohan

I am also facing the same problem...

Can u pls tell me how to fetch the data from variant of tcode CU60.. in a simpler manner.

thnx/Pankaj

Jelena
Active Contributor

I found this post through search and thought I'd update it in case anyone else is looking for the same thing.

I couldn't find an FM that would take the table name as input, but I was able to use FM CUTS_GET_VALUES_OF_TABLE. It needs the table number, which may be obtained from the table CUVTAB. CUVTAB-VTNAM = table name; CUVTAB-VTINT is the number that can be fed into this FM.

kzak
Explorer
0 Kudos

To retrieve data from variant tables you can use function modules:

CARD_TABLE_READ_STRUCTURE - get structure

CARD_TABLE_READ_ENTRIES - get data