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

can anyone help me with the code

Former Member
0 Likes
711

Hi Experts

can anyone help me with the code . i want Value Category Code in Tranction Code:CJVC .i did Debug the program i am figuring the code but i cant get the right code from the program.

in the below i am comparing coep-KSTAR to CT_KSTAR_SETS-from if the both cost elements are equal than i am display the value category from TPIk3.the problem is its not refreshing.please help me.

  • get all assignments: cost element -> value category

SELECT * FROM TPIK3 INTO TABLE ET_TPIK3

WHERE KOKRS IN RT_KOKRS

AND APPL = V_APPL.

  • dissolve cost element groups

PERFORM F20_DISSOLVE_SET TABLES ET_TPIK3

CHANGING CT_KSTAR_SETS.

FORM F20_DISSOLVE_SET TABLES IT_TPIK3 STRUCTURE TPIK3

CHANGING CT_KSTAR_SETS TYPE T_KSTAR_SETS.

  • local declarations

DATA: ld_kokrs like tpik3-kokrs,

LD_SETNR LIKE TPIK3-KAGRU,

LD_SETID LIKE SETHIER-SETID,

LS_KSTAR_SET TYPE KSTAR_SETS,

LT_SET_VALUES LIKE SETVALUES OCCURS 0 WITH HEADER LINE.

LOOP AT IT_TPIK3 WHERE NOT KAGRU IS INITIAL.

  • call set manager modules

  • modify set name

LD_SETNR = IT_TPIK3-KAGRU.

IF LD_SETNR(2) = '0H'.

SHIFT LD_SETNR LEFT BY 2 PLACES.

ENDIF.

  • set CO area

if it_tpik3-kokrs <> ld_kokrs.

CALL FUNCTION 'K_KOKRS_SET'

exporting

I_KOKRS = it_tpik3-kokrs

POPUP = '0'.

ld_kokrs = it_tpik3-kokrs.

endif.

  • get setid

CALL FUNCTION 'G_SET_ENCRYPT_SETID'

EXPORTING

SETCLASS = '0102' "cost element group

SHORTNAME = LD_SETNR

KOKRS = IT_TPIK3-KOKRS

IMPORTING

SETID = LD_SETID

EXCEPTIONS

NO_CO_AREA_SPECIFIED = 1

ILLEGAL_SETCLASS = 2.

IF SY-SUBRC IS INITIAL.

  • get ranges of cost elements

CALL FUNCTION 'G_SET_TREE_IMPORT'

EXPORTING

NO_DESCRIPTIONS = 'X'

NO_RW_INFO = 'X'

SETID = LD_SETID

TABLES

SET_VALUES = LT_SET_VALUES

EXCEPTIONS

SET_NOT_FOUND = 1

ILLEGAL_FIELD_REPLACEMENT = 2

ILLEGAL_TABLE_REPLACEMENT = 3

OTHERS = 4.

IF SY-SUBRC IS INITIAL.

  • MOVE IT_TPIK3-KAGRU TO LS_KSTAR_SET-SETNR. "del 365567

MOVE LD_SETNR TO LS_KSTAR_SET-SETNR. "ins 365567

MOVE LD_SETID TO LS_KSTAR_SET-SETID.

LOOP AT LT_SET_VALUES.

MOVE LT_SET_VALUES-FROM TO LS_KSTAR_SET-FROM.

MOVE LT_SET_VALUES-TO TO LS_KSTAR_SET-TO.

APPEND LS_KSTAR_SET TO CT_KSTAR_SETS.

ENDLOOP.

ENDIF.

ENDIF.

ENDLOOP.

from

Hi Experts

can anyone help me with the code . i want Value Category Code in Tranction Code:CJVC .i did Debug the program i am figuring the code but i cant get the right code from the program.

in the below i am comparing coep-KSTAR to CT_KSTAR_SETS-from if the both cost elements are equal than i am display the value category from TPIk3.the problem is its not refreshing.please help me.

  • get all assignments: cost element -> value category

SELECT * FROM TPIK3 INTO TABLE ET_TPIK3

WHERE KOKRS IN RT_KOKRS

AND APPL = V_APPL.

  • dissolve cost element groups

PERFORM F20_DISSOLVE_SET TABLES ET_TPIK3

CHANGING CT_KSTAR_SETS.

FORM F20_DISSOLVE_SET TABLES IT_TPIK3 STRUCTURE TPIK3

CHANGING CT_KSTAR_SETS TYPE T_KSTAR_SETS.

  • local declarations

DATA: ld_kokrs like tpik3-kokrs,

LD_SETNR LIKE TPIK3-KAGRU,

LD_SETID LIKE SETHIER-SETID,

LS_KSTAR_SET TYPE KSTAR_SETS,

LT_SET_VALUES LIKE SETVALUES OCCURS 0 WITH HEADER LINE.

LOOP AT IT_TPIK3 WHERE NOT KAGRU IS INITIAL.

  • call set manager modules

  • modify set name

LD_SETNR = IT_TPIK3-KAGRU.

IF LD_SETNR(2) = '0H'.

SHIFT LD_SETNR LEFT BY 2 PLACES.

ENDIF.

  • set CO area

if it_tpik3-kokrs <> ld_kokrs.

CALL FUNCTION 'K_KOKRS_SET'

exporting

I_KOKRS = it_tpik3-kokrs

POPUP = '0'.

ld_kokrs = it_tpik3-kokrs.

endif.

  • get setid

CALL FUNCTION 'G_SET_ENCRYPT_SETID'

EXPORTING

SETCLASS = '0102' "cost element group

SHORTNAME = LD_SETNR

KOKRS = IT_TPIK3-KOKRS

IMPORTING

SETID = LD_SETID

EXCEPTIONS

NO_CO_AREA_SPECIFIED = 1

ILLEGAL_SETCLASS = 2.

IF SY-SUBRC IS INITIAL.

  • get ranges of cost elements

CALL FUNCTION 'G_SET_TREE_IMPORT'

EXPORTING

NO_DESCRIPTIONS = 'X'

NO_RW_INFO = 'X'

SETID = LD_SETID

TABLES

SET_VALUES = LT_SET_VALUES

EXCEPTIONS

SET_NOT_FOUND = 1

ILLEGAL_FIELD_REPLACEMENT = 2

ILLEGAL_TABLE_REPLACEMENT = 3

OTHERS = 4.

IF SY-SUBRC IS INITIAL.

  • MOVE IT_TPIK3-KAGRU TO LS_KSTAR_SET-SETNR. "del 365567

MOVE LD_SETNR TO LS_KSTAR_SET-SETNR. "ins 365567

MOVE LD_SETID TO LS_KSTAR_SET-SETID.

LOOP AT LT_SET_VALUES.

MOVE LT_SET_VALUES-FROM TO LS_KSTAR_SET-FROM.

MOVE LT_SET_VALUES-TO TO LS_KSTAR_SET-TO.

APPEND LS_KSTAR_SET TO CT_KSTAR_SETS.

ENDLOOP.

ENDIF.

ENDIF.

ENDLOOP.

from

3 REPLIES 3
Read only

Former Member
0 Likes
642

Hi,

no one can understand this code. Press button "format text as code" before posting the code.

Read only

StMou
Active Participant
0 Likes
642

HI,

Put your code between Markup

Rgds

Read only

ThomasZloch
Active Contributor
0 Likes
642

I tried, even with code tags it looks the same since the 2500 character limit is exceeded.

Please post just the relevant parts inside tags as mentioned, and choose a descriptive subject line.

I'm locking this thread.

Thomas