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

Runtime error : OBJECTS_NOT_CHARLIKE

Former Member
0 Likes
7,180

Hi,

When i run a report. It runs fine. but when i try to print the alv output, it throws this error."OBJECTS_NOT_CHARLIKE".

Error analysis says : At the statment "STRLEN( obj )..." , only character-type data objects are supported at the argument position "obj". In this particular case, the operand "obj" has the non-charcter-type type "P".

I have one of the currency field defined as "P".

Pls help.

Regards

Hrishi

12 REPLIES 12
Read only

Former Member
0 Likes
3,633

Hi Hrishi,

Just change the field to char type OR

in the fieldcatalog pass it as a currency field

and your problem will be solved.

Reward points if useful.

Regards,

Atish

Read only

0 Likes
3,633

I did both, char and currency.. still its giving that run time error.

Any idea ??

Read only

0 Likes
3,633

Hi,

Can you paste your code here?

Thanks.

Read only

0 Likes
3,633

Hi Viji,

I have declared all as 'c' type. Still it is giving runtime error. Could you please help.

Thanks

Hrishi

Here is my code :

*----


REPORT ZBACKORDER_REPORT_BY_VBBE line-size 400.

*----


TABLES:

LIPS,

VBBE, "Sales Requirements: Individual Records

VBAP, "Sales Document: Item Data

VBAK, "Sales Document: Header Data

KNA1, "Customer Header Table

MARD. "

*********************************************************************

*----> Selection Screen

*----


Selection-screen begin of block 001 with frame title T_BLOCK1.

SELECT-OPTIONS:

S_MATNR FOR VBAP-MATNR, "Material

S_MBDAT FOR VBBE-MBDAT. "Sched Date

selection-screen skip 1.

****

Selection-screen begin of block 004 with frame title T_BLOCK4.

SELECT-OPTIONS:

S_VKBUR FOR VBAK-VKBUR, "Sales office

S_VKGRP FOR VBAK-VKGRP, "Sales group

S_VBELN FOR VBBE-VBELN, "Sales document

S_ERDAT FOR VBAK-ERDAT, "Created on

S_ERNAM FOR VBAP-ERNAM. "Created by

PARAMETERS:

Z_KDMAT as checkbox. "Customer Matnr

Selection-screen end of block 004.

****

Selection-screen begin of block 003 with frame title T_BLOCK3.

SELECT-OPTIONS:

S_WERKS FOR VBBE-WERKS. "Plant

Selection-screen end of block 003.

****

PARAMETERS:

ZINC_SO AS CHECKBOX DEFAULT 'X',

ZINC_DEL AS CHECKBOX DEFAULT 'X',

ZINC_STO AS CHECKBOX DEFAULT 'X'.

****

selection-screen skip 1.

****

Selection-screen begin of block 002 with frame title T_BLOCK2.

SELECTION-SCREEN BEGIN OF LINE.

Parameter ZGRID RADIOBUTTON GROUP radi DEFAULT 'X' .

SELECTION-SCREEN COMMENT (12) T_ZGRID FOR FIELD ZGRID.

Parameter ZLIST RADIOBUTTON GROUP radi.

SELECTION-SCREEN COMMENT 18(17) T_ZLIST FOR FIELD ZLIST.

SELECTION-SCREEN END OF LINE.

Selection-screen end of block 002.

****

Selection-screen end of block 001.

*********************************************************************

*----> ALV function declarations

*----


TYPE-POOLS slis.

*********************************************************************

Data:

ls_sort TYPE slis_sortinfo_alv,

it_sortcat TYPE slis_t_sortinfo_alv.

DEFINE m_sort.

add 1 to ls_sort-spos.

ls_sort-fieldname = &1.

ls_sort-up = 'X'.

ls_sort-subtot = &2.

  • ls_sort-expa = 'X'. "Colapse the subtotal sections

append ls_sort to it_sortcat.

END-OF-DEFINITION.

*********************************************************************

DATA:

BEGIN OF w,

col_pos TYPE i,

END OF w,

it_fieldcat TYPE slis_fieldcat_alv OCCURS 0 WITH HEADER LINE,

it_layout TYPE slis_layout_alv,

farb1 TYPE slis_specialcol_alv.

it_layout-coltab_fieldname = 'FARB'.

