10-25-2007 9:26 PM
Hi folks,
iam uploading longtext in transaction KP06 in bdc programing using create_text.
now my problem is if i pass selection criteria
case 1:
Vertion : N0
fiscal year : 2007
planner profile: CCPLAN4
then the budeget plan data uploading successfully along with long text.
case2: Vertion : N1
in this case also everthing wrking fine
case3: Vertion : 001
in this case budgetplan data uploading sucessfully but longtext is not uploading,
i debbug the proragm , create_text also returning sy-subrc = 0. but if i check in KP06 the long text is not there.
data declaration
vertion : VERSN type C(3)
can u tell me the problem is in logic or with FM ?
note : i checked with save_text also.
regards
neeru
10-25-2007 9:29 PM
Hello Neeru,
use the combination of the SAVE_TEXT and COMMIT_TEXT.
For example:
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
HEADER = THEAD
INSERT = TEXT_NEU
SAVEMODE_DIRECT = TRUE
IMPORTING
FUNCTION = TEXT_FUNKTION
NEWHEADER = NEWTHEAD
TABLES
LINES = TEXTZEILEN
EXCEPTIONS
ID = 01
LANGUAGE = 02
NAME = 03
OBJECT = 04.
IF SY-SUBRC <> 0.
MOVE FALSE TO VERBUCHT.
MESSAGE E298 WITH SY-SUBRC.
ELSE.
CALL FUNCTION 'COMMIT_TEXT'.
* IMPORTING
* COMMIT_COUNT = I01.
MOVE TRUE TO VERBUCHT.
ENDIF.
Regards,
Naimesh Patel
10-25-2007 9:36 PM
HI Naimesh,
the FM Create_text internally contains both FMs save_text and commit_text,
even i debug the FM in case of vertion N1, N0 and 001,
all the cases sy-subrc = 0.
code:
CLEAR G_OBJNR.
LOOP AT RECORD.
COST = RECORD-BDC01.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = COST
IMPORTING
output = COST.
CONCATENATE 'KS' p_kokrs record-bdc00 INTO g_objnr.
SELECT SINGLE * FROM COSP WHERE OBJNR = g_objnr
AND GJAHR = P_GJAHR
AND VERSN = p_ver
AND KSTAR = COST.
IF SY-SUBRC = 0.
LEDNR = COSP-LEDNR.
OBJNR = COSP-OBJNR.
GJAHR = COSP-GJAHR.
WRTTP = COSP-WRTTP.
VERSN = COSP-VERSN.
KSTAR = COSP-KSTAR.
HRKFT = COSP-HRKFT.
VRGNG = COSP-VRGNG.
VBUND = COSP-VBUND.
PARGB = COSP-PARGB.
BEKNZ = COSP-BEKNZ.
TWAER = COSP-TWAER.
CONCATENATE LEDNR OBJNR INTO OBJNR.
CONCATENATE OBJNR GJAHR INTO TNAME1 separated BY SPACE10.
CONCATENATE TNAME1 WRTTP VERSN INTO TNAME2.
CONCATENATE TNAME2 KSTAR INTO TNAME3 separated BY SPACE.
CONCATENATE TNAME3 VRGNG INTO TNAME4 separated BY SPACE4.
CONCATENATE TNAME4 BEKNZ INTO TNAME5 separated BY SPACE10.
CONCATENATE TNAME5 TWAER INTO TNAME.
I_THEAD-TDOBJECT = 'CCSS'.
I_THEAD-TDID = 'COSP'.
I_THEAD-TDNAME = TNAME.
I_THEAD-TDSPRAS = 'E'.
APPEND I_THEAD.
i_tline-tdformat = '*'.
I_TLINE-TDLINE = RECORD-LONGTEXT.
APPEND I_TLINE.
loop at i_thead.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
FID = I_THEAD-TDID
FLANGUAGE = I_THEAD-TDSPRAS
FNAME = I_THEAD-TDNAME
FOBJECT = I_THEAD-TDOBJECT
SAVE_DIRECT = 'X'
FFORMAT = '*'
TABLES
FLINES = i_tline
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
CLEAR I_TLINE.
REFRESH I_TLINE.
CLEAR I_THEAD.
REFRESH I_THEAD.
SELECT SINGLE * from cokp into itab WHERE OBJNR = g_objnr
AND GJAHR = P_GJAHR
AND VERSN = p_ver
AND KSTAR = COST.
if sy-subrc = 0.
itab-TXFLG = 'X'.
append itab.
write:/ 'Text saved for', record-bdc00 , record-bdc01.
else.
write:/ 'Text saved for', record-bdc00 , record-bdc01.
ENDIF.
ENDIF.
my program wrking fine but the long text is not visible for vertion 001.
regards
niru
10-25-2007 9:41 PM
Hello Neeru,
I guess you should use DELETE_TEXT FM Before calling Create_TEXT or SAVE_TEXT.
For testing purpose call delete_text FM ,Delete the text then use Create-text.
CALL FUNCTION 'DELETE_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = c_tdid
LANGUAGE = 'E'
NAME = TNAME
OBJECT = 'ROUTING'
SAVEMODE_DIRECT = 'X'
TEXTMEMORY_ONLY = ' '
LOCAL_CAT = ' '
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
if sy-subrc eq 0.
use create_text here
endif.
Thanks
Seshu
10-25-2007 9:50 PM
Hello Neeru,
I think the problem is in this part of the code:
CONCATENATE LEDNR OBJNR INTO OBJNR.
CONCATENATE OBJNR GJAHR INTO TNAME1 separated BY SPACE10.
CONCATENATE TNAME1 WRTTP VERSN INTO TNAME2.
CONCATENATE TNAME2 KSTAR INTO TNAME3 separated BY SPACE.
CONCATENATE TNAME3 VRGNG INTO TNAME4 separated BY SPACE4.
CONCATENATE TNAME4 BEKNZ INTO TNAME5 separated BY SPACE10.
CONCATENATE TNAME5 TWAER INTO TNAME.
This works fine for the version with 2 digits (N1, N0) but not for the version with 3 digits (001).
What happens, with the version 001 is the all other values after the VERSN has shifted right with 1 digit.
To avoid this, I suggest you use like
TNAME+0(2) = LEDNR.
TNAME+2(10) = OBJNR.
and rest....
Hope you understand what I mean.
Regards,
Naimesh Patel
10-26-2007 12:51 AM
Hi naimesh
i chaecked in deubugging , there is no problem with length of vertion .
even the FM also returning sy-subrc = 0. but if i check in KP06 there is no long text available there.
please suggest me
10-26-2007 2:18 PM
Hello Neeru,
Can you please try to make the T_NAME in the following way?
TNAME+0(2) = LEDNR .
TNAME+2(22) = OBJNR .
TNAME+22(4) = GJAHR .
TNAME+26(2) = WRTTP .
TNAME+28(3) = VERSN .
TNAME+31(10) = KSTAR .
TNAME+41(4) = VRGNG .
TNAME+45(1) = BEKNZ .
TNAME+46(5) = TWAER.
Regards,
Naimesh Patel
10-27-2007 12:26 AM
Hi Naimesh,
i noticed some problem in conatactnation of TNAME,
now my program wrking fine
thanks for your help.
Regards
neeru
10-25-2007 9:32 PM
Use :
SAVEMODE_DIRECT = 'X' ( create_text or SAVE_TEXT FM )
after FM -> use below FM
if sy-subrc eq 0.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = t_header-TDOBJECT
NAME = t_header-TDNAME
ID = t_header-TDID
endif. LANGUAGE = t_header-TDSPRAS
Seshu