Regarding combining the 2 codes
hi,
i had deveoped a code in which i am displaying that these are the open items and close items. i had used the tables :- BSIK,BSAK.
I am able to create it in 2 different code but now i want to combine it .main data is in ITAB2 n itab3.
plzz help me in delepoing dis code,i will be very thankful to you all:-
here's d code:-
report ZNEW01
no standard page heading line-size 255.
***********BEGIN OF OPEN ITEMS*******************************
TABLES: RSEG.
DATA: BEGIN OF ITBKPF OCCURS 0,
BUKRS LIKE BKPF-BUKRS,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
AWKEY LIKE BKPF-AWKEY,
BUDAT LIKE BKPF-BUDAT,
XBLNR LIKE BKPF-XBLNR,
AWTYP LIKE BKPF-AWTYP,
END OF ITBKPF.
DATA: BEGIN OF ITAB2 OCCURS 0,
BUKRS LIKE BSIK-BUKRS,
GJAHR LIKE BSIK-GJAHR,
BELNR LIKE BSIK-BELNR,
WRBTR LIKE BSIK-WRBTR,
LIFNR LIKE BSIK-LIFNR,
END OF ITAB2.
DATA: BEGIN OF ITDEMO OCCURS 0,
BELNR LIKE RSEG-BELNR,
GJAHR LIKE RSEG-GJAHR,
LFBNR LIKE RSEG-LFBNR,
XBLNR LIKE RSEG-XBLNR,
END OF ITDEMO.
DATA: BEGIN OF ITFINAL OCCURS 0,
LFBNR LIKE RSEG-LFBNR,
BUKRS LIKE BKPF-BUKRS,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
AWKEY LIKE BKPF-AWKEY,
WRBTR LIKE BSIK-WRBTR,
LIFNR LIKE BSIK-LIFNR,
END OF ITFINAL.
*SELECT-OPTIONS: S_MBLNR FOR MKPF-MBLNR.
SELECT-OPTIONS: P_LFBNR FOR RSEG-LFBNR.
START-OF-SELECTION.
BKPF
SELECT BUKRS BELNR GJAHR AWKEY BUDAT XBLNR AWTYP
FROM BKPF
INTO (ITBKPF-BUKRS,ITBKPF-BELNR,ITBKPF-GJAHR,
ITBKPF-AWKEY,ITBKPF-BUDAT,ITBKPF-XBLNR,ITBKPF-AWTYP)
WHERE AWTYP EQ 'MKPF' OR AWTYP EQ 'RMRP'.
o MKPF
***********BEGIN OF TRY CODE***********
ITDEMO-BELNR = ITBKPF-AWKEY(10).
ITDEMO-GJAHR = ITBKPF-AWKEY+10(4).
ITDEMO-XBLNR = ITBKPF-XBLNR.
SELECT LFBNR FROM RSEG INTO
(ITDEMO-LFBNR) WHERE
BELNR EQ ITBKPF-AWKEY(10) AND
GJAHR EQ ITBKPF-AWKEY+10(4) AND
XBLNR EQ ITBKPF-XBLNR AND LFBNR > 0.
AND LFBNR > 0.
***********END OF TRY CODE**************
CHECK SY-SUBRC EQ 0 AND ITDEMO-LFBNR IN P_LFBNR.
o BSIK
ITAB2-BUKRS = ITBKPF-BUKRS.
ITAB2-GJAHR = ITBKPF-GJAHR.
ITAB2-BELNR = ITBKPF-BELNR.
SELECT WRBTR LIFNR FROM BSIK
INTO (ITAB2-WRBTR, ITAB2-LIFNR)
WHERE BUKRS EQ ITBKPF-BUKRS
AND GJAHR EQ ITBKPF-GJAHR
AND BELNR EQ ITBKPF-BELNR.
APPEND ITAB2.
EXIT.
ENDSELECT.
CHECK sy-subrc EQ 0?
APPEND ITDEMO.
EXIT.
ENDSELECT.
APPEND ITBKPF.
ENDSELECT.
Fields Found?
READ TABLE ITBKPF TRANSPORTING NO FIELDS INDEX 1.
IF sy-subrc NE 0.
MESSAGE i000(zmm1) WITH 'No documents found!'.
ENDIF.
Prepare Output
LOOP AT ITBKPF.
CLEAR ITAB2.
READ TABLE ITAB2
WITH KEY BUKRS = ITBKPF-BUKRS
BELNR = ITBKPF-BELNR
GJAHR = ITBKPF-GJAHR.
READ TABLE ITDEMO
WITH KEY BELNR = ITBKPF-AWKEY(10).
ITFINAL-LFBNR = ITDEMO-LFBNR.
ITFINAL-BUKRS = ITBKPF-BUKRS.
ITFINAL-BELNR = ITBKPF-BELNR.
ITFINAL-GJAHR = ITBKPF-GJAHR.
ITFINAL-AWKEY = ITBKPF-AWKEY.
ITFINAL-WRBTR = ITAB2-WRBTR.
ITFINAL-LIFNR = ITAB2-LIFNR.
APPEND ITFINAL.
CLEAR ITFINAL.
DELETE ITFINAL WHERE WRBTR = 0.
ENDLOOP.
END-OF-SELECTION
END-OF-SELECTION.
*DELETE ITFINAL WHERE WRBTR = 0.
Output
LOOP AT ITFINAL.
WRITE: / ITFINAL-LFBNR,ITFINAL-BELNR, ITFINAL-GJAHR,ITFINAL-AWKEY, ITFINAL-WRBTR, ITFINAL-LIFNR.
ENDLOOP.
************************END OF OPEN ITEMS******************************
*****************************BEGIN OF CLEARED ITEMS*******************************
*TABLES: RSEG.
*DATA: BEGIN OF ITBKPF OCCURS 0,
BUKRS LIKE BKPF-BUKRS,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
AWKEY LIKE BKPF-AWKEY,
BUDAT LIKE BKPF-BUDAT,
XBLNR LIKE BKPF-XBLNR,
AWTYP LIKE BKPF-AWTYP,
END OF ITBKPF.
*DATA: BEGIN OF ITAB3 OCCURS 0,
BUKRS LIKE BSAK-BUKRS,
GJAHR LIKE BSAK-GJAHR,
BELNR LIKE BSAK-BELNR,
WRBTR LIKE BSAK-WRBTR,
LIFNR LIKE BSAK-LIFNR,
AUGBL LIKE BSAK-AUGBL,
AUGDT LIKE BSAK-AUGDT,
XBLNR LIKE BSAK-XBLNR,
END OF ITAB3.
*DATA: BEGIN OF ITDEMO OCCURS 0,
BELNR LIKE RSEG-BELNR,
GJAHR LIKE RSEG-GJAHR,
LFBNR LIKE RSEG-LFBNR,
XBLNR LIKE RSEG-XBLNR,
END OF ITDEMO.
*DATA: BEGIN OF ITFINAL OCCURS 0,
LFBNR LIKE RSEG-LFBNR,
BUKRS LIKE BKPF-BUKRS,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
AWKEY LIKE BKPF-AWKEY,
WRBTR LIKE BSAK-WRBTR,
LIFNR LIKE BSAK-LIFNR,
AUGBL LIKE BSAK-AUGBL,
AUGDT LIKE BSAK-AUGDT,
END OF ITFINAL.
*SELECT-OPTIONS: P_LFBNR FOR RSEG-LFBNR.
*START-OF-SELECTION.
o BKPF
SELECT BUKRS BELNR GJAHR AWKEY BUDAT XBLNR AWTYP
FROM BKPF
INTO (ITBKPF-BUKRS,ITBKPF-BELNR,ITBKPF-GJAHR,
ITBKPF-AWKEY,ITBKPF-BUDAT,ITBKPF-XBLNR,ITBKPF-AWTYP)
WHERE AWTYP EQ 'MKPF' OR AWTYP EQ 'RMRP'.
o
+ MKPF
*****************BEGIN OF TRY CODE****************
ITDEMO-BELNR = ITBKPF-AWKEY(10).
ITDEMO-GJAHR = ITBKPF-AWKEY+10(4).
ITDEMO-XBLNR = ITBKPF-XBLNR.
SELECT LFBNR FROM RSEG INTO
(ITDEMO-LFBNR) WHERE
BELNR EQ ITBKPF-AWKEY(10) AND
GJAHR EQ ITBKPF-AWKEY+10(4) AND
XBLNR EQ ITBKPF-XBLNR AND LFBNR > 0.
CHECK SY-SUBRC EQ 0 AND ITDEMO-LFBNR IN P_LFBNR.
****************END OF TRY CODE*******************
o
+ BSAK
ITAB3-BUKRS = ITBKPF-BUKRS.
ITAB3-GJAHR = ITBKPF-GJAHR.
ITAB3-BELNR = ITBKPF-BELNR.
SELECT WRBTR LIFNR AUGBL AUGDT
FROM BSAK
INTO (ITAB3-WRBTR,ITAB3-LIFNR,ITAB3-AUGBL,ITAB3-AUGDT)
WHERE BUKRS EQ ITBKPF-BUKRS
AND GJAHR EQ ITBKPF-GJAHR
AND BELNR EQ ITBKPF-BELNR.
APPEND ITAB3.
EXIT.
ENDSELECT.
o CHECK sy-subrc EQ 0?
APPEND ITDEMO.
EXIT.
ENDSELECT.
APPEND ITBKPF.
ENDSELECT.
*SORT ITBKPF BY BELNR.
*SORT ITAB3 BY BELNR.
o Fields Found?
READ TABLE ITBKPF TRANSPORTING NO FIELDS INDEX 1.
IF sy-subrc NE 0.
MESSAGE i000(zmm1) WITH 'No documents found!'.
ENDIF.
o Prepare Output
LOOP AT ITBKPF.
CLEAR ITAB3 .
READ TABLE ITAB3
WITH KEY BUKRS = ITBKPF-BUKRS
BELNR = ITBKPF-BELNR
GJAHR = ITBKPF-GJAHR. .
READ TABLE ITDEMO
WITH KEY BELNR = ITBKPF-AWKEY(10).
ITFINAL-LFBNR = ITDEMO-LFBNR.
ITFINAL-BUKRS = ITBKPF-BUKRS.
ITFINAL-BELNR = ITBKPF-BELNR.
ITFINAL-GJAHR = ITBKPF-GJAHR.
ITFINAL-AWKEY = ITBKPF-AWKEY.
ITFINAL-WRBTR = ITAB3-WRBTR.
ITFINAL-LIFNR = ITAB3-LIFNR.
ITFINAL-WRBTR = ITAB3-WRBTR.
ITFINAL-AUGBL = ITAB3-AUGBL.
ITFINAL-AUGDT = ITAB3-AUGDT.
APPEND ITFINAL.
CLEAR ITFINAL.
DELETE ITFINAL WHERE WRBTR = 0.
ENDLOOP.
SORT ITFINAL BY BELNR.
o END-OF-SELECTION
*END-OF-SELECTION.
o Output
LOOP AT ITFINAL.
WRITE: / ITFINAL-LFBNR,ITFINAL-BELNR,ITFINAL-AUGBL,ITFINAL-AUGDT,ITFINAL-GJAHR,ITFINAL-BUKRS,ITFINAL-AWKEY,ITFINAL-WRBTR,ITFINAL-LIFNR.
ENDLOOP.
Edited by: abaper2008 on Jun 5, 2008 7:49 AM
Edited by: abaper2008 on Jun 5, 2008 8:11 AM
hi,
I HAD MODIFIED THE CODE ,plzz tell me how to make display the data from itab3 and itab2.
here's d code:-
TABLES: RSEG.
**********DECLARATION OF TABLES************
DATA: BEGIN OF ITBKPF OCCURS 0,
BUKRS LIKE BKPF-BUKRS,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
AWKEY LIKE BKPF-AWKEY,
BUDAT LIKE BKPF-BUDAT,
XBLNR LIKE BKPF-XBLNR,
AWTYP LIKE BKPF-AWTYP,
END OF ITBKPF.
DATA: BEGIN OF ITAB2 OCCURS 0,
BUKRS LIKE BSIK-BUKRS,
GJAHR LIKE BSIK-GJAHR,
BELNR LIKE BSIK-BELNR,
WRBTR LIKE BSIK-WRBTR,
LIFNR LIKE BSIK-LIFNR,
AUGBL LIKE BSAK-AUGBL,
AUGDT LIKE BSAK-AUGDT,
END OF ITAB2.
DATA: BEGIN OF ITAB3 OCCURS 0,
BUKRS LIKE BSAK-BUKRS,
GJAHR LIKE BSAK-GJAHR,
BELNR LIKE BSAK-BELNR,
WRBTR LIKE BSAK-WRBTR,
LIFNR LIKE BSAK-LIFNR,
AUGBL LIKE BSAK-AUGBL,
AUGDT LIKE BSAK-AUGDT,
END OF ITAB3.
DATA: BEGIN OF ITDEMO OCCURS 0,
BELNR LIKE RSEG-BELNR,
GJAHR LIKE RSEG-GJAHR,
LFBNR LIKE RSEG-LFBNR,
XBLNR LIKE RSEG-XBLNR,
END OF ITDEMO.
DATA: BEGIN OF ITFINAL OCCURS 0,
LFBNR LIKE RSEG-LFBNR,
BUKRS LIKE BKPF-BUKRS,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
AWKEY LIKE BKPF-AWKEY,
WRBTR LIKE BSIK-WRBTR,
LIFNR LIKE BSIK-LIFNR,
AUGBL LIKE BSAK-AUGBL,
AUGDT LIKE BSAK-AUGDT,
END OF ITFINAL.
*********END OF DECLARATIONS************
SELECT-OPTIONS: P_LFBNR FOR RSEG-LFBNR.
START-OF-SELECTION.
BKPF
SELECT BUKRS BELNR GJAHR AWKEY BUDAT XBLNR AWTYP
FROM BKPF
INTO (ITBKPF-BUKRS,ITBKPF-BELNR,ITBKPF-GJAHR,
ITBKPF-AWKEY,ITBKPF-BUDAT,ITBKPF-XBLNR,ITBKPF-AWTYP)
WHERE AWTYP EQ 'MKPF' OR AWTYP EQ 'RMRP'.
MKPF
***********BEGIN OF TRY CODE***********
ITDEMO-BELNR = ITBKPF-AWKEY(10).
ITDEMO-GJAHR = ITBKPF-AWKEY+10(4).
ITDEMO-XBLNR = ITBKPF-XBLNR.
SELECT LFBNR FROM RSEG INTO
(ITDEMO-LFBNR) WHERE
BELNR EQ ITBKPF-AWKEY(10) AND
GJAHR EQ ITBKPF-AWKEY+10(4) AND
XBLNR EQ ITBKPF-XBLNR AND LFBNR > 0.
CHECK SY-SUBRC EQ 0 AND ITDEMO-LFBNR IN P_LFBNR.
ITAB2-BUKRS = ITBKPF-BUKRS.
ITAB2-GJAHR = ITBKPF-GJAHR.
ITAB2-BELNR = ITBKPF-BELNR.
ITAB3-BUKRS = ITBKPF-BUKRS.
ITAB3-GJAHR = ITBKPF-GJAHR.
ITAB3-BELNR = ITBKPF-BELNR.
BSIK
IF ITAB2-BUKRS = ITBKPF-BUKRS AND ITAB2-BELNR = ITBKPF-BELNR AND ITAB2-GJAHR = ITBKPF-GJAHR.
SELECT WRBTR LIFNR FROM BSIK
INTO (ITAB2-WRBTR, ITAB2-LIFNR)
WHERE BUKRS EQ ITBKPF-BUKRS
AND GJAHR EQ ITBKPF-GJAHR
AND BELNR EQ ITBKPF-BELNR.
APPEND ITAB2.
EXIT.
ENDSELECT.
ELSEIF ITAB3-BUKRS = ITBKPF-BUKRS AND ITAB3-BELNR = ITBKPF-BELNR AND ITAB3-GJAHR = ITBKPF-GJAHR.
BSAK
SELECT WRBTR LIFNR AUGBL AUGDT
FROM BSAK
INTO (ITAB3-WRBTR,ITAB3-LIFNR,ITAB3-AUGBL,ITAB3-AUGDT)
WHERE BUKRS EQ ITBKPF-BUKRS
AND GJAHR EQ ITBKPF-GJAHR
AND BELNR EQ ITBKPF-BELNR.
APPEND ITAB3.
EXIT.
ENDSELECT.
ENDIF.
CHECK sy-subrc EQ 0?
APPEND ITDEMO.
EXIT.
ENDSELECT.
APPEND ITBKPF.
ENDSELECT.
Fields Found?
READ TABLE ITBKPF TRANSPORTING NO FIELDS INDEX 1.
IF sy-subrc NE 0.
MESSAGE i000(zmm1) WITH 'No documents found!'.
ENDIF.
Prepare Output
LOOP AT ITBKPF.
IF ITAB2-BUKRS = ITBKPF-BUKRS AND ITAB2-BELNR = ITBKPF-BELNR AND ITAB2-GJAHR = ITBKPF-GJAHR.
CLEAR ITAB2.
READ TABLE ITAB2
WITH KEY BUKRS = ITBKPF-BUKRS
BELNR = ITBKPF-BELNR
GJAHR = ITBKPF-GJAHR.
ITFINAL-WRBTR = ITAB2-WRBTR.
ITFINAL-LIFNR = ITAB2-LIFNR.
ELSE.
CLEAR ITAB3.
READ TABLE ITAB3
WITH KEY BUKRS = ITBKPF-BUKRS
BELNR = ITBKPF-BELNR
GJAHR = ITBKPF-GJAHR. .
ITFINAL-WRBTR = ITAB3-WRBTR.
ITFINAL-LIFNR = ITAB3-LIFNR.
ENDIF.
READ TABLE ITDEMO
WITH KEY BELNR = ITBKPF-AWKEY(10).
ITFINAL-LFBNR = ITDEMO-LFBNR.
ITFINAL-BUKRS = ITBKPF-BUKRS.
ITFINAL-BELNR = ITBKPF-BELNR.
ITFINAL-GJAHR = ITBKPF-GJAHR.
ITFINAL-AWKEY = ITBKPF-AWKEY.
APPEND ITFINAL.
CLEAR ITFINAL.
DELETE ITFINAL WHERE WRBTR = 0.
ENDLOOP.
END-OF-SELECTION
END-OF-SELECTION.
Output
WRITE: /' OPEN ITEMS -> PAYMENTS ARE NOT DONE'.
ULINE.
WRITE: / 'MAT.DOC. A/C DOC. YEAR REF.KEY AMOUNT VENDOR' .
ULINE.
LOOP AT ITFINAL.
WRITE: / ITFINAL-LFBNR,ITFINAL-BELNR, ITFINAL-GJAHR,ITFINAL-AWKEY, ITFINAL-WRBTR, ITFINAL-LIFNR.
ENDLOOP.
plzz tell me how do i display the data from both the ITAB2 and itab3.
Edited by: abaper2008 on Jun 5, 2008 11:28 AM
Similar Messages
-
Issues regarding Transporting the Custom codes and Text Elements
I created a custom t-code and had some text elements for my ABAP program in DEV, I transported quality an it worked , but when i transport it production it did not transport the custom code and the text elements. Can u guys give me steps to take for the custom code and the text to be transported sucessfully??
Hi,
Please check whether the Tcode and Text elements are assigned to the particular Transport Request number. If it is an enhancement that Tcode and Text elements might be there in QA before itself and so this is working. You need to add the TCode manually while transporting the request and transport it to QA and PRD.
Thanks and Regards
Sowmmya VB -
Regarding reset the security code.
I have a nokia 305 asha mobile. I am using default security code for lock and unlock the mobile. But I am not getting a away to reset that password. How can I access the reset option? kindly do the needful.
Thanks
Surjith K.S.How about going to Menu > Settings > Security > Access codes > Security code?
Happy to have helped forum in a small way with a Support Ratio = 37.0 -
Regarding the security code to connect my iPhone to iTunes.
Is there any way to use the computer to do the security code? My iPhone is destroyed and I need to do the security code to be able to take a backup of it. Please help me!
people repairing iphones aren't able to do it. if you've made a backup in itunes prior to right now, you can restore from that backup even if you've got a passcode lock on the device by putting it into DFU mode. However, you're saying that you're trying to back up your device which can only be done if the phone isn't locked with a passcode. If there were a way around this, people could steal other people's phones with passcode locks on them, plug said stolen phone into a computer, bypass the lock, then make a backup of someone else's information. This simply cannot be done for security reasons
-
Need help regarding report ( i need the transaction code copy of the query)
Hi,
I want to copy the query designer fields and those field i have to use another query for that can any one give me the transaction code for copy query
thanks
phanidharRSZC = to coy quer from on infoprovider to another..
HOpe it helps
Thanks for points assigned -
User exit for ME21N for displaying the tax code from custom table
Hi,
I have a requirement, in our system, the inforecord is not maintain for all the material and vendor combination, we have a custom table in which we have maintain the
Compnay code, Pur. Org., Vendor code Tax code, juridiction code
now we want that when a Po is created with ME21 or ME21N the tax code and jurisdiction code should be come from this table and if entry not found in this table then it should search as per the regular process like from last Po or info record. then which user exit we can use for this.
regards,
zafarCLOSE
-
[JNI Beginner] GC of Java arrays returned by the native code
Hello all,
I am beginning with JNI, to integrate a C library that pilots an industrial equipment, into a java UI. This library enables to exchange various proprietary PDUs (protocol data units), with the equipment, up and down (request/replies). Both requests and replies are arrays of bytes (+char*+).
"Request" byte arrays are constructed by Java code, which passes them to the JNI code that glues with the lib. "Reply" byte arrays are returned to the Java code, which analyzes them.
The "return reply" part is very similar to this [tutorial example|http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html] , which returns bytes read from a file. However there's something I don't understand with regard to garbage collection of the returned byte array:
- in this stock example, the C code creates a Java byte array fills it, and simply returns it (example code stripped to highlight only the parts relevant to my question):
jByteArray=(*env)->NewByteArray(env, size);
(*env)->SetByteArrayRegion(env, jByteArray, 0, size, (jbyte *)sourceBytes);
return (jByteArray);What will happen to this Java array (jByteArray) with regard to garbage collection?
- if it's no more referenced (the example Java code just systemouts it and forgets it), will it be eligible to GC?
- if it is referenced by a Java variable (in my case, I plan to keep a reference to several replies as the business logic requires to analyze several of them together), do regular Java language GC rules apply, and prevent eligibility of the array to GC as long as it's referenced?
That may sound obvious, but what mixes me up is that the same tutorial describes memory issues in subsequent chapters: spécifically, the section on "passing arrays states that:
[in the example] the array is returned to the calling Java language method, which in turn, garbage collects the reference to the array when it is no longer usedThis seems to answer "yes" to both my questions above :o) But it goes on:
The array can be explicitly freed with the following call:
{code} (*env)-> ReleaseByteArrayElements(env, jByteArray, (jbyte *)sourceBytes, 0);{code}Under what circumstances would one need to explicitly free jByteArray when it's about to be returned to the Java calling method? Or does this sentence apply to completely different situations (such as, when the array is +not+ returned as is to a Java method)?
The tutorial's next section has a much-expected +memory issues+ paragraph, from which I quote:
By default, JNI uses local references when creating objects inside a native method. This means when the method returns, the references are eligible to be garbage collected.I assume this means, +unless the references are assigned, in the Java code, to a Java variable+, right?
If you want an object to persist across native method calls, use a global reference instead. A global reference is created from a local reference by calling NewGlobalReference on the the local reference.I assume this enables the C code to maintain a global reference to a java object even if it's not referenced anymore from the Java variables, right?
I also checked the [JNI specification|http://download-llnw.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp1242] , but this didn't clear the doubt completely:
*Global and Local References*
The JNI divides object references used by the native code into two categories: local and global references. Local references are valid for the duration of a native method call, and are automatically freed after the native method returns. Global references remain valid until they are explicitly freed.
Objects are passed to native methods as local references. All Java objects returned by JNI functions are local references. The JNI allows the programmer to create global references from local references. JNI functions that expect Java objects accept both global and local references. A native method may return a local or global reference to the VM as its resultAgain I assume the intent is that Global references are meant for objects that have to survive across native calls, regardless of whether they are referenced by Java code. But what worries me is that combining both sentences end up in +All Java objects returned by JNI functions are local references (...) and are automatically freed after the native method returns.+.
Could you clarify how to make sure that my Java byte arrays, be they allocated in C code, behave consistently with a Java array allocated in Java code (I'm familiar already with GC of "regular" Java objects)?
Thanks in advance, and best regards,
J.jduprez wrote:
Hello all,
I am beginning with JNI, to integrate a C library that pilots an industrial equipment, into a java UI. This library enables to exchange various proprietary PDUs (protocol data units), with the equipment, up and down (request/replies). Both requests and replies are arrays of bytes (+char*+).
"Request" byte arrays are constructed by Java code, which passes them to the JNI code that glues with the lib. "Reply" byte arrays are returned to the Java code, which analyzes them.
The "return reply" part is very similar to this [tutorial example|http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html] , which returns bytes read from a file. However there's something I don't understand with regard to garbage collection of the returned byte array:
- in this stock example, the C code creates a Java byte array fills it, and simply returns it (example code stripped to highlight only the parts relevant to my question):
jByteArray=(*env)->NewByteArray(env, size);
(*env)->SetByteArrayRegion(env, jByteArray, 0, size, (jbyte *)sourceBytes);
return (jByteArray);What will happen to this Java array (jByteArray) with regard to garbage collection?It will be collected when it is no longer referenced.
The fact that you created it in jni doesn't change that.
The array can be explicitly freed with the following call:
(*env)-> ReleaseByteArrayElements(env, jByteArray, (jbyte *)sourceBytes, 0);Under what circumstances would one need to explicitly free jByteArray when it's about to be returned to the Java calling method? Or does this sentence apply to completely different situations (such as, when the array is not returned as is to a Java method)?
Per what the tutorial says it is either poorly worded or just wrong.
An array which has been properly initialized it a just a java object. Thus it can be freed like any other object.
Per your original question that does not concern you because you return it.
In terms of why you need to explicitly free local references.
[http://download-llnw.oracle.com/javase/6/docs/technotes/guides/jni/spec/design.html#wp16785]
The tutorial's next section has a much-expected memory issues paragraph, from which I quote:
By default, JNI uses local references when creating objects inside a native method. This means when the method returns, the references are eligible to be garbage collected.I assume this means, unless the references are assigned, in the Java code, to a Java variable, right?As stated it is not precise.
The created objects are tracked by the VM. When they are eligible to be collected they are.
If you create a local reference and do NOTHING that creates an active reference elsewhere then when the executing thread returns to the VM then the local references are eligible to be collected.
>
If you want an object to persist across native method calls, use a global reference instead. A global reference is created from a local reference by calling NewGlobalReference on the the local reference.That is not precise. The scope is the executing thread. You can pass a local reference to another method without problem.
I assume this enables the C code to maintain a global reference to a java object even if it's not referenced anymore from the Java variables, right?
It enables access to it to be insured across multiple threads in terms of execution scope. Normally you should not use them. -
Key combination of Tax code / Vendor not working for JVRD condition Type.
Dear All.
I have maintain the pricing condition JVRD under key combination of Tax Code / Vendor . But the same is not reflecting in the Purchase Order. Have also checked the validity periods .
Kndly advice
AVSHi
Please check the following:
1. whether you have maintained the cond.type in tax procedure in tcode OBQ3.
2. whether you have maintained the cond.type in IMG activity: LogisticsGeneral>>Tax on goods mov.>>India>>Determination of excise duty>>Cond.based excise determination>> classification of condition type
3. Also, check whether any other condition record is maintained for the vendor at any other level in FV13.
Regards
Prabhu -
Invalid Business Area in combination with company code
Dear Expert,
I have just created a new business area, however, when doing a posting against the new business area I got prompted an error message "Invalid Business Area 7000 with combination of company code 0001". Could anyone tell me what setting did I miss?
Thank youHi...
As per your issue..i think your company is using validation for your business area avoiding miss usage.
In this case once created new business area you have to update new business area in GGB0 T.code at company code level
So go to GGB0 and click on Financial accounting -> line item -> here select your company code and click on business area here enter your new business area and save it after that come back one step and select your company code go to Validation at menu bar select transport.
I hope it will helps you and let me know if you have any doubts
Regards
vamsi -
What is the function code of create new session?
what is the function code of create new session?
thanks...Hi
Please put a "/n" (to open a new session after killing the current session)
or "/o" (to open a new session without killing the current session)
or "/i" (to end the current session) before the below T Codes as per your requirement...
<u><b>For more Tcodes check the following</b></u>
=>smartforms - Smartforms (SAP Form Builder to Create and Adjust Forms)
=>cmod - Enhancements, User Exits (Project Tool to coordinate changes into projects for the purpose of activating all user exits for a particular project)
=>sale - ALE Customizing
=>bale - Distribution Administration (ALE)
=>wedi - IDOC Type and EDI Basis
=>shdb - BDC (Transaction Recorder)
=>lsmw - LSMW
=>bapi - BAPI
=>spau - Display Modified DE Objects
=>spdd - Display Modified DDIC Objects
=>sara - central idoc archiving
=>stms - Transport Management System
=>wedi - IDOC Type and EDI Basis (IDOC Configuration)
=>bd21 - Analyze change pointers - create IDOC from change pointer
=>bd10 - Send Material Master
=>bd12 - Send Customer Master
=>bd14 - Send Vendor Master
=>bd50 - Activate Change Pointer for Message Type
=>bd55 - Conversion rule user exit (Link conversion rule user exit to the different system \ partner combinations)
=>bd54 - Maintain Logical Systems
=>bd71 - Distribute Customer Model
=>bd87 - Process Inbound IDOCs
=>bd88 - Process Outbound IDOCs
=>bdm2 - Cross-system IDOC Reporting
=>bdm7 - ALE Audit - statistical analyses
=>bdm8 - ALE Audit - sending confirmations
=>bd61 - Activate Change Pointer generally
=>bmv0 - Direct Input Data Transfer Administration
=>rz04 - Operation Mode
=>rz12 - RFC Server Group Maintenance
=>sar3 - Archiving object customizing
=>s001 - SAPoffice Inbox
=>s010 - Standards Texts (SAP Script)
=>se01 - Transport Organizer (Extended View - Performing and managing the transport of development object across different systems)
=>se09 - Transport (Workbench) Organizer (Controlling and keeping track of Development work and Development Objects)
=>se24 - Class Builder (BAPI)
=>se30 - Runtime Analysis
=>se36 - LDB
=>se37 - Function Builder
=>se38 - ABAP Editor (to modify ABAP programs)
=>se39 - Split-Screen-Editor
=>se11 - ABAP Dictionary
=>se16 - Data Browser (Table contents display)
=>se41 - Menu Painter
=>se51 - Screen Painter
=>se71 - SAPScript Forms
=>se73 - SAPScript Font Maintenance
=>se75 - Graphic Objects and Graphic IDs Sapscript Settings
=>se78 - Administration of Form Graphics (Import Graphics into SAP System)
=>se80 - Object Navigator
=>se84 - ABAP Repository Information (search for SAP objects)
=>se91 - Message Maintenance
=>se93 - Maintain T codes
=>su01 - User Maintenance (Security)
=>su02 - Maintain Authorization Profiles
=>su03 - Maintain Authorizations
=>slg1 - Evaluate Application Log
=>sm12 - Lock Entries
=>sm21 - System Logs
=>sm36 - Background Job Scheduling
=>sm37 - Background Job Monitoring (display batch jobs)
=>sm31 - Table Maintenance
=>sm30 - Calling View Maintenance
=>sm35 - Batch Input Monitoring (Error Logs)
=>sm50 - Process Overview
=>sm58 - Transactional RFC Monitoring
=>sm59 - Maintain RFC Destinations (Define RFC Configuration)
=>snro - Number Range Objects (for IDOCs)
=>scc4 - Client Overview (Create, Quick Delete, Modify)
=>spro - Customizing, Execute Project
=>sp01 - Spool Administration
=>sq01 - Maintain SAP Queries
=>st02 - Buffer Analysis (Status Overview)
=>st03 - Workflow Analysis
=>st05 - Performance SQL trace (Tracking the Database calls from the System Transaction and Programs)
=>st22 - ABAP Dump Analysis, check logical runtime errors
=>/h - ABAP Debugger
=>we02 - Display IDOC
=>we05 - IDOC lists
=>we07 - IDOC statistics
=>we12 - Inbound processing of outbound file - convert outbound to inbound file
=>we14 - Process (dispatch) IDOCs through Port - RSEOUT00
=>we15 - Outbound IDOC from NAST - message control
=>we16 - Inbound File
=>we18 - Generate status file
=>we19 - Test tool
=>we20 - Add new Message Type to Partner Profile
=>we21 - Maintain Port Definition
=>we30 - IDOC Type development
=>we31 - IDOC Segment development
=>we41 - Process Code Outbound
=>we42 - Process Code Inbound
=>we46 - IDoc Administration
=>we47 - Status Code Maintenance
=>we57 - Assign function module to logical message and IDoc type
=>we63 - IDOC Type for Parser Output
=>we82 - Assign IDOC to Message Type
=>we60 - IDOC Documentation - IDOC Types
=>we61 - IDOC Documentation - IDOC Record Types
=>we81 - Create new IDOC Message Types
=>we82 - Assign IDOC to Message Type
=>pa20 - Display HR Master Data
=>pa30 - Maintain HR Master Data
=>bd59 - Create and assign Filter Object Type for Message Type
=>bd64 - Maintenance of ALE or any other Distribution Model
=>db02 - Storage Management and Database Performance
=>db14 - Database monitor
=>se18 - BADI definitions
=>se19 - BADI implementations
=>fd03 - Accounts Receivable Master Data (Display Customer in Accounting)
=>me22 - Change Purchase Order
=>me21 - Create Purchase Order
=>me51 - Create Purchase Requisition
<u><b>Official source of SAP T Codes -</b></u>Go to se11 or se16 and view table entries for
TSTC and TSTCT. This will give you the Transaction List.
Reward all helpfull answers
Regards
Pavan -
Report for downloading the source code of a Program
Hi.
Need a code to download the source code of a Program in a text file and all the includes of that program in a separate coressponding files. <b>This should be with scan and read report statements.It should be with classe CL_GUI_FRONTEND_SERVICES but not with function modules.</b>
Thanks in advance.
Regards,
AshaHi Asha
Use the below program for your purpose.
Report: ZKBPROGS *
Function : Up/Download ABAP reports complete with texts *
Change Log : *
July 5, 1999 *
- Combined existing programs that did the upload and download into*
- one program. *
- Changed format that the reports are saved in to be compatible *
with Wolfgang Morgenthaler's upload/download program(YSTRASN00 *
at www.antarcon.de). Major differences between this program and*
Wolfgang's are:
- this program does not update TRDIR with the *
TRDIR entries that are in the program uploaded. Instead, *
current users stats are used. *
- this program allows selection of reports from a list or *
a single report can be tuped in and uploaded *
- this program also updates TADIR so that a development class*
is assigned to the program *
- this program checks to see if the program already has a *
TRDIR entry, and if it does, warns the user *
- this program will save/restore the program documenation too*
REPORT ZKBPROGS
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Declare Database Objects *
tables:
DOKIL,
TRDIR.
Constants*
CONSTANTS:
MC_TRDIR_IDENTIFIER(72) TYPE C VALUE '%&%& RDIR',
MC_REPORT_IDENTIFIER(72) TYPE C VALUE '%&%& REPO',
MC_TEXT_IDENTIFIER(72) TYPE C VALUE '%&%& TEXP',
MC_THEAD_IDENTIFIER(72) TYPE C VALUE '%&%& HEAD',
MC_DOC_IDENTIFIER(72) TYPE C VALUE '%&%& DOKL',
MC_TRDIR_SHORT(4) TYPE C VALUE 'RDIR',
MC_REPORT_SHORT(4) TYPE C VALUE 'REPO',
MC_TEXT_SHORT(4) TYPE C VALUE 'TEXP',
MC_THEAD_SHORT(4) TYPE C VALUE 'HEAD',
MC_DOC_SHORT(4) TYPE C VALUE 'DOKP'.
Declare Module level data structures *
DATA: BEGIN OF MTAB_PROGRAM_SOURCE OCCURS 0,
LINE(72) TYPE C,
END OF MTAB_PROGRAM_SOURCE.
DATA: MTAB_PROGRAM_TRDIR LIKE TRDIR OCCURS 0 WITH HEADER LINE.
DATA: MTAB_PROGRAM_TEXTS LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.
DATA: MSTR_THEAD LIKE THEAD.
DATA: BEGIN OF MTAB_PROGRAM_FILE OCCURS 0,
LINE(275) TYPE C,
END OF MTAB_PROGRAM_FILE.
DATA: BEGIN OF MTAB_DIRECTORY OCCURS 0,
NAME LIKE TRDIR-NAME,
DESC(72) TYPE C,
SAVENAME LIKE RLGRAP-FILENAME,
END OF MTAB_DIRECTORY.
DATA: BEGIN OF MTAB_PROGRAM_DOCUMENTATION OCCURS 0,
LINE(255) TYPE C,
END OF MTAB_PROGRAM_DOCUMENTATION.
Selection Screen *
*-- Options for upload/download of programs
SELECTION-SCREEN BEGIN OF BLOCK FRM_OPTIONS WITH FRAME TITLE TEXT-UDL.
PARAMETERS:
RB_DOWN RADIOBUTTON GROUP UDL DEFAULT 'X'. " Download reports
SELECTION-SCREEN BEGIN OF BLOCK FRM_TRDIR WITH FRAME TITLE TEXT-DIR.
SELECT-OPTIONS:
S_NAME FOR TRDIR-NAME, " Program Name
S_SUBC FOR TRDIR-SUBC " Program Type
DEFAULT 'F' OPTION EQ SIGN E," Exclude Functions by default
S_CNAM FOR TRDIR-CNAM " Created by
DEFAULT SY-UNAME,
S_UNAM FOR TRDIR-UNAM, " Last Changed by
S_CDAT FOR TRDIR-CDAT, " Creation date
S_UDAT FOR TRDIR-UDAT. " Last update date
SELECTION-SCREEN END OF BLOCK FRM_TRDIR.
*-- Options for uploading programs
PARAMETERS:
RB_UP RADIOBUTTON GROUP UDL. " Upload reports
SELECTION-SCREEN BEGIN OF BLOCK FRM_UPLOAD WITH FRAME TITLE TEXT-UPL.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(29) TEXT-SNG.
PARAMETERS:
RB_FILE RADIOBUTTON GROUP HOW DEFAULT 'X'.
SELECTION-SCREEN COMMENT 33(42) TEXT-FNA.
SELECTION-SCREEN END OF LINE.
PARAMETERS:
RB_LIST RADIOBUTTON GROUP HOW.
SELECTION-SCREEN END OF BLOCK FRM_UPLOAD.
SELECTION-SCREEN END OF BLOCK FRM_OPTIONS.
*-- Options for up/downloading programs
SELECTION-SCREEN BEGIN OF BLOCK FRM_FILEN WITH FRAME TITLE TEXT-FIL.
PARAMETERS:
RB_DOS RADIOBUTTON GROUP FIL DEFAULT 'X', " Save to local
RB_UNIX RADIOBUTTON GROUP FIL, " Save to UNIX
P_PATH LIKE RLGRAP-FILENAME " Path to save files to
DEFAULT 'c:\temp\'.
SELECTION-SCREEN END OF BLOCK FRM_FILEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-LOW.
CALL FUNCTION 'F4_PROGRAM'
EXPORTING
OBJECT = S_NAME-LOW
SUPPRESS_SELECTION = 'X'
IMPORTING
RESULT = S_NAME-LOW
EXCEPTIONS
OTHERS = 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-HIGH.
CALL FUNCTION 'F4_PROGRAM'
EXPORTING
OBJECT = S_NAME-HIGH
SUPPRESS_SELECTION = 'X'
IMPORTING
RESULT = S_NAME-HIGH
EXCEPTIONS
OTHERS = 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-LOW.
PERFORM GET_NAME USING 'S_UNAM-LOW'
CHANGING S_UNAM-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-HIGH.
PERFORM GET_NAME USING 'S_UNAM-HIGH'
CHANGING S_UNAM-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-LOW.
PERFORM GET_NAME USING 'S_CNAM-LOW'
CHANGING S_CNAM-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-HIGH.
PERFORM GET_NAME USING 'S_CNAM-HIGH'
CHANGING S_CNAM-HIGH.
TOP-OF-PAGE.
IF RB_LIST = 'X'.
FORMAT COLOR COL_HEADING.
NEW-LINE.
WRITE: AT 3 TEXT-H01,
AT 15 TEXT-H03.
FORMAT COLOR OFF.
ENDIF.
AT LINE-SELECTION.
CHECK RB_LIST = 'X'. " only do in list mode
READ LINE SY-CUROW FIELD VALUE MTAB_DIRECTORY-SAVENAME.
*-- Read file into an internal table
PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
USING MTAB_DIRECTORY-SAVENAME.
*-- Split table into TADIR entry, report lines, and report text
PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
MTAB_PROGRAM_SOURCE
MTAB_PROGRAM_TEXTS
MTAB_PROGRAM_DOCUMENTATION
CHANGING TRDIR
MSTR_THEAD.
*-- Save all of the data
PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
MTAB_PROGRAM_TEXTS
MTAB_PROGRAM_DOCUMENTATION
USING TRDIR
MSTR_THEAD.
Start of processing *
START-OF-SELECTION.
FORMAT COLOR COL_NORMAL.
IF RB_DOWN = 'X'.
PERFORM DOWNLOAD_REPORTS.
ELSEIF RB_UP = 'X'.
PERFORM UPLOAD_REPORTS.
ENDIF.
END-OF-SELECTION.
IF RB_DOWN = 'X'.
CONCATENATE P_PATH
'directory.txt'
INTO P_PATH.
PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_DIRECTORY
USING P_PATH.
ENDIF.
FORM UPLOAD_REPORTS *
FORM UPLOAD_REPORTS.
*-- Can upload a reports entered in selection criteria or
*-- select from a list. List can be from index.txt in same directory
*-- (created by the download) or by reading the first line of each file
*-- in the directory.
IF RB_FILE = 'X'. " Upload single program from a file
*-- Read file into an internal table
PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
USING P_PATH.
*-- Split table into TADIR entry, report lines, and report text
PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
MTAB_PROGRAM_SOURCE
MTAB_PROGRAM_TEXTS
MTAB_PROGRAM_DOCUMENTATION
CHANGING TRDIR
MSTR_THEAD.
*-- Save all of the data
PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
MTAB_PROGRAM_TEXTS
MTAB_PROGRAM_DOCUMENTATION
USING TRDIR
MSTR_THEAD.
ELSEIF RB_LIST = 'X'. " Show list for user to choose from
*-- get list of report names/descriptions from directory text
CONCATENATE P_PATH
'directory.txt'
INTO P_PATH.
PERFORM READ_REPORT_FROM_DISK TABLES MTAB_DIRECTORY
USING P_PATH.
SORT MTAB_DIRECTORY.
*-- Write out list of report names/descriptions
LOOP AT MTAB_DIRECTORY.
WRITE:
/ MTAB_DIRECTORY-NAME UNDER TEXT-H01,
MTAB_DIRECTORY-DESC UNDER TEXT-H03,
MTAB_DIRECTORY-SAVENAME.
ENDLOOP.
*-- Process user selections for reports to upload.
ENDIF.
ENDFORM. " upload_reports
FORM DOWNLOAD_REPORTS *
From the user selections, get all programs that meet the *
criteria, and save them in ftab_program_directory. *
Also save the report to disk. *
FORM DOWNLOAD_REPORTS.
DATA:
LC_FULL_FILENAME LIKE RLGRAP-FILENAME.
*-- The table is put into an internal table because the program will
*-- abend if multiple transfers to a dataset occur within a SELECT/
*-- ENDSELCT (tested on 3.1H)
SELECT * FROM TRDIR
INTO TABLE MTAB_PROGRAM_TRDIR
WHERE NAME IN S_NAME
AND SUBC IN S_SUBC
AND CNAM IN S_CNAM
AND UNAM IN S_UNAM
AND CDAT IN S_CDAT
AND UDAT IN S_UDAT.
LOOP AT MTAB_PROGRAM_TRDIR.
*-- Clear out text and source code tables
CLEAR:
MTAB_PROGRAM_FILE,
MTAB_PROGRAM_SOURCE,
MTAB_PROGRAM_TEXTS,
MTAB_PROGRAM_DOCUMENTATION.
REFRESH:
MTAB_PROGRAM_FILE,
MTAB_PROGRAM_SOURCE,
MTAB_PROGRAM_TEXTS,
MTAB_PROGRAM_DOCUMENTATION.
*-- Get the report
READ REPORT MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_SOURCE.
*-- Get the text for the report
READ TEXTPOOL MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_TEXTS.
*-- Get the documentation for the report
CLEAR DOKIL.
SELECT * UP TO 1 ROWS FROM DOKIL
WHERE ID = 'RE'
AND OBJECT = MTAB_PROGRAM_TRDIR-NAME
AND LANGU = SY-LANGU
AND TYP = 'E'
ORDER BY VERSION DESCENDING.
ENDSELECT.
*-- Documentation exists for this object
IF SY-SUBRC = 0.
CALL FUNCTION 'DOCU_READ'
EXPORTING
ID = DOKIL-ID
LANGU = DOKIL-LANGU
OBJECT = DOKIL-OBJECT
TYP = DOKIL-TYP
VERSION = DOKIL-VERSION
IMPORTING
HEAD = MSTR_THEAD
TABLES
LINE = MTAB_PROGRAM_DOCUMENTATION
EXCEPTIONS
OTHERS = 1.
ENDIF.
*-- Put the report code and texts into a single file
*-- Put the identifier line in so that the start of the TRDIR line
*-- is marked
CONCATENATE MC_TRDIR_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
*-- Add the TRDIR line
MTAB_PROGRAM_FILE-LINE = MTAB_PROGRAM_TRDIR.
APPEND MTAB_PROGRAM_FILE.
*-- Put the identifier line in so that the start of the report code
*-- is marked
CONCATENATE MC_REPORT_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
*-- Add the report code
LOOP AT MTAB_PROGRAM_SOURCE.
MTAB_PROGRAM_FILE = MTAB_PROGRAM_SOURCE.
APPEND MTAB_PROGRAM_FILE.
ENDLOOP.
*-- Put the identifier line in so that the start of the report text
*-- is marked
CONCATENATE MC_TEXT_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
*-- Add the report texts
LOOP AT MTAB_PROGRAM_TEXTS.
MTAB_PROGRAM_FILE = MTAB_PROGRAM_TEXTS.
APPEND MTAB_PROGRAM_FILE.
ENDLOOP.
*-- Put the identifier line in so that the start of the THEAD record
*-- is marked
CONCATENATE MC_THEAD_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
MTAB_PROGRAM_FILE = MSTR_THEAD.
APPEND MTAB_PROGRAM_FILE.
*-- Put the identifier line in so that the start of the report
*-- documentation is marked
CONCATENATE MC_DOC_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
*-- Add the report documentation
LOOP AT MTAB_PROGRAM_DOCUMENTATION.
MTAB_PROGRAM_FILE = MTAB_PROGRAM_DOCUMENTATION.
APPEND MTAB_PROGRAM_FILE.
ENDLOOP.
*-- Make the fully pathed filename that report will be saved to
CONCATENATE P_PATH
MTAB_PROGRAM_TRDIR-NAME
'.txt'
INTO LC_FULL_FILENAME.
PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_PROGRAM_FILE
USING LC_FULL_FILENAME.
*-- Write out message with Program Name/Description
READ TABLE MTAB_PROGRAM_TEXTS WITH KEY ID = 'R'.
IF SY-SUBRC = 0.
MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
MTAB_DIRECTORY-DESC = MTAB_PROGRAM_TEXTS-ENTRY.
MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
APPEND MTAB_DIRECTORY.
WRITE: / MTAB_PROGRAM_TRDIR-NAME,
MTAB_PROGRAM_TEXTS-ENTRY(65) COLOR COL_HEADING.
ELSE.
MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
MTAB_DIRECTORY-DESC = 'No description available'.
MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
APPEND MTAB_DIRECTORY.
WRITE: / MTAB_PROGRAM_TRDIR-NAME.
ENDIF.
ENDLOOP.
ENDFORM. " BUILD_PROGRAM_DIRECTORY
FORM SAVE_TABLE_TO_FILE *
--> FTAB_TABLE *
--> F_FILENAME *
FORM SAVE_TABLE_TO_FILE TABLES FTAB_TABLE
USING F_FILENAME.
IF RB_DOS = 'X'. " Save file to presentation server
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = F_FILENAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = FTAB_TABLE
EXCEPTIONS
OTHERS = 4.
IF SY-SUBRC NE 0.
WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
F_FILENAME COLOR COL_NEGATIVE.
ENDIF.
ELSE. " Save file to application server
OPEN DATASET F_FILENAME FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC = 0.
LOOP AT FTAB_TABLE.
TRANSFER FTAB_TABLE TO F_FILENAME.
IF SY-SUBRC NE 0.
WRITE: / 'Error writing record to file;' COLOR COL_NEGATIVE,
F_FILENAME COLOR COL_NEGATIVE.
ENDIF.
ENDLOOP.
ELSE.
WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
F_FILENAME COLOR COL_NEGATIVE.
ENDIF.
ENDIF. " End RB_DOS
ENDFORM. " SAVE_PROGRAM
FORM READ_REPORT_FROM_DISK *
Read report into internal table. Can read from local or *
remote computer *
FORM READ_REPORT_FROM_DISK TABLES FTAB_TABLE
USING F_FILENAME.
DATA:
LC_MESSAGE(128) TYPE C.
CLEAR FTAB_TABLE.
REFRESH FTAB_TABLE.
IF RB_DOS = 'X'.
TRANSLATE F_FILENAME USING '/\'. " correct slash for Dos PC file
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = F_FILENAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = FTAB_TABLE
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
IF SY-SUBRC >< 0.
WRITE: / 'Error reading file from local PC' COLOR COL_NEGATIVE.
ENDIF.
ELSEIF RB_UNIX = 'X'.
TRANSLATE F_FILENAME USING '\/'. " correct slash for unix
OPEN DATASET F_FILENAME FOR INPUT MESSAGE LC_MESSAGE IN TEXT MODE.
IF SY-SUBRC = 0.
DO.
READ DATASET F_FILENAME INTO FTAB_TABLE.
IF SY-SUBRC = 0.
APPEND FTAB_TABLE.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET F_FILENAME.
ELSE.
WRITE: / 'Error reading file from remote computer'
COLOR COL_NEGATIVE,
/ LC_MESSAGE,
/ F_FILENAME.
SY-SUBRC = 4.
ENDIF.
ENDIF.
ENDFORM. " READ_REPORT_FROM_DISK
FORM SPLIT_INCOMING_FILE *
--> FTAB_PROGRAM_FILE *
--> FTAB_PROGRAM_SOURCE *
--> ` *
--> FTAB_PROGRAM_TEXTS *
FORM SPLIT_INCOMING_FILE TABLES FTAB_PROGRAM_FILE
STRUCTURE MTAB_PROGRAM_FILE
FTAB_PROGRAM_SOURCE
STRUCTURE MTAB_PROGRAM_SOURCE
FTAB_PROGRAM_TEXTS
STRUCTURE MTAB_PROGRAM_TEXTS
FTAB_PROGRAM_DOCUMENTATION
STRUCTURE MTAB_PROGRAM_DOCUMENTATION
CHANGING FSTR_TRDIR
FSTR_THEAD.
DATA:
LC_DATATYPE(4) TYPE C, " Type of data, REPO, TEXP, RDIR
LC_PROGRAM_FILE LIKE MTAB_PROGRAM_FILE.
LOOP AT FTAB_PROGRAM_FILE.
LC_PROGRAM_FILE = FTAB_PROGRAM_FILE.
CASE LC_PROGRAM_FILE(9).
WHEN MC_TRDIR_IDENTIFIER.
LC_DATATYPE = MC_TRDIR_SHORT.
WHEN MC_REPORT_IDENTIFIER.
LC_DATATYPE = MC_REPORT_SHORT.
WHEN MC_TEXT_IDENTIFIER.
LC_DATATYPE = MC_TEXT_SHORT.
WHEN MC_DOC_IDENTIFIER.
LC_DATATYPE = MC_DOC_SHORT.
WHEN MC_THEAD_IDENTIFIER.
LC_DATATYPE = MC_THEAD_SHORT.
WHEN OTHERS. " Actual contents of report, trdir, or text
CASE LC_DATATYPE.
WHEN MC_TRDIR_SHORT.
FSTR_TRDIR = FTAB_PROGRAM_FILE.
WHEN MC_REPORT_SHORT.
FTAB_PROGRAM_SOURCE = FTAB_PROGRAM_FILE.
APPEND FTAB_PROGRAM_SOURCE.
WHEN MC_TEXT_SHORT.
FTAB_PROGRAM_TEXTS = FTAB_PROGRAM_FILE.
APPEND FTAB_PROGRAM_TEXTS.
WHEN MC_THEAD_SHORT.
FSTR_THEAD = FTAB_PROGRAM_FILE.
WHEN MC_DOC_SHORT.
FTAB_PROGRAM_DOCUMENTATION = FTAB_PROGRAM_FILE.
APPEND FTAB_PROGRAM_DOCUMENTATION.
ENDCASE.
ENDCASE.
ENDLOOP.
ENDFORM. " SPLIT_INCOMING_FILE
FORM INSERT_NEW_REPORT*
--> FTAB_PROGRAM_SOURCE *
--> FTAB_PROGRAM_TEXTS *
--> F_TRDIR *
FORM INSERT_NEW_REPORT TABLES FTAB_PROGRAM_SOURCE
STRUCTURE MTAB_PROGRAM_SOURCE
FTAB_PROGRAM_TEXTS
STRUCTURE MTAB_PROGRAM_TEXTS
FTAB_PROGRAM_DOCUMENTATION
STRUCTURE MTAB_PROGRAM_DOCUMENTATION
USING FSTR_TRDIR LIKE TRDIR
FSTR_THEAD LIKE MSTR_THEAD.
DATA:
LC_OBJ_NAME LIKE E071-OBJ_NAME,
LC_LINE2(40) TYPE C,
LC_ANSWER(1) TYPE C.
*-- read trdir to see if the report already exists, if it does, prompt
*-- user to overwrite or abort.
SELECT SINGLE * FROM TRDIR WHERE NAME = FSTR_TRDIR-NAME.
IF SY-SUBRC = 0. " Already exists
CONCATENATE 'want to overwrite report'
FSTR_TRDIR-NAME
INTO LC_LINE2 SEPARATED BY SPACE.
CONCATENATE LC_LINE2
INTO LC_LINE2.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
DEFAULTOPTION = 'N'
TEXTLINE1 = 'The selected report already exists, do you'
TEXTLINE2 = LC_LINE2
TITEL = 'Report already exists'
CANCEL_DISPLAY = SPACE
IMPORTING
ANSWER = LC_ANSWER
EXCEPTIONS
OTHERS = 1.
ELSE.
LC_ANSWER = 'J'.
ENDIF.
IF LC_ANSWER = 'J'.
*-- Create the TADIR entry. (TRDIR entry created by INSERT REPORT)
LC_OBJ_NAME = TRDIR-NAME.
CALL FUNCTION 'TR_TADIR_POPUP_ENTRY_E071'
EXPORTING
WI_E071_PGMID = 'R3TR'
WI_E071_OBJECT = 'PROG'
WI_E071_OBJ_NAME = LC_OBJ_NAME
WI_TADIR_DEVCLASS = '$TMP'
EXCEPTIONS
EXIT = 3
OTHERS = 4.
IF SY-SUBRC = 0.
*-- Create Report
INSERT REPORT FSTR_TRDIR-NAME FROM FTAB_PROGRAM_SOURCE.
*-- Create Texts
INSERT TEXTPOOL FSTR_TRDIR-NAME FROM FTAB_PROGRAM_TEXTS
LANGUAGE SY-LANGU.
*-- Save Documentation
CALL FUNCTION 'DOCU_UPDATE'
EXPORTING
HEAD = FSTR_THEAD
STATE = 'A'
TYP = 'E'
VERSION = '1'
TABLES
LINE = FTAB_PROGRAM_DOCUMENTATION
EXCEPTIONS
OTHERS = 1.
ELSE.
WRITE: / 'Error updating the TADIR entry' COLOR COL_NEGATIVE,
'Program' COLOR COL_NEGATIVE INTENSIFIED OFF,
FSTR_TRDIR-NAME, 'was not loaded into SAP.'
COLOR COL_NEGATIVE INTENSIFIED OFF.
ENDIF.
ELSE.
WRITE: / FSTR_TRDIR-NAME COLOR COL_NEGATIVE,
'was not uploaded into SAP. Action cancelled by user'
COLOR COL_NEGATIVE INTENSIFIED OFF.
ENDIF.
ENDFORM. " INSERT_NEW_REPORT
FORM GET_NAME *
--> VALUE(F_FIELD) *
--> F_NAME *
FORM GET_NAME USING VALUE(F_FIELD)
CHANGING F_NAME.
DATA: LTAB_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
LC_PROG LIKE D020S-PROG,
LC_DNUM LIKE D020S-DNUM.
TRANSLATE F_FIELD TO UPPER CASE.
refresh ltab_fields.
LTAB_FIELDS-FIELDNAME = F_FIELD.
append ltab_fields.
LC_PROG = SY-REPID .
LC_DNUM = SY-DYNNR .
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = LC_PROG
DYNUMB = LC_DNUM
TABLES
dynpfields = ltab_fields
EXCEPTIONS
OTHERS = 01.
read table ltab_fields index 1.
IF SY-SUBRC EQ 0.
F_NAME = LTAB_FIELDS-FIELDVALUE.
refresh ltab_fields.
ENDIF.
CALL FUNCTION 'F4_USER'
EXPORTING
OBJECT = F_NAME
IMPORTING
RESULT = F_NAME.
ENDFORM. " GET_NAME
Regards,
Sree -
Dear Sir,
We have the Following difficulty while creating a tax code
We have defined condition types for Ser, tax & Vat
As discussed with our taxation dept Building & Construction Tax (BOCW)@ 1% on basic is applicable under Labour Law
Can you please guide how to incorporate BOCW1% in the tax code
(Other details we are using TAXINN Procedure & using combination Tax classification)
Regards
sameermn
-
"Check Business Area of the company code" error while posting stock
Hi Experts,
While posting stock to a storage location of a plant , the system is giving me the following error message :
"Check Business Area of the company code" .
Would highly appreciate if I could get some info for this error message and how to resolve the same.
Thanks & regards
Vikas Halihi
i think division is missing in material master basic data , please enter division in basic data tab in material master then you will try ,
then post the stock
regards
vijay -
My ITunes gift card I brought, the Reemdem code had bin wide out so I can no longer see that code what do I do?
"bin wide out"?
If you mean you cannot read the code on the back of the card take it back to the store you purchased it from. If the numbers are not visable because you scratched them out I don't know if the store will replace or refund that. If you can read some of the numbers you could just keep trying a combination of letters and numbers to replace the missing ones. This will take a while depending on how many inputs are missing. You will have to use 0 through 9 and I am guessing A through Z. -
Hi,
I'm pretty new to Sharepoint and wanted to ask a question to see if it can actually do what we need it to do.
We would have a top Site within a collection and under this we would have 400 sites for different sections of the business (External) Lots of teams create documents for all these sites and use the Code of the site in each document so we know what business
site its going to. For example 67890_BusinessReportMay.docx We know this document should be heading to site 67890
We have lots of services sending data to these 400 business sites. If we were to do them manually it would take most of our time to go to each site and upload the documents, even if we could do all the sites documents in 1 multiple upload. We still have
to go to each site to do it
Is there an easy answer to this? At present I have folders to match each of the 400 Sharepoint Sites and I use an Integration Services package to move all the documents into these 400 Matching folders. I do this using the Code at the start of each file name.
If it doesn't have a code its put into an error folder and reported back on.
Then I want something to automatically go through each of these folders and load them into the Sharepoint Sites document libraries.
OR
Say you have 600 files all going to the 500 sites on Sharepoint in one folder. The File contains meta data regarding the Sites Code. Using this you can split the files and automatically pull them across to the Sharepoint Sites without having to go
into each Sharepoint Site?
I'm thinking that you cant do this and I'm hoping I'm wrong. Any help would be greatly appreciated.
DebbieHi Debbie,
According to your description, my understanding is that you want to move the documents to different sites based on the code in the name of the files.
I recommend to create workflow and set the workflow to start when an item is created to achieve this goal.
As there is no built-in action which can move the documents cross site, we need to use the custom activity 'Copy List Item Extended' which need to be downloaded from
http://spdactivities.codeplex.com/.
Please per the steps in the link below to deploy the custom activity to SharePoint:
http://social.technet.microsoft.com/Forums/en-US/82609160-152f-461a-9a19-0e996f5a309b/sharepoint-2010-archiving-the-files-from-one-document-library-to-another-document-library-in
After that, we can create a workflow to meet the need.
Here is the detailed steps to create the workflow:
Create a column in single line of text type(called NO for example) in the library where the documents are uploaded, and input value manually in the column to store the code when uploading the documents. (We can also use workflow to extract the code from
the name of the documents if the codes are always 5 numbers.)
Create a workflow associated with the library and set the workflow to start when an item is created.
Select If current item field equals value, change the settings to be If Current Item: NO equals 67890.
Select Copy List Item Extended, change the settings to be Copy item in Current Item to list at site 67890 URL.
Select Delete Item, change the settings to be Delete Item in Current Item.
Create other conditions from step 3 to step 5 to copy the documents to different sites and delete current documents.
Best regards.
Thanks
Victoria Xia
TechNet Community Support
Maybe you are looking for
-
Printing certain pages in a report
Hi all, I want to know how can i make the ABAP report to print certain pages in a report. Say, my abap report has 3 pages. The second page is blank. How can i code it so the printing skip the second page and continue to the third page? Additional Inf
-
Pl/sql block updating orderId, itemID
lol here i am again! This time its like this: i have a table (orderId, itemId, CustomerId, productId, quantity, start_date, end_date, oldRef) here are some of the values: 2477, 1, 201, 111, 1,19-MAR-93,14-APR-93 2477,2,201,112,1,19-MAR-93,14-APR-93 2
-
Can I run adobe master collection in MacBook Air 11.6"?
Can I run adobe master collection in MacBook Air 11.6"? I am thinking to use MacBook Air 11.6" to do some graphics design work, those model support adobe Illustrator, PhotoShop and Dreamweaver? the size is perfect for me that is the point. thank you
-
I've bought video clips from iTunes Mudisc Stores. Some have been downloaded as bonus tracks when I've bought some albums, some have been bought recently as stand-alone videoclips. The issue is that the first kind are "tagged" as movies, the second k
-
HOW to add Dynamic Columns in ADF Faces CORE Table
In ADF im going to display the dynamic column in Coretable, Header are displaying very fine. but im unable to display rows sucessfuly,how to resolve. Second thing is that JSF page isn't getting the value from dataList, whats wrong in JSF code. // JSF