*********************************************************************

*----> BDC Declarations

*----


data: opt like CTU_PARAMS.

opt-dismode = 'E'.

opt-updmode = 'S'.

opt-NOBINPT = ' '.

opt-nobiend = ' '.

DATA: text(75) TYPE c.

DATA: itab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.

DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.

*********************************************************************

*----> Itab Declarations

*----


DATA:

Begin of IT_DATA OCCURS 0,

VBTYP LIKE VBBE-VBTYP, "doc.type C = SO J = DELIV

OMENG LIKE VBBE-OMENG, "Open quantity

POSNR LIKE VBBE-POSNR, "Item

etenr like vbbe-etenr, "sched line no

VBELN LIKE VBBE-VBELN, "Sales document

DELIV LIKE VBBE-VBELN, "DELIVERY

WERKS LIKE VBBE-WERKS, "Plant

ARKTX LIKE VBAP-ARKTX, "Description

KDMAT LIKE KNMT-KDMAT, "CUST MAT Description

ERNAM LIKE VBAP-ERNAM, "Created by

KPEIN LIKE VBAP-KPEIN, "Pricing unit

KWMENG LIKE VBAP-KWMENG, "Order quantity

MATKL LIKE VBAP-MATKL, "Material group

MATNR LIKE VBAP-MATNR, "Material NETPR LIKE VBAP-NETPR, "Net price

NETPR(15) TYPE p decimals 2 , "Net price (TYPE DEFINED TO AVOID FIELD

"OVERFLOW IN ALV)

  • NETPR TYPE F, "Net price

KUNNR LIKE VBBE-KUNNR, "Customer

BSTNK LIKE VBAK-BSTNK, "Purch.order no.

ERDAT LIKE VBAK-ERDAT, "Created on

MBDAT LIKE VBBE-MBDAT, "VBBE MAT AVAIL DATE (Sched Date)

VKBUR LIKE VBAK-VKBUR, "Sales office

VKGRP LIKE VBAK-VKGRP, "Sales group

NAME1 LIKE KNA1-name1, "NAME

LPRIO LIKE VBAP-LPRIO,

MAABC LIKE MARC-MAABC,

KLABC LIKE KNVV-KLABC,

deldt like lips-erdat, "Delivery Creation Date

erzet like lips-erzet, "Delivery Creation Time

LGPBE like mard-LGPBE, "Storage Bin Location

ATP like mard-LABST, "atp stock

BAL like mard-LABST, "Balance stock

lgort like VBBE-lgort, "Storage Location

LATE like mard-LABST, "DAYS LATE

BESKZ LIKE MARC-BESKZ, "Proc Type

AUTLF LIKE VBAK-AUTLF,

END OF IT_DATA,

*Begin AVL Structure

Begin of IT_ALV OCCURS 0,

VBTYP LIKE VBBE-VBTYP, "doc.type C = SO J = DELIV

OMENG LIKE VBBE-OMENG, "Open quantity

POSNR LIKE VBBE-POSNR, "Item

etenr like vbbe-etenr, "sched line no

VBELN LIKE VBBE-VBELN, "Sales document

DELIV LIKE VBBE-VBELN, "DELIVERY

WERKS LIKE VBBE-WERKS, "Plant

ARKTX LIKE VBAP-ARKTX, "Description

KDMAT LIKE KNMT-KDMAT, "CUST MAT Description

ERNAM LIKE VBAP-ERNAM, "Created by

KPEIN LIKE VBAP-KPEIN, "Pricing unit

KWMENG LIKE VBAP-KWMENG, "Order quantity

MATKL LIKE VBAP-MATKL, "Material group

MATNR LIKE VBAP-MATNR, "Material

NETPR LIKE VBAP-NETPR, "Net price

*NETPR(15) TYPE p decimals 2, "Net price (TYPE DEFINED TO AVOID FIELD

"OVERFLOW IN ALV)

  • NETPR TYPE F, "Net price

KUNNR LIKE VBBE-KUNNR, "CUSTOMER

BSTNK LIKE VBAK-BSTNK, "Purch.order no.

ERDAT LIKE VBAK-ERDAT, "Created on

MBDAT LIKE VBBE-MBDAT, "VBBE MAT AVAIL DATE (Sched Date)

VKBUR LIKE VBAK-VKBUR, "Sales office

VKGRP LIKE VBAK-VKGRP, "Sales group

NAME1 LIKE KNA1-name1, "NAME

LPRIO LIKE VBAP-LPRIO,

MAABC LIKE MARC-MAABC,

KLABC LIKE KNVV-KLABC,

deldt like lips-erdat, "Delivery Creation Date

erzet like lips-erzet, "Delivery Creation Time

LGPBE like mard-LGPBE, "Storage Bin Location

ATP like mard-LABST, "atp stock

BAL like mard-LABST, "Balance stock

lgort like VBBE-lgort, "Storage Location

LATE like mard-LABST, "DAYS LATE

BESKZ LIKE MARC-BESKZ, "Proc Type

AUTLF LIKE VBAK-AUTLF,

FARB TYPE slis_t_specialcol_alv,

END OF IT_ALV,

Begin of IT_DATA2 OCCURS 0,

MATNR LIKE mard-MATNR, "Material

WERKS LIKE mard-WERKS, "Plant

KUNNR LIKE VBBE-KUNNR, "Customer

lgort like mard-lgort, "Storage Location

LGPBE like mard-LGPBE, "Storage Bin Location

LABST like mard-LABST, "atp stock

ATP like mard-LABST, "atp stock

END OF IT_DATA2,

zomeng LIKE VBBE-OMENG, "Open quantity

ZTABIX LIKE SY-TABIX.

*********************************************************************

*----> INITIALIZATION

*----


INITIALIZATION.

Move 'General Selection Data' TO T_BLOCK1.

Move 'ALV Report Layout' TO T_BLOCK2.

Move 'Distribution Data Selection' TO T_BLOCK3.

Move 'Sales Data Selection' TO T_BLOCK4.

Move 'List' TO T_ZLIST.

Move 'Grid' TO T_ZGRID.

"Set Sched to date to yesterday (backorder only)

S_MBDAT-HIGH = SY-DATUM - 1.

APPEND S_MBDAT.

*********************************************************************

*----> Performs

*----


START-OF-SELECTION.

PERFORM GATHER_DATA.

END-OF-SELECTION.

PERFORM BUILD_ALV_STRUCTURE.

PERFORM ALV_DISPLAY.

*********************************************************************

*----> At User Command

*----


FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN '&IC1'.

CASE rs_selfield-sel_tab_field.

WHEN 'IT_ALV-AUART'.

  • Do something at 'Sales document type' field selection

WHEN 'IT_ALV-OMENG'.

  • Do something at 'Open quantity' field selection

WHEN 'IT_ALV-POSNR'.

  • Do something at 'Sales document item' field selection

WHEN 'IT_ALV-VBELN'.

  • Do something at 'Sales document' field selection

if rs_selfield-value < 7000000000.

CHECK NOT rs_selfield-value IS INITIAL.

SET PARAMETER ID 'AUN' FIELD rs_selfield-value.

CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.

else.

CHECK NOT rs_selfield-value IS INITIAL.

read table IT_ALV index rs_selfield-tabindex.

Perform RUN_BDC_ME22N.

endif.

WHEN 'IT_ALV-DELIV'.

  • Do something at 'Sales document' field selection

CHECK NOT rs_selfield-value IS INITIAL.

read table IT_ALV index rs_selfield-tabindex.

IF IT_ALV-deliv > 0.

Perform RUN_BDC_ZPICK.

ENDIF.

WHEN 'IT_ALV-WERKS'.

  • Do something at 'Plant' field selection

WHEN 'IT_ALV-ERNAM'.

  • Do something at 'Created by' field selection

WHEN 'IT_ALV-KWMENG'.

  • Do something at 'Order quantity' field selection

WHEN 'IT_ALV-MATNR'.

  • Do something at 'Material' field selection

CHECK NOT rs_selfield-value IS INITIAL.

read table IT_ALV index rs_selfield-tabindex.

Perform RUN_BDC_MD04.

WHEN 'IT_ALV-BSTNK'.

  • Do something at 'Purchase order no.' field selection

WHEN 'IT_ALV-ERDAT'.

  • Do something at 'Created on' field selection

WHEN 'IT_ALV-VKBUR'.

  • Do something at 'Sales office' field selection

WHEN 'IT_ALV-VKGRP'.

  • Do something at 'Sales group' field selection

ENDCASE.

ENDCASE.

ENDFORM.

*********************************************************************

*----> Gather Data

*----


FORM GATHER_DATA.

SELECT * FROM MARD INTO CORRESPONDING FIELDS OF IT_DATA2

WHERE MATNR IN S_MATNR..

IT_DATA2-ATP = IT_DATA2-LABST.

APPEND IT_DATA2.

ENDSELECT.

  • Get the open Sales order data

SELECT VBBEAUART VBBEOMENG VBBEPOSNR VBBEVBELN VBBEWERKS VBBELGORT

VBAPARKTX VBAPERNAM VBAPKPEIN VBAPKWMENG VBAP~MATKL

VBAPMATNR VBAPNETPR VBAPPOSNR VBAPVBELN VBAPLPRIO MARCMAABC

MARCBESKZ KNVVKLABC VBAKBSTNK VBAKERDAT VBAKVBELN VBAKVKBUR

VBAKVKGRP KNA1NAME1 VBBEMBDAT VBBEETENR VBAK~AUTLF

VBBEVBTYP VBBEOMENG VBBE~VMENG

into corresponding fields of IT_DATA

FROM ( VBBE

INNER JOIN VBAP

ON VBAPPOSNR = VBBEPOSNR

AND VBAPVBELN = VBBEVBELN

INNER JOIN VBAK

ON VBAKVBELN = VBAPVBELN

INNER JOIN KNA1

ON VBBEKUNNR = KNA1KUNNR

INNER JOIN KNVV

ON KNVVKUNNR = KNA1KUNNR

INNER JOIN MARC

ON MARCMATNR = VBAPMATNR

AND MARCWERKS = VBBEWERKS )

WHERE VBBE~VBTYP EQ 'C'

AND VBBE~MATNR IN S_MATNR

AND OMENG > 0.

APPEND IT_DATA.CLEAR IT_DATA.

ENDSELECT.

*Get the Sales order data for the open deliveries

SELECT VBBEOMENG VBBEVBELN VBBEMATNR VBBEWERKS VBBELGORT LIPSVGBEL

LIPSVGPOS VBAPARKTX VBAPKPEIN VBAPNETPR VBAPLPRIO MARCMAABC

MARCBESKZ KNVVKLABC VBAKBSTNK VBAKERDAT VBAKVKBUR VBAKVKGRP

KNA1NAME1 vbbembdat vbbeetenr lipserdat lips~erzet

VBBEVBTYP VBAKAUTLF

into corresponding fields of IT_DATA

FROM ( VBBE

INNER JOIN LIPS

ON LIPSPOSNR = VBBEPOSNR

AND LIPSVBELN = VBBEVBELN

INNER JOIN VBAP

ON VBAPVBELN = LIPSVGBEL

AND VBAPPOSNR = LIPSVGPOS

INNER JOIN VBAK

ON VBAKVBELN = VBAPVBELN

INNER JOIN KNA1

ON KNA1KUNNR = VBAKKUNNR

INNER JOIN KNVV

ON KNVVKUNNR = KNA1KUNNR

INNER JOIN MARC

ON MARCMATNR = VBAPMATNR

AND MARCWERKS = VBBEWERKS )

WHERE VBBE~VBTYP EQ 'J'

AND VBBE~AUART EQ 'LF'

AND VBBE~MATNR IN S_MATNR.

APPEND IT_DATA.CLEAR IT_DATA.

ENDSELECT.

*Get the STO deliveries

SELECT VBBEOMENG VBBEVBELN VBBEMATNR VBBEWERKS VBBELGORT LIPSVGBEL

LIPSVGPOS MAKTMAKTX

MARC~MAABC

MARC~BESKZ

KNVV~KLABC

KNA1NAME1 vbbembdat vbbe~etenr

lipserdat lipserzet VBBE~VBTYP

INTO (IT_DATA-OMENG, IT_DATA-DELIV, IT_DATA-MATNR, IT_DATA-WERKS,

IT_DATA-LGORT,

IT_DATA-VBELN, IT_DATA-POSNR, IT_DATA-ARKTX,

IT_DATA-MAABC,

IT_DATA-BESKZ,

IT_DATA-KLABC,

IT_DATA-NAME1, IT_DATA-mbdat, IT_DATA-etenr,

IT_DATA-deldt, IT_DATA-erzet, IT_DATA-VBTYP)

