‎2007 Apr 11 8:32 AM
hi everyone,
its my first time to post a thread here and hoping someone can help me about my problem in ALV Grid. Im using REUSE_ALV_GRID_DISPLAY.I use the code
SET PARAMETER ID 'BEL' FIELD rs_selfield-value.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
which is ok but my problem is when TCODE fb03 loaded the document number that i specify does not appear..Kindly help me how to solve this.
Thanks in advance ,
Avaduds
‎2007 Apr 11 8:37 AM
Hi,
I believe that the parameter ID is 'BLN'. Either way don't skip the first screen in order to see which document is put in the first screen of FB03.
Kostas
‎2007 Apr 11 8:37 AM
Hi,
I believe that the parameter ID is 'BLN'. Either way don't skip the first screen in order to see which document is put in the first screen of FB03.
Kostas
‎2007 Apr 11 8:48 AM
hello Kostas,
Amazing! thanks for your help:-) but how would i know the parameter id for a specific field like for the sample below..
IF rs_selfield-fieldname = 'BELNR'.
SET PARAMETER ID 'BLN' FIELD rs_selfield-value.
CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
ENDIF.
BLN is for BELNR...how about for the others?is there any table of transaction code for me to know the parameter id?
Thanks so much you're so genius
Avaduds
‎2007 Apr 11 8:52 AM
Hi,
Just see the technical info for the field in the screen. For example in tran FB03 press F1 , F9 in the field Document Number and you should see the the parameter id is BLN.
Kostas
‎2007 Apr 11 9:38 AM
‎2007 Apr 12 3:17 AM
hi kostas,
Can you help me to optimize my code?please...i used logical dbf before which is SDF but simple select to tables BSIS,BKPF and BSEG is much faster..but it also took i while to process a report (2minutes). Here is a sample code.
Hope you can give me some advice...Im just a begginer in ABAP programming
Thanks in advance
aVaDuDz
SELECT SINGLE *
FROM skb1
WHERE bukrs EQ p_bukrs
AND saknr EQ p_saknr.
IF sy-subrc EQ 0.
SELECT blart belnr waers monat budat bukrs hkont buzei
shkzg dmbtr wrbtr gjahr
INTO CORRESPONDING FIELDS OF TABLE it_bsis
FROM bsis
WHERE bukrs EQ p_bukrs
AND hkont EQ p_saknr
AND gjahr IN p_gjahr
AND monat IN p_monat.
PERFORM add_record.
ENDIF.
&----
*& Form add_record
&----
text
----
--> p1 text
<-- p2 text
----
FORM add_record .
LOOP AT it_bsis.
g_percn = 1.
CLEAR g_indic.
g_indic = c_indic.
REPLACE '&' WITH it_bsis-belnr INTO g_indic.
REPLACE '%' WITH it_bsis-buzei INTO g_indic.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = g_percn
text = g_indic.
READ TABLE it_data ASSIGNING <data>
WITH KEY belnr = it_bsis-belnr "document #
buzei = it_bsis-buzei. "Line Item
IF sy-subrc <> 0.
APPEND INITIAL LINE TO it_data ASSIGNING <data>.
<data>-belnr = it_bsis-belnr. "document #
<data>-buzei = it_bsis-buzei. "Line Item
ENDIF.
<data>-bukrs = it_bsis-bukrs. "Company
<data>-hkont = it_bsis-hkont. "G/L Acct.
<data>-gjahr = it_bsis-gjahr.
<data>-waers = it_bsis-waers.
<data>-belnr = it_bsis-belnr.
<data>-monat = it_bsis-monat.
<data>-budat = it_bsis-budat.
<data>-blart = it_bsis-blart.
IF it_bsis-shkzg ='H'.
<data>-wrbtr = it_bsis-wrbtr * -1.
<data>-dmbtr = it_bsis-dmbtr * -1.
ELSE.
<data>-wrbtr = it_bsis-wrbtr.
<data>-dmbtr = it_bsis-dmbtr.
ENDIF.
SELECT SINGLE lifnr sgtxt
FROM bseg
INTO gs_vendor
WHERE belnr = it_bsis-belnr
AND gjahr IN p_gjahr
AND lifnr NE ''.
SELECT SINGLE lifnr name1 stcd1
FROM lfa1
INTO gs_lfa1
WHERE lifnr = gs_vendor-lifnr.
<data>-lifnr = gs_lfa1-lifnr.
<data>-sgtxt = gs_vendor-sgtxt.
<data>-name1 = gs_lfa1-name1.
<data>-stcd1 = gs_lfa1-stcd1.
SELECT SINGLE wt_withcd
FROM with_item
INTO gs_item
WHERE belnr = it_bsis-belnr
AND gjahr IN p_gjahr.
IF sy-subrc EQ 0.
<data>-mwskz = gs_item.
ENDIF.
SELECT SINGLE ppnam usnam bldat
FROM bkpf
INTO gs_bkpf
WHERE belnr = it_bsis-belnr
AND gjahr IN p_gjahr.
<data>-ppnam = gs_bkpf-ppnam.
<data>-usnam = gs_bkpf-usnam.
<data>-bldat = gs_bkpf-bldat.
ENDLOOP.
ENDFORM. " add_record
‎2007 Apr 12 8:26 AM
Hi,
an advice is to to try and read dictionary tables with their primary key or their index, furthermore instead of many select single statements i believe it's better to use select ...for all entries in table...
nevertheless i have made a few changes in your code. I don't know if it's fully correct since i don't have your full report.
Anyway you can try it and compare it in performance with your own code
DATA: BEGIN OF GT_VENDOR OCCURS 0,
BELNR LIKE BSEG-BELNR,
LIFNR LIKE BSEG-LIFNR,
SGTXT LIKE BSEG-SGTXT,
NAME1 LIKE LFA1-NAME1,
END OF GT_VENDOR.
DATA: BEGIN OF GT_LFA1 OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
STCD1 LIKE LFA1-STCD1,
END OF GT_LFA1.
SELECT SINGLE *
FROM SKB1
WHERE BUKRS EQ P_BUKRS
AND SAKNR EQ P_SAKNR.
IF SY-SUBRC EQ 0.
SELECT BLART BELNR WAERS MONAT BUDAT BUKRS HKONT BUZEI
SHKZG DMBTR WRBTR GJAHR
INTO CORRESPONDING FIELDS OF TABLE IT_BSIS
FROM BSIS
WHERE BUKRS EQ P_BUKRS
AND HKONT EQ P_SAKNR
AND GJAHR IN P_GJAHR.
* AND MONAT IN P_MONAT.
DELETE IT_BSIS WHERE NOT MONAT IN P_MONAT. "kostas
SELECT BELNR LIFNR SGTXT FROM BSEG INTO TABLE GT_VENDOR
FOR ALL ENTRIES IN IT_BSIS
WHERE BELNR = IT_BSIS-BELNR
AND GJAHR IN P_GJAHR.
*
DELETE GT_VENDOR WHERE VENDOR IS INITIAL.
SORT GT_VENDOR.
SELECT LIFNR NAME1 STCD1 FROM LFA1 INTO TABLE GT_LFA1
FOR ALL ENTRIES IN GT_VENDOR
WHERE LIFNR = GT_VENDOR-LIFNR.
SORT GT_LFA1.
PERFORM ADD_RECORD.
ENDIF.
*&---------------------------------------------------------------------
*
*& Form add_record
*&---------------------------------------------------------------------
*
* text
*----------------------------------------------------------------------
*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------
*
FORM ADD_RECORD .
LOOP AT IT_BSIS.
G_PERCN = 1.
CLEAR G_INDIC.
G_INDIC = C_INDIC.
REPLACE '&' WITH IT_BSIS-BELNR INTO G_INDIC.
REPLACE '%' WITH IT_BSIS-BUZEI INTO G_INDIC.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = G_PERCN
TEXT = G_INDIC.
READ TABLE IT_DATA ASSIGNING <DATA>
WITH KEY BELNR = IT_BSIS-BELNR "document #
BUZEI = IT_BSIS-BUZEI. "Line Item
IF SY-SUBRC <> 0.
APPEND INITIAL LINE TO IT_DATA ASSIGNING <DATA>.
<DATA>-BELNR = IT_BSIS-BELNR. "document #
<DATA>-BUZEI = IT_BSIS-BUZEI. "Line Item
ENDIF.
<DATA>-BUKRS = IT_BSIS-BUKRS. "Company
<DATA>-HKONT = IT_BSIS-HKONT. "G/L Acct.
<DATA>-GJAHR = IT_BSIS-GJAHR.
<DATA>-WAERS = IT_BSIS-WAERS.
<DATA>-BELNR = IT_BSIS-BELNR.
<DATA>-MONAT = IT_BSIS-MONAT.
<DATA>-BUDAT = IT_BSIS-BUDAT.
<DATA>-BLART = IT_BSIS-BLART.
IF IT_BSIS-SHKZG ='H'.
<DATA>-WRBTR = IT_BSIS-WRBTR * -1.
<DATA>-DMBTR = IT_BSIS-DMBTR * -1.
ELSE.
<DATA>-WRBTR = IT_BSIS-WRBTR.
<DATA>-DMBTR = IT_BSIS-DMBTR.
ENDIF.
CLEAR GT_VENDOR.
READ TABLE GT_VENDOR WITH KEY BELNR = IT_BSIS-BELNR BINARY SEARCH.
* SELECT SINGLE LIFNR SGTXT
* FROM BSEG
* INTO GS_VENDOR
* WHERE BELNR = IT_BSIS-BELNR
* AND GJAHR IN P_GJAHR
* AND LIFNR NE ''.
CLEAR GT_LFA1.
READ TABLE GT_LFA1 WITH KEY LIFNR = GT_VENDOR-LIFNR BINARY SEARCH.
* SELECT SINGLE LIFNR NAME1 STCD1
* FROM LFA1
* INTO GS_LFA1
* WHERE LIFNR = GS_VENDOR-LIFNR.
<DATA>-LIFNR = GT_LFA1-LIFNR.
<DATA>-SGTXT = GT_VENDOR-SGTXT.
<DATA>-NAME1 = GT_LFA1-NAME1.
<DATA>-STCD1 = GT_LFA1-STCD1.
SELECT SINGLE WT_WITHCD
FROM WITH_ITEM
INTO GS_ITEM
WHERE BELNR = IT_BSIS-BELNR
AND GJAHR IN P_GJAHR.
IF SY-SUBRC EQ 0.
<DATA>-MWSKZ = GS_ITEM.
ENDIF.
*here i believe you add the company code?
SELECT SINGLE PPNAM USNAM BLDAT
FROM BKPF
INTO GS_BKPF
WHERE BELNR = IT_BSIS-BELNR
AND BUKRS EQ P_BUKRS "kostas
AND GJAHR IN P_GJAHR.
<DATA>-PPNAM = GS_BKPF-PPNAM.
<DATA>-USNAM = GS_BKPF-USNAM.
<DATA>-BLDAT = GS_BKPF-BLDAT.
ENDLOOP.
ENDFORM. " add_record
Kostas
‎2007 Apr 12 9:03 AM
Many Thanks:-)
To those who response to my thread...and solved my problem..a BIG THANKS to all of you..(u know who u are)
‎2007 Apr 13 3:52 AM
Hi Kostas,
Hello genius, im very eager to learn the basic dialog programming...can you help me please? can you give me some advice?
Thanks in advance
aVaDuDz
‎2007 Apr 13 8:40 AM
Hi Kosta,
Hello my friend,im here again..:-) hope u dont mind..
i have a problem in setting the default printer in tcode VF02...actually the scenario is we bought a new printer..and the program in billing documents always default it to the old printer...and
i tried to change the default printer thru the following :
1.change the new default printer from settings->printer
2.change the output in VF02 tcode from GOTO->header->output->communication method
3.change it from billing document->issued to output ->print options.
but all of these is i need to change it per document no...
now...how will i default it only once..and all documents i my print will default the printer to the new printer..
Please help:-(
aVaDuDz
‎2007 Apr 11 8:45 AM
The Parameter-ID is 'BLN' and not 'BEL'. Try this, this should work
‎2007 Apr 11 8:52 AM
hi
good
process of this function module->
Functionality
The function module outputs an internal table with whatever structure in the form of a formatted single- oder multi-line list.
Process:
Passing an internal table with the set of information to be output
Passing a structure with general layout specifications for list layout
Passing a field catalog in the form of an internal table
The field catalog describes the fields to be output in the list.
Notes
All interactions performed on the list refer directly to the internal output table. Sorting the list, for example, also involves a resorting of the internal output table passed (since it was passed by reference).
An important factor determining the usability of the tool or of various generic functions (totals, subtotals) is the expected amount of data to be displayed.
The application is responsible for critically testing this aspect and consider it when it comes to decision-making.
Process->
debut the program and check where you r storing the document number tht is coming from FB03 and check where you r printing that particular document number,if you have designed your field catalog accrdingly than check the field catalog also duing the debug.
Thanks
mrutyun^