Application Development and Automation 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: 
Read only

Code help please

Former Member
0 Likes
794

Can anyone help me in wriitng the code for the following

First


I want to write a code to check the whether the following fields are present in TKVST table.

If SPRAS(language) has D, then The VERSI(Version) and VTEXT(description) should have the following values


SPRAS VERSI VTEXT

D 000 plan/Ist-version
D 001 Plan version änderung 1
D 002 plan version änderung 2
D 003 plan verison änderung 3


if SPRAS value is E then,The table TKVS must have the following values

SPRAS VERSI VTEXT

E 000 plan/Ist-version
E 001 Plan version revision 1
E 002 plan version revision 2
E 003 plan verison revision 3

Second


VERSI should not have a values from 004-009

third

VERSI can have values 100 and Above ?

2 REPLIES 2
Read only

Former Member
0 Likes
742

Hi Oliver,

The following code should give you some clues:

DATA: itab TYPE tkvst OCCURS 0,

wtab TYPE tkvst.

SELECT *

INTO itab

FROM tkvst

WHERE spras CO 'DE'.

IF sy-subrc EQ 0.

LOOP AT itab INTO wtab

WHERE spras EQ 'D'.

CASE wtab-versi.

WHEN '000'.

IF wtab-vtext NE 'plan/Ist-version'.

WRITE: / 'Error: ', wtab.

ELSE.

  • No error

ENDIF.

WHEN '001'.

IF wtab-vtext NE 'Plan version änderung 1'.

WRITE: / 'Error: ', wtab.

ELSE.

  • No error

ENDIF.

WHEN '002'.

IF wtab-vtext NE 'plan version änderung 2'.

WRITE: / 'Error: ', wtab.

ELSE.

  • No error

ENDIF.

WHEN '003'.

IF wtab-vtext NE 'plan verison änderung 3'.

WRITE: / 'Error: ', wtab.

ELSE.

  • No error

ENDIF.

WHEN '004' OR '005' OR '006' OR '007' OR '008' OR '009'.

WRITE: / 'Error: ', wtab.

WHEN OTHERS.

  • No Error

ENDCASE.

ENDLOOP.

LOOP AT itab INTO wtab

WHERE spras EQ 'D'.

CASE wtab-versi.

WHEN '000'.

IF wtab-vtext NE 'plan/Ist-version'.

WRITE: / 'Error: ', wtab.

ELSE.

  • No error

ENDIF.

WHEN '001'.

IF wtab-vtext NE 'Plan version revision 1'.

WRITE: / 'Error: ', wtab.

ELSE.

  • No error

ENDIF.

WHEN '002'.

IF wtab-vtext NE 'Plan version revision 2'.

WRITE: / 'Error: ', wtab.

ELSE.

  • No error

ENDIF.

WHEN '003'.

IF wtab-vtext NE 'Plan version revision 3'.

WRITE: / 'Error: ', wtab.

ELSE.

  • No error

ENDIF.

WHEN '004' OR '005' OR '006' OR '007' OR '008' OR '009'.

WRITE: / 'Error: ', wtab.

WHEN OTHERS.

  • No Error

ENDCASE.

ENDLOOP.

ENDIF.

Regards,

Rob.

Read only

Former Member
0 Likes
742

Hello Oliver,

The following SELECT statement should help you.

tables tkvst.

select *

from tkvst

where spras in ('DE','EN') and versi not in ('000','001','002','003')

or ( versi between '004' and '099' ).

write: / tkvst-spras, tkvst-versi, tkvst-vtext.

endselect.

Please note that I have not considered the field VTEXT here. I do not know the reason why you are writing this report, but these tind of tables contain control information (unlike other tables which contain the Master / Transaction data) are populated through the customizing transaction, SPRO. So usually somebody who wants to know the CO Versions and their texts would go to SPRO and then see the entries in the table directly.

Anyways, if you are very particular that the VTEXT field also contains exactly the values you have provided (case-sensivite), then you can extend the above select statement to achieve the same. Or, you might want to code another new select, which might provide you better code-readability.

Hope this information will be helpful.

Regards,

Anand Mandalika.