FROM ( VBBE

INNER JOIN LIPS

ON LIPSPOSNR = VBBEPOSNR

AND LIPSVBELN = VBBEVBELN

INNER JOIN LIKP

ON LIKPVBELN = VBBEVBELN

INNER JOIN KNA1

ON KNA1KUNNR = LIKPKUNNR

INNER JOIN KNVV

ON KNVVKUNNR = KNA1KUNNR

INNER JOIN MARC

ON MARCMATNR = VBBEMATNR

AND MARCWERKS = VBBEWERKS

INNER JOIN MAKT

ON MAKTMATNR = VBBEMATNR )

WHERE VBBE~VBTYP EQ 'J'

AND VBBE~AUART EQ 'NL'

AND VBBE~MATNR IN S_MATNR.

APPEND IT_DATA.CLEAR IT_DATA.

ENDSELECT.

SORT IT_DATA BY DELIV ASCENDING.

Perform Calculate_Lines USING: 'J'.

SORT IT_DATA BY MBDAT VBELN.

Perform Calculate_Lines USING: 'C'.

SORT IT_ALV BY VBELN POSNR.

ENDFORM.

*********************************************************************

Form Calculate_Lines USING DOCTYP.

LOOP AT IT_DATA WHERE VBTYP = DOCTYP.

IT_DATA-late = SY-DATUM - it_data-mbdat.

ZTABIX = SY-TABIX.

LOOP AT IT_DATA2 WHERE WERKS = IT_DATA-WERKS AND

KUNNR = IT_DATA-KUNNR AND LGORT = IT_DATA-LGORT AND

MATNR = IT_DATA-MATNR.

IT_DATA-LGPBE = IT_DATA2-LGPBE.

IT_DATA-ATP = IT_DATA2-ATP.

IT_DATA-BAL = IT_DATA2-ATP - IT_DATA-OMENG.

IT_DATA2-ATP = IT_DATA-BAL.

MODIFY IT_DATA INDEX ZTABIX. "CLEAR IT_DATA.

MODIFY IT_DATA2 INDEX SY-TABIX. "CLEAR IT_DATA2.

ENDLOOP.

  • Customer Material Number

IF Z_KDMAT = 'X'.

SELECT SINGLE KDMAT FROM KNMT

INTO IT_DATA-KDMAT

WHERE KUNNR = IT_DATA-KUNNR

AND MATNR = IT_DATA-MATNR.

MODIFY IT_DATA.

ENDIF.

move-corresponding IT_DATA to IT_ALV.

IF IT_DATA-AUTLF = ''.

farb1-color-col = 6.

farb1-fieldname = 'AUTLF'.

append farb1 to IT_ALV-farb.

ENDIF.

IF IT_DATA-LGORT = ''.

farb1-color-col = 6.

farb1-fieldname = 'LGORT'.

append farb1 to IT_ALV-farb.

ENDIF.

IF IT_DATA-BAL < 0.

farb1-color-col = 6.

farb1-fieldname = 'BAL'.

append farb1 to IT_ALV-farb.

ENDIF.

if IT_DATA-VKBUR IN S_VKBUR

AND IT_DATA-VKGRP IN S_VKGRP

AND IT_DATA-VBELN IN S_VBELN

AND IT_DATA-WERKS IN S_WERKS

AND IT_DATA-ERNAM IN S_ERNAM

AND IT_DATA-MATNR IN S_MATNR

AND IT_DATA-ERDAT IN S_ERDAT

AND IT_DATA-mbdat in S_MBDAT.

IT_ALV-NETPR = ( IT_ALV-NETPR * IT_DATA-OMENG ) / IT_DATA-KPEIN.

IF IT_ALV-NETPR < 1.

IT_ALV-NETPR = 1 / 1000.

ENDIF.

IF ZINC_SO = 'X' AND IT_DATA-VBTYP = 'C'.

APPEND IT_ALV.

ELSEIF ZINC_DEL = 'X' AND IT_DATA-VBTYP = 'J' AND IT_DATA-VBELN <

