All the flows seen like okay, however when pass through the call function, the update also failed and the field that need to be update not updated, not sure where is the problem, can someone help me with this problem? do i miss any step?
Error message Log in LT_PROT
DATA: LT_PROT LIKE PROTT OCCURS 10 WITH HEADER LINE.
DATA: LT_VBPOK LIKE VBPOK OCCURS 500 WITH HEADER LINE.
DATA: LS_VBKOK LIKE VBKOK.
DATA: GT_LIPS LIKE LT_LIPS.
DATA: WA_LIPS TYPE LTY_LIPS.
DATA: EF_ERROR_ANY_0 TYPE C,
EF_ERROR_IN_ITEM_DELETION_0 TYPE C,
EF_ERROR_IN_POD_UPDATE_0 TYPE C,
EF_ERROR_IN_INTERFACE_0 TYPE C,
EF_ERROR_IN_GOODS_ISSUE_0 TYPE C,
EF_ERROR_IN_FINAL_CHECK_0 TYPE C.
SELECT * FROM LIPS INTO CORRESPONDING FIELDS OF TABLE LT_LIPS
WHERE VGBEL = LT_BCODE_I-VGBEL
AND VGPOS = LT_BCODE_I-VGPOS.
LOOP AT LT_LIPS INTO WA_LIPS.
WA_LIPS-LFIMG = LT_BCODE_I-MENGE.
MODIFY LT_LIPS FROM WA_LIPS INDEX SY-TABIX.
ENDLOOP.
"VBPOK IS CHANGE INDICATOR, AFTERWARD CALL FUNCTION TO CHANGE FIELD LFIMG IN STANDART TABLE LIPS.
LOOP AT LT_LIPS INTO GT_LIPS.
LT_VBPOK-LFIMG = GT_LIPS-LFIMG.
APPEND LT_VBPOK.
ENDLOOP.
ls_vbkok-vbeln_vl = LT_BCODE_I-REF_DOC.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = ls_vbkok " DELIVERY DOCUMENT NUMBER
synchron = 'X'
no_messages_update = ' '
update_picking = 'X'
commit = 'X'
delivery = LT_BCODE_I-REF_DOC "VARIABLE OF DELIVERY DOCUMENT
nicht_sperren = 'X'
if_error_messages_send_0 = space
IMPORTING
ef_error_any_0 = ef_error_any_0
ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
ef_error_in_pod_update_0 = ef_error_in_pod_update_0
ef_error_in_interface_0 = ef_error_in_interface_0
ef_error_in_goods_issue_0 = ef_error_in_goods_issue_0
ef_error_in_final_check_0 = ef_error_in_final_check_0
TABLES
vbpok_tab = lt_vbpok "TABLE TO BE CHANGE
prot = lt_prot.
First of all, this function model has the status "Not released" on its attribute tab. That means that it should not be used in customer code, because
SAP might change or delete it in a future update without warning, and then your code won't work anymore.
It is very likely not properly documented.
It might have hidden and unexpected gotchas. Like for example only working for specific corner-cases, not doing everything you would expect it to be doing or requiring to call some other function module before or afterwards in order to do something.
The error handling might be missing or might provide information that's misleading outside of the context where the module is usually used
So before you use a "Not Released" function module, you should check the transaction code BAPI if there is an official bapi function module which does what you want. Bapi function modules are specifically intended for use in customer code. They are well-documented, are guaranteed to take care of everything and SAP promises not to break them in future updates.
So much for the preaching, let's look at your actual problem.
Whenever you encounter a data structure with fields like MSGNO, MSGTY, MSGID and up to four generic variables, you are dealing with a message. You can look up message codes like that in transaction SE91. There we can see that the number 280 in message class VL means:
Required field in interface to delivery update missing VBELN 00000 00000
This could refer to the structure ls_vbkok or to the table lt_vbpok. I would recommend you to set a debugger breakpoint in your code and find out where that VBELN field could be missing a value.
Related
All the flows seen like okay, however when pass through the call function, the update also failed and the field that need to be update not updated, not sure where is the problem, can someone help me with this problem? do i miss any step?
Error message Log in LT_PROT
DATA: LT_PROT LIKE PROTT OCCURS 10 WITH HEADER LINE.
DATA: LT_VBPOK LIKE VBPOK OCCURS 500 WITH HEADER LINE.
DATA: LS_VBKOK LIKE VBKOK.
DATA: GT_LIPS LIKE LT_LIPS.
DATA: WA_LIPS TYPE LTY_LIPS.
DATA: EF_ERROR_ANY_0 TYPE C,
EF_ERROR_IN_ITEM_DELETION_0 TYPE C,
EF_ERROR_IN_POD_UPDATE_0 TYPE C,
EF_ERROR_IN_INTERFACE_0 TYPE C,
EF_ERROR_IN_GOODS_ISSUE_0 TYPE C,
EF_ERROR_IN_FINAL_CHECK_0 TYPE C.
SELECT * FROM LIPS INTO CORRESPONDING FIELDS OF TABLE LT_LIPS
WHERE VGBEL = LT_BCODE_I-VGBEL
AND VGPOS = LT_BCODE_I-VGPOS.
LOOP AT LT_LIPS INTO WA_LIPS.
WA_LIPS-LFIMG = LT_BCODE_I-MENGE.
MODIFY LT_LIPS FROM WA_LIPS INDEX SY-TABIX.
ENDLOOP.
"VBPOK IS CHANGE INDICATOR, AFTERWARD CALL FUNCTION TO CHANGE FIELD LFIMG IN STANDART TABLE LIPS.
LOOP AT LT_LIPS INTO GT_LIPS.
LT_VBPOK-LFIMG = GT_LIPS-LFIMG.
APPEND LT_VBPOK.
ENDLOOP.
ls_vbkok-vbeln_vl = LT_BCODE_I-REF_DOC.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = ls_vbkok " DELIVERY DOCUMENT NUMBER
synchron = 'X'
no_messages_update = ' '
update_picking = 'X'
commit = 'X'
delivery = LT_BCODE_I-REF_DOC "VARIABLE OF DELIVERY DOCUMENT
nicht_sperren = 'X'
if_error_messages_send_0 = space
IMPORTING
ef_error_any_0 = ef_error_any_0
ef_error_in_item_deletion_0 = ef_error_in_item_deletion_0
ef_error_in_pod_update_0 = ef_error_in_pod_update_0
ef_error_in_interface_0 = ef_error_in_interface_0
ef_error_in_goods_issue_0 = ef_error_in_goods_issue_0
ef_error_in_final_check_0 = ef_error_in_final_check_0
TABLES
vbpok_tab = lt_vbpok "TABLE TO BE CHANGE
prot = lt_prot.
First of all, this function model has the status "Not released" on its attribute tab. That means that it should not be used in customer code, because
SAP might change or delete it in a future update without warning, and then your code won't work anymore.
It is very likely not properly documented.
It might have hidden and unexpected gotchas. Like for example only working for specific corner-cases, not doing everything you would expect it to be doing or requiring to call some other function module before or afterwards in order to do something.
The error handling might be missing or might provide information that's misleading outside of the context where the module is usually used
So before you use a "Not Released" function module, you should check the transaction code BAPI if there is an official bapi function module which does what you want. Bapi function modules are specifically intended for use in customer code. They are well-documented, are guaranteed to take care of everything and SAP promises not to break them in future updates.
So much for the preaching, let's look at your actual problem.
Whenever you encounter a data structure with fields like MSGNO, MSGTY, MSGID and up to four generic variables, you are dealing with a message. You can look up message codes like that in transaction SE91. There we can see that the number 280 in message class VL means:
Required field in interface to delivery update missing VBELN 00000 00000
This could refer to the structure ls_vbkok or to the table lt_vbpok. I would recommend you to set a debugger breakpoint in your code and find out where that VBELN field could be missing a value.
I am currently trying to program a function module which should, in theory, output a custom table like T052, but with an additional field Z_TEXTLONG, which explains the details of the chosen ZTERM, akin to the text in FI_F4_ZTERM's popup. Here's what I tried:
LOOP AT T_ZBEDS ASSIGNING FIELD-SYMBOL(<line>).
CALL FUNCTION 'FI_F4_ZTERM'
EXPORTING
I_KOART = 'K'
I_ZTERM = <line>-zterm
I_XSHOW = ''
I_ZTYPE = ''
I_NO_POPUP = 'X'
IMPORTING
E_ZTERM = v_text
EXCEPTIONS
NOTHING_FOUND = 1
OTHERS = 2.
WRITE v_text TO <line>-Z_TEXTLONG.
From what I gathered, this does not work due to FI_F4_ZTERM writing the list it returns into E_ZTERM, not a single value, which would be what I need. I am a bit lost as to what I should do next. I tried looking into how exactly FI_F4_ZTERM generates these texts or where it calls them from, but I was not successful. Currently, I am trying to maybe get this text from V_T052, but that does not work either. I would be thankful for any suggestions.
Try function FI_TEXT_ZTERM, it has single import parameter I_T052
why not just call CALL FUNCTION 'FI_F4_ZTERM'
with I_NO_POPUP = 'X'
importing
ET_ZTERM = lt_zterm.
you get the list of payment terms and their texts.
Then in the loop read it from the table of payment terms.
LOOP AT T_ZBEDS ASSIGNING FIELD-SYMBOL(<line>).
read table lt_zterm assigning <term>
with key ZTERM = <line>-zterm.
ENDLOOP.
I'm new to ABAP, and I'm trying to build a field catalog using the REUSE_ALV_FIELDCATALOG_MERGE function module. This function module exits with sy-subrc value 1 ("Inconsistent interface") and a message dialog appears saying that the field catalog couldn't be build.
My code is the same as the examples found online. Maybe I missed something.
My program consists of a TOP include, a FORMS include and the main module:
FORMS include:
FORM DISPLAY_WITH_ALV_LIST.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'it_report'
I_INCLNAME = sy-repid
CHANGING
CT_FIELDCAT = it_fldcat.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
IT_FIELDCAT = it_fldcat
TABLES
T_OUTTAB = it_report.
ENDFORM.
FORM ZSELECT.
SELECT VBELN ERDAT ERNAM
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE it_report
WHERE ERDAT IN S_ERDAT
AND ERNAM IN S_ERNAM.
ENDFORM.
TOP include:
TYPE-POOLS: slis.
TABLES VBAK.
DATA: BEGIN OF it_report OCCURS 0,
VBELN LIKE VBAK-VBELN,
ERDAT LIKE VBAK-ERDAT,
ERNAM LIKE VBAK-ERNAM,
END OF it_report.
DATA it_fldcat TYPE slis_t_fieldcat_alv.
Main module:
REPORT ZMLA_EXO1.
INCLUDE ZMLA_EXO1_TOP.
INCLUDE ZMLA_EXO1_SCREEN.
INCLUDE ZMLA_EXO1_FORM.
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
PERFORM ZSELECT.
PERFORM DISPLAY_WITH_ALV_LIST.
END-OF-SELECTION.
I would advise using the "SALV" class. It's pretty straight forward, in your case it would look like this:
DATA: go_salv_table TYPE REF TO cl_salv_table.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = go_salv_table
CHANGING
t_table = it_report.
go_salv_table->display( ).
If you still insist on using the function module (FM) REUSE_ALV_FIELDCATALOG_MERGE, and generate field catalog from internal table, then these conditions must be observed:
Your internal table with the data to be displayed has to be declared with the word "OCCURS" (not a must to use addition "WITH HEADER LINE").
Fields of the internal table have to be declared using "LIKE". It will not work if you use "TYPE" to declare the fields.
No line in your program should exceed 72 characters. Otherwise a short dump will be generated with the exception cx_sy_read_src_line_too_long since the FM has to scan your program code looking for the internal table definition.
In short, it's an old FM with a lot of problems.
While displaying an ALV I get a crash report when executing the program. To create an ALV I have followed a few tutorials and stuff and at the moment it looks like this:
TYPE-POOLS: slis.
*build field catalog
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
repid TYPE sy-repid.
REFRESH it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Table ID'.
wa_fieldcat-fieldname = 'table_id'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '18'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Table Description'.
wa_fieldcat-fieldname = 'table_description'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '40'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-reptext_ddic = 'Numer of Records Found'.
wa_fieldcat-fieldname = 'nr_of_records'.
wa_fieldcat-tabname = 'lt_where_used_data_of_coll'.
wa_fieldcat-outputlen = '30'.
APPEND wa_fieldcat TO it_fieldcat.
*pass data and field catalog to ALV function module
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
it_fieldcat = it_fieldcat
i_structure_name = 'lty_where_used_data_of_coll'
TABLES
t_outtab = lt_where_used_data_of_coll.
'lt_where_used_data_of_coll' is my local table that I have already filled with a working function earlier in my program. This function works and I have tested it and the table fills itself with data. My next step was displaying this data to the end user. The error report I receive when executing this program is:
Short text: Field symbol has not yet been assigned.
What happened?:
Error in the ABAP Application Program.
The current ABAP program "SAPLSLVC" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis:
You attempted to access an unassigned field symbol
(data segment "-1").
Trigger Location of Runtime Error:
Program SAPLSLVC
Include LSLVCF36
Row 3,273
Module type (FORM)
Module Name FILL_DATA_TABLE
I really don't know how to start finding my mistake. It seems like it runs bad when calling a function from ABAP itself.
Any help is much appreciated.
EDIT: As was suggested I implemented another way of displaying an ALV that can be found below. This way works fine and gives no errors. Question still remains why the older method does give me an error.
I replaced the entire block of code above with this:
DATA alv TYPE REF TO cl_salv_table. DATA message TYPE REF TO cx_salv_msg.
*initialize ALV
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = alv
CHANGING
t_table = lt_where_used_data_of_coll ).
CATCH cx_salv_msg INTO message.
" error handling
ENDTRY.
*display ALV
alv->display( ).
why the older method does give me an error
Field catalog names are case sensitive. Capitalize every fieldname and tabname value and see if the error's still there. Also make sure that the names match those of your internal table lt_where_used_data_of_coll
I need to track down where within a large number of custom sapscripts and smartforms a specific standard text (SO10) is being used.
Apart from the equivalent of "check the code for each print script", I've not found a workable solution online. Any suggestions?
After posting, I found a partial solution. The code below will search for a standard text within sapscripts, but not smartforms.
PARAMETERS: p_sttxt LIKE stxh-tdname.
DATA: BEGIN OF t_stxh OCCURS 0,
tdname LIKE stxh-tdname,
tdspras LIKE stxh-tdspras,
END OF t_stxh.
DATA t_lines LIKE tline OCCURS 0 WITH HEADER LINE.
SELECT tdname tdspras FROM stxh INTO TABLE t_stxh
WHERE tdobject = 'FORM'
AND tdid = 'TXT'
AND tdspras = 'E'.
LOOP AT t_stxh.
REFRESH t_lines.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'TXT'
language = t_stxh-tdspras
name = t_stxh-tdname
object = 'FORM'
TABLES
lines = t_lines
EXCEPTIONS
id = 0
language = 0
name = 0
not_found = 0
object = 0
reference_check = 0
wrong_access_to_archive = 0
OTHERS = 0 .
SEARCH t_lines FOR p_sttxt.
IF sy-subrc EQ 0.
WRITE:/ t_stxh-tdname, t_stxh-tdspras.
ENDIF.
ENDLOOP.
This is a (fixed) version of the code found here: http://scn.sap.com/thread/179142
What concerns SmartForms, you cannot. You cannot just find it like you want it.
Unfortunately, in such ̶g̶o̶o̶d̶ ̶o̶l̶'̶ legacy technology as SmartForms everything is working legacy way, and standard texts are simply hard-coded. Yes, it looks awkward but they are really hard-coded, and these names are written out to SmartForm FM code every time it is re-generated.
So the only workaround here is to analyze the code.
Find all FMs for existing Smart Forms in system
There is a D010INC table containing all forms with their includes. The main point here is that all SmartForm FMs start with /1BCDWB/ prefix.
The main logic is in the includes, so we need to find correspondent INCLUDE for the target form.
Fetch SF include source code
It can be done in a several ways: via CL_RECA_RS_SERVICES class, via table REPOSRC, but the simplest way is ABAP statement READ REPORT.
Search SO10 text element name in the source code
Get Smart Form names for the FMs from hit list. It can be done via STXFADMI table, like in below snippet, but the more correct way is SSF_FUNCTION_MODULE_NAME FM
Bingo!
Sample solution could look like this:
DATA: lt_source TYPE TABLE OF string,
lt_smartforms TYPE TABLE OF d010inc,
so_text TYPE char50,
fs_form TYPE string,
used_in TYPE TABLE OF string,
len TYPE i.
* populating the list of SmartForm FMs
SELECT * FROM d010inc AS d
INTO TABLE lt_smartforms
WHERE master LIKE '/1BCDWB/%'
AND include LIKE '/1BCDWB/%'.
so_text = '85XX_FOOTER'. " <- our SO10 text element name
LOOP AT lt_smartforms ASSIGNING FIELD-SYMBOL(<fs_fm_name>).
* reading FM source code
READ REPORT <fs_fm_name>-include INTO lt_source.
* checking if SO11 exists in source code
FIND FIRST OCCURRENCE OF so_text IN TABLE lt_source.
IF sy-subrc = 0.
len = strlen( <fs_fm_name>-include ) - 7.
* searching for SmartForm related to the target FM
SELECT SINGLE formname
FROM stxfadmi
INTO fs_form
WHERE fmnumb = <fs_fm_name>-include+len(4).
IF sy-subrc = 0.
APPEND fs_form TO used_in.
ENDIF.
ENDIF.
ENDLOOP.
Yes, it is junky, not elegant and awkward, but who said it should be so?