7000000000.

APPEND IT_ALV.

ELSEIF ZINC_STO = 'X' AND IT_DATA-VBTYP = 'J' AND IT_DATA-VBELN >

7000000000.

APPEND IT_ALV.

ENDIF.

endif.

CLEAR: IT_DATA, IT_DATA2, IT_ALV.

ENDLOOP.

sort it_alv by vbeln posnr.

DELETE ADJACENT DUPLICATES FROM IT_alv COMPARING vbeln posnr.

Endform.

*********************************************************************

*----> Perform BUILD_ALV_STRUCTURE

*----


  • Colour code : *

  • Colour is a 4-char field where : *

  • - 1st char = C (color property) *

  • - 2nd char = color code (from 0 to 7) *

  • 0 = background color *

  • 1 = blue *

  • 2 = gray *

  • 3 = yellow *

  • 4 = blue/gray *

  • 5 = green *

  • 6 = red *

  • 7 = orange *

  • - 3rd char = intensified (0=off, 1=on) *

  • - 4th char = inverse display (0=off, 1=on) *

  • *

  • Colour overwriting priority : *

  • 1. Line *

  • 2. Cell *

  • 3. Column *

*********************************************************************

FORM BUILD_ALV_STRUCTURE.

PERFORM ADD_ALV_FIELD USING:

'LPRIO' 'C' '2' 'DP' 'Deliv Prio' 'Delivery Priority' 'C500',

'VKBUR' 'C' '4' 'SOff.' 'Sales office' 'Sales office' '',

'VKGRP' 'C' '3' 'Sales grp' 'Sales group' 'Sales group' '',

'VBELN' 'C' '6' 'Sales doc.' 'Sales document' 'Sales document' 'C401',

'DELIV' 'C' '8' 'Delivery' 'Delivery' 'Delivery' 'C501',

'DELDT' 'C' '10' 'Crtd-DT' 'Crtd-DT' 'Crtd-DT' '',

'ERZET' 'C' '8' 'Crtd-T' 'Crtd-T' 'Crtd-T' '',

'POSNR' 'C' '5' 'Item' 'Item' 'Sales document item' '',

'ETENR' 'C' '4' 'SL' 'Sched Line' 'Sched Line' '',

'MAABC' 'C' '1' 'M' 'Matl ABC' 'Material ABC' 'C500',

'MATNR' 'C' '7' 'Material' 'Material' 'Material' '',

'ARKTX' 'C' '40' 'Material Desc' 'Material Desc' 'Material Desc' '',

'OMENG' 'C' '11' 'Open' 'Open quantity' 'Open quantity' '',

'ATP' 'C' '13' 'ATP' 'ATP' 'ATP' '',

'BAL' 'C' '13' 'Bal Qty' 'Bal Qty' 'Bal Qty' '',

'ERDAT' 'C' '10' 'On' 'Created on' 'Created on' '',

'AUTLF' 'C' '1' 'Comp Delv' 'Comp Delv' 'Comp Delv' '',

'MBDAT' 'C' '10' 'Avail' 'Sched Date' 'Sched Date' '',

'NETPR' 'C' '15' 'Value' 'Value' 'Value' '',

'KLABC' 'C' '1' 'C' 'Customer ABC' 'Customer ABC' 'C500',

*'KUNNR' 'C' '18' 'Customer No' 'Customer No' 'Customer No' '',

'NAME1' 'C' '30' 'Customer' 'Customer' 'Customer' '',

'WERKS' 'C' '4' 'Plant' 'Plant' 'Plant' '',

'LGORT' 'C' '3' 'SLoc' 'SLoc' 'SLoc' '',

'LGPBE' 'C' '10' 'Bin' 'Bin' 'Bin' '',

'LATE' 'C' '13' 'Days Late' 'Days Late' 'Days Late' '',

'BESKZ' 'C' '1' 'Proc Type' 'Proc Type' 'Proc Type' ''.

IF Z_KDMAT = 'X'.

PERFORM ADD_ALV_FIELD USING:

'KDMAT' 'C' '40' 'Customer Material' 'Customer Material'

'Customer Material' ''.

ENDIF.

m_sort 'VKBUR' 'X'.

m_sort 'VKGRP' 'X'.

m_sort 'VBELN' ''.

*m_sort 'POSNR' ''.

ENDFORM.

*********************************************************************

*----> Perfrom ADD_ALV_FIELD

*----


FORM ADD_ALV_FIELD USING p1 p2 p3 p4 p5 p6 p7.

ADD 1 TO w-col_pos.

CLEAR it_fieldcat.

it_fieldcat-col_pos = w-col_pos.

it_fieldcat-tabname = 'IT_ALV'.

it_fieldcat-fieldname = p1.

it_fieldcat-inttype = p2.

it_fieldcat-outputlen = p3.

it_fieldcat-seltext_s = p4.

it_fieldcat-seltext_m = p5.

it_fieldcat-seltext_l = P6.

it_fieldcat-emphasize = P7.

CASE it_fieldcat-FIELDNAME.

WHEN 'VKBUR'.

it_fieldcat-LZERO = 'X'.

WHEN 'LGORT'.

it_fieldcat-LZERO = 'X'.

WHEN 'LPRIO'.

WHEN 'ATP'.

WHEN 'BAL'.

WHEN 'NETPR'.

it_fieldcat-do_sum = 'X'.

WHEN 'MATNR'.

it_fieldcat-LZERO = 'X'.

  • WHEN 'BAL'

  • IF it_fieldcat-emphasize = P7.

WHEN OTHERS.

it_fieldcat-no_zero = 'X'.

ENDCASE.

APPEND it_fieldcat.CLEAR it_fieldcat.

ENDFORM.

*********************************************************************

*----> Form ALV_DISPLAY

*----


FORM alv_display.

DATA: l_repid LIKE sy-repid.

l_repid = sy-repid.

If ZLIST = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = l_repid

i_callback_user_command = 'USER_COMMAND'

is_layout = it_layout

it_fieldcat = it_fieldcat[]

it_sort = ls_sort

i_save = 'X'

  • is_variant = w_variant

TABLES

t_outtab = IT_ALV

EXCEPTIONS

program_error = 1

OTHERS = 2.

Else.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = l_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE = 'Test Grid Title'

  • I_GRID_SETTINGS =

IS_LAYOUT = it_layout

IT_FIELDCAT = it_fieldcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

IT_SORT = it_sortcat

  • IT_FILTER =

  • IS_SEL_HIDE =

I_DEFAULT = 'X'

I_SAVE = 'X'

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_ADD_FIELDCAT =

  • IT_HYPERLINK =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_EXCEPT_QINFO =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = IT_ALV.

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Endif.

*

  • IF sy-subrc <> 0.

    • MESSAGE e002.

  • ENDIF.

ENDFORM.

*********************************************************************

*----> Form RUN_BDC_ZPICK (C:\zpick.xls)

*----


Form RUN_BDC_ZPICK.

perform dynpro using:

'X' 'Z_DELIVERY_PROCESSING' '123',

' ' 'ZZVBELN' it_DATA-deliv.

Call TRANSACTION 'ZPICK' USING bdcdata

OPTIONS FROM opt

MESSAGES INTO ITAB.

refresh bdcdata.

Endform.

*********************************************************************

*----> Form RUN_BDC_MD04 (C:\MDO4.xls)

*----


Form RUN_BDC_MD04.

perform dynpro using:

'X' 'SAPMM61R' '300',

' ' 'BDC_OKCODE' '=ENTR',

' ' 'RM61R-MATNR' IT_ALV-MATNR,

' ' 'RM61R-WERKS' IT_ALV-WERKS.

Call TRANSACTION 'MD04' USING bdcdata

OPTIONS FROM opt

MESSAGES INTO ITAB.

refresh bdcdata.

Endform.

*********************************************************************

*----> Form RUN_BDC_ME22N (C:\ME22N.xls)

*----


Form RUN_BDC_ME22N.

perform dynpro using:

'X' 'SAPLMEGUI' '14',

' ' 'BDC_OKCODE' '=MECHOB',

'X' 'SAPLMEGUI' '2',

' ' 'BDC_OKCODE' '=MEOK',

' ' 'MEPO_SELECT-EBELN' IT_ALV-VBELN,

' ' 'MEPO_SELECT-BSTYP_F' 'X'.

Call TRANSACTION 'ME22N' USING bdcdata

OPTIONS FROM opt

MESSAGES INTO ITAB.

refresh bdcdata.

Endform.

*********************************************************************

*----> Form DYNPRO_FORM

*----


FORM dynpro USING dynbegin fnam fval.

CLEAR bdcdata.

IF dynbegin EQ 'X'.

bdcdata-dynbegin = dynbegin.

bdcdata-program = fnam.

bdcdata-dynpro = fval.

ELSE.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

ENDIF.

APPEND bdcdata.

ENDFORM.

*********************************************************************

*----> Form BDC_RESULTS

*----


FORM BDC_RESULTS.

LOOP AT itab where msgtyp EQ 'E'.

CLEAR text.

CALL FUNCTION 'SX_MESSAGE_TEXT_BUILD'

EXPORTING

msgid = itab-msgid

msgnr = itab-msgnr

msgv1 = itab-msgv1

msgv2 = itab-msgv2

msgv3 = itab-msgv3

msgv4 = itab-msgv4

IMPORTING

message_text_output = text.

WRITE:/ text.

ENDLOOP.

IF sy-subrc = 0.

WRITE:/ 'Program successfully executed'.

ENDIF.

ENDFORM.

Read only

0 Likes
3,633

I get error at this line " gs_out-hlplen = strlen( <field> ).

Pls help.

Hrishi

Read only

0 Likes
3,633

Hi Hrishi,

When you get the dump, You can look the values of the fields. Can you by looking at dump see what is the value of field symbol <field>. There is a chance that it is checking stringlenth of non-char field mostly integer thats why you are getting dump.

Reward points to all useful answers.

Regards,

Atish

Read only

0 Likes
3,633

Hi Hirishikesh ,

i tested your program and it worked fine for grid , but the program dumped when the output mode was lsit.

The reason for the dump was a type conflict , in the parameters being passed to the FM.

In your FM REUSE_ALV_LIST_DISPLAY for the parameter IT_SORT you are passing <b>ls_sort</b> which is a work area , but you need to pass a table to this parameter , so you need to pass<b> it_sortcat</b>, i did the said cahnges and the program was eecuted without any errors.

So please do the same in your program also and check.

Assign points if helpful and feel free to revert back in case of any further queries.

Regards,

Arun

Read only

0 Likes
3,633

Problem solved.

ATP and BAL cases were to be removed from FM for PF .

thanks for all your help.

Hrishi

Read only

0 Likes
3,633

Hi Hrishi,

I am also facing the same issue.Please tell me how the problem is solved in your case.

What do you mean by 'ATP and BAL cases were to be removed from FM for PF ' in your post.

Read only

0 Likes
3,633

Hi Harshit,

I also faces the same problem which you faces in the past, my report is working fine and display data on output. but when i export it to local file this shows run time error. i try all the changes like change the field type and all, still faces problem

let me know how your problem get resolve and What is ATP and BAL in FM.

here is my FM. let me know what to do. if you need full code let me know.

Thanks in advance.

call function 'REUSE_ALV_GRID_DISPLAY_LVC'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

i_callback_program = sy-repid

  • I_CALLBACK_PF_STATUS_SET = ' '

i_callback_user_command = 'USER_COMMAND'

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

is_layout_lvc = gw_layout

it_fieldcat_lvc = gt_fcat[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS_LVC =

  • IT_SORT_LVC =

  • IT_FILTER_LVC =

  • IT_HYPERLINK =

  • IS_SEL_HIDE =

i_default = 'X'

i_save = 'X'

is_variant = gw_config-variant

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT_LVC =

  • IS_REPREP_ID_LVC =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO_LVC =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab = gt_final[]

exceptions

program_error = 1

others = 2 .

if sy-subrc <> 0.

message id sy-msgid type 'E' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

Thanks

Sachin

Edited by: sachin gaur21 on Sep 10, 2011 3:09 PM

Read only

Former Member
0 Likes
3,633

Hi,

You assign the floating number

assign the filed_catalog-datatype = 'FLTP'

with no of decimals

datatype like dd03p-datatype,

Regards

Shiva

Read only

Former Member
0 Likes
3,633

Declare the fields in your internal table as characater data type fields and then try to do transfer ..

<b>Reward points</b>

